File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1757,10 +1757,23 @@ void init_triton_ir(py::module &&m) {
17571757
17581758 // Run the pass manager under a source manager diagnostic handler, which
17591759 // enables emitted MLIR diagnostics to directly reference Python source
1760- // code.
1761- llvm::SourceMgr sourceMgr;
1762- SourceMgrDiagnosticHandler diagHandler (sourceMgr, mod.getContext (),
1763- llvm::errs ());
1760+ // code. This diagnostic handler will only filter for errors.
1761+ struct SourceMgrErrorDiagnosticHandler
1762+ : public SourceMgrDiagnosticHandler {
1763+ SourceMgrErrorDiagnosticHandler (MLIRContext *ctx)
1764+ : SourceMgrDiagnosticHandler(sourceMgr, ctx, llvm::errs()) {
1765+ setHandler ([this ](Diagnostic &diag) {
1766+ if (diag.getSeverity () != DiagnosticSeverity::Error)
1767+ return failure ();
1768+ emitDiagnostic (diag);
1769+ return success ();
1770+ });
1771+ }
1772+
1773+ llvm::SourceMgr sourceMgr;
1774+ };
1775+ SourceMgrErrorDiagnosticHandler diagHandler (mod.getContext ());
1776+
17641777 if (failed (self.run (mod.getOperation ())))
17651778 throw std::runtime_error (" PassManager::run failed" );
17661779 });
You can’t perform that action at this time.
0 commit comments