Skip to content

fix: simplify redundant softmax version condition - #3363

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/fused-attn-simplify-redundant-softmax-version
Open

fix: simplify redundant softmax version condition#3363
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/fused-attn-simplify-redundant-softmax-version

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Contributor

This PR addresses the following issue in transformer_engine/common/fused_attn/fused_attn.cpp: simplify redundant softmax version condition.

Changes

  • transformer_engine/common/fused_attn/fused_attn.cpp: simplify redundant softmax version condition.

Details

--- a/transformer_engine/common/fused_attn/fused_attn.cpp
+++ b/transformer_engine/common/fused_attn/fused_attn.cpp
@@ -1,6 +1,5 @@
-        // softmax type
-        // pre-9.13.1: vanilla
-        // 9.13.1+: vanilla, off-by-one, learnable
-        (cudnn_runtime_version >= 91301 ||
-         (cudnn_runtime_version < 91301 &&
-          softmax_type == NVTE_Softmax_Type::NVTE_VANILLA_SOFTMAX)) &&
+        // softmax type
+        // pre-9.13.1: vanilla
+        // 9.13.1+: vanilla, off-by-one, learnable
+        (cudnn_runtime_version >= 91301 ||
+         softmax_type == NVTE_Softmax_Type::NVTE_VANILLA_SOFTMAX) &&

Tests

Let me know if you want tests added for this fix or not.

Squashed to single commit for review.

Original PR: #15
@github-actions github-actions Bot added the community-contribution PRs from external contributor outside the core maintainers, representing community-driven work. label Aug 13, 2026
@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR simplifies a redundant cuDNN-version condition in fused-attention backend selection without changing its Boolean behavior.

  • Removes the unnecessary cudnn_runtime_version < 91301 subcondition.
  • Preserves vanilla softmax support on older cuDNN versions and all supported softmax types on cuDNN 9.13.1 or newer.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
transformer_engine/common/fused_attn/fused_attn.cpp Simplifies the softmax eligibility expression to its logically equivalent form without altering backend selection.

Reviews (2): Last reviewed commit: "fix: simplify redundant softmax version ..." | Re-trigger Greptile

@cyanguwa

cyanguwa commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Please fix the DCO for this PR. Thanks.

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

Labels

community-contribution PRs from external contributor outside the core maintainers, representing community-driven work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants