• MLIR ExecutionContext vs custom action handler infrastructure Hi, I have recently rediscoveredAction: Tracing and Debugging MLIR-based Compilers - MLIRand wanted to use it within our compiler project. • This post is to collect user experience withmlir::ExecutionContextspecifically and discuss with people aware of the technology how suitable it is for my current and future needs. • Specific use cases What I want to use the action “framework” for: To disable passes at will - in some sense, similar toDebugCounter, but simpler. • To use intrusive tracing with profilers (such as VTune’s ITT orvalgrind) for various actions (e.g. • to profile a particular section of compiler) (Maybe) To run actions repeatedly (e.g. • run the same pass N times) for benchmarking purposes and to do it through compiler (this just avoids the need for a developer to dump IR, make sure it is valid, run this IR via mlir-opt, etc.) (Maybe) To use existing ExecutionContext hooks All these “features” must becomposable: I want to disable some passes, and run profiling on some of the remaining passes; I want to profile a repeated action to get clearer hotspots; etc.

Article Summaries:

  • A developer is evaluating MLIR’s built‑in ExecutionContext for advanced compiler instrumentation. The goal is to disable passes on demand, add intrusive profiling (VTune, Valgrind), run passes repeatedly for benchmarking, and compose these features. While the ExecutionContext::Observer and Control APIs can support such tasks, they require integration with breakpoints and a complex action stack, raising concerns about overhead and usability. The author has already implemented simple pass‑disabling and profiling via the standard action‑handler API, but seeks community experience on whether ExecutionContext is practical for these use cases or if a custom action‑handler infrastructure is preferable.
  • Hi, I have recently rediscovered Action: Tracing and Debugging MLIR-based Compilers - MLIR and wanted to use it within our compiler project. This post is to collect user experience with mlir::ExecutionContext specifically and discuss with people aware of the technology how suitable it is for my current and future needs. Specific use cases What I want to use the action “framework” for: - To disable passes at will - in some sense, similar to DebugCounter , but simpler. - To use intrusive tracing with profilers (such as VTune’s ITT or valgrind) for various actions (e.g. to profile a particular se

Sources: