News for hackers. Stuff that matters.
Re:Eigen: A C++ template library for linear algebra by bee_rider on Monday April 04, 2022 @01:03PM (#30909062)
That's interesting. I'd assume that a template library like Eigen would be most competitive for really small matrices and vectors of a known size -- it should have a fundamental advantage over something like MKL or BLIS, in that it can fully inline and unroll everything if it wants, right?
Re:Eigen: A C++ template library for linear algebra by Const-me on Monday April 04, 2022 @01:16PM (#30909260)
My guess it’s their deliberate design decision. It could be that most users of the library don’t care about small things.

About the template stuff, I think their main performance advantage over traditional BLAS is not even SIMD, it’s lazy evaluation. Expressions like x=a*b+c never compute the complete a*b matrix or vector. The a*b expression returns a small placeholder object on the stack, of a scary type with couple lines of template arguments in the type name. This way the complete expression runs without making temporary matrices, instead it streams data from all 3 arguments and only writes to memory once. And if the `x` is of the correct size already, it doesn’t call malloc/free.

Re:Eigen: A C++ template library for linear algebra by bee_rider on Monday April 04, 2022 @01:35PM (#30909542)
Yeah, lazy evaluation/fusing operations is I think their best feature. Fixed interface BLAS has really good performance, but I mean, something as simple as DAXPBY is an extension. Selecting what functionality to super-optimize is hard for a fixed interface, and involves non-technical stuff like figuring out what subroutines people actually want.

I'm sure someone has already looked at this, but I wonder if Eigen can just somehow nab kernels directly from BLIS, haha.

Re:Eigen: A C++ template library for linear algebra by liquidify on Monday April 04, 2022 @01:37PM (#30909569)
This is called "expression templates" https://en.wikipedia.org/wiki/Expression_templates