Add support for scf.for ops in the convert-quantum-to-qecl pass#2881
Add support for scf.for ops in the convert-quantum-to-qecl pass#2881joeycarter wants to merge 3 commits into
scf.for ops in the convert-quantum-to-qecl pass#2881Conversation
scf.for ops in the convert-quantum-to-qecl pass
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## joeycarter/quantum-to-qecl/scf-if #2881 +/- ##
==================================================================
Coverage 97.03% 97.04%
==================================================================
Files 167 167
Lines 18876 18914 +38
Branches 1766 1767 +1
==================================================================
+ Hits 18317 18355 +38
Misses 415 415
Partials 144 144 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // CHECK: [[cb4:%.+]] = qecl.qec | ||
| // CHECK: scf.yield [[cb4]] : !qecl.codeblock<1> | ||
| %3 = scf.for %arg0 = %c0 to %c5 step %c1 iter_args(%arg1 = %2) -> (!quantum.bit) { | ||
| %out_qubits = quantum.custom "PauliX"() %arg1 : !quantum.bit |
There was a problem hiding this comment.
looks like the current implementation is bounded to k=1? Any implementation challenges you can foresee if we move to k > 1.
There was a problem hiding this comment.
In fact, I think the control-flow conversion, as implemented here, should be generalizable to k > 1. The piece that would need to be updated is the conversion pattern for the quantum.extract op, which currently assumes k = 1. The tests still use k = 1 because the pass itself still raises an error when given k != 1 🙂
There was a problem hiding this comment.
But of course we'd need to verify once we start working on support for k > 1!
There was a problem hiding this comment.
Should be lots of fun for k>1 , would like to know more about that later. Feel free to tag me to take a look
Context: In order to support more general input programs in the experimental QEC compilation pipeline, we must add support for control-flow operations.
Description of the Change: This PR adds support for
forloops (viascf.forops) in theconvert-quantum-to-qeclpass. For example, an input program such asis lowered to
Support for
scf.forops that return!quantum.regvalues, and a mix of quantum and classical types, has also been added.[sc-120266]