Skip to content

[CUDA] Fix PagedAttention build without FlashAttention - #32327

Merged
Tianlei Wu (tianleiwu) merged 1 commit into
mainfrom
tlwu/paged_attention_no_flash_werror
Sep 3, 2026
Merged

Tianlei Wu (tianleiwu) merged 1 commit into
mainfrom
tlwu/paged_attention_no_flash_werror

Conversation

@tianleiwu

Copy link
Copy Markdown
Contributor

Description

Fix the CUDA PagedAttention build when FlashAttention is disabled. Two values used only by the FlashAttention path otherwise trigger -Werror=unused-variable and -Werror=unused-but-set-variable.

Summary of Changes

  • Define flash_block_size_ok only when USE_FLASH_ATTENTION is enabled.
  • Mark max_kv_len_lower_bound unused in builds without FlashAttention.
  • Leave runtime behavior unchanged for both configurations.

Testing

  • Built onnxruntime_providers_cuda with onnxruntime_USE_FLASH_ATTENTION=OFF and -Werror.
  • Compiled the rebased paged_attention.cc directly with the same CUDA Debug configuration.

Checklist

  • Tests not required for this build-only fix
  • No breaking changes
  • Documentation not required

flash_block_size_ok and max_kv_len_lower_bound are only read inside
#if USE_FLASH_ATTENTION, so a --disable_flash_attention build fails on
-Werror=unused-variable and -Werror=unused-but-set-variable.
Copilot AI balanced review requested due to automatic review settings August 30, 2026 05:57

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

Fixes CUDA PagedAttention compilation when FlashAttention is disabled.

Changes:

  • Guards FlashAttention-only eligibility state.
  • Explicitly marks the split-KV lower bound unused without FlashAttention.
  • Preserves runtime behavior.

No actionable findings.


πŸ’‘ Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tianleiwu
Tianlei Wu (tianleiwu) merged commit 2ea96f7 into main Sep 3, 2026
90 of 91 checks passed
@tianleiwu
Tianlei Wu (tianleiwu) deleted the tlwu/paged_attention_no_flash_werror branch September 3, 2026 20:12
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