[Kernel] Finalize the audited TP2 DFlash2 31/29 ms endpoint - #566
Conversation
Keep the q8 FP32-partial route opt-in while retaining the full-round quality gate and recording measured TP2 limits. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Generate the CUDA source used by the admitted TP2 projection experiments without installing a serving route. Record the full-projection trace, three-start decoder results, and rejected activation-layout screen. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Preserve the scalar q8 reduction and rounding contract while using an exact half bit expansion and FP32 scale. Require native revision 2 when explicitly enabled and reject stale revision 1 modules. Validate with 15 native tests, 24 graph replacements, full-length memcheck, and bounded racecheck. Record combined precision diagnostics, first paired round cost, and rejected QPN2 candidates. Long racecheck timeout remains excluded. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Report complete-round latency, TTFT, decode rate and separate accepted/emitted lengths for the native exact decoder plus context overlap, with full QPN2 and BV2 fixed. Retain the unmet 25 ms target and unresolved cross-startup limitation. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Withdraw the unadmitted combined-copy experiment; retain its audit history. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Retain both TP2 and TP4 dispatch contracts, FP32 beta and nonoverlapping row strides. Require native revision2 in the public benchmark. Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
yangzhuxinyzx
left a comment
There was a problem hiding this comment.
Final audit at d03edb0: no remaining blocking findings.
Reviewed the exact E4M3 decoder, ascending PV FMA chain, FP32 partials and dispatch guards; TP2 BV2 recurrence and TP4 fallback; merged FP32-beta/nonoverlapping-row-stride repairs; QPN2 source reproduction; and unchanged sampling/precision contract. The unadmitted TP2 combined-copy route was withdrawn. The public benchmark now rejects native revision1.
Merged-source validation: 23 GPU tests pass, full-model logits/hidden/valid-acceptance shadow is exact on both fixtures/ranks, and five unprofiled pairs per fixture retain token IDs/acceptance/EOS at 31.826824 / 29.074814 ms. CI is green. The accepted endpoint remains the earlier three-startup 31.884546 / 29.279787 ms result; new switches remain opt-in and the full measured harness is not a new production default. User requested campaign closure and merge. AI-assisted review performed at the user's request.
Purpose
Finalize the user-accepted TP2 QUASAR + DFlash2 endpoint: 31.884546 ms on release1k and 29.279787 ms on MBPP28 per complete B1/q8 round. The user ended further tuning on 2026-09-10 and authorized audit and merge; 25 ms is no longer the target for this PR.
This PR adds the opt-in revision-2 E4M3 scalar decoder with ordered PV unroll eight, a separate TP2 q8 BV2 GDN schedule, focused numerical tests, and a reproducible matched QPN2 builder. It preserves FP32 partials/state/logits, E4M3 KV, scale rounding, K64 partition order, sampling and natural EOS. Unsupported shapes keep the existing path.
The branch incorporates main at
80545c010bbf6f5ed06458d992c189d75d0eff8f, including #556's FP32-beta and strided-QKV repairs. Conflict resolution retains both TP2/TP4 dispatch limits, nonoverlapping row strides and the TP4 fallback. The public benchmark now requires the actually accepted native revision 2. The later TP2 combined-copy experiment was withdrawn from source before finalization; its failed harness and local results remain recorded.This scope extends the TP4 work in #556 rather than duplicating it. AI assistance was used for implementation and the user-requested audit. The existing PR is retained; no duplicate PR is opened.
Test Plan
Keep TP2/B1/q8 on physical V100 GPUs 4/7, CUDA 12.8, Torch 2.10.0+cu128, frozen model revisions, maximum context 262144, memory utilization 0.8, T1/k20/p0.95 and natural EOS. Separate diagnostic results from unprofiled round timing. Validate the merged source and rebuilt native module before merge.
Test Result
The accepted campaign uses three independent startups, five alternating pairs after warmup per fixture:
All fifteen pairs and warmups preserve token IDs, acceptance counters and EOS. A separate two-rank full-model shadow preserves hidden states, full local-vocabulary FP32 logits and valid acceptance records under different invalid-tail sentinels. Accepted runtime source is
ca0ea462c1877525fb231faf4f817d7929a3a64a; native SHA256 is9d0fe7186bfe82ccd0b58f0795b9f0b4a70eb7ecf8dc9caf345efb4055752cdf..venv/bin/python -m pytest --confcutdir=tests/kernels tests/kernels/test_sm70_dflash2_packed_gdn_fp32.py -q: 8 passed, including TP4 fallback, all eight acceptance selectors, changing graph operands, retired rows and strided state.139ff11214d1fb49062efe1e6d9dc824588e5f2f14439435154d30b43915fc62.a50e87abde5ca52d6be560448ed70220d2ce60c31f54facdf49b5732ca2123ac. Its 15 GPU attention tests pass; combined with the 8 GDN cases this gives 23 merged-source GPU tests. Full-model integration shadow passes both fixtures and both ranks, preserving complete FP32 logits, hidden states and valid acceptance/EOS records.The final unprofiled integration startup uses the rebuilt module and five alternating pairs after warmup per fixture. Complete-round medians are 31.826824/29.074814 ms, versus contemporaneous controls of 32.863370/29.797836 ms. All ten measured pairs and both warmups retain tokens, acceptance and natural EOS. This is an integration confirmation, not a replacement for the accepted three-startup endpoint. Evidence:
final-main-1-start-pair-summary.jsonandtp2-final-main-shadow-1-admission.json.Remote pre-commit CI is green for
d03edb067c9683c6892972b933bc1bcf52660a5d(run). The final source audit has no remaining blocking findings. Native/runtime code is unchanged from the validated merge commit348fd5e2f3efa96ac06ede761817171531c1feb1; the last commit only documents frozen switches.Integration scope
The new TP2 switches stay opt-in. The full measured combination also uses the retained single-layout QPN2 and context worker harness; merging these kernel components does not enable that whole combination by default. No service API, weights, model format or sampling policy changes.
These short-context endpoint measurements are not 256K performance evidence and do not resolve historical cross-startup variation. Arithmetic candidates with distribution drift, including the draft column-GEMM candidate, remain excluded. Full evidence and retained negative results are in
docs/design/sm70_dflash2_tp2_verifier.md, campaignv100-quasar-dflash2-tp2-25ms-20260908.