Repository navigation
cuda : reuse and emit MMVQ activation images - #117
Draft
GenerelSchwerz wants to merge 8 commits into
Draft
GenerelSchwerz wants to merge 8 commits into
GenerelSchwerz wants to merge 8 commits into
Conversation
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
This was referenced Oct 2, 2026
Assisted-by: Codex
This was referenced Oct 3, 2026
Assisted-by: Codex
This was referenced Oct 4, 2026
Assisted-by: Codex
Assisted-by: Codex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Share temporary Q8_1 activation images across compatible ordinary and routed MMVQ projections. Eligible RMS and F32 GLU producers can emit that image while retaining their original final F32 output. This removes a separate activation-quantization launch and reread where the allocated graph permits it. Existing matrix selection, reduction trees, quantization rounding and higher-priority matrix fusions remain intact.
PR116 is superseded. Ordinary and routed MMQ preparation remain in PR118 and PR119. These are independent review branches; their combined integration needs validation.
Coverage
MUL_MATand quantizedMUL_MAT_IDon their existing MMVQ paths. Routed eligibility usesget_mmvq_mmid_max_batch(type, cc)and the true token dimension. All 23 MMVQ weight formats use the standard Q8_1 activation image; compatible mixed formats, per-slot routed inputs and valid scalar strides are supported.This PR does not implement cross-token weight decode reuse, new paired matrix kernels, omission of dead F32 producer stores, MMQ producer images, direct emission from fused matrix producers, transfer/residency policy, an MTP implementation, the full HC pipeline or private-executor allocation/dispatch integration. Eligible nodes inside an existing MTP graph can benefit; model-serving gains remain unproven.
GLU producer evidence
RTX5070Ti / CUDA13.4 / SM120a. Own control is the previous PR117 head
55098781192d0231007d6b1b2ca3e2a87134f7ca, based on official upstreamdcd387a412ca54e172a8d60eb71ef6753850c8ca. The new review leaf is six files, 152 added / 38 deleted lines, including 20 lines in the existing backend test file. The complete PR includes prior reuse/RMS work: ten files, 943 added / 47 deleted lines against its reference base.Three rotated pairs per row, 2000 warmed captured-graph replays per run. Times cover the complete component graph; correctness, image inspection and sanitizer runs are separate from timing.
The typical K2560 / 8-slot / T8 routed case is effectively flat (20.489 vs 20.470 us). Early ordinary, per-slot, existing paired-fusion, live-gate, RMS and K2592-tail controls are also flat. Fewer quantization launches do not imply a universal gain. Larger-volume improvements repeat in all three pairs.
Validation of this leaf:
Artifacts:
moe-cache-tests/results/upstream-kernel-series-20261001/ACTIVATION-IMAGE-EMISSION-20261009.FINAL-SEALED-V1.jsonverifies 4943 source/build/log/payload bindings;FINAL-RESULTS-V1.mdandFINAL-SOURCE-REVIEW-V1.mdrecord results and exclusions. Failed external-fixture/parser probes are preserved and corrected separately, without product or ownership-check changes. No serving or Strata speed claim is made for this leaf.Earlier routed reuse evidence
The preceding routed extension
55098781192d0231007d6b1b2ca3e2a87134f7cawas qualified againstd1b2bd8d074aa6253e3123c5f19a5e9baed423bc; it changed host admission and the existing fixture, with quantizer/MMVQ/norm device objects unchanged. Three rotated pairs and 2000 captured replays measured 19.86% less component time for two shared routed projections, 13.74% for three per-slot projections, 12.71% with padded strides, 14.20% with seven readers and 11.10-12.44% for selected RMS producers. Distinct-input, ordinary, already-fused and T16 MMQ controls were flat; T16/T32 selection stayed unchanged.That extension retained 50 paired normal graphs / 200 datasets, all 23 quant formats, mixed formats, input/ID writes, distinct ID values, in-place writes, live outputs and eight norm cuts. Full GPU/reference/input bytes matched and CPU NMSE stayed below 5e-4. All 474 then-existing backend cases passed in both builds across default/uncaptured/unfused operation. Eight focused memchecks and four changed-host older-SM compile checks passed.
Two additional actual two-stream fork/join fixtures retained independent MMVQ branches, exact outputs and event-backed emission decline. Quantizer counts fell from two to one; both memchecks passed. One component improved 3.55%, the norm-before-fork case was flat. Total routed-extension timing evidence was 60 rotated pairs / 120 calls. Artifacts remain under
MULTITOKEN-WEIGHT-REUSE-20261008/ROUTED-ACTIVATION.Prior evidence and serving limits
Earlier normalization qualification includes 18 boundary pairs, 234 emitted-image observations representing 37 fresh images, actual scheduler allocation, direct alias/partial-view/write-epoch declines and event-backed emission decline. One compound overwrite fixture exceeds CPU NMSE 5e-4 identically in both arms and remains baseline-limited, with no relaxed tolerance; the other 17 pairs pass. Artifacts remain under
HYPERCONNECTION/Q8-EMISSION.Earlier ordinary reuse evidence includes branch-local/common-input streams, overlapping/disjoint groups and post-join lifetimes. Some graphs-disabled synthetic cases took 0.4-2.4% more time; a small supplied-token model trial showed no additional gain over the previous extension. These historical results are not serving evidence for the latest updates.
Previous Qwen3.6-35B-A3B Q4_K_M serving tests used the same native MTP configuration in both builds: ABBA measured 100.010 vs 100.951 tok/s with overlapping ranges, hence inconclusive. Without MTP, one pair measured 64.525 vs 64.626 tok/s, also insufficient for a gain claim. Outputs matched within each mode and MTP acceptance matched 1345/2106. The roughly 1.6x MTP-versus-no-MTP difference is not a PR117 speedup.
Reproduction and requirements
Run
test-backend-ops test -b CUDA0 -o MUL_MAT_REUSED_INPUT -j1, then repeat withGGML_CUDA_DISABLE_GRAPHS=1and withGGML_CUDA_DISABLE_FUSION=1. Exact external commands, frozen weights, loaded DLL hashes and retained arrays are in the bound manifests. Use fresh output labels. Whole suites hold ordered shared build then GPU locks, workload-sized hard host-memory limits, zero swap allowance, finite timeouts and verified whole-process-tree teardown.