Skip to content

Move kCutlassSafeMaskFilterValue outside USE_MEMORY_EFFICIENT_ATTENTION guard - #32588

Merged
Tianlei Wu (tianleiwu) merged 1 commit into
microsoft:mainfrom
SIDDARTHAREDDY8:oss-bhai-2026-09-14-onnxruntime-mea-guard
Sep 14, 2026
Merged

Tianlei Wu (tianleiwu) merged 1 commit into
microsoft:mainfrom
SIDDARTHAREDDY8:oss-bhai-2026-09-14-onnxruntime-mea-guard

Conversation

@SIDDARTHAREDDY8

Copy link
Copy Markdown
Contributor

Description

Moves the kCutlassSafeMaskFilterValue constexpr definition (with its explanatory comment) outside the #if USE_MEMORY_EFFICIENT_ATTENTION guard in onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/memory_efficient_attention.h, keeping it in the onnxruntime::contrib::cuda namespace. A short NOTE comment documents why it must stay unconditional. The MEA-specific implementation remains conditionally compiled, so there is no behavior change when the flag is enabled.

Motivation and Context

Fixes #32566. Building with -Donnxruntime_USE_CUDA=ON -Donnxruntime_USE_MEMORY_EFFICIENT_ATTENTION=OFF fails because MaskedBiasSentinel() in core/providers/cuda/llm/attention.cc unconditionally references ::onnxruntime::contrib::cuda::kCutlassSafeMaskFilterValue, while the constant was defined inside the feature guard. The constant has no CUTLASS dependency and is also required by the unfused attention path, so defining it unconditionally is the correct fix (per the discussion with Saad-Mallebhari in the issue).

…ON guard

Fixes microsoft#32566.

The constant has no CUTLASS dependency and is referenced unconditionally by
MaskedBiasSentinel() in core/providers/cuda/llm/attention.cc, so defining it
inside the feature guard breaks the CUDA build when
onnxruntime_USE_MEMORY_EFFICIENT_ATTENTION=OFF.

Signed-off-by: SIDDARTHA REDDY <75976672+SIDDARTHAREDDY8@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 14, 2026 17:55
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🟢 Approval recommended

The focused change correctly resolves the missing declaration without altering enabled-MEA behavior.

Pull request overview

Moves the mask sentinel outside the MEA feature guard, fixing CUDA builds with MEA disabled.

Changes:

  • Defines kCutlassSafeMaskFilterValue unconditionally.
  • Documents its use by unfused attention.
File summaries
File Description
onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/memory_efficient_attention.h Makes the shared sentinel available when MEA is disabled.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@SIDDARTHAREDDY8

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@tianleiwu
Tianlei Wu (tianleiwu) enabled auto-merge (squash) September 14, 2026 18:34
@tianleiwu
Tianlei Wu (tianleiwu) merged commit bf8b4f1 into microsoft:main Sep 14, 2026
89 of 90 checks passed
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.

[Build] [CUDA] Build fails when onnxruntime_USE_MEMORY_EFFICIENT_ATTENTION=OFF due to missing kCutlassSafeMaskFilterValue declaration

3 participants