[Mlir-commits] [mlir] 4c38917 - [MLIR][NVVM] Print readable modifer (NFC) (#153779)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Aug 15 06:47:42 PDT 2025
Author: Guray Ozen
Date: 2025-08-15T15:47:39+02:00
New Revision: 4c389178eeb73618ec80f88d306300949480e40f
URL: https://github.com/llvm/llvm-project/commit/4c389178eeb73618ec80f88d306300949480e40f
DIFF: https://github.com/llvm/llvm-project/commit/4c389178eeb73618ec80f88d306300949480e40f.diff
LOG: [MLIR][NVVM] Print readable modifer (NFC) (#153779)
Currently, modifier is printed as address, so it is not readable and not
useful. This PR adds readable printing for it.
---------
Co-authored-by: Copilot <175728472+Copilot at users.noreply.github.com>
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h
mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h b/mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h
index 5b7df69b62e0b..3e3fcd7d1fb82 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h
@@ -33,6 +33,19 @@ enum class PTXRegisterMod {
/// set read and write for the same operand.
ReadWrite = 1,
};
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
+ PTXRegisterMod mod) {
+ switch (mod) {
+ case PTXRegisterMod::Read:
+ return os << "Read";
+ case PTXRegisterMod::Write:
+ return os << "Write";
+ case PTXRegisterMod::ReadWrite:
+ return os << "ReadWrite";
+ }
+ llvm_unreachable("Unknown PTXRegisterMod value");
+}
} // namespace NVVM
} // namespace mlir
diff --git a/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp b/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
index 91788f9848fe6..e0144bff4d371 100644
--- a/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
+++ b/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
@@ -61,7 +61,7 @@ struct PtxLowering
op.getAsmValues(rewriter, asmValues);
for (auto &[asmValue, modifier] : asmValues) {
- LDBG() << asmValue << "\t Modifier : " << &modifier;
+ LDBG() << asmValue << "\t Modifier : " << modifier;
generator.insertValue(asmValue, modifier);
}
More information about the Mlir-commits
mailing list