Skip to content

Support mqa_logits blocksize is multiple of ChunkK cases - #1674

Merged
sjfeng1999 merged 3 commits into
mainfrom
feat-mqa_logits_large_blocksize
Dec 24, 2025
Merged

Support mqa_logits blocksize is multiple of ChunkK cases#1674
sjfeng1999 merged 3 commits into
mainfrom
feat-mqa_logits_large_blocksize

Conversation

@sjfeng1999

Copy link
Copy Markdown
Contributor
  1. support blocksize is multiple of ChunkK
  2. add experimental s_set_prio instruction to optimize performance

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for cases where the KV cache blocksize is a multiple of ChunkK (in addition to the existing support for ChunkK being a multiple of blocksize), and introduces experimental s_set_prio instructions to optimize performance on AMD CDNA3 architecture.

Key Changes

  • Updated assertion logic to support bidirectional divisibility between ChunkK and KVBlockSize
  • Refactored the main kernel into two code paths: one for when ChunkKPerStage divides evenly into KVBlockSize, and another for the reverse case
  • Added s_set_prio calls for instruction scheduling optimization with different priority levels (0-3)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
op_tests/op_benchmarks/triton/bench_deepgemm_attention.py Updated benchmark parameters: ChunkK from 256 to 128, WavePerEU from 2 to 5, and fixed num_blocks calculation to properly account for blocksize
aiter/ops/triton/pa_mqa_logits.py Relaxed assertion to allow KVBlockSize % ChunkK == 0 in addition to ChunkK % KVBlockSize == 0
aiter/ops/triton/gluon/pa_mqa_logits.py Major refactoring: added version compatibility for 2D vs 3D MFMA layouts, added s_set_prio import with fallback, introduced LoadBlockIndiceForEachStage branching for two different block loading strategies
Comments suppressed due to low confidence (1)

aiter/ops/triton/gluon/pa_mqa_logits.py:43

  • Except block directly handles BaseException.
except:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread aiter/ops/triton/gluon/pa_mqa_logits.py
Comment thread aiter/ops/triton/gluon/pa_mqa_logits.py Outdated
valarLip
valarLip previously approved these changes Dec 18, 2025
@sjfeng1999
sjfeng1999 force-pushed the feat-mqa_logits_large_blocksize branch 3 times, most recently from 8029feb to d40fb02 Compare December 23, 2025 06:03
@sjfeng1999
sjfeng1999 force-pushed the feat-mqa_logits_large_blocksize branch from cd2c8f7 to c5a826a Compare December 24, 2025 06:18
@sjfeng1999
sjfeng1999 requested a review from valarLip December 24, 2025 06:21

@coderfeli coderfeli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sjfeng1999
sjfeng1999 merged commit da67608 into main Dec 24, 2025
23 checks passed
@sjfeng1999
sjfeng1999 deleted the feat-mqa_logits_large_blocksize branch December 24, 2025 12:58
ZhangLirong-amd pushed a commit that referenced this pull request Dec 29, 2025
* Support mqa_logits blocksize is multiple of ChunkK cases and Add s_set_prio optimization

* Add var-context optimzation for pa_mqa_logits

* resolve ruff suggestion
zhuyuhua-v pushed a commit that referenced this pull request Jan 14, 2026
* Support mqa_logits blocksize is multiple of ChunkK cases and Add s_set_prio optimization

* Add var-context optimzation for pa_mqa_logits

* resolve ruff suggestion
valarLip pushed a commit that referenced this pull request Mar 18, 2026
* Support mqa_logits blocksize is multiple of ChunkK cases and Add s_set_prio optimization

* Add var-context optimzation for pa_mqa_logits

* resolve ruff suggestion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants