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.0 KiB29 linesraw
1// src/quant/x86/act_avx2.cpp - the Avx2 contract's activation quantizers: ggml's AVX2 Q8_0 / Q8_1 (round half to even), and Q8_K, which is ggml's scalar
2// `_ref` on every x86 flavour and is quantized here byte for byte the same in AVX2 (the engine's q8k_quant_avx2, moved into the layer).
3// Compiled with -mavx2 -mfma -mf16c (/arch:AVX2).
4#include "tier_common.hpp"
5
6#include "../registry.hpp"
7#include "strata/quant/act.hpp"
8
9namespace strata::quant {
10namespace avx2 {
11
12#include "x86_helpers.inc"
13#include "x86_act.inc"
14#include "q8k_avx2.inc"
15
16}  // namespace avx2
17
18namespace {
19const ActKernel kTable[] = {
20    {avx2::quantize_q8_0, Type::Q8_0, Arith::Avx2, Isa::Avx2, "avx2_q8_0"},
21    {avx2::quantize_q8_1, Type::Q8_1, Arith::Avx2, Isa::Avx2, "avx2_q8_1"},
22    {avx2::quantize_q8_K_avx2, Type::Q8_K, Arith::Avx2, Isa::Avx2, "avx2_q8_K"},
23    {quantize_q8_K_ref, Type::Q8_K, Arith::Avx2, Isa::Scalar, "avx2_q8_K_ref"},
24};
25}  // namespace
26
27ActTable avx2_act_table() noexcept { return {kTable, (int) (sizeof kTable / sizeof kTable[0])}; }
28
29}  // namespace strata::quant