Skip to content

Add conversion for magic-state subroutines back to quantum dialect#2895

Merged
lillian542 merged 96 commits into
mainfrom
lillian542/qecp_to_quantum_t
Jun 6, 2026
Merged

Add conversion for magic-state subroutines back to quantum dialect#2895
lillian542 merged 96 commits into
mainfrom
lillian542/qecp_to_quantum_t

Conversation

@lillian542
Copy link
Copy Markdown
Contributor

@lillian542 lillian542 commented May 29, 2026

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 quantum dialect for execution. These are:

  • allocate_cb: to create an additional auxiliary codeblock that we can put in the magic state
  • deallocate_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 codeblock

Description of the Change:

We add lowering for:

  • allocate_cb: translates to allocating a quantum register of size n
  • deallocate_cb: translates to deallocating a quantum register
  • t: translates to quantum.custom "T"

We add integration tests to confirm that this and previous PRs for apply_T and fabricate_magic_state allow 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

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.94%. Comparing base (454ded8) to head (7c66489).

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.
📢 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.

Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
@lillian542 lillian542 changed the title [WIP] Add conversion for magic-state subroutines back to quantum dialect Add conversion for magic-state subroutines back to quantum dialect Jun 4, 2026
Copy link
Copy Markdown
Member

@multiphaseCFD multiphaseCFD left a comment

Choose a reason for hiding this comment

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

Thanks @lillian542 ! Nice one

Copy link
Copy Markdown
Contributor

@joeycarter joeycarter left a comment

Choose a reason for hiding this comment

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

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>
Base automatically changed from lillian542/qecp_t_lowering to main June 5, 2026 23:15
@lillian542 lillian542 merged commit 55f12dd into main Jun 6, 2026
38 checks passed
@lillian542 lillian542 deleted the lillian542/qecp_to_quantum_t branch June 6, 2026 00:00
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.

3 participants