|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Does dot(v1, v2) name the quad kernel with the operands the OTHER way round? More...
#include <dot.hpp>
Does dot(v1, v2) name the quad kernel with the operands the OTHER way round?
(int8, uint8) has no hardware pairing – VNNI implements unsigned x signed, so (uint8, int8) is the native one. The kernel reduce_dot_widen rejects the reversed order at compile time, which is right for a primitive that mirrors the instruction: there is no such instruction, and silently taking a three-times-slower emulation would be worse than saying so.
dot is not that primitive. Refusing to compute a well-defined dot product because the hardware lacks a fused form would break generic code for a performance reason, and dropping to the generic loop would cost roughly an order of magnitude with nothing to warn the caller. Neither is necessary: a dot product is SYMMETRIC, so the operands are simply swapped and the native instruction runs. conj is the identity on the integers, so this holds for the Hermitian dot as well as dot_real.