3 ms·
I only played with ISPC a little bit. What I found is that it is really great if you need to write a large volume of SIMD code and that code sticks to one lane
by corysama 7y ago
I only played with ISPC a little bit. What I found is that it is really great if you need to write a large volume of SIMD code and that code sticks to one lane size. Like, 4 32-bit floats or ints. But, if you want switch mid-stream to 8 shorts or 16 bytes, you’re gonna have a hard time. Or, if you just need a few instructions, it’s easier to just use intrinsics.
- a1369209993 7y agoI think that's somewhat intentional? The name stands for [Intel [Single Program Multiple Data] Program Compiler], not "SIMD"/"Instruction". I'd expect switching lane depth (4 shorts or 4 bytes) to work fine, but switching SIMD width (8 or 16 lanes) seems out of scope for "run 4 instances of this program in lockstep".
- BubRoss 7y agoI would have to see an example of what you mean, but it should be completely possible though might require converting without using vectorization. Switching lane size doesn't make much sense to me because ideally you would want lanes that are as wide as possible and mostly be agnostic to their size.
- corysama 7y agoI had some code that tried to stay 16x8bit, but would occasionally _mm_unpacklo_epi8, _mm_unpackhi_epi8 to 2 8x16bit vectors to keep precise intermediate results during some fixed-point math. Writing it out like that, it sounds like it should have been easy. Don't remember what I ran into. Maybe didn't bang on it long enough.
- BubRoss 7y agoThe original AVX instructions didn't have all the integer operations that the most modern chips have. It might have been haswell that added small integers over the 256 bit lane width.
- stephencanon 7y agoRight. AVX (the original extension) only added 256b floating-point and non-destructive 128b integer. The 256b integer SIMD ops are all in AVX2 or later.