Skip to content

Comment on Rust SIMD on the GPUparent

Comments

I wonder how much easier/better the code would have been to write with portable_simd ..

I had a quick glance of the code and it seems to use mostly basic arithmetic instructions on fixed width simd vectors using some helper macros like SIMD_MUL(x, y) for _mm_mul_ps, etc. Some explicit simd intrinsics code for stuff like sin.

That would've been pretty easy to write with portable_simd in Rust or the equivalent C/C++ language extensions (or maybe C++26 std::simd).

You'd just use f32x4 (or add a typedef with attribute in C++) and then use x*y instead of SIMD_MUL.

For basic stuff like this, you should get the exact same generated code.

https://clang.llvm.org/docs/LanguageExtensions.html#vectors-...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.