3 ms·
Why do the x4/x8 types seem to be the default in rust? A portable SIMD feature should encurage portable SIMD and not a specific vector register size.
by camel-cdr 2y ago
Why do the x4/x8 types seem to be the default in rust?
A portable SIMD feature should encurage portable SIMD and not a specific vector register size.
- the__alchemist 2y agoThis sounds like a great idea. I went with this approach because I'm new to SIMD, so I aped the most promising API (core::simd), extending it naturally. I need to think through the consequences. It might involve feature gates, and/or an enum. So, for example, instead of: pub struct f32x8(__m256); It might be this internally, with some method to auto-choose variant based on system capability?: pub enum f32_simd { X8(__m256), X16(__m512), } etc. Thoughts?
- camel-cdr 2y agoI'm not proficient in Rust, but API wise I'd conceptually define types like f32xn or f32s, which have the number of elements that fit into a vector register for your target architecture, so 4 for NEON/SSE, 8 for AVX and 16 for AVX512. I can recommens lookig at the highway library: https://github.com/google/highway https://github.com/google/highway
- janwas 2y agoAmen! I really do not understand this. It has been 7 years since SVE was introduced. Writing an application in terms of a specific lane count loses performance portability - either it's too many, or too few, for the particular CPU. And it also enables/encourages antipatterns like putting RGB in Vec4.