Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch all multi target uncontrolled gates #214

Merged
merged 6 commits into from
Dec 11, 2024

Conversation

splch
Copy link
Collaborator

@splch splch commented Dec 10, 2024

Summary

instead of checking against a tuple, check the quality of the gate

Details and comments

if the gate has multiple targets and no control qubits

@@ -244,7 +236,7 @@ def qiskit_circ_to_ionq_circ(
converted["gate"] = instruction_name

# Make sure uncontrolled multi-targets use all qargs.
if isinstance(instruction, multi_target_uncontrolled_gates):
if instruction.num_qubits > 1 and not hasattr(instruction, "num_ctrl_qubits"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

is num_qubits guaranteed to be set?

I don't quite understand why we are changing this and not

if instruction_name not in GATESET_MAP[gateset]:
raise ionq_exceptions.IonQGateError(instruction_name, gateset)
based on the gates you've seen issues with?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Spoke offline: main issue is that where I linked we check gate name, and here we are checking python classes, which might not match in the case of QASM/etc

WDYT about changing to the values from GATESET_MAP that we know should have multiple controls?

This LGTM assuming the num_qubits attribute must exist, if it might not I would change to getattr(instruction, "num_qubits", 0)

@@ -244,7 +236,7 @@ def qiskit_circ_to_ionq_circ(
converted["gate"] = instruction_name

# Make sure uncontrolled multi-targets use all qargs.
if isinstance(instruction, multi_target_uncontrolled_gates):
if instruction.num_qubits > 1 and not hasattr(instruction, "num_ctrl_qubits"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Spoke offline: main issue is that where I linked we check gate name, and here we are checking python classes, which might not match in the case of QASM/etc

WDYT about changing to the values from GATESET_MAP that we know should have multiple controls?

This LGTM assuming the num_qubits attribute must exist, if it might not I would change to getattr(instruction, "num_qubits", 0)

@splch splch merged commit 3f35b49 into main Dec 11, 2024
19 checks passed
@splch splch deleted the multi-target-uncontrolled-gates branch December 11, 2024 20:07
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.

2 participants