You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FlyDSL] [PA] Extend pa decode tile to support Qlen8 and SWA with sink - #5887
This PR aim to extend FlyDSL pa decode pipeline with the MiMo target's Q/K192-V128 geometry.
Based on PR #5809 planning, sinks, BF16 KV, query splitting, reduction, and native autotuning; It also tunes the existing BF16 D128/V128 W1024 path for the separate MiMo DFlash draft model.
Extend gfx950 Qlen8/GQA16/page64 one-KV-head decode to Q/K192-V128: Support both scalar BF16/FP8 KV cache.
Support full attention (sliding_window=-1 or 0) and any positive integer sliding window for both BF16/FP8 KV dtypes.
Propagate the independent V/output width through V-cache addressing, PV, partial workspaces, output, reduction and native autotuning.
Fix asymmetric FP8 probability-rounding failures with selective FP8 residuals. For short context (small windows 1-16) use a full residual plane via a shared internal tile policy controls.
Use the existing gfx950 K128 MFMA support for asymmetric FP8 SWA. Retain grid-aware query splitting for the existing BF16 D128/V128 W1024 path.
Extend the tests with asymmetric FP8/BF16 cases, graph replay, sinks, and BF16 schedule-boundary coverage.
What behavior does this PR change:
Add native Q/K192-V128 decode on gfx942/gfx950 for BF16 and scalar/per-token FP8 KV, carrying the independent V width through cache addressing, PV,
workspaces, reduction and autotuning.
Why is the existing behavior insufficient?
The previous pipeline required matching Q/K and V widths. Full attention and every positive window are supported.
Validate on on both MI300X (gfx942) and MI350 (gfx950). ROCm 7.2, PyTorch 2.9.1, FlyDSL 0.4.1: pytest -q op_tests/test_flydsl_pa_decode.py - 217 passed
Unverified for this revision: native gfx1250 execution.
PR-specific question
This PR introduce several test coverage in op_tests/test_flydsl_pa_decode.py
Add asymmetric and newly accepted FP8-width test cases would previously be rejected. They exercise independent V addressing and short-context FP8 rounding against the existing FP32 reference; symmetric cases cannot expose those width errors.
The >2 GiB tests exercise address truncation beyond ordinary allocations.
New asymmetric FP8 cases use atol=rtol=0.01; existing symmetric FP8/BF16 accuracy gates remain unchanged.
Changed op tests
The change in op_tests/test_flydsl_pa_decode.py. It adds 65 cases test case: 63 in the existing test_pa_decode test case and two in the new test_asymmetric_multihead_large_address function.
PR-added coverage
Cases
Why it is needed
Q/K192-V128, FP8/BF16
35
Independent V layout, short-context residuals, per-token scales, multihead/query geometry, windows, sinks and replay.
Symmetric BF16 SWA
21
Numerical correctness across changed query-splitting geometry, neighboring windows and partition budgets.
Symmetric FP8 D192/320/448/576/704/832/960
7
One case per newly accepted width, rotating dtype/scale/V-layout variants already covered by the canonical matrix.
Asymmetric K/V offsets >2 GiB
2
BF16/FP8 address truncation and KV-head indexing beyond ordinary allocations.
All standard extended tests (excludes ci:atom_full)
Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 5887 --add-label <label>
One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.
PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.
github-actionsBot
changed the title
[FlyDSL][PA] Extend pa decode tile to support Qlen8 and SWA with sink
[FlyDSL] [PA] Extend pa decode tile to support Qlen8 and SWA with sink
Sep 27, 2026
The new exception only checks head_dim/value_dim, so the CLI accepts unsupported asymmetric requests such as the defaults with --head-dim 192 --value-dim 128 (Qlen1, page128, and FP8 per-token scales). prepare_pa_decode_plan later rejects these because the kernel requires gfx950, Qlen8/GQA16/one KV head/page64, vectorized V, and scalar FP8 (or W128 BF16), making the tuning command fail after setup rather than reporting invalid arguments. Validate the full qualified geometry and scale/window mode here, or remove the asymmetric exception from the generic parser.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human verification is needed because the change spans architecture-specific MFMA/LDS, FP8/BF16, addressing, scheduling, and tuning paths, while target-GPU execution and gfx1250 coverage remain unavailable.
No open issues 🎉
Review effort: Lite
sammysun0711
added a commit
to sammysun0711/aiter
that referenced
this pull request
Oct 30, 2026
- Support QK192/V128 BF16 and FP8 attention with sliding windows.
- Carry the upstream scheduling, accuracy fixes and regression coverage.
Signed-off-by: Xiake Sun <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The changes span complex gfx942/gfx950 scheduling, LDS, FP8 residual, asymmetric-V, and autotuning behavior, but no head-matched GPU validation confirms correctness or resource behavior across both architectures and replay paths.
- Support QK192/V128 BF16 and FP8 attention with sliding windows.
- Carry the upstream scheduling, accuracy fixes and regression coverage.
Signed-off-by: Xiake Sun <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An active review issue remains because the new correctness check bypasses the repository’s standard checkAllclose mismatch-ratio reporting and should be made consistent with the surrounding kernel checks.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Because the change spans architecture-specific GPU pipelines, MFMA/LDS scheduling, residual and asymmetric addressing, and graph-replay paths, static review cannot replace targeted reproducible runtime validation on gfx942 and gfx950, especially after the test-call regression.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A moderate active finding remains because the test architecture gate uses a runtime architecture helper instead of the repository’s test/build-time helper, which can select the wrong FP8 dtype or specialization when multiple GPU targets are configured.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed commit 11b2117. No actionable correctness or regression defect found. Targeted native GPU tests passed on gfx950 and gfx942, covering asymmetric dimensions, FP8 residuals, BF16 scheduling, sinks, graph replay, and large-address handling. Native gfx950 autotuning also passed.
Validation:
PASS on local: git -C checkout rev-parse HEAD; git -C checkout diff --check f9bc33b599a84b5d980971714f6109e3aed121a7 HEAD
Verified the supplied head SHA and merge base; diff check exited 0. Reviewed all 10 changed files, complete diff, callers, tests, prior feedback, and CI results.
PASS on gfx950 / fsx950223_pr_review_gfx950: flock -w 60 /workspace/gpu.lock bash /workspace/codex-pr-review-5887-20261112/run-targeted.sh /workspace/codex-pr-review-5887-20261112
Exit 0: 98 passed, 20 skipped, 265 deselected in 151.84s. Script runs timeout 900 python3 -m pytest with the targeted selection preserved in run-targeted.sh. Architecture, exact SHA, and checkout imports verified; GPU 0 and isolated compilation caches used. Log: gfx950-targeted.log.
FAIL on gfx942 / sixifang_dev: flock -w 60 /tmp/codex-pr-review-5887-20261112/gpu.lock bash /tmp/codex-pr-review-5887-20261112/run-targeted.sh /tmp/codex-pr-review-5887-20261112
Exit 1: 96 failures before decode compilation because Torch 2.8 lacks shared_memory_per_block, required by unchanged pa_decode_plan.py:266. Also 22 skipped and 265 deselected. Log: gfx942-targeted.log.
PASS on gfx942 / sixifang_dev: flock -w 60 /tmp/codex-pr-review-5887-20261112/gpu.lock bash /tmp/codex-pr-review-5887-20261112/run-compat.sh /tmp/codex-pr-review-5887-20261112
Exit 0: 96 passed, 22 skipped, 265 deselected in 458.75s. Test-only adapter supplies the missing Torch property using HIP's queried 65536-byte capacity; PR source and kernel logic remain unchanged. Exact SHA, gfx942 architecture, and imports verified. Scripts: run-compat.sh and compat-test.py. Log: gfx942-compat-final.log.
PASS on gfx950 / fsx950223_pr_review_gfx950: flock -w 60 /workspace/gpu.lock bash /workspace/codex-pr-review-5887-20261112/run-tuning.sh /workspace/codex-pr-review-5887-20261112
Exit 0: bounded native autotuning for Q/K192-V128, Qlen8, page64, FP8 scalar scales, window4, and FP32 sinks. Graph correctness checks passed; configuration saved with capacity 8 and max partitions 4. Exact CLI and environment preserved in run-tuning.sh; log: gfx950-tuning.log.
PASS on GitHub CI / MI35X: gh api repos/ROCm/aiter/actions/jobs/127245235989/logs
CI run 42005347223 matches the reviewed head. Job log confirms the complete decode test file ran: 362 passed, 21 skipped in 400.73s. This is CI evidence, separate from reviewer-run tests. Log: ci-gfx950-shard7.log.
Remaining validation:
gfx942 validation required a test-only Torch compatibility adapter; the unadapted environment failure is outside this diff.
Reviewer GPU environments use FlyDSL 0.4.0; the inspected gfx950 CI job used the repository-pinned FlyDSL 0.4.1.
No native gfx1250 execution or independent performance benchmark was performed.
Detailed commands, environment checks, exit statuses, and logs are preserved in the task directory.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical active finding remains: the gfx9 direct-output path can overrun rows or write out of bounds during empty-sequence zero-fill for asymmetric Q/K192-V128 outputs.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed a memory-safety defect in the new asymmetric direct-output path. On gfx942 with the pinned FlyDSL 0.5.0, 65 targeted correctness cases passed, but empty D192/V128 sequences overwrite memory outside padded output views for both BF16 and FP8 KV. The base commit rejects these asymmetric inputs before writing.
Allowing an independent output width makes the existing direct-output zero-fill unsafe. With Q/K192-V128, Qlen8, GQA16, max_partitions=1, no sinks, context length 0, and query/output views sharing strides (4096, 256, 1), direct_output is enabled. However, _zero_rows in pa_decode_kernel.py uses traits.head_dim // 8 and writes 192 elements into each 128-element output row. A guarded gfx942 reproduction overwrote 8,192 elements outside the output view for both BF16 and FP8 KV; the D192/V192 controls preserved their padding. This can corrupt adjacent data or exceed the allocation at its final row. Use traits.value_dim for this zero-fill, or disable direct output for asymmetric values, and add a padded-output empty-sequence regression case.
Validation:
PASS on local: git -C source rev-parse HEAD; git -C source merge-base 7c2fa4dae5084d0ab8dcc17064afc8f27604c492 HEAD; git -C source diff --check 7c2fa4dae5084d0ab8dcc17064afc8f27604c492 HEAD
Verified exact head bd5315e and supplied base as merge-base. Diff check exited 0.
PASS on gfx942 / sixifang_dev: docker exec sixifang_dev flock -w 60 /tmp/codex-pr-review-5887-bd5315e7-20261117/gpu.lock bash /tmp/codex-pr-review-5887-bd5315e7-20261117/width-tests.sh
Exit 0: all seven newly accepted FP8-width cases passed. Details: gfx942-width-tests.sh and gfx942-width-tests.log.
FAIL on gfx942 / sixifang_dev: docker exec sixifang_dev flock -w 60 /tmp/codex-pr-review-5887-bd5315e7-20261117/gpu.lock bash /tmp/codex-pr-review-5887-bd5315e7-20261117/repro.sh
Exit 1: BF16 and FP8 D192/V128 each overwrote 8,192 guard elements outside output; symmetric controls overwrote zero. Reproduction safely contained writes in an overallocated buffer. Details: repro-empty.py and gfx942-repro-both.log.
PASS on gfx942 / sixifang_dev: docker exec sixifang_dev flock -w 60 /tmp/codex-pr-review-5887-bd5315e7-20261117/gpu.lock bash /tmp/codex-pr-review-5887-bd5315e7-20261117/base-repro.sh
Exit 0 on verified base 7c2fa4d: asymmetric inputs rejected without writes; supported symmetric BF16 control preserved padding. Details: repro-empty-base.py and gfx942-base-repro-final.log.
SKIP on gfx950 / dzm-mi355-gpu34-dev: ssh -o BatchMode=yes -o ConnectTimeout=10 -o RequestTTY=no -o ControlMaster=no -o ControlPath=none -o RemoteCommand=none dzm-mi355-gpu34-dev "squeue -h -u zhiming_ding_qle -o '%i|%N|%t'"
Both discovery attempts failed: connection to aac16.amd.com port 22 timed out. No allocation or container architecture could be verified; no GPU test launched. Logs: allocation.log and allocation-retry.log.
PASS on GitHub CI / MI35X: gh api repos/ROCm/aiter/actions/jobs/133480402971/logs
Read-only log retrieval exited 0. Current CI explicitly reports 454 passed, 16 skipped for test_flydsl_pa_decode.py. The shard's later failure occurred in another op test. This is CI evidence, not reviewer-run testing. Log: ci-shard0.log.
No activity for 15 days, so this is now labelled stale. A push or a comment clears it; keep-open exempts it. Nothing is closed automatically.
This branch has not been deployed
No deployments
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
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
This PR aim to extend FlyDSL pa decode pipeline with the MiMo target's Q/K192-V128 geometry.
Based on PR #5809 planning, sinks, BF16 KV, query splitting, reduction, and native autotuning; It also tunes the existing BF16 D128/V128 W1024 path for the separate MiMo DFlash draft model.
Target model:
Technical Details
sliding_window=-1or0) and any positive integer sliding window for both BF16/FP8 KV dtypes.Test Plan
Test Result
Platform: MI350X (gfx950), 256CU, ROCm 7.2, PyTorch 2.9.1, FlyDSL 0.4.0
python3 -m pytest -q op_tests/test_flydsl_pa_decode.py ....................................................................................... [ 38%] ....................................................................................... [ 76%] ..................................................... [100%] ====================================== warnings summary ======================================= ../../../../../../opt/venv/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py:15 ../../../../../../opt/venv/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py:15 /opt/venv/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py:15: DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead. from distutils.dep_util import newer, newer_group -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 227 passed, 2 warnings in 67.75s (0:01:07)```Performance
Platform: MI350X (gfx950), 256 CUs, ROCm 7.2, PyTorch 2.9.1, FlyDSL 0.4.0
The MiMo target model has Q/K192-V128 full-attention and W128 SWA layers.
Target full attention, FP8 K/V and V128
Target W128 SWA, Q/K192-V128
The MiMo draft model is a separate five-layer DFlash model with D128/V128,
W1024 SWA.
PR Self-Review
Reviewed revision
79a5626
Behavior and intent
What behavior does this PR change:
Add native Q/K192-V128 decode on gfx942/gfx950 for BF16 and scalar/per-token FP8 KV, carrying the independent V width through cache addressing, PV,
workspaces, reduction and autotuning.
Why is the existing behavior insufficient?
The previous pipeline required matching Q/K and V widths. Full attention and every positive window are supported.
Validation and unverified scope
Validate on on both MI300X (gfx942) and MI350 (gfx950). ROCm 7.2, PyTorch 2.9.1, FlyDSL 0.4.1:
pytest -q op_tests/test_flydsl_pa_decode.py- 217 passedUnverified for this revision: native gfx1250 execution.
PR-specific question
This PR introduce several test coverage in
op_tests/test_flydsl_pa_decode.pyatol=rtol=0.01; existing symmetric FP8/BF16 accuracy gates remain unchanged.Changed op tests
The change in
op_tests/test_flydsl_pa_decode.py. It adds 65 cases test case: 63 in the existingtest_pa_decodetest case and two in the newtest_asymmetric_multihead_large_addressfunction.Submission Checklist