MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::quad_int_dot_swapped Concept Reference

Does dot(v1, v2) name the quad kernel with the operands the OTHER way round? More...

#include <dot.hpp>

Concept definition

template<typename Accumulator, typename Result, typename V1, typename V2>
std::is_same_v<Accumulator, simd::quad_accumulator_t<typename V2::value_type,
typename V1::value_type>> &&
std::is_same_v<Result, Accumulator>
Concept satisfied by dense vector types of an 8-bit element that the quad multiply-accumulate can wid...
Definition dispatch_traits.hpp:197
Does dot(v1, v2) name the quad kernel with the operands the OTHER way round?
Definition dot.hpp:61
Is (A, B) a quad-widening pair the hardware op accepts?
Definition batch.hpp:169
typename quad_accumulator< A, B >::type quad_accumulator_t
Definition batch.hpp:165

Detailed Description

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.