mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4046] [Engine] add opt-in reference-order CPU mixed-IQ down dispatch #4888
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4888
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/Niko1221/Strata/pull/4046
Author: @CrashxZ
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:pr/iq-down-reference-order📝 Commits (2)
1bedc77feat(cpu): add opt-in exact mixed-IQ native down dispatch3cbfd25refactor: scope mixed-IQ down port to exact CPU dispatch📊 Changes
6 files changed (+457 additions, -0 deletions)
View changed files
➕
docs/IQ_DOWN_EXACT.md(+98 -0)📝
src/kernels/cpu/native_expert.cpp(+19 -0)➕
tools/iq_down_dispatch_test.cpp(+110 -0)➕
tools/iq_down_exact_test.cpp(+125 -0)➕
tools/test_iq_down_dispatch.py(+47 -0)➕
tools/test_iq_down_exact.py(+58 -0)📄 Description
This adds an opt-in CPU down-projection path for the 2048/512 mixed-IQ layout: IQ2_S gate/up with IQ2_S or IQ3_S down. It reuses upstream's
iq256x_rowsAPI to decode weights once across multiple tokens while keeping reference-order dot products.Set
STRATA_IQ_DOWN_EXACT=1before startup to enable it. The default path is unchanged. The dispatcher checks the runtime and compiled GGML ISA, quantization types, contiguous layout and token width (2–8). Unsupported cases fall back;STRATA_NO_IQ256andSTRATA_IQ_MT_MINstill apply.This came out of the MoEmentum low-VRAM inference work. The exact-row arithmetic already exists upstream; this PR wires it into the native CPU dispatcher and adds regression tests.
Tests
Tested on Linux with GCC/G++ 15.2.0 and AVX2/FMA/F16C, against llama.cpp
3cf03257f219afbe7334045ff7c6a06ac68c627d:To reproduce, point
$LLAMAat that llama.cpp checkout and use fresh output directories:Limits
These are kernel and dispatch tests, not full-model validation or a speed benchmark. The option stays off by default, and this PR makes no model-correctness or performance claim.
The earlier draft included GPU registrations. Those were removed after a device-reference check failed; CUDA/HIP source and the grouped device fixture now match the upstream base. The original failure and its rounding analysis are documented in IQ_DOWN_EXACT.md, along with the CPU test details.
AI assistance was used for implementation, testing and review.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.