News for hackers. Stuff that matters.
Re:Three Fundamental Flaws of SIMD by phkahler on Tuesday August 10, 2021 @12:01PM (#28130484)
My biggest complaint is that SIMD opens the door to doing proper vector math (dot product, cross product, vector addition, etc) in a single instruction. I'd like to see languages like C++ and Rust adopt 2,3 and 4-element vectors as first class types and use these registers and instructions for them.

I don't want to use the language features to define my onw vector types and figure out how to minimize any overhead in the implementation. I tried that years ago in C++ and ended up not using some of my overloaded operators because they were too slow. Some of that can be overcome with C++11 (I think) features, or others. Point is, vector math is so common I think they deserve first class support in languages.

Re:Three Fundamental Flaws of SIMD by dragontamer on Tuesday August 10, 2021 @12:38PM (#28130970)
I'm not convinced that the "4-vector" is a very useful C++ concept. Sure, it easily maps to 4-wide SIMD registers, but is that really what you want?

Its clear to anyone who has tried it... that NVidia's CUDA / OpenCL / Intel ISPC approach is superior. Seeing the SIMD-lanes as a thread is easier to understand than expected.

NVidia CUDA and AMD ROCm/HIP are your C++ languages that compile into SIMD code. OpenCL isn't really C++ but kinda is associated with it. Intel is doing the OneAPI thing but I don't know much about it yet.

Python, Julia, and other high-level languages are also moving into the "simd-lanes as threads" approach. Its just fundamentally easier to think about.

Re:Three Fundamental Flaws of SIMD by josefx on Tuesday August 10, 2021 @01:56PM (#28132022)
> SIMD opens the door to doing proper vector math (dot product

dot product turns vectors into a scalar value, doing that for single vectors is a bad fit for SIMD. You can write SIMD code that efficiently computes multiple dot products in parallel but that needs a completely different vector layout.

Re:Three Fundamental Flaws of SIMD by programmerjake on Thursday August 19, 2021 @10:27PM (#28241761)
Well, Rust is getting support for portable vectors (I'm one of the ones working on that): https://github.com/rust-lang/portable-simd
Re:Three Fundamental Flaws of SIMD by wrnr on Tuesday August 10, 2021 @03:09PM (#28132895)
How about geometric algebra libraries like Klein and g3. Klein has operator overloading for the basis elements of the algebra implemented using intel's SSE, while g3 does the same but uses the Rust's portable stdsimd crate.

Klein: https://www.jeremyong.com/klein/ g3: https://github.com/wrnrlr/g3

Re:Three Fundamental Flaws of SIMD by jjoonathan on Tuesday August 10, 2021 @12:17PM (#28130683)
Making Julia viable for your use case is probably a quicker path towards this goal than trying to persuade C++ and Rust to cater to the math audience.
Re:Three Fundamental Flaws of SIMD by agilebodyshoppe on Tuesday August 10, 2021 @12:32PM (#28130885)
alignment requirements for loading/storing wider registers makes this not worth the effort. simd instruction sets also generally dont have anything like dot or cross products.

shading languages do of course have first class vector types but all modern GPUs implement them with plain scalar code.