| ▲ | taeric 12 hours ago | |||||||||||||||||||||||||
I'm curious on the uptake of SIMD and other assembly level usage through high level code? I'd assume most is done either by people writing very low level code that directly manages the data, or by using very high level libraries that are prescriptive on what data they work with? How many people are writing somewhat bog standard RUST/C and expect optimal assembly to be created? | ||||||||||||||||||||||||||
| ▲ | jacquesm 7 hours ago | parent | next [-] | |||||||||||||||||||||||||
I was heavily into assembly before I discovered C. For the first decade and half or so I could usually beat the compiler. Since then, especially when supporting multiple architectures I have not been able to do that unless I knew some assumption that the compiler was likely to make wasn't true. The 'const' keyword alone killed most of my hand optimized stuff. In the end the only bits where I resorted to assembly were the ones where it wouldn't make any sense to write stuff in C. Bootloaders, for instance, when all you have to work with is 512 bytes the space/speed constraints are much more on the space side and that's where I find I still have a (slight) edge. Which I guess means that 'optimal' is context dependent and that the typical 'optimal' defaults to 'speed'. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | zamadatix 11 hours ago | parent | prev [-] | |||||||||||||||||||||||||
It's really only comparable to assembly level usage in the SIMD intrinsics style cases. Portable SIMD, like std::simd, is no more assembly level usage than calling math functions from the standard library. Usually one only bothers with the intrinsic level stuff for the use cases you're saying. E.g. video encoders/decoders needing hyper-optimized, per architecture loops for the heavy lifting where relying on the high level SIMD abstractions can leave cycles on the table over directly targeting specific architectures. If you're just processing a lot of data in bulk with no real time requirements, high level portable SIMD is usually more than good enough. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||