✨ Add Constant Propagation#1845
Draft
LiRem101 wants to merge 149 commits into
Draft
Conversation
…e into mlir/hadamard-lifting
…ore into mlir/constant-propagation
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.
Description
This PR introduces the optimization pass constant propagation. It propagates the state of a quantum machine through a circuit and optimizes the applied gates with respect to the current state. Namely, it removes controlling qubits, exchanges controlling qubits with controlling classical values and removes phase gates which only introduce a global phase. The optimization routine is based on this paper, accepted at QSW 2026.
I suggest having constant propagation switched to off on default, because it assumes that all states are initial zero, can take quite a while and can create dynamic circuits, which might not be everyone's goal.
GPT-4 and GPT-5 have been used for refactoring and for first drafts of code. No Gen AI was integrated in the used IDE.
Fixes #(1387)
Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.