perf(gdr): move SM100 prepare_h CP transition-matrix recurrence to tcgen05 - #42
Open
Butterfingrz wants to merge 1 commit into
Open
perf(gdr): move SM100 prepare_h CP transition-matrix recurrence to tcgen05#42Butterfingrz wants to merge 1 commit into
Butterfingrz wants to merge 1 commit into
Conversation
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.
Summary
M,Z) off Consumer-X/YT.gemmonto the MMA warp's tcgen05 pipe, withMresident in TMEM.168/160/160/24to152/104/104/152, funded by theMfragments X and Y no longer carry.store_h=False, publish the nextbar_0arrival and the left state half one iteration early, inside thetcbar_2a → tcbar_2bwindow.mtstraight from the final fragments, dropping its shared-memory/TMA bounce.calc_mtreachability guard to the existing long-fixed auto-CP test.PR implementation
This PR touches
flash_qla/ops/gated_delta_rule/chunk/blackwell/prepare_h.py(+144/-123on7c7dfe1) andtests/test_gdr_unit.py(+26/-2). Public API, tensor shapes, CP selection, state layouts, and dispatch are unchanged, and every kernel hunk is insidewith T.Kernel. The test change guardscalc_mtreachability inside the existingtest_fwd_auto_cplong-fixed case and adds no test ids.Correctness validation
python -m pytest tests/ -q: 123 passed, 7 skipped. The count predates the test guard, which has not been rerun on GPU.7c7dfe1(store_hxh0xstate_v_firstx varlen x CP): 48 / 48.hbitwise on the 24 rows that write it,hton all 48,mton 4390 / 4480 slices — the 90 excluded are those the baseline itself does not reproduce run to run.7c7dfe1:oandhtbitwise on 15 / 15 model-derived rows and 42 / 42 matrix rows.sha256(prim_func.script()), TileLang's kernel-cache key, identical on 64 / 64 specializations between the benchmarked and the submitted source, so the table below applies unchanged.Performance Results (B200 / SM100)
Across the 24 CP-active rows of a 42-case matrix on one B200: BF16, B=1, T=32768, D=128, varlen seed 42. Three interleaved CUDA-graph A/B rounds (
warmup=10,rep=100), swapping onlyprepare_h. The table reports standaloneprepare_hlatency; the 18 non-CP rows are the control in the summary below. A same-source A/A control over 12 CP-active rows returnsprepare_h1.0003; clocks were not fixed.Performance Summary
prepare_hgeomean ratio 0.731245 (1.368x), improved in 24 / 24 rows. CP-active forward E2E 0.915596; the 18 non-CP control rows sit at 0.999925.prepare_h0.716833 (1.395x), CP-active E2E 0.914899.store_h=True, auto-CP off):prepare_h0.843574 (1.185x), E2E 0.967635 across 15 / 15 rows.Change attribution
Mstays in TMEM; only the BF16B-operand restages cross back through registers, because TileLang 0.1.13 has no TMEM-to-SMEM path while tcgen05 requiresBin SMEM. Consumer-X restagesZalone, in a window where it would otherwise idle; X and Y each restage their ownMhalf.set_max_nregdirections are1/0/0/1and a wrong direction traps at runtime, not at compile time.store_h=Falseearly publish is legal for iterationi+1becauseh_shared's only GEMM reader,U = K @ S, precedes theh_Lupdate on the same in-order pipe. Thestore_h=Truerendezvous is untouched, and the L-half TMEM load stays adjacent to thetcbar_2await so the tcgen05 fence pass keeps itsafter_thread_sync.mtstore removes the SMEM/TMA hop at the cost of a finaltcbar_4a/tcbar_4bdrain.NCU Spot Check
NCU was collected with Full + PmSampling and clock-control=base on B200 using BF16 B=1, T=32768, Hg=16, H=32, D=128, and a single sequence, replaying the spy-captured CP-preprocess
fused_gdr_hcall under--profile-from-start off -k regex:tilelang_prepare_h --launch-count 1.sm__cycles_active.avggpu__time_duration.sumsmsp__inst_executed.sumdram__bytes_write.summtmoves off the TMA path onto the LSU path. Per-sector store efficiency is unchanged at 16.0 bytes in both configurations.Scope
Backward figures were taken at
c18a486, before7c7dfe1merged PR #40'sfused_bwd.pyregister-cap change, so they are pre-rebase;prepare_h.pyis identical across those commits, so the forward figures and every gate are unaffected. Only B200 / SM100 is measured, though SM103 shares the Blackwell dispatch. Runs used TileLang 0.1.13 whilesetup.pypins 0.1.9.