Skip to content

Fix: Skip UnitaryGate instances during BasisTranslator#15916

Open
raynelfss wants to merge 3 commits intoQiskit:mainfrom
raynelfss:fix-basis-once-again
Open

Fix: Skip UnitaryGate instances during BasisTranslator#15916
raynelfss wants to merge 3 commits intoQiskit:mainfrom
raynelfss:fix-basis-once-again

Conversation

@raynelfss
Copy link
Copy Markdown
Contributor

Summary

Fixes #15278
Fixes #15733

  • This aims to fix a well known bug introduced by Make BasisTranslator rust-native. #14659 in which the AerSimulator is known to define UnitaryGate as part of its target basis. However, BasisTranslator should not include UnitaryGate as part of its calculations, it should instead be handled by UnitarySynthesis.
  • To fix this, BasisTranslator skips any UnitaryGate in the circuit by filtering its op_nodes to check for any UnitaryGate instances.

Details and comments

The only question left is whether we should still have the panic condition in name_to_packed_operation because this check is done on a name basis rather than instance.

…slator`.

- A well known bug introduced by Qiskit#14659 in which the `AerSimulator` is known to define `UnitaryGate` as part of its target basis. However, `BasisTranslator` should not include `UnitaryGate` as part of its calculations, it should instead be handled by `UnitarySynthesis`.
- To fix this, `BasisTranslator` skips any `UnitaryGate` in the circuit by filtering its `op_nodes` to check for any `UnitaryGate` instances.
- The only question left is whether we should still have the panic condition in `name_to_packed_operation` because this check is done on a name basis rather than instance.
@raynelfss raynelfss added this to the 2.4.0 milestone Mar 30, 2026
@raynelfss raynelfss requested a review from a team as a code owner March 30, 2026 18:47
@raynelfss raynelfss added bug Something isn't working stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge. Rust This PR or issue is related to Rust code in the repository mod: transpiler Issues and PRs related to Transpiler labels Mar 30, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@raynelfss
Copy link
Copy Markdown
Contributor Author

The only question left is whether we should still have the panic condition in name_to_packed_operation because this check is done on a name basis rather than instance.

I'd like to bring this up again, in case it is a genuine concern. Since most of this fix might be superseded by #15684, we won't need to even go through Python in the future.

@raynelfss raynelfss changed the title Fix: Skip UnitaryGate instances during BasisTraslator Fix: Skip UnitaryGate instances during BasisTranslator Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mod: transpiler Issues and PRs related to Transpiler Rust This PR or issue is related to Rust code in the repository stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge.

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

Rust panic during transpiler basis_translator pass pyo3_runtime.PanicException raised for simple circuit execution

2 participants