mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #132] [CLOSED] cpu_exact1: the CPU lane's singleton IQ2_XXS rows run an exact AVX-2 gate/up kernel #357
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#357
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/132
Author: @handmade0octopus
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:pr/cpu-exact1📝 Commits (1)
bdfab17cpu_exact1: the CPU lane's singleton IQ2_XXS rows run an exact AVX-2 gate/up kernel📊 Changes
8 files changed (+404 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+3 -0)📝
include/strata/kernels/cpu/iq_avx2.hpp(+10 -0)📝
include/strata/kernels/cpu/native_expert.hpp(+3 -0)📝
src/kernels/cpu/iq_avx2.cpp(+77 -0)📝
src/kernels/cpu/native_expert.cpp(+47 -0)➕
src/kernels/cpu/q8k_exact_port.inc(+68 -0)📝
src/program/generate.cpp(+15 -0)➕
tests/glm_cpu_exact1_test.cpp(+181 -0)📄 Description
What
The CPU lane computes a route's RAM-tier experts on the host. For a decode, that work is dominated by singleton calls: one IQ2_XXS row against one q8_1 activation. ggml's vec_dot path for that case dequantizes through its own rounding and costs ~0.74 ms per expert on a 6-thread Ryzen 5 3600 lane. This adds an AVX-2 kernel that computes the gate/up rows exactly the way the device path does (dequant, clamp, sigmoid-mul) and takes over only the dominating case: one row x one token, type 16 (IQ2_XXS). Everything else - other formats, multi-token calls, the contiguous batched dispatch - keeps ggml. On by default where the CPU has AVX-2 (and no AVX-512 ggml path);
STRATA_GLM_CPU_EXACT1=0falls back to ggml,STRATA_GLM_CPU_EXACT1_DIAG=1prints per-request counters.Numbers (Maya-S-v2-IQ2_XXS, one 4090 D, RAM-resident tiers, ~9.5 CPU-lane experts/token)
Campaign protocol: 32,755-token prompt, 128 warm-up tokens, 2,048 measured on the fully cached prefix, temp 1.0 / top_p 0.95 / seed 734621, thinking max.
Per-expert: 0.736 -> 0.694 ms. Teacher-forced scoring over 2,047 positions with the path active: identical nll (0.16356) and top-1 (97.61%) to the ggml path; the diag counters confirm every CPU row went through the exact kernel (
exact_rows=39,692,288 ggml_rows=0).Verification
glm_cpu_exact1_test(needs a real pack) checks the exact path's activation on real experts.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.