Skip to content

Commit

Permalink
Enable loc info when printing .ttir .ttgir (triton-lang#2736)
Browse files Browse the repository at this point in the history
Summary: in triton.cc, enable_debug on PM will make sure debugging info
is dumped when MLIR_ENABLE_DUMP is on. But for printing .ttir .ttgir, we
are using the default OpPrintingFlags for Operation::print: const
OpPrintingFlags &flags = std::nullopt

With this patch, we pass in OpPrintingFlags with debug info enabled.

Since the generation of debug info is controlled via env var:
TRITON_DISABLE_LINE_INFO, it should be okay to print loc info as long as
it exists.

Co-authored-by: Manman Ren <mren@meta.com>
  • Loading branch information
manman-ren and manman-ren authored Nov 30, 2023
1 parent 18ae9a4 commit a27e041
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/src/triton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,9 @@ void init_triton_ir(py::module &&m) {
[](mlir::OpState &self) -> std::string {
std::string str;
llvm::raw_string_ostream os(str);
self->print(os);
auto printingFlags = mlir::OpPrintingFlags();
printingFlags.enableDebugInfo();
self->print(os, printingFlags);
return str;
})
.def("append_operand",
Expand Down Expand Up @@ -498,7 +500,9 @@ void init_triton_ir(py::module &&m) {
[](mlir::ModuleOp &self) -> std::string {
std::string str;
llvm::raw_string_ostream os(str);
self.print(os);
auto printingFlags = mlir::OpPrintingFlags();
printingFlags.enableDebugInfo();
self.print(os, printingFlags);
return str;
})
.def("bytecode",
Expand Down

0 comments on commit a27e041

Please sign in to comment.