Skip to content

Add support for choosing decomposition rules in decompose-lowering#2973

Open
kipawaa wants to merge 12 commits into
mainfrom
dl-driver-restructure
Open

Add support for choosing decomposition rules in decompose-lowering#2973
kipawaa wants to merge 12 commits into
mainfrom
dl-driver-restructure

Conversation

@kipawaa

@kipawaa kipawaa commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Context:
decompose-lowering always applies all (applicable) decomposition rules in the IR, and removes all decomposition rules on cleanup.

Description of the Change:
Introduces a target-rules option to apply only a subset of the rules available in the IR. Rules are now applied by aligning the target_op's operands with the decomposition functions body and cloning the function body inline, to avoid the inconsistencies/heuristics of the built-in inliner. Rules are no longer removed after the decompose-lowering pass to allow use throughout the pipeline in graph-decomposition passes. Decomposition functions will be removed by the symbol-dce pass at the end of the default pipeline.

Benefits:
Provides a more versatile decompose-lowering pass, and will support a more efficient graph-decomposition pass.

Possible Drawbacks:

Related GitHub Issues:

[sc-122013]

@kipawaa kipawaa marked this pull request as ready for review June 23, 2026 19:13
@kipawaa kipawaa marked this pull request as draft June 23, 2026 19:20
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.98%. Comparing base (ce5eefa) to head (0c3b7c7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2973   +/-   ##
=======================================
  Coverage   96.98%   96.98%           
=======================================
  Files         166      166           
  Lines       19249    19249           
  Branches     1791     1791           
=======================================
  Hits        18668    18668           
  Misses        429      429           
  Partials      152      152           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread mlir/lib/Quantum/Transforms/decompose_lowering.cpp
@kipawaa kipawaa marked this pull request as ready for review June 25, 2026 13:47
@Alex-Preciado Alex-Preciado requested a review from maliasadi June 30, 2026 19:13
Comment thread mlir/lib/Quantum/Transforms/decompose_lowering.cpp
Comment thread mlir/lib/Quantum/Transforms/graph_decomposition.cpp
Comment thread mlir/lib/Quantum/Transforms/decompose_lowering.cpp
Comment thread mlir/lib/Quantum/Transforms/decompose_lowering.cpp
Comment thread mlir/lib/Quantum/Transforms/DecomposeLoweringPatterns.cpp
Comment thread mlir/lib/Quantum/Transforms/DecomposeLoweringPatterns.cpp
Comment thread mlir/lib/Quantum/Transforms/DecomposeLoweringPatterns.cpp
Comment thread mlir/test/Quantum/DecomposeLoweringTest.mlir
Comment thread mlir/test/Quantum/DecomposeLoweringTest.mlir

@paul0403 paul0403 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants