3 ms·
I recently experimented with Rust's std::simd library prototype, and it gave me the same sense of wasted potential. My program performed complicated processing
by fleabitdev 5y ago
I recently experimented with Rust's std::simd library prototype, and it gave me the same sense of wasted potential.
My program performed complicated processing of large 8-bit grayscale images. Naive use of portable SIMD made several important parts of the algorithm run ten times faster than my integrated-GPU implementation! (OpenGL ES 3.0 over ANGLE on an Intel HD Graphics 520)
I think the sheer power of modern SIMD has slipped past most peoples' radar. A multicore processor with AVX2 has number-crunching throughput comparable to a low-end GPU, and for some workloads, the extra flexibility of the CPU can unlock an additional order-of-magnitude performance uplift. (The comparison may be a little different if you're programming the GPU with modern compute shaders - I'm not sure.)
Portable SIMD programming is also just fun! Trying to keep my working set within the 32 KiB L1 cache, trying to keep my data packed within individual 8-bit lanes, and lacking access to some basic operations like integer multiplication and division - it almost feels like programming for a retro games console.
- Royi 5y agoHave you looked at [ISPC - Intel SPMD Program Compiler][0]? [0]: https://github.com/ispc/ispc
- shakow 5y agoI concur. I recently ported some bioinfo computations from scalar to SIMD with primitives from core::arch, and the gain was an immediate ~10×. It is a shame that one needs to fiddle with RUSTC_FLAGS just for SIMD extensions to trigger though :/
- dahart 5y ago> it almost feels like programming for a retro games console. I get this feeling writing CUDA code all the time, having to keep my stack frames and local data small, figuring out how to even out and time-slice the work. It’s a little like Arduino coding in a way, it’s just that instead of one of them running at 16Mhz, I have ten thousand of them running at 2Ghz (and as a bonus they have floating point superpowers).