Refactor: rename spmd_paged_attention_tpush and optimize pipe barriers#629
Merged
ChaoWao merged 1 commit intoApr 22, 2026
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes the paged attention kernel by replacing coarse-grained pipe barriers with fine-grained flags and refactoring block processing logic. The reviewer noted a high-severity issue where using PIPE_FIX instead of PIPE_MTE3 after TPUSH operations in aic_qk_step and aic_pv_step could result in race conditions, as the consumer might read data before the DMA write to global memory is fully complete.
9eb1736 to
8db35eb
Compare
- Rename test directory from spmd_paged_attention_tpush/ to spmd_paged_attention/ and update benchmark_rounds.sh references - Replace coarse pipe_barrier(PIPE_ALL/PIPE_MTE3) with fine-grained set_flag/wait_flag synchronization in AIC TPUSH sequences - Reorder TPOP after TLOAD in aic_pv_step to overlap DMA with consume - Remove redundant pipe_barrier(PIPE_V) calls in AIV softmax and online-update steps where data dependencies already serialize - Precompute is_last_partial boolean instead of recomputing per-step
8db35eb to
875c958
Compare
ChaoWao
approved these changes
Apr 22, 2026
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
spmd_paged_attention_tpush/tospmd_paged_attention/and updatebenchmark_rounds.shreferencespipe_barrier(PIPE_ALL/PIPE_MTE3)with fine-grainedset_flag/wait_flagsynchronization in AIC TPUSH sequencesaic_pv_stepto overlap DMA with consumepipe_barrier(PIPE_V)calls in AIV softmax and online-update steps where data dependencies already serializeis_last_partialboolean instead of recomputing per-stepTesting