Previous | Next --- Slide 4 of 73
Back to Lecture Thumbnails
kayvonf

Question: Can someone please describe why the code on the screen defines no parallelism.

xielei

Multiple simultaneous instruction streams is called parallelism, ISPC just emits SIMD instructions for this code, which are only one instruction stream operating on multiple data.

kayvonf

@xielei. SIMD is also parallelism! It's just parallelism that shares an instruction stream. (Lecture 2 discussed both SIMD parallelism, multi-core parallelism, and superscalar parallelism.)

What I meant in the question above is a little subtle, so I'll explain here:

The code above defines the logic carried out sequentially by a single program instance. Therefore, to be precise, not on the loops you see are carried out in parallel. The first loop (i loop) iterates over a subset of the elements in the input array. The inner loop (j loop) iterates over terms in the Taylor expansion. A single program instance executes all this code serially.

However, as we know, ISPC never runs only a single program instance, it runs a gang of program instances simultaneously, by mapping the logic of all program instances in a gang to a stream of SIMD instructions. So the parallelism comes from launching a gang of program instances, which occurs in the call to the ispc function (sinx in this case). There is no parallelism expressed in the ISPC function's definition itself.