Skip to content

[Perf][SM70] Add opt-in native-g32 AWQ QPN M1 dispatch - #12

Draft
Leonccaa wants to merge 2 commits into
perf/sm70-awq-qpn-kernel-20260905from
perf/sm70-awq-qpn-runtime-20260905
Draft

Leonccaa wants to merge 2 commits into
perf/sm70-awq-qpn-kernel-20260905from
perf/sm70-awq-qpn-runtime-20260905

Conversation

@Leonccaa

@Leonccaa Leonccaa commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Purpose and stack

Layer 2/3, based on perf/sm70-awq-qpn-kernel-20260905: connect the native
operator to a narrow, default-off AWQ runtime path. The third layer is an
independent cooperative 3-byte metadata load optimization.

Review order: #8 (prerequisite) -> #10 (kernel) -> #12 (runtime) -> #11 (3B loads).

  • Add VLLM_SM70_AWQ_QWEN38_QPN_M1, default 0, accepting only 0/1.
  • Require TP4/E512/native checkpoint and prepared g32, existing batched banks,
    W13 interleaving and legacy M1 compact admission. Explicit unsupported
    layer or missing native build fails closed.
  • Only physical M=1, FP16 contiguous (1,2560), INT32 (1,10) IDs and FP32
    router weights select QPN. Other/padded batch shapes keep existing routes.
  • Reuse all existing weight banks and intermediate/output buffers. No DSO
    loading, compilation at startup, new persistent weight copy, graph policy,
    prefill/grouped decode, router, shared expert or attention change.
  • Rollback: set the flag to 0 before restarting the engine. Changing an
    environment variable cannot replace already captured CUDA graphs.

Open-PR checks found no duplicate native AWQ QPN runtime proposal. Fork #8 is
the separate grouped M=2..8 prerequisite, 1Cat 1CatAI#509 is startup cache release,
and merged 1CatAI#477 supplies common compilation behavior; none implements this
M1 expert operator. The QSA page4 fix is a separately tracked validation
dependency, not part of this diff. The stack is based on fork #8 (fbaa195f47)
above main 755baae1d075; no unrelated upstream changes are packaged here.

Numerical acceptance: controlled additional perturbation

Both paths already approximate the same fixed AWQ-weight computation. Neither
is ground truth. Evaluate each against the same independently decoded-weight /
FP64 reference, and distinguish existing quantization error from this change's
additional arithmetic perturbation. Passing local error bounds does not mean
identical noise or prove whole-model task-quality non-inferiority.

The initial cross-process 65-case pair had one IFEval pass-to-fail change
(4/5 to 3/5). Its unchanged C4 controls also differed, so it did not isolate
QPN as the cause. That failed comparison remains recorded. A later same-runtime
pair produced the following small-sample scores:

Subset OFF ON
HumanEval 5/5 5/5
MBPP 4/5 4/5
IFEval strict 3/5 4/5
GSM8K 29/32 28/32
Tool selection (contains rubric) 10/12 10/12
Needle retrieval 6/6 6/6

47/65 token streams were exact. One GSM regression and one IFEval improvement
remain; they do not cancel into a zero-regression result.
Original answer
budgets, EOS behavior and scoring were retained.

Focused attribution then froze the process, M1 graph, target shapes and GEMM
LUTs. Both local MoE operators executed on identical local inputs/routes;
a device boolean selected the output. OFF/ON/ON/OFF C4 controls and same-arm
C1 repeats were exact. The diagnostic's overhead is not performance data.

  • 24 independent checkpoint/FP64 reports cover 1,152 layer/rank/arm
    samples
    at three fixed prefixes. Both implementations' W13/W2 remain
    within the retained bounds; QPN maximum bound fractions 0.173925/0.966499,
    legacy 0.173925/0.954273. Legacy W2 is checked using its own intermediate.
  • The current GSM first divergence is index120: legacy IDs4003/16526 exactly
    tie at21.59375, whereas QPN favors16526 at21.625 over4003 at21.578125.
    Legacy also reproduced the previous QPN failed trajectory at the unchanged
    256-token budget. This failure is not exclusive to the new kernel.
  • At the captured 64K step, 13/48 layers change expert membership; all choices
    respect each arm's actual router scores. The first change reverses a
    0.01171875 score margin, supporting internal routing amplification.
  • The focused 64K raw-logit maximum is 1.751953; the earlier full trace's
    5.052734 remains evidence. A GSM maximum 2.59375 occurs away from its first
    token flip and that step lacks a local FP64 capture. These are not all
    described as a few ULPs or as fully reconstructed historical trajectories.
  • The analysis tool used the first topk(2) index as greedy argmax, which is
    wrong at ties. Corrected to argmax and reanalyzed unchanged raw tensors:
    the earlier same-runtime pair's flip is IFEval index80 entering a tie,
    not the previously reported short-prompt tie-order artifact. Quality
    scores and raw-logit maxima were unaffected; 25 tool CPU tests pass.

Current evidence supports numerical trajectory variation, without a
demonstrated systematic kernel defect on tested inputs. It does not establish
broad quality non-inferiority or production readiness. We do not rewrite the
kernel solely to reproduce a historical sampled answer; quality remains a
separate acceptance question. Full details are in the design document.

Full-model performance snapshot

Four V100s, TP4/MTP0, FP16 activations and KV, native-g32 AWQ, 4-byte
metadata
, frozen prompts, prefix cache off, max batched tokens8192,
ignore_eos=false/min_tokens=0, maximum320 output tokens. Each cell/arm was
scored once. Both arms use the same separate QSA page4 fix and grouped-decode
baseline. Aggregate pure-decode, excluding prefill/mixed phases:

Cell OFF tok/s ON tok/s
C1 x 64K 50.0326 59.0313
C4 x 64K 131.3485 129.5357
C8 x 16K 246.3619 245.7809

C1 is +17.99% in this pair and about2.04% below the separate same-day NVFP4
reference60.2609. No claim of exact/statistical parity, C8x64K performance,
or E2E equivalence. The independent older54.6544 baseline and +25% target
68.3180 remain unchanged and unachieved. These 4-byte results do not measure
the layer3 cooperative 3-byte optimization.

Tests and provenance

.venv/bin/python -m pytest -q \
  tests/quantization/test_awq_qpn_sm70.py \
  tests/quantization/test_sm70_awq_active_grouped_decode.py \
  tests/quantization/test_sm70_awq_indexed_prefill.py \
  tests/quantization/test_sm70_awq_compact_metadata.py

69 passed, run using the canonical repository venv from this worktree.
Changed-file pre-commit hooks (including mypy) and git diff --check: passed.
An expanded CPU invocation including unchanged fallback and prefill-exact
modules was 78 passed, 9 teardown errors: their global cleanup calls
torch.accelerator.empty_cache() on a no-accelerator host. This invocation
is not all-green; those fixtures and product cleanup are unchanged, and no
unrelated cleanup patch is included.

The final four Python runtime files are SHA-256 identical to the native-r2
GPU-validated snapshot. Native core:
e5083c1f26392873460c4a798244f454c6adef4acb66cc7d6573d4da8f8916e1.
Full-model evidence uses the unchanged 4-byte kernel shared with layer1;
scalar/cooperative builds also have separate portable and real-weight GPU gates.
Evidence IDs under qwen38-c1-qpn-awq-20260905:
native-model-{0,1}-r1, same-runtime-numerics-r2, same-runtime-focused-r1.
No new GPU timing was collected during this documentation/stack extraction.

AI assistance: OpenAI Codex assisted with implementation, analysis, tests and
documentation. Leon directed scope and requested submission to this fork.
Draft for human review: human line-by-line review is not claimed complete.
No upstream submission, production deployment, default enablement or claim of
completed broad quality acceptance is made here.

Gate the native operator to the existing Qwen3.8 TP4 E512 M1 contract, retaining default-off behavior and neighboring routes. Document numerical attribution, observed quality changes, and incomplete production acceptance.

Assisted-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Evaluate both AWQ arithmetic paths against an independent fixed-weight reference; distinguish existing quantization error, local arithmetic bounds, and task-level quality.

Assisted-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Leonccaa <166551845+Leonccaa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant