Add support for choosing decomposition rules in decompose-lowering#2973
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2973 +/- ##
==========================================
- Coverage 96.98% 96.96% -0.03%
==========================================
Files 166 167 +1
Lines 19249 19349 +100
Branches 1791 1799 +8
==========================================
+ Hits 18668 18761 +93
- Misses 429 433 +4
- Partials 152 155 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Maybe a general design question, but is there a use case to having a separate decompose-lowering pass that is distinct from a graph solver pass (assuming that is the current design)? Naively I would have thought there is one "decompose" pass, with the target gate set, and the pass computes whatever is necessary and replaces your gates until all are in the target. Alternatively, if the pass separation is in fact useful, one could perhaps leverage an analysis result from the first pass in the second, but it depends on how they are intended to be used. |
I think that these two should be combined in the near future, but until the graph is able to accommodate all decomposition requirements we'll need the separation. I've been working towards this goal of unifying the decomposition passes, and hopefully this can be complete in the next couple of months. |
What does the separation do for us while we don't have all requirements? |
Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com>
Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com>
Chatted offline, seems likely I was mistaken and that we can move up the timeline on combining these passes. I'll evaluate and make necessary changes in a follow-up PR. |
Context:
decompose-loweringalways applies all (applicable) decomposition rules in the IR, and removes all decomposition rules on cleanup.Description of the Change:
Introduces a
target-rulesoption to apply only a subset of the rules available in the IR. Rules are now applied by aligning thetarget_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 thedecompose-loweringpass to allow use throughout the pipeline ingraph-decompositionpasses. Decomposition functions will be removed by thesymbol-dcepass at the end of the default pipeline.Benefits:
Provides a more versatile
decompose-loweringpass, and will support a more efficientgraph-decompositionpass.Possible Drawbacks:
Related GitHub Issues:
[sc-122013]