Repository navigation
[Test] [AMD] deterministic: Check AITER paged decode batch invariance on gfx950 - #46790
Draft
aarnetalman wants to merge 1 commit into
Draft
aarnetalman wants to merge 1 commit into
aarnetalman wants to merge 1 commit into
Conversation
… on gfx950 The AITER backend's non-MLA decode on gfx950 (paged_attention_ragged) is batch-invariant, which is what deterministic inference needs from decode attention, but nothing tests it. Decode a request alone and next to batchmates of other lengths and positions (1 to 12,000 KV tokens, bf16 and fp8 KV cache), and compare its output bit for bit, so an AITER update that loses batch invariance fails CI.
This branch has not been deployed
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.
Motivation
Deterministic inference needs batch-invariant decode attention: a request's output must not depend on how many other requests share its batch, or how long they are. On gfx950, the AITER attention backend decodes non-MLA models with AITER's
paged_attention_ragged. That kernel splits each request's KV cache into fixed 256-token partitions, so its result for one request does not depend on its batchmates. Nothing tests that, though. An AITER update that changed it, for example by choosing the number of partitions from the batch, would make outputs batch-dependent without any test failing.This adds a small kernel-level test to the MI35x per-PR suite. It pins that property, so a regression shows up in CI at the AITER bump that causes it, instead of as non-reproducible outputs later. #44489 proposes allowing AITER decode attention in deterministic mode on gfx950 on the strength of this property. This test is useful with or without it and does not depend on it.
Impact: test only. No runtime code changes. Adds about 35 s to the
stage-b-test-1-gpu-small-amd-mi35xsuite. It is skipped when AITER is not installed or the GPU is not gfx950.Modifications
test/registered/attention/test_aiter_decode_batch_invariance.py, registered withregister_amd_ci(est_time=60, suite="stage-b-test-1-gpu-small-amd-mi35x"):paged_attention_ragged, called the wayAiterAttnBackendcalls it (same argument order, partition size_AITER_PARTITION_SIZE_ROCM, same workspace layout).torch.equal) to the alone result.fp8_e4m3) KV cache.Accuracy Tests
Test only, so no model outputs can change.
MI350X (gfx950), ROCm 7.2.4, images
rocm/sgl-dev:v0.5.22-rocm724-mi35x-20261018androcm/sgl-dev:v0.5.22-rocm724-mi35x-20261021, with the AITER each image ships:The bitwise comparison is sensitive enough to catch a batch-dependent kernel. The same alone-versus-batch comparison, applied to AITER's prefill kernel
mha_batch_prefill_funcwith one query token per request (prefix 4,096 and 32,768 tokens, 1, 3 and 15 batchmates), finds a difference in 6 of 6 cases (max abs diff 3.05e-5, one bf16 ulp). So the paged decode kernel is batch-invariant where that kernel is not, and a loss of the property would fail this test.Speed Tests and Profiling
Test only; no runtime code changes, so no performance effect. The test takes about 35 s on MI350X.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #40475355281
Latest PR Test (Extra): ❌ Run #40475355210
Latest PR Test (AMD ROCm 10): ❌ Run #40475355201