Towards fearless SIMD
raphlinus.github.io
Towards fearless SIMD
1–10 of 82 posts
Re: Towards fearless SIMD
#2Re: Towards fearless SIMD
#3What is SIMD?
https://en.wikipedia.org/wiki/SIMD
ELI5: Your processor can process more data in parallel.
If you have for example loop that has something like this in the body:
a[i] + b[i] = c[i]
Using SIMD processor can make all this operations same time:
a[i] + b[i] = c[i]
a[i+1] + b[i+1] = c[i+1]
a[i+2] + b[i+2] = c[i+2]
a[i+3] + b[i+3] = c[i+3]
Normally in one iteration you would only get one of this addition done without SIMD, thanks to SIMD you can have multiple.
Re: Towards fearless SIMD
#4What is SIMD?
Single Instruction Multiple Data https://en.wikipedia.org/wiki/SIMD ELI5: Your processor can process more data in parallel. If you have for example loop that has something like this in the body: a[i] + b[i] = c[i] Using SIMD processor can make all this operations same time: a[i] + b[i] = c[i] a[i+1] + b[i+1] = c[i+1] a[i+2] + b[i+2] = c[i+2] a[i+3] + b[i+3] = c[i+3] Normally in one iteration you would only get one of…
ETA: My bad - I did not think to click that. Embarrassing. Thanks for pointing it out!
Re: Towards fearless SIMD
#5Earlier quoted context omitted.
Single Instruction Multiple Data https://en.wikipedia.org/wiki/SIMD ELI5: Your processor can process more data in parallel. If you have for example loop that has something like this in the body: a[i] + b[i] = c[i] Using SIMD processor can make all this operations same time: a[i] + b[i] = c[i] a[i+1] + b[i+1] = c[i+1] a[i+2] + b[i+2] = c[i+2] a[i+3] + b[i+3] = c[i+3] Normally in one iteration you would only get one of…
Thanks! I get that if you don't already know the acronym, you're not the audience, but it is helpful to not have to search externally for a reference. Could you imagine if that was in a general programming magazine before global internet search engines were popular? You'd have to cross your fingers that your local encyclopedia has an entry! ETA: My bad - I did not think to click that. Embarrassing. Thanks for pointin…
Re: Towards fearless SIMD
#6Re: Towards fearless SIMD
#7https://github.com/jackmott/simdeez
full disclosure, that's mine.
Re: Towards fearless SIMD
#8The simplest target-independent fearless SIMD is autovectorization[1] . But taking maximum advantage of that probably means writing some code that feels a little unnatural. Also, IIRC bounds checks thwart some autovectorization. [1] https://llvm.org/docs/Vectorizers.html
JITs could solve that problem, but few JITs currently do very much auto vectorization, because they don't have time.
Re: Towards fearless SIMD
#9Earlier quoted context omitted.
Single Instruction Multiple Data https://en.wikipedia.org/wiki/SIMD ELI5: Your processor can process more data in parallel. If you have for example loop that has something like this in the body: a[i] + b[i] = c[i] Using SIMD processor can make all this operations same time: a[i] + b[i] = c[i] a[i+1] + b[i+1] = c[i+1] a[i+2] + b[i+2] = c[i+2] a[i+3] + b[i+3] = c[i+3] Normally in one iteration you would only get one of…
Thanks! I get that if you don't already know the acronym, you're not the audience, but it is helpful to not have to search externally for a reference. Could you imagine if that was in a general programming magazine before global internet search engines were popular? You'd have to cross your fingers that your local encyclopedia has an entry! ETA: My bad - I did not think to click that. Embarrassing. Thanks for pointin…
Style manuals of the time encouraged expanding acronyms on first use, but I can imagine this wasn't consistently done in a technical field!
Re: Towards fearless SIMD
#10The simplest target-independent fearless SIMD is autovectorization[1] . But taking maximum advantage of that probably means writing some code that feels a little unnatural. Also, IIRC bounds checks thwart some autovectorization. [1] https://llvm.org/docs/Vectorizers.html
In an LLVM context it also means you don't get runtime feature detection. You would need to build N dlls and then write code to load the proper one at runtime based on feature detection. JITs could solve that problem, but few JITs currently do very much auto vectorization, because they don't have time.
Does LLVM not support GCC-style function multiversioning?