okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
9c143c403
main
1// src/quant/x86/dot_avx2.cpp - the Avx2 contract: ggml-cpu's dot products as its AVX2 + FMA + F16C flavour compiles them (the shipped release flavour). 2// Compiled with -mavx2 -mfma -mf16c (/arch:AVX2). Types ggml has no SIMD branch for (Q2_0) run the Generic code under this contract. 3#include "tier_common.hpp" 4 5#include "../generic.hpp" 6#include "../registry.hpp" 7#include "strata/quant/dot.hpp" 8 9namespace strata::quant { 10namespace avx2 { 11 12#include "x86_helpers.inc" 13#include "x86_dots.inc" 14 15}// namespace avx2 16 17namespace { 18#define ENTRY (T ,ACT ,NAME ) {avx2::dot_##NAME, Type::T, Type::ACT, Arith::Avx2, Isa::Avx2, "avx2_" #NAME} 19const DotKernel kTable []= { 20ENTRY (Q4_0 ,Q8_0 ,q4_0_q8_0 ),ENTRY (Q4_1 ,Q8_1 ,q4_1_q8_1 ),ENTRY (Q5_0 ,Q8_0 ,q5_0_q8_0 ),ENTRY (Q5_1 ,Q8_1 ,q5_1_q8_1 ), 21ENTRY (Q8_0 ,Q8_0 ,q8_0_q8_0 ),ENTRY (IQ4_NL ,Q8_0 ,iq4_nl_q8_0 ),ENTRY (MXFP4 ,Q8_0 ,mxfp4_q8_0 ),ENTRY (NVFP4 ,Q8_0 ,nvfp4_q8_0 ), 22ENTRY (Q2_K ,Q8_K ,q2_K_q8_K ),ENTRY (Q3_K ,Q8_K ,q3_K_q8_K ),ENTRY (Q4_K ,Q8_K ,q4_K_q8_K ),ENTRY (Q5_K ,Q8_K ,q5_K_q8_K ), 23ENTRY (Q6_K ,Q8_K ,q6_K_q8_K ),ENTRY (IQ1_S ,Q8_K ,iq1_s_q8_K ),ENTRY (IQ1_M ,Q8_K ,iq1_m_q8_K ),ENTRY (IQ2_XXS ,Q8_K ,iq2_xxs_q8_K ), 24ENTRY (IQ2_XS ,Q8_K ,iq2_xs_q8_K ),ENTRY (IQ2_S ,Q8_K ,iq2_s_q8_K ),ENTRY (IQ3_XXS ,Q8_K ,iq3_xxs_q8_K ),ENTRY (IQ3_S ,Q8_K ,iq3_s_q8_K ), 25ENTRY (IQ4_XS ,Q8_K ,iq4_xs_q8_K ), 26 {generic::dot_q2_0_q8_0_generic ,Type ::Q2_0 ,Type ::Q8_0 ,Arith ::Avx2 ,Isa ::Scalar ,"avx2_q2_0_generic" }, 27}; 28#undef ENTRY 29}// namespace 30 31DotTable avx2_dot_table ()noexcept {return {kTable , (int ) (sizeof kTable /sizeof kTable [0 ])}; } 32 33}// namespace strata::quant