Skip to content

Commit 4c38917

Browse files
gryppCopilot
andauthored
[MLIR][NVVM] Print readable modifer (NFC) (llvm#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 <[email protected]>
1 parent af92cab commit 4c38917

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

mlir/include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ enum class PTXRegisterMod {
3333
/// set read and write for the same operand.
3434
ReadWrite = 1,
3535
};
36+
37+
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
38+
PTXRegisterMod mod) {
39+
switch (mod) {
40+
case PTXRegisterMod::Read:
41+
return os << "Read";
42+
case PTXRegisterMod::Write:
43+
return os << "Write";
44+
case PTXRegisterMod::ReadWrite:
45+
return os << "ReadWrite";
46+
}
47+
llvm_unreachable("Unknown PTXRegisterMod value");
48+
}
3649
} // namespace NVVM
3750
} // namespace mlir
3851

mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct PtxLowering
6161

6262
op.getAsmValues(rewriter, asmValues);
6363
for (auto &[asmValue, modifier] : asmValues) {
64-
LDBG() << asmValue << "\t Modifier : " << &modifier;
64+
LDBG() << asmValue << "\t Modifier : " << modifier;
6565
generator.insertValue(asmValue, modifier);
6666
}
6767

0 commit comments

Comments
 (0)