4 ms·
That’s library functions from stdsimd crate. Looks like significant overhead over C intrinsics. Two calls to transmute() for every instruction. And other calls
by Const-me 7y ago
That’s library functions from stdsimd crate.
Looks like significant overhead over C intrinsics. Two calls to transmute() for every instruction. And other calls for every instruction, stuff like as_i32x4.
It’s technically possible every last one of them compile into nothing at all, and emits just a single desired instruction. I don’t believe these optimizations are 100% reliable, however. They aren’t reliable in clang or vc++, I sometimes have to use trickery to force compilers to inline stuff, keep data in registers instead of loads/stores, and otherwise not screw up the performance.
- adamnemecek 7y agoThere's no transmute. Look I don't have time for this.
- Const-me 7y ago> There's no transmute. That crate calls transmute twice, for every single instruction. https://github.com/rust-lang-nursery/stdsimd/blob/master/crates/core_arch/src/x86/sse2.rs#L94-L103 https://github.com/rust-lang-nursery/stdsimd/blob/master/cra... https://github.com/rust-lang-nursery/stdsimd/blob/master/crates/core_arch/src/x86/mod.rs#L389-L392 https://github.com/rust-lang-nursery/stdsimd/blob/master/cra...
- adamnemecek 7y agoCheck the actual compiler output.
- steveklabnik 7y agoWhat he’s trying to say is that transmute is also an intrinsic. They correspond to the machine instructions, that’s their entire purpose. That’s also why they’re intrinsics.