Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
jcaraban
left a comment
There was a problem hiding this comment.
Rechecked 84a2fb4 on #8800. Moving the backing allocation to the producers and keeping the launcher validation-only avoids the old implicit-copy and layout-validation problems. I found no new correctness blocker in the source review.
The added tests cover compiled backing, rejection of truncated scale storage, rank-2/rank-8 tilt and mapped-allocation boundaries. The finite/nonidentical tilt check establishes that the planes affect the output; it is not an independent numerical oracle. Please keep this stack coordinated with #8683/#8684 so the shared hd128 backing fix is not landed twice.
Validation: source review and the seven CPU source/contract checks across these revisions passed. I have not independently run these GPU tests; the available test nodes were occupied. This is advisory feedback, not an approval.
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
2404f65 to
7cf5688
Compare
…d read past The 64x64 MXFP8 Sol-Attn kernel (fmha_fwd_hd128_mxfp8_sol_64x64_gfx950) reads its pooled E8M0 K scales, and the Jensen variance's, past their last 128-row tile and on into the producer's lookahead rows. sol_prepare, sol_jensen_cap and sol_tilt_planes back them with those rows. A scale without them, a clone for instance, faulted whenever its allocation ended at an unmapped page; the launch now refuses it. - asm_mha_v4_fwd.cu: check_pooled_k_scale_backing_storage requires the tile padding plus kKvScaleLookaheadRows rows of mapped storage behind mean_k_scale and mean_k_var_scale on the hd128 64x64 FP8-K rows. With the tilt, mean_k_scale is plane 0 of a stack, so this bounds plane 0; sol_tilt_planes backs the last plane the same way. - test_mha_v4_sparse: on the 64x64 MXFP8 row, sol_prepare's scales carry the zeroed lookahead rows, eager and under torch.compile, and a clone of either is refused. The tilt reaches the row at ranks 2 and 8. Each pooled K-scale allocation, sol_tilt_planes' stack included, placed at the end of a mapping with an unmapped granule after it, leaves the output unchanged at 8, 128, 136 and 1024 pooled rows. Signed-off-by: Niko Säkkinen <[email protected]>
7cf5688 to
3437013
Compare
Summary
The 64x64 MXFP8 Sol-Attn kernel reads its pooled E8M0 K scales, and the Jensen variance's, past their last 128-row tile and into the producer's lookahead rows. The producers now back them with those rows. A scale without them, a clone for instance, still faulted at the end of an allocation; the launch now refuses it with an error instead.
The earlier version of this PR copied the scales at launch. Under the tilt that copy dropped the K-scale planes behind
mean_k_scale, and under torch.compile the backing did not survive. The copy is gone.Motivation
A scale without the lookahead rows can still reach the kernel's read past its allocation. A clone of a pooled scale is one example. The launch accepted such a scale before this check, so the fault was reachable from a caller that bypasses the producers.
Changes
asm_mha_v4_fwd.cu:check_pooled_k_scale_backing_storagerequires the tile padding pluskKvScaleLookaheadRowsrows of mapped storage behindmean_k_scaleandmean_k_var_scaleon the hd128 64x64 FP8-K rows. With the tilt it bounds plane 0;sol_tilt_planesbacks the last plane.test_mha_v4_sparse.py: on the 64x64 MXFP8 row:sol_prepare's scales carry the zeroed lookahead rows, eager and under torch.compile, and a clone of either is refused.Performance (if applicable)
Not applicable. This is a launch check and tests. No performance claim; not measured.
Testing
Results on MI355X (gfx950):
op_tests/test_mha_v4_sparse.pyop_tests/test_mha_v4.pyop_tests/triton_tests/attention/test_sol_tilt.pyOn the earlier version of this PR, all four new checks fail: the tilt does not reach the row, the scales have no backing until the launch, the tilt stack placed at the end of a mapping changes the output, and a clone is accepted.
Documentation
Dependencies
Breaking Changes
None. A pooled K scale without lookahead rows now raises at launch. The producers in #8800 always supply the rows.
PR Self-Review
Reviewed revision
3437013
Behavior and intent
The only code change against its base (#8800) is the launch check in
asm_mha_v4_fwd.cu. A pooled K scale (mean_k_scaleormean_k_var_scale) without the lookahead rows, on the 64x64 hd128 FP8-K rows, is now refused with aRuntimeError. Before, the launch accepted it. #8800 backs the scales where they are made, so the check catches only a scale made some other way, such as a clone.Validation and unverified scope
refuses_pooled_k_scales_without_lookahead_rows, which raised noRuntimeError.test_mha_v4_sparse.py619 ran, 5 skipped, 0 failed;test_mha_v4.py357 ran, 0 failed.test_sol_prepare.pycheck. The merge brings in only that file, so the results above stand;test_sol_prepare.pyat this head is 95 passed (run on the same file at 5274fbf).PR-specific question
Before this PR (the base, 9b6a954), only
refuses_pooled_k_scales_without_lookahead_rowsfails. That is the test for this PR's check. The other three new tests pass on the base.pooled_k_scales_carry_lookahead_rowsoverlaps the lookahead assertion in #8800'stest_sol_tilt.py, and the other two check #8800's backing on the 64x64 row end to end. None of the three checks this PR's change.tilt_reads_its_k_scale_planesalso passes on main.Changed op tests
op_tests/test_mha_v4_sparse.py, the four tests on the 64x64 MXFP8 row:refuses_pooled_k_scales_without_lookahead_rows: a clone without backing is refused. Fails on the base, so this covers this PR's check.pooled_k_scales_carry_lookahead_rows(eager and compiled, two sizes):sol_prepare's scales carry the zeroed rows. Fails on main, passes on the base. Overlaps [Triton/Gluon] [Fix] Sol-Attn: back pooled E8M0 K scales with lookahead rows #8800'stest_sol_tilt.pylookahead check at the op level.tilt_reads_its_k_scale_planes(ranks 2 and 8, two sizes): the tilt reaches the row. Passes on main and on the base, so it does not guard either change.pooled_k_scale_reads_stay_in_their_allocation(child process, VMM): reads end inside their allocations. Faults on main, passes on the base. Covers [Triton/Gluon] [Fix] Sol-Attn: back pooled E8M0 K scales with lookahead rows #8800's backing end to end.