Skip to content

[ROCm] Fix CK varlen_fwd binding argument mismatch - #2742

Merged
micmelesse merged 1 commit into
Dao-AILab:mainfrom
hyoon1:fix/rocm-ck-varlen-fwd-binding
Aug 4, 2026
Merged

[ROCm] Fix CK varlen_fwd binding argument mismatch#2742
micmelesse merged 1 commit into
Dao-AILab:mainfrom
hyoon1:fix/rocm-ck-varlen-fwd-binding

Conversation

@hyoon1

@hyoon1 hyoon1 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix an API mismatch between the Python varlen_fwd wrapper and the ROCm CK binding.

Problem

The Python wrapper passes num_splits as the trailing argument to flash_attn_gpu.varlen_fwd, but the CK binding still uses the previous function signature. This causes CK varlen attention calls to fail with an incompatible function arguments error.

Fix

Add the trailing num_splits argument to the CK mha_varlen_fwd declaration and definition.

The argument is intentionally unused. CK continues to initialize num_splits internally and select the split count using the existing heuristic, so this change does not alter kernel behavior.

Testing

Tested tests/test_flash_attn_ck.py on gfx942:

  • Built the ROCm CK extension successfully
  • Ran the full CK test suite
    • 260680 passed, 152076 skipped

@hyoon1

hyoon1 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@tridao @micmelesse @rocking5566
Could you review this? ROCm FlashAttention CK backend is currently failing on upstream, so would it be possible merge this fix?

@rocking5566 rocking5566 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.

LGTM, I think we can merge this PR

@micmelesse
micmelesse merged commit 4a948e9 into Dao-AILab:main Aug 4, 2026
StevenWang-CY pushed a commit to StevenWang-CY/flash-attention that referenced this pull request Aug 28, 2026
(cherry picked from commit 4a948e9)
Signed-off-by: StevenWang-CY <stevenwang0805@outlook.com>
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.

3 participants