mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #560] iq_mmvq: read each weight block once per batch (block index outermost), +20% prefill on IQ experts #596
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#596
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/560
Author: @precisionailabsllc-collab
Created: 10/27/2026
Status: 🔄 Open
Base:
main← Head:pr/iq-mmvq-batched📝 Commits (1)
058f927iq_mmvq: read each weight block once per batch (block index outermost)📊 Changes
3 files changed (+193 additions, -10 deletions)
View changed files
📝
CMakeLists.txt(+8 -0)📝
src/kernels/cuda/iq_kernels.cu(+78 -10)➕
tests/iq_mmvq_parity_test.cu(+107 -0)📄 Description
What
iq_mmvqcalledrow_dot()once per activation column, androw_dot()re-reads and re-dequantises thesame weight bytes each time. A
k-column batch therefore paid the weight trafficktimes.This makes the block index the outer loop, so one weight block is loaded and decoded once and applied to
every column:
Widths are grouped
NCat a time (8, then 4, then 2) with the single-column form for the tail, so anyncolsworks.ncols == 1keeps the existing kernel untouched, so decode is unaffected.It is a scheduling change, not an arithmetic one
The per-lane accumulation order is identical (same
k, same stride) and the warp reduction is the samewarp_sum, so each column is bit-identical to the single-column call.tests/iq_mmvq_parity_test.cu(new, registered in ctest) checks that over all 10 supported IQ formats(16, 17, 18, 19, 20, 21, 22, 23, 29, 42) x 9 widths (1, 2, 3, 4, 5, 7, 8, 9, 16), comparing raw bits:
The single NaN-sign case is IQ1_M at 16 columns on the random-byte fixture: random fp16 scales go NaN and
IEEE leaves a NaN's sign to the implementation. It is not a numeric difference and cannot arise from real
quantised weights. The test's pass criterion is value equality with NaN treated as equal to NaN; the strict
bit count is reported separately.
Effect
Measured on a Radeon 8060S (gfx1151, ROCm 7.15), single GPU, with a MiniMax-M3.1-Flash expert pack whose
routed experts are IQ1_M / IQ2_XS / IQ2_XXS (so they go through this kernel):
+20% on prefill, which is where a batch actually has several columns per expert. Anything with IQ-type
weights and a multi-token prompt should see the same shape of gain; the win scales with how many columns
share a weight block.
Scope
src/kernels/cuda/iq_kernels.cu, plus the new test and its CMake entry.iq_mmvq's public signature is unchanged; no caller changes.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.