catalyst.debug.print_compilation_stage

print_compilation_stage(fn, stage)[source]

Print one of the recorded compilation stages for a JIT-compiled function.

The stages are indexed by their Catalyst compilation pipeline name, which are either provided by the user as a compilation option, or predefined in catalyst.compiler.

Requires keep_intermediate=True.

Parameters
  • fn (QJIT) – a qjit-decorated function

  • stage (str) – string corresponding with the name of the stage to be printed

See also

Debugging Tips

Example

@qjit(keep_intermediate=True)
def func(x: float):
    return x
>>> debug.print_compilation_stage(func, "HLOLoweringPass")
module @func {
  func.func public @jit_func(%arg0: tensor<f64>)
  -> tensor<f64> attributes {llvm.emit_c_interface} {
    return %arg0 : tensor<f64>
  }
  func.func @setup() {
    quantum.init
    return
  }
  func.func @teardown() {
    quantum.finalize
    return
  }
}