catalyst
catalyst copied to clipboard
Add `rulesPath` option to `DecomposeLoweringPass`
Context:
Introduced a new option rulesPath in the DecomposeLoweringPass to specify the path for external gate decomposition rules. This work addresses the limitation that MLIR lacks a linker like LLVM, requiring a custom approach to integrate decomposition rules from separate files. In the absence of a rules path, the pass will examine the decomposition rules within the main module instead (preserving the previous behavior of that pass).
Usage:
quantum-opt --decompose-lowering="rules-path=<path-to-rules-mlir>" <circuit.mlir>
Example:
quantum-opt --decompose-lowering="rules-path=rules.mlir" main.mlir
main.mlircontains the quantum circuit with gates to be decomposedrules.mlircontains the list of decomposition rules (functions withtarget_gateattributes)
Related to: https://github.com/PennyLaneAI/catalyst/pull/2029