3 ms·
For the given example code the answer is to use the underlying SIMD types and intrinsic instructions. If you're on Intel or PowerPC then the SSE or Altivec regi
by Oxryly 17y ago
For the given example code the answer is to use the underlying SIMD types and intrinsic instructions. If you're on Intel or PowerPC then the SSE or Altivec registers and instructions are available. Use them and you'll beat any compiler optimization every time. And, most importantly, the chances that up-to-date SIMD types and intrinsics will be available in any language but C/C++ is vanishingly small. Java, Ocaml, Haskell... you name it, you can't properly use SIMD (AFAIK... please let me know if there are exceptions).
And if you're application doesn't fit the native SIMD properly, there's no chance the compiler can really do anything meaningful with it anyway.
- jrockway 17y agoSome quick googling suggests you are wrong: http://www.cas.mcmaster.ca/~kahl/Publications/TR/Anand-Kahl-2007a_DSL/ http://www.cas.mcmaster.ca/~kahl/Publications/TR/Anand-Kahl-... http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/camlg4.html http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/... http://tirania.org/blog/archive/2008/Nov-03.html http://tirania.org/blog/archive/2008/Nov-03.html etc.
- Oxryly 17y agoI would suggest taking a closer look at those links. They bring up another point in that you'll only find current, usable, robust support for SIMD in C++: The first link is just a paper; the second is a 1.0 release that is seven years old, it only supports SSE, and it's all in French; the third is only for Mono, it only supports SSE and its SSE support is old and incomplete. On the other hand, if you try to use SIMD types and intrinsics in C++ you'll find current and comprehensive support from the major compilers on all SIMD platforms. (I'd love to use a current and comprehensive version of Haskell SIMD, but its just not ready for prime time.)
- jrockway 17y ago(I'd love to use a current and comprehensive version of Haskell SIMD, but its just not ready for prime time.) Since you're obviously an expert in the area, why aren't you helping make it ready for prime time?
- scott_s 17y agoThat's really not fair. I know of many things in and outside of my area of research that need improvement, as does any researcher. But we can only work on one thing at a time.