2 ms·
What benefits do we gain versus a standard compiler with intrinsic approach?
by fsaintjacques 10y ago
What benefits do we gain versus a standard compiler with intrinsic approach?
- scott_s 10y agoPotentially significant, since they add new types and control structures. The new types inform the optimizer if data is local to SIMD computations or not, can optimize memory layout for SIMD computations, and the control structures allow for converged control-flow at runtime where only one branch is taken by all threads. See the full paper I link to as a top-level comment for more details.
- CyberDildonics 10y agoWith intrinsics you have to write each instruction by hand. Not only is this a lot of work and compiler specific but if you aren't familiar with all of the instructions at your disposal it is unlikely you will get the same performance. Not only that but ISPC can be compiled to multiple different SIMD lane widths so that something doesn't need to be re-written with the width increases or decreases. One example would be the n-body simulation of the computer language benchmarks game. The C++ version uses intrinsics but wouldn't benefit from anything that can do 4 doubles instead of only two at a time.
- fsaintjacques 10y agoI would argue that learning the 'basics' of intrinsic is less of a burden than learning a new C extension and modifying your existing code base to include additional new build tools. OTOH, I like the idea of automatic lane width detection.
- CyberDildonics 10y agoI've learned ISPC and didn't find it too difficult. It largely boils down to the varying and uniform keywords along with one more loop syntax. I've looked into intrinsics and I'm extremely skeptical that there is much benefit there other than to play with the actual CPU instructions. ISPC produces tiny .o | .obj files and a header file, the integration has not been a hurdle that I can remember.
- scott_s 10y agoBased on my understanding of both, learning the new C extensions would be easier than using the intrinsics. Whatever concepts you need to understand the new C extensions (which are limited to type modifiers and a few new control-flow modifiers) you will also need to understand to use the intrinsics. However, I agree that having another dependency in your build may be more of a problem.
- a_e_k 10y agoThere's also the benefit of not having to worry about managing the scalar prologues and epilogues.