3 ms·
> Using instructions that don't exist on a given CPU will cause the program to crash. But surely this also applies to a Rust program that only uses safe code b
by quietbritishjim 7y ago
> Using instructions that don't exist on a given CPU will cause the program to crash.
But surely this also applies to a Rust program that only uses safe code but it's compiled with the right compiler switches that is allowed to use SIMD instructions?
- steveklabnik 7y agoIt will only use the SIMD intrinsically that work on the platform requested, in that case.
- mikepurvis 7y agoSure would be nice to have a way to mark a block as "compile for arches x, y" and have the binary check on entry which you have and select a different code path. This way you could do it only for your hot sections and not need to have the entire binary duplicated. AFAIK the main way to manage this right now is throwing the optimized stuff into a plugin and then loading it at runtime— but that ends up having huge implications on your project structure, source layout, etc.
- zamadatix 7y agohttps://doc.rust-lang.org/1.29.1/std/arch/#dynamic-cpu-feature-detection https://doc.rust-lang.org/1.29.1/std/arch/#dynamic-cpu-featu...
- mikepurvis 7y agoWell, that is awesome. Thanks for the link!