Skip to content

fix: add missing NVTE_BHSD to qkv format to_string - #3362

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/fused-attn-add-missing-nvte-bhsd-to-qkv-format-to
Open

fix: add missing NVTE_BHSD to qkv format to_string#3362
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:bugfix/fused-attn-add-missing-nvte-bhsd-to-qkv-format-to

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Contributor

This PR addresses the following issue in transformer_engine/common/fused_attn/fused_attn.cpp: add missing NVTE_BHSD to qkv format to_string.

Changes

  • transformer_engine/common/fused_attn/fused_attn.cpp: add missing NVTE_BHSD to qkv format to_string.

Details

--- a/transformer_engine/common/fused_attn/fused_attn.cpp
+++ b/transformer_engine/common/fused_attn/fused_attn.cpp
@@ -1,6 +1,8 @@
-    case NVTE_BSHD:
-      return "NVTE_BSHD";
-    case NVTE_THD:
-      return "NVTE_THD";
-    case NVTE_BSHD_2SBHD:
-      return "NVTE_BSHD_2SBHD";
+    case NVTE_BSHD:
+      return "NVTE_BSHD";
+    case NVTE_BHSD:
+      return "NVTE_BHSD";
+    case NVTE_THD:
+      return "NVTE_THD";
+    case NVTE_BSHD_2SBHD:
+      return "NVTE_BSHD_2SBHD";

Tests

  • tests/test_qkv_format_to_string.cpp
diff --git a/tests/test_qkv_format_to_string.cpp b/tests/test_qkv_format_to_string.cpp
new file mode 100644
--- /dev/null
+++ b/tests/test_qkv_format_to_string.cpp
@@ -0,0 +1,15 @@
+/*************************************************************************
+ * Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ *
+ * See LICENSE for license information.
+ ************************************************************************/
+
+#include <gtest/gtest.h>
+#include <string>
+
+#include "transformer_engine/fused_attn.h"
+
+TEST(QKVFormatToString, BHSD) {
+  EXPECT_EQ(transformer_engine::to_string(NVTE_QKV_Format::NVTE_BHSD), "NVTE_BHSD");
+}
+
+TEST(QKVFormatToString, LayoutBHSD_BHSD_BHSD) {
+  EXPECT_EQ(nvte_get_qkv_format(NVTE_QKV_Layout::NVTE_BHSD_BHSD_BHSD),
+            NVTE_QKV_Format::NVTE_BHSD);
+}

@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 completes the QKV-format string conversion by returning "NVTE_BHSD" for the existing NVTE_BHSD enum value.

  • Adds the missing NVTE_BHSD case to transformer_engine::to_string.

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 Adds the correct string representation for NVTE_BHSD; no actionable issue remains in the changed code.

Reviews (5): Last reviewed commit: "fix: add missing NVTE_BHSD to qkv format..." | Re-trigger Greptile

Comment thread tests/test_qkv_format_to_string.cpp Outdated
@cyanguwa

cyanguwa commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks @andrewwhitecdw for submitting PRs #3361 to #3379. I've reviewed them and I think I should make a few suggestions regarding the PR styling and CI testing.

  • Some of the PRs are one-liners, or fairly small, and they touch the same files as others. So could you please consolidate the relevant ones to one PR, and this will save rebase churns and some CI runs.
  • Not all of these PRs require adding a test. For example, the [()] -> [] change is probably safe with just some local testing, instead of bloating the CI infra.
  • Some PRs have code diffs in their descriptions. This is unnecessary because we have the "Files changed" tab, and can be misleading if they don't match what's really changed in the code.

Thanks for the contribution!

@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/fused-attn-add-missing-nvte-bhsd-to-qkv-format-to branch from 370bcf9 to 9159d39 Compare August 18, 2026 00:17
Squashed to single commit for review.

Original PR: #16

Signed-off-by: Andrew White <andrewwhitecdw@users.noreply.github.com>
@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/fused-attn-add-missing-nvte-bhsd-to-qkv-format-to branch from 9159d39 to ce42aaf Compare August 18, 2026 01:10
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