okami.mom/strata

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

Niko1221Merge f-own-2n (ead5a32ae) into f-own-int: the Arm NEON tier of the quant layer0a9381336

main
1.7 KiB34 linesraw
1// src/quant/arm/dot_neon.cpp - the Neon contract: ggml-cpu's dot products as its Arm flavour compiles them (armv8.2-a + dotprod + fp16 + i8mm, no SVE: the
2// DGX Spark's STRATA_PORTABLE build and the Mac's native build).  The two-row i8mm forms are not here: the pool asks for one row at a time.
3// Compiled with the flags of cmake/backends/quant.cmake (GCC: -ffp-contract=fast like ggml's gnu11 C; Clang: its default, contraction within an expression).
4#include "tier_common.hpp"
5
6#include "../generic.hpp"
7#include "../registry.hpp"
8#include "strata/quant/dot.hpp"
9
10namespace strata::quant {
11namespace neon {
12
13#include "arm_helpers.inc"
14#include "arm_tables.inc"
15#include "arm_dots.inc"
16
17}  // namespace neon
18
19namespace {
20#define ENTRY(T, ACT, NAME) {neon::dot_##NAME, Type::T, Type::ACT, Arith::Neon, Isa::Neon, "neon_" #NAME}
21const DotKernel kTable[] = {
22    ENTRY(Q2_0, Q8_0, q2_0_q8_0),   ENTRY(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),
23    ENTRY(Q5_1, Q8_1, q5_1_q8_1),   ENTRY(Q8_0, Q8_0, q8_0_q8_0),   ENTRY(IQ4_NL, Q8_0, iq4_nl_q8_0), ENTRY(MXFP4, Q8_0, mxfp4_q8_0),
24    ENTRY(NVFP4, Q8_0, nvfp4_q8_0), ENTRY(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),
25    ENTRY(Q5_K, Q8_K, q5_K_q8_K),   ENTRY(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),
26    ENTRY(IQ2_XXS, Q8_K, iq2_xxs_q8_K), ENTRY(IQ2_XS, Q8_K, iq2_xs_q8_K), ENTRY(IQ2_S, Q8_K, iq2_s_q8_K),
27    ENTRY(IQ3_XXS, Q8_K, iq3_xxs_q8_K), ENTRY(IQ3_S, Q8_K, iq3_s_q8_K), ENTRY(IQ4_XS, Q8_K, iq4_xs_q8_K),
28};
29#undef ENTRY
30}  // namespace
31
32DotTable neon_dot_table() noexcept { return {kTable, (int) (sizeof kTable / sizeof kTable[0])}; }
33
34}  // namespace strata::quant