Previous | Next --- Slide 55 of 83
Back to Lecture Thumbnails
tim

What's so hard about making foreach automatically split into tasks?

shreya_ravi

Does the work here get broken down at the foreach level (where each foreach iteration is a task)? Or does each task correspond to a gang of program instances, within which there is a foreach that the ISPC compiler uses to create SIMD instructions?

juliewang

@tim @shreya_ravi I believe foreach vs. launch are doing two different things. Launch is creating tasks, whereas foreach is indicating what instructions can be done completely in parallel by different program instances.

lindenli

This slide helped me understand the difference between the ISPC task abstraction and threads. ISPC just indicates how many independent pieces of work; the compiler determines how many threads to launch and these are launched to completion. This is not the case with threads, where they are interleaved.

jasonalouda

If we only have a next_task pointer, does that mean we can only assign tasks from the list of tasks in a particular order? If some tasks are bigger than others, it would be better to run them first, as mentioned somewhere else in this lecture.

kayvonf

@jasonalouda, that is correct. In this implementation of a task queue, tasks will be assigned in order. You could imagine different ISPC implementations that might choose a more sophisticated assignment strategy.

kayvonf

And this is an important property of having work that can be computed in any order. Since the programmer, by means of using tasks, has said, "Hey ISPC run these in any order you see fit", it's opened the door for ISPC implementors to experiment with different implementations that might yield the best performance.

Please log in to leave a comment.