Previous | Next --- Slide 3 of 57
Back to Lecture Thumbnails
Khryl

Just to check my understanding here. I think abstraction is a characterization of the program, while implementation is how compiler decide to take advantage of it to achieve better performance. For the parallel setting here, the ISPC foreach instruction is an abstraction characterizing data independence, and the ISPC compiler decide how they handle all these independent program instances to achieve better parallism (vector utilization and memory coherence), which is an implementation.

It's better to expose the abstraction to programmers but to seal the implementation. Here are some reasons. First, it's easier to characterize the program than to actually take advantage of it, so the abstraction interface makes things easier for programmers. Besides, abstraction allows compilers to choose different implementations for different hardwares based on their characteristics, so only one piece of codes can still have ideal performance on different systems.

nmrrs

Yes, I think that's right. A key example of this is the difference between ISPC tasks and explicit threads in C. C exposes a bit too much of the implementation of parallelism to the programmer, and thus if the programmer makes poor decisions when deciding where to spawn threads, the compiler is forced to stick with those decisions because it no longer has enough control over the implementation. The ISPC task abstraction allows the compiler to only split up the work when it wants to do so for performance.