Skip to content

✨ Add Hadamard Lifting#1605

Draft
LiRem101 wants to merge 71 commits intomunich-quantum-toolkit:mainfrom
LiRem101:mlir/hadamard-lifting
Draft

✨ Add Hadamard Lifting#1605
LiRem101 wants to merge 71 commits intomunich-quantum-toolkit:mainfrom
LiRem101:mlir/hadamard-lifting

Conversation

@LiRem101
Copy link
Copy Markdown
Collaborator

@LiRem101 LiRem101 commented Apr 2, 2026

Description

This PR introduces the optimization pass Hadamard lifting.

The optimization pass lifts Hadamard gates in front of Pauli gates in order to improve the results bu measurement-lifting. The implemented liftings are:
z followed by h to h followed by x.
x followed by h to h followed by z.
y followed by h to h followed by y.

The transformation are also applied on controlled gates, provided both participating gates have the same target qubit and the same control qubits.
An exception is the z gate: The transformation exchanges the target and control qubits of a controlled z gate, if it is followed by a controlled Hadamard gate it can be swapped with afterwards.

Additionally, a transformation routine is implemented which swaps the target and control qubits of a CNOT operation (by adding four Hadamard gates before/after the target/control qubits). This is applied if a Hadamard gate is applied to the CNOT target, and afterwards the qubit is measured. The whole transformation routine is:
image

After the transformation routine, measurement-lifting can be used to lift the measurement in front of the control and to remove a costly two-qubit gate.

The paper in which the routine is published is currently under review.

Microsoft Copilot has been occasionally used to draft first versions of code, but was not integrated into an IDE.

Fixes #1386

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • I have disclosed the use of AI tools in the PR description as per our AI Usage Guidelines.
  • AI-assisted commits include an Assisted-by: [Model Name] via [Tool Name] footer.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@LiRem101 LiRem101 added the MLIR Anything related to MLIR label Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mergify mergify Bot removed the conflict label Apr 17, 2026
@mergify mergify Bot added the conflict label Apr 21, 2026
@mergify mergify Bot removed the conflict label Apr 22, 2026
@LiRem101 LiRem101 requested a review from burgholzer April 22, 2026 08:08
Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ MLIR - Add Hadamard lifting to support measurement lifting

3 participants