[MLIR] Add quantum.ctrl region op and ctrl-lowering pass - #3089
Conversation
kipawaa
left a comment
There was a problem hiding this comment.
Nice work @maliasadi 💯 Just requesting a couple of test cases that I think would be good to have
paul0403
left a comment
There was a problem hiding this comment.
Nice, thanks @maliasadi !
One thing I'm wondering is do we need a reference semantics version? Since the frontend qp.ctrl will be lowered to reference semantics.
I can help out with the qref.ctrl op (and the bidirectional semantics conversions) in another PR. For now, happy to get this one merged and unblock other graph decomp work!
e18555c to
a6d0912
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3089 +/- ##
=======================================
Coverage 96.67% 96.67%
=======================================
Files 166 166
Lines 19171 19171
Branches 1822 1822
=======================================
Hits 18534 18534
Misses 475 475
Partials 162 162 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kipawaa
left a comment
There was a problem hiding this comment.
Nice, thanks @maliasadi!
Co-authored-by: Paul <79805239+paul0403@users.noreply.github.com>
5963615 to
fac801e
Compare
Context:
As part of adding Adjoint/Ctrl region/ops support to the graph-decomposition system, we need to reduce region-level modifiers to op-level nodes before the solver runs (Check the ADR for details). Controlled subcircuits need the same treatment: a
Controlled(Op)produced by the solver (or actrlregion coming from the frontend) must be reduced to op-level controlled gates before calling into the graph solver.This PR adds the
ctrlcounterpart to the existingadjointregion infra via aquantum.ctrlregion op and actrl-loweringpass.Description of the Change:
We started simply by just implementing a forward walk pass over the region in the
ctrl-loweringpass, for each op:quantum.ctrl: outer controls merged in and lowered on the next iterationextract/insert/alloc/dealloc) and classical ops: just clonedRelated GitHub Issues:
[sc-125409]