okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-own-2a (7c09c4a75) into f-own-int: the Strata quant layer and the x86 CPU rows9c143c403

main
1.2 KiB33 linesraw
1// src/quant/x86/act_avx.cpp - the Avx contract's activation quantizers: ggml's AVX Q8_0 / Q8_1 (128-bit integer halves), and Q8_K (ggml's scalar `_ref`, here in
2// 128-bit lanes, byte for byte the same; the engine's q8k_quant_avx1, moved into the layer).
3// Compiled with -mavx and AVX2, FMA and F16C off (/arch:AVX).
4#include "tier_common.hpp"
5
6#include "../registry.hpp"
7#include "strata/quant/act.hpp"
8
9#if defined(__AVX2__) || defined(__FMA__) || defined(__F16C__)
10#error "act_avx.cpp is the AVX-only tier: compile it without AVX2, FMA and F16C"
11#endif
12
13namespace strata::quant {
14namespace avx {
15
16#include "x86_helpers.inc"
17#include "x86_act.inc"
18#include "q8k_avx1.inc"
19
20}  // namespace avx
21
22namespace {
23const ActKernel kTable[] = {
24    {avx::quantize_q8_0, Type::Q8_0, Arith::Avx, Isa::Avx1, "avx_q8_0"},
25    {avx::quantize_q8_1, Type::Q8_1, Arith::Avx, Isa::Avx1, "avx_q8_1"},
26    {avx::quantize_q8_K_avx1, Type::Q8_K, Arith::Avx, Isa::Avx1, "avx_q8_K"},
27    {quantize_q8_K_ref, Type::Q8_K, Arith::Avx, Isa::Scalar, "avx_q8_K_ref"},
28};
29}  // namespace
30
31ActTable avx_act_table() noexcept { return {kTable, (int) (sizeof kTable / sizeof kTable[0])}; }
32
33}  // namespace strata::quant