Skip to content

Conversation

@mnfarooqi
Copy link
Collaborator

Add the following new instruction to support new backends

  • swap
  • reset

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for two new quantum instructions (swap and reset) to enable compatibility with new backends. The version is bumped from 0.2.0 to 0.2.1 to reflect this enhancement.

  • Adds Reset and SwapGate imports from Qiskit
  • Implements handler functions for both new instructions following existing patterns
  • Updates the instruction map to include the new instructions

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
pyproject.toml Increments version from 0.2.0 to 0.2.1 for the patch release
mqss/qiskit_adapter/mqss_resources.py Adds Reset and SwapGate imports, implements their handler functions, and registers them in the instruction_map

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mnfarooqi mnfarooqi requested a review from Bmete7 November 26, 2025 08:59
Copy link
Collaborator

@Bmete7 Bmete7 left a comment

Choose a reason for hiding this comment

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

The warning for reset instruction no longer exists, and jobs succeed without any issues. However:
test/test_backend.py::TestMQSSQiskitBackend::test_run_job_qasm3 Warning: Instruction 'if_else' not found in the instruction_map.

Should we add this as well?

@mnfarooqi
Copy link
Collaborator Author

The warning for reset instruction no longer exists, and jobs succeed without any issues. However: test/test_backend.py::TestMQSSQiskitBackend::test_run_job_qasm3 Warning: Instruction 'if_else' not found in the instruction_map.

Should we add this as well?

I could not find if_else instruction/gate in Qiskit.
Do you happen to have any link to the corresponding gate in Qiskit Documentation?

@Bmete7
Copy link
Collaborator

Bmete7 commented Dec 2, 2025

I think there are two options:

circuit.append(MidCircuitMeasure(), [q0], [c0])

or

with circuit.if_test((c0, 1)):
    circuit.x(q0)

Here are more detailed explanations on here:
https://quantum.cloud.ibm.com/docs/en/guides/classical-feedforward-and-control-flow

I think overall, the instruction is called if_test.
It apparently modifies the context manager, such that both operations (if, and else part, if else exists) are added to the quantum circuit

@burgholzer
Copy link

You might want to look at the IfElseOp docs as well: https://quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.circuit.IfElseOp
That's the canonical operation being generated from the if_test function.

@mnfarooqi
Copy link
Collaborator Author

Thank you @burgholzer and @Bmete7 for the links.

I will add it and see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants