Skip to content

Fix lightcone pass mid circuit measurements#16046

Open
CosminDinuThiery wants to merge 9 commits intoQiskit:mainfrom
CosminDinuThiery:fix/lightcone-mid-circuit-measurements
Open

Fix lightcone pass mid circuit measurements#16046
CosminDinuThiery wants to merge 9 commits intoQiskit:mainfrom
CosminDinuThiery:fix/lightcone-mid-circuit-measurements

Conversation

@CosminDinuThiery
Copy link
Copy Markdown
Contributor

Summary

Fixes #15937. The LightCone pass was using calc_final_ops to find measured qubits, which
only detects final measurements and ignored mid-circuits.

  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

Details and comments

I removed _find_measurement_qubits and replaced it with detection of standard and PauliProductMeasurement gates during the reverse-topological traversal, as suggested in the issue.

Also, _measurement_commutation_ops accesses private attributes _pauli_z and _pauli_x of PauliProductMeasurement

AI/LLM disclosure

  • [ YES] I didn't use LLM tooling, or only used it privately.
  • [NO] I used the following tool to help write this PR description:
  • [ NO] I used the following tool to generate or modify code:

@CosminDinuThiery CosminDinuThiery requested a review from a team as a code owner April 16, 2026 04:21
@Cryoris
Copy link
Copy Markdown
Collaborator

Cryoris commented Apr 16, 2026

Thanks for the contribution! The approach looks good here, though we need more testing here, mainly to cover 2 newly unlocked cases:

  • circuits with PauliProductMeasurements (especially multi-qubit ones) -- here I'd suggest to use a circuit that only contains PauliProductRotationGates and PauliProductMeasurements
  • circuits with mid-circuit and final measurements

We can't backport this PR since it adds the Pauli product handling as new feature. Would you mind splitting this PR into two, where (1) handles mid-circuit measurements only (this we can backport as fix), and (2) adds Pauli-product support (this is a new feature).

@Cryoris Cryoris self-assigned this Apr 16, 2026
@CosminDinuThiery
Copy link
Copy Markdown
Contributor Author

Alright, I will take care of that by tomorrow, thank you for the review!

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.

LightCone pass incorrectly simplifies circuits with mid-circuit measurements

2 participants