Skip to content

fix: Unreachable backend check after earlier backend skip - #3368

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/test-fused-attn-unreachable-backend-check-after
Open

fix: Unreachable backend check after earlier backend skip#3368
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/test-fused-attn-unreachable-backend-check-after

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Contributor

This PR addresses the following issue in tests/jax/test_fused_attn.py: Unreachable backend check after earlier backend skip.

Changes

  • tests/jax/test_fused_attn.py: Unreachable backend check after earlier backend skip.

Details

--- a/tests/jax/test_fused_attn.py
+++ b/tests/jax/test_fused_attn.py
@@ -1,13 +1,8 @@
-        if (
-            self.attn_bias_type == AttnBiasType.POST_SCALE_BIAS
-            and self.bias_shape != BiasShape._1HSS
-        ):
-            if self.attn_mask_type.is_padding():
-                pytest.skip(
-                    "B1SS, BHSS and 11SS bias shapes are only supported for non-padding mask"
-                )
-            elif self.backend != NVTE_Fused_Attn_Backend.NVTE_F16_arbitrary_seqlen:
-                pytest.skip(
-                    "B1SS, BHSS and 11SS bias shapes are only supported for "
-                    "the F16_arbitrary_seqlen backend."
-                )
+        if (
+            self.attn_bias_type == AttnBiasType.POST_SCALE_BIAS
+            and self.bias_shape != BiasShape._1HSS
+        ):
+            if self.attn_mask_type.is_padding():
+                pytest.skip(
+                    "B1SS, BHSS and 11SS bias shapes are only supported for non-padding mask"
+                )

Tests

  • tests/jax/test_fused_attn.py
--- a/tests/jax/test_fused_attn.py
+++ b/tests/jax/test_fused_attn.py
@@ -1235,4 +1235,35 @@
     return (left_window_size, 0)
 
+
+def test_post_scale_non_1hss_bias_shapes_do_not_hit_unreachable_backend_skip():
+    """
+    Regression test for the removed unreachable backend check.
+
+    A config that reaches this point with a non-1HSS post-scale bias shape must
+    already be using the F16_arbitrary_seqlen backend, so there should be no
+    additional skip for the backend.
+    """
+    runner = FusedAttnRunner(
+        batch_size=2,
+        max_seqlen_q=2048,
+        max_seqlen_kv=2048,
+        num_heads_q=12,
+        num_heads_kv=12,
+        head_dim_qk=64,
+        head_dim_v=64,
+        attn_bias_type=AttnBiasType.POST_SCALE_BIAS,
+        attn_mask_type=AttnMaskType.NO_MASK,
+        softmax_type=AttnSoftmaxType.VANILLA_SOFTMAX,
+        dropout_prob=0.0,
+        dtype=jnp.bfloat16,
+        is_training=True,
+        qkv_layout=QKVLayout.BSHD_BSHD_BSHD,
+        bias_shape=BiasShape._B1SS,
+        window_size=None,
+        seq_desc_format=SeqDescFormat.Mask,
+    )
+    runner._check_configs()
+    assert runner.backend == NVTE_Fused_Attn_Backend.NVTE_F16_arbitrary_seqlen
+
+
 @pytest.mark.parametrize(
     "attn_mask_type",

Squashed to single commit for review.

Original PR: #10
@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

Removes a redundant fused-attention backend check that was unreachable after the preceding backend validation.

  • Retains the separate restriction for non-1HSS post-scale bias shapes used with padding masks.
  • Does not alter production fused-attention behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
tests/jax/test_fused_attn.py Removes an unreachable test skip; the preceding configuration check already guarantees the required arbitrary-sequence-length backend.

Reviews (2): Last reviewed commit: "fix: Unreachable backend check after ear..." | Re-trigger Greptile

@cyanguwa cyanguwa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a no-brainer. Thanks.

@andrewwhitecdw

Copy link
Copy Markdown
Contributor Author

script closed on accident

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