Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 9b4fb92

Browse files
authored
[mlir] expose -debug-only equivalent to C and Python (#93175)
These are useful for finer-grain debugging and complement the already exposed global debug flag.
1 parent 61cc91f commit 9b4fb92

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

IRCore.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,20 @@ struct PyGlobalDebugFlag {
240240
// Debug flags.
241241
py::class_<PyGlobalDebugFlag>(m, "_GlobalDebug", py::module_local())
242242
.def_property_static("flag", &PyGlobalDebugFlag::get,
243-
&PyGlobalDebugFlag::set, "LLVM-wide debug flag");
243+
&PyGlobalDebugFlag::set, "LLVM-wide debug flag")
244+
.def_static(
245+
"set_types",
246+
[](const std::string &type) {
247+
mlirSetGlobalDebugType(type.c_str());
248+
},
249+
"types"_a, "Sets specific debug types to be produced by LLVM")
250+
.def_static("set_types", [](const std::vector<std::string> &types) {
251+
std::vector<const char *> pointers;
252+
pointers.reserve(types.size());
253+
for (const std::string &str : types)
254+
pointers.push_back(str.c_str());
255+
mlirSetGlobalDebugTypes(pointers.data(), pointers.size());
256+
});
244257
}
245258
};
246259

0 commit comments

Comments
 (0)