Presentation is loading. Please wait.

Presentation is loading. Please wait.

The C++ compiler is obsessed with optimization: In this case, it will auto-vectorize the loop.

Similar presentations


Presentation on theme: "The C++ compiler is obsessed with optimization: In this case, it will auto-vectorize the loop."— Presentation transcript:

1

2

3

4

5

6

7

8

9

10

11

12 The C++ compiler is obsessed with optimization: In this case, it will auto-vectorize the loop

13 B[0] B[1] B[2] B[3] A[0] A[1] A[2] A[3] A[0] + B[0] A[1] + B[1] A[2] + B[2] A[3] + B[3] + xmm1 xmm0 “addps xmm1, xmm0 “ xmm1 for (i = 0; i < 1000; i++) { C[i] = A[i]+B[i] } for (i = 0; i < 1000; i+=4) { C[i:i+3] = A[i:i+3]+B[i:i+3] }

14

15 info C5002: loop not vectorized due to reason ‘501’

16

17 info C5001: loop vectorized

18

19

20 Lots of triangles: we have less than 15ms to “turn a page” in real time; we need to parallelize this algorithm C++ AMP is a good candidate, since the data size is pretty large

21 We’re looping over each triangle This set of operations is safe, because it works on a single triangle at each time, no races But here we’re updating vertexes which are shared between triangles -> race! This algorithm only works on a single thread

22 for each triangle for each vertex

23 We use C++ AMP Same as before, we calculate the normals for each triangle We collect the normals into a temporary array, which stay in GPU memory

24 We go over each vertex, so no races In sumTriangleNormals, we fetch the normals from tempTriangleNormals, i.e., the temporary we kept on the GPU memory

25

26

27

28

29

30

31 Please submit session evals on the Build Windows 8 App or at

32 MICROSOFT DEVELOPER DIVISION DESIGN RESEARCH EXPERIENCE DEVELOPMENT TOOLS AND FEATURES EARLY IN THEIR DESIGN AND DEVELOPMENT INFLUENCE FUTURE DESIGN DECISIONS FILL IT ONLINE AT

33

34

35

36

37

38


Download ppt "The C++ compiler is obsessed with optimization: In this case, it will auto-vectorize the loop."

Similar presentations


Ads by Google