Add conversion for magic-state subroutines back to quantum dialect#2895
Merged
Conversation
Co-authored-by: Joey Carter <joey.snarrcarter@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2895 +/- ##
==========================================
+ Coverage 96.91% 96.94% +0.02%
==========================================
Files 166 166
Lines 19056 19067 +11
Branches 1760 1760
==========================================
+ Hits 18469 18485 +16
+ Misses 434 430 -4
+ Partials 153 152 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
lillian542
commented
Jun 4, 2026
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
multiphaseCFD
approved these changes
Jun 5, 2026
Member
multiphaseCFD
left a comment
There was a problem hiding this comment.
Thanks @lillian542 ! Nice one
joeycarter
approved these changes
Jun 5, 2026
Contributor
joeycarter
left a comment
There was a problem hiding this comment.
Nice! I only had a couple of minor comments, happy to approve. 💯
…p_to_quantum.py Co-authored-by: Joey Carter <joseph.carter@xanadu.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context:
We have 3 ops that we add to the IR for creating and using magic states that need to be translated back to the
quantumdialect for execution. These are:allocate_cb: to create an additional auxiliary codeblock that we can put in the magic statedeallocate_cb: to deallocate the data codeblock after the entanglement and measurement protocol teleports the data to the allocated auxiliary codeblock (new data codeblock)t: used on a single physical qubit in the subroutine for generating a magic state on the auxiliary codeblockDescription of the Change:
We add lowering for:
allocate_cb: translates to allocating a quantum register of sizendeallocate_cb: translates to deallocating a quantum registert: translates toquantum.custom "T"We add integration tests to confirm that this and previous PRs for
apply_Tandfabricate_magic_stateallow us to apply T gates in the Steane code as expected.Benefits:
We can execute circuits with T-gates using the Steane code
We have the pieces in place to lower other protocols fabricating and using magic states, like pi/8 PPMs