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

This PR simplifies a redundant cuDNN-version condition without changing fused-attention backend selection behavior.

  • Removes an unnecessary cudnn_runtime_version < 91301 check.
  • Preserves vanilla-only softmax support before cuDNN 9.13.1 and all supported softmax types from 9.13.1 onward.

Confidence Score: 5/5

The PR appears safe to merge because the simplified predicate is equivalent to the original for all version and softmax-type combinations.

The change removes a redundant comparison while preserving the exact set of inputs that select the fused-attention backend.

Important Files Changed

Filename Overview
transformer_engine/common/fused_attn/fused_attn.cpp Simplifies the softmax compatibility predicate to a Boolean-equivalent expression with no observable behavior change.

Reviews (1): 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