News for hackers. Stuff that matters.
Re:Arm-Based 128-Core Ampere CPUs Cost a Fraction of x86 Price by Const-me on Wednesday January 05, 2022 @02:42PM (#29813871)
> The code was awful and it would need to be a compiler generated thing for sure.

C++ templates technically work, Eigen [1] is made entirely of them and the performance is pretty good. However, writing and debugging code in that style is hard, and the code is unreadable.

I tried T4 [2] to generate AVX intrinsics-heavy C++ code. At least the programming language is sane as opposed to C++ template metaprogramming. However, the code generation adds friction. Also, IDE integration is less than ideal, apparently Microsoft only cared about consuming T4 from C# projects.

I basically gave up, and usually writing normal C-like code with SIMD intrinsics, with just a few preprocessor macros, and no template metaprogramming. Unrolling things manually when necessary. At least the code is readable this way, and not too hard to debug. The compilers have these non-standard keywords/attributes to forcefully inline functions, they allow to reuse code instead of copy-pasting.

[1] https://eigen.tuxfamily.org/index.php?title=Main_Page

[2] https://en.wikipedia.org/wiki/Text_Template_Transformation_T...

Re:Arm-Based 128-Core Ampere CPUs Cost a Fraction of x86 Price by reitzensteinm on Wednesday January 05, 2022 @05:06PM (#29815708)
That's interesting, thanks. TIL about T4/Eigen.

Actually, for my specific use case using AVX512 gather intrinsics would probably have worked OK and been cleaner - although I've heard they're pretty slow.