[Kernel] Migrate SWA decode to tile programming - #909
Open
fsx950223 wants to merge 3 commits into
Open
Conversation
Signed-off-by: fsx950223 <fsx950223@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the sliding-window paged-attention (SWA) decode path to FlyDSL tile programming primitives (layout views + copy atoms) while keeping the existing raw-pointer launch ABI and preserving the existing FP8 MFMA/LDS compute path. The PR also tightens supported configurations and fixes the large-partition reduction fallback to compile correctly.
Changes:
- Replaces legacy global/buffer helper loads/stores with buffer tensors, logical divides, and
fx.copy-based copy atoms for most global traffic. - Keeps K/V cache reads as aligned 128-bit universal copies while routing query/scale/metadata/partial-output/reduction through tile views.
- Fixes the >64-partition reduction fallback SSA/branching and fails fast for unsupported
head_dimvalues (now only 64 or 128).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: fsx950223 <fsx950223@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: fsx950223 <fsx950223@outlook.com> Co-authored-by: Cursor <cursoragent@cursor.com>
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
Sliding-window paged-attention decode now uses FlyDSL layout views and copy atoms for global memory traffic while preserving the compact raw-pointer launch ABI and hardware-specific FP8 MFMA/LDS paths. Supported production configurations retain their accuracy and effectively neutral aggregate performance.
Motivation
The SWA path still bypassed FlyDSL's layout algebra through legacy buffer helpers, making its addressing and data movement inconsistent with current kernel authoring patterns. Its large-partition reduction fallback also could not compile because runtime branch values lacked valid SSA initialization.
Changes
Performance
GPU-only rocprofv3 medians on AMD Instinct MI308X (gfx942), paired across two reversed-order A/B rounds. Path time includes the SWA kernel and reduction; lower is better.
Geometric mean across the matrix is +0.31%; the transposed-V configurations used by the main regression matrix are effectively unchanged.
Testing
Dependencies
Breaking Changes
None for supported configurations. SWA now fails fast for head dimensions other than 64 or 128; the previously accepted 256 path produced invalid results.
Made with Cursor