Skip to content

Conversation

@DharuniRAcharya
Copy link
Contributor

This patch moves the print functions from NVVMIntrinsicUtils.h to NVVMIntrinsicUtils.cpp, a file created in the llvm/lib/IR directory.

This patch moves the print functions from NVVMIntrinsicUtils.h to NVVMIntrinsicUtils.cpp, a file created in the llvm/lib/IR directory.

Signed-off-by: Dharuni R Acharya <dharunira@nvidia.com>
@llvmbot
Copy link
Member

llvmbot commented Nov 21, 2025

@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-nvptx

Author: Dharuni R Acharya (DharuniRAcharya)

Changes

This patch moves the print functions from NVVMIntrinsicUtils.h to NVVMIntrinsicUtils.cpp, a file created in the llvm/lib/IR directory.


Full diff: https://github.com/llvm/llvm-project/pull/168997.diff

3 Files Affected:

  • (modified) llvm/include/llvm/IR/NVVMIntrinsicUtils.h (+2-43)
  • (modified) llvm/lib/IR/CMakeLists.txt (+1)
  • (added) llvm/lib/IR/NVVMIntrinsicUtils.cpp (+61)
diff --git a/llvm/include/llvm/IR/NVVMIntrinsicUtils.h b/llvm/include/llvm/IR/NVVMIntrinsicUtils.h
index d383769043605..a6356a99b9c77 100644
--- a/llvm/include/llvm/IR/NVVMIntrinsicUtils.h
+++ b/llvm/include/llvm/IR/NVVMIntrinsicUtils.h
@@ -662,50 +662,9 @@ inline APFloat::roundingMode GetFMARoundingMode(Intrinsic::ID IntrinsicID) {
   llvm_unreachable("Invalid FP instrinsic rounding mode for NVVM fma");
 }
 
-inline void printTcgen05MMAKind(raw_ostream &OS, const Constant *ImmArgVal) {
-  if (const auto *CI = dyn_cast<ConstantInt>(ImmArgVal)) {
-    uint64_t Val = CI->getZExtValue();
-    switch (static_cast<Tcgen05MMAKind>(Val)) {
-    case Tcgen05MMAKind::F16:
-      OS << "f16";
-      return;
-    case Tcgen05MMAKind::TF32:
-      OS << "tf32";
-      return;
-    case Tcgen05MMAKind::F8F6F4:
-      OS << "f8f6f4";
-      return;
-    case Tcgen05MMAKind::I8:
-      OS << "i8";
-      return;
-    }
-  }
-  llvm_unreachable(
-      "printTcgen05MMAKind called with invalid value for immediate argument");
-}
+void printTcgen05MMAKind(raw_ostream &OS, const Constant *ImmArgVal);
 
-inline void printTcgen05CollectorUsageOp(raw_ostream &OS,
-                                         const Constant *ImmArgVal) {
-  if (const auto *CI = dyn_cast<ConstantInt>(ImmArgVal)) {
-    uint64_t Val = CI->getZExtValue();
-    switch (static_cast<Tcgen05CollectorUsageOp>(Val)) {
-    case Tcgen05CollectorUsageOp::DISCARD:
-      OS << "discard";
-      return;
-    case Tcgen05CollectorUsageOp::LASTUSE:
-      OS << "lastuse";
-      return;
-    case Tcgen05CollectorUsageOp::FILL:
-      OS << "fill";
-      return;
-    case Tcgen05CollectorUsageOp::USE:
-      OS << "use";
-      return;
-    }
-  }
-  llvm_unreachable("printTcgen05CollectorUsageOp called with invalid value for "
-                   "immediate argument");
-}
+void printTcgen05CollectorUsageOp(raw_ostream &OS, const Constant *ImmArgVal);
 
 } // namespace nvvm
 } // namespace llvm
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index 10572ff708bd3..31821a2d6b208 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -35,6 +35,7 @@ add_llvm_component_library(LLVMCore
   GVMaterializer.cpp
   Globals.cpp
   Intrinsics.cpp
+  NVVMIntrinsicUtils.cpp
   IRBuilder.cpp
   IRPrintingPasses.cpp
   SSAContext.cpp
diff --git a/llvm/lib/IR/NVVMIntrinsicUtils.cpp b/llvm/lib/IR/NVVMIntrinsicUtils.cpp
new file mode 100644
index 0000000000000..bf5c25c891cea
--- /dev/null
+++ b/llvm/lib/IR/NVVMIntrinsicUtils.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements functions associated with NVVM Intrinsics.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/NVVMIntrinsicUtils.h"
+
+using namespace llvm;
+using namespace nvvm;
+
+void nvvm::printTcgen05MMAKind(raw_ostream &OS, const Constant *ImmArgVal) {
+  if (const auto *CI = dyn_cast<ConstantInt>(ImmArgVal)) {
+    uint64_t Val = CI->getZExtValue();
+    switch (static_cast<Tcgen05MMAKind>(Val)) {
+    case Tcgen05MMAKind::F16:
+      OS << "f16";
+      return;
+    case Tcgen05MMAKind::TF32:
+      OS << "tf32";
+      return;
+    case Tcgen05MMAKind::F8F6F4:
+      OS << "f8f6f4";
+      return;
+    case Tcgen05MMAKind::I8:
+      OS << "i8";
+      return;
+    }
+  }
+  llvm_unreachable(
+      "printTcgen05MMAKind called with invalid value for immediate argument");
+}
+
+void nvvm::printTcgen05CollectorUsageOp(raw_ostream &OS,
+                                  const Constant *ImmArgVal) {
+  if (const auto *CI = dyn_cast<ConstantInt>(ImmArgVal)) {
+    uint64_t Val = CI->getZExtValue();
+    switch (static_cast<Tcgen05CollectorUsageOp>(Val)) {
+    case Tcgen05CollectorUsageOp::DISCARD:
+      OS << "discard";
+      return;
+    case Tcgen05CollectorUsageOp::LASTUSE:
+      OS << "lastuse";
+      return;
+    case Tcgen05CollectorUsageOp::FILL:
+      OS << "fill";
+      return;
+    case Tcgen05CollectorUsageOp::USE:
+      OS << "use";
+      return;
+    }
+  }
+  llvm_unreachable("printTcgen05CollectorUsageOp called with invalid value for "
+                   "immediate argument");
+}

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

🐧 Linux x64 Test Results

  • 186432 tests passed
  • 4868 tests skipped

@durga4github durga4github requested a review from jurahul November 21, 2025 07:55
Copy link
Contributor

@durga4github durga4github left a comment

Choose a reason for hiding this comment

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

Let us wait for @jurahul to have a look

@durga4github durga4github merged commit a39af12 into llvm:main Nov 25, 2025
10 checks passed
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
…ile (llvm#168997)

This patch moves the print functions from `NVVMIntrinsicUtils.h` to
`NVVMIntrinsicUtils.cpp`, a file created in the `llvm/lib/IR` directory.

Signed-off-by: Dharuni R Acharya <dharunira@nvidia.com>
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 29, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/13467

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'SanitizerCommon-asan-powerpc64le-Linux :: Linux/getpwnam_r_invalid_user.cpp' FAILED ********************
Exit Code: 134

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=address  -m64 -fno-function-sections -funwind-tables  -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test -ldl -O0 -g /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-powerpc64le-Linux/Linux/Output/getpwnam_r_invalid_user.cpp.tmp &&  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-powerpc64le-Linux/Linux/Output/getpwnam_r_invalid_user.cpp.tmp # RUN: at line 2
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address -m64 -fno-function-sections -funwind-tables -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test -ldl -O0 -g /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-powerpc64le-Linux/Linux/Output/getpwnam_r_invalid_user.cpp.tmp
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-powerpc64le-Linux/Linux/Output/getpwnam_r_invalid_user.cpp.tmp
Result: 110
getpwnam_r_invalid_user.cpp.tmp: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp:19: int main(): Assertion `res == 0 || res == ENOENT' failed.
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-powerpc64le-Linux/Linux/Output/getpwnam_r_invalid_user.cpp.script: line 1: 339488 Aborted                 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-powerpc64le-Linux/Linux/Output/getpwnam_r_invalid_user.cpp.tmp

--

********************

Step 10 (build stage 2) failure: 'ninja' (failure) (timed out)
...
[6294/6592] Linking CXX executable bin/llvm-lto2
[6295/6592] Linking CXX executable bin/llvm-isel-fuzzer
[6296/6592] Linking CXX executable bin/clang-linker-wrapper
[6297/6592] Linking CXX executable bin/llvm-reduce
[6298/6592] Linking CXX executable bin/llvm-dwarfutil
[6299/6592] Linking CXX executable bin/llvm-opt-fuzzer
[6300/6592] Linking CXX executable bin/llvm-lto
[6301/6592] Linking CXX executable bin/opt
[6302/6592] Building CXX object tools/bugpoint-passes/CMakeFiles/BugpointPasses.dir/TestPasses.cpp.o
[6303/6592] Linking CXX shared module lib/BugpointPasses.so
command timed out: 1200 seconds without output running [b'ninja'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=1727.360898

augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
…ile (llvm#168997)

This patch moves the print functions from `NVVMIntrinsicUtils.h` to
`NVVMIntrinsicUtils.cpp`, a file created in the `llvm/lib/IR` directory.

Signed-off-by: Dharuni R Acharya <dharunira@nvidia.com>
kcloudy0717 pushed a commit to kcloudy0717/llvm-project that referenced this pull request Dec 4, 2025
…ile (llvm#168997)

This patch moves the print functions from `NVVMIntrinsicUtils.h` to
`NVVMIntrinsicUtils.cpp`, a file created in the `llvm/lib/IR` directory.

Signed-off-by: Dharuni R Acharya <dharunira@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants