-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[NVVM] Move print functions from NVVMIntrinsicUtils.h to cpp file #168997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[NVVM] Move print functions from NVVMIntrinsicUtils.h to cpp file #168997
Conversation
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/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-nvptx Author: Dharuni R Acharya (DharuniRAcharya) ChangesThis patch moves the print functions from Full diff: https://github.com/llvm/llvm-project/pull/168997.diff 3 Files Affected:
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");
+}
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
🐧 Linux x64 Test Results
|
durga4github
left a comment
There was a problem hiding this 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
This patch moves the print functions from
NVVMIntrinsicUtils.htoNVVMIntrinsicUtils.cpp, a file created in thellvm/lib/IRdirectory.