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

Transpiler integration refactor and qiskit v1.2 support #116

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

Aerylia
Copy link
Contributor

@Aerylia Aerylia commented Sep 5, 2024

Minimal refactor of transpile_to_IQM to support qiskit v1.2.
Part of COMP-1361

Task list:

  • Remove the use of Qiskit's BackendProperties
  • Update tox and pyproject files for the new version
  • Create a fake and a real backend in IQMBackendBase to use instead of BackenProperties
  • Fix the transpile layout preservation in transpile_to_IQM. It is currently ignored. SW-601 and IQMCS-159
  • Add unittests to check if the layout is properly preserved.
  • Add the option to restrict transpilation to a set of connected qubits
  • Update documentation
  • Check e2e tests
  • Discuss version bump. There is a major backward compatible workflow change (native Qiskit transpile integration) and a small breaking API change for the IQMBackend, so major release it is.

Other changes:

  • Refactored create_run_request to improve the experience when using different run options, by making them explicit arguments that our documentation can refer to
  • Updated the user guide to refer to the create_run_request documentation to avoid out-dated duplicated information.
  • Adjusted qubit_name_to_idx and idx_to_qubit_name in IQMBackendBase to no longer return Optional, but raise an error when the name or index cannot be found. This improved mypy and pylint issues as well as user experience since these functions should never be called in a way that it would return None.
  • Native transpiler integration
  • Addition of transpiler plugins
  • Deneb bugfix.

@Aerylia Aerylia requested a review from smite September 5, 2024 12:16
@Aerylia Aerylia requested a review from kukushechkin October 15, 2024 11:50
@Aerylia
Copy link
Contributor Author

Aerylia commented Nov 1, 2024

I pushed my changes in case someone wants to pick it up next week. I'll be back on the 12th. The main framework is set up, but the tests are currently failing because of some stupid bugs that are hard to find:

  • The backend.coupling_map is not set anymore for some reason
  • The transpiler gets into an infinite loop for some reason
  • Some circuits are no longer valid for some reason.

@Aerylia Aerylia changed the title Minimal changes to support qiskit v1.2 Transpiler integration refactor and qiskit v1.2 support Dec 10, 2024
@Aerylia Aerylia marked this pull request as ready for review December 10, 2024 15:18
tox.ini Show resolved Hide resolved
CHANGELOG.rst Outdated Show resolved Hide resolved
CHANGELOG.rst Outdated
* Refactoring of the Qiskit transpiler:
* The Qiskit transpiler now automatically uses the :class:`IQMOptimizeSingleQubitGates` pass to optimize single-qubit gates if the `optimization_level >= 0`.
* You can now use the native Qiskit :meth:`transpile` method to transpile a circuit to the IQM Deneb backend as long as your circuit does not contain any resonators.
* There are many new transpiler plugins available that you can use as the `scheduling_method` argument in Qiskit's :meth:`transpile` method. You can find them in following the `Qiskit documentation <https://docs.quantum.ibm.com/guides/transpiler-plugins>`_.
Copy link
Member

Choose a reason for hiding this comment

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

Only scheduling_method? What about the other *_method args?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The plugins are only registered as scheduling_method because they make assumptions about how much the circuit has been transpiled already. You can still combine them with the other transpiler args.
You could make our own optimization plugin or routing plugin, but that would be exposed to the user as a string making them overwrite the existing transpiler and making it impossible to augment it with an existing pass. So they would need to defined with an existing optimization/routing pass and we need a new class for each or combination of passes we want to support. That's not maintainable.

Comment on lines +112 to +113
sorted(arch.qubits, key=_component_sort_key)
+ sorted(arch.computational_resonators, key=_component_sort_key)
Copy link
Member

Choose a reason for hiding this comment

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

These are already sorted in the DQA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You sure? The sorting was already there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an old unittests that checks if the qubits names are properly sorted. i.e. tests/test_iqm_backend_base.py:test_qubit_name_to_index_to_qubit_name

Comment on lines +132 to +134
def has_resonators(self) -> bool:
"""Return whether the backend has resonators."""
return bool(self.architecture.computational_resonators)
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed? Can't the user just look at backend.architecture?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They need to know that they can find it there. That's quite some archeology

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

Successfully merging this pull request may close these issues.

2 participants