Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Enable id->delay translation on all backends#468

Merged
kt474 merged 6 commits into
Qiskit:mainfrom
mtreinish:translate-id-by-default
Jan 29, 2023
Merged

Enable id->delay translation on all backends#468
kt474 merged 6 commits into
Qiskit:mainfrom
mtreinish:translate-id-by-default

Conversation

@mtreinish
Copy link
Copy Markdown
Member

Summary

The use of id as a gate equivalent to the single qubit gate delay on IBM backends has been deprecated for > 1 yr. As new backends are being released that do not support using id in this manner anymore we should be translating the id for IBM backends to the delay during transpilation otherwise users who manually insert id into their circuit on new backends without id as a supported gate will get a error. Additionally, Qiskit 0.23.0 will likely change the definition of IGate to be a typical identity which will be optimized away (or translated to Rz(0) if no optimization is specified) which will break user assumptions if they were manually using Id as a single qubit gate delay.

This commit enables default translation during transpile() by creating a separate translation stage plugin which is the default basis translation with the ConvertIdToDelay prepended to it. This plugin is then set as the default with the IBMBackend class using the backend default stage plugin hook points which override the default stage plugin to use during transplation when targeting the backend. This means if a user runs transpile() targeting an IBMBackend object on a cirucit that contains id gate it will be translated to delay as part of that process.

Details and comments

The use of id as a gate equivalent to the single qubit gate delay on IBM
backends has been deprecated for > 1 yr. As new backends are being
released that do not support using id in this manner anymore we should
be translating the id for IBM backends to the delay during transpilation
otherwise users who manually insert id into their circuit on new backends
without id as a supported gate will get a error. Additionally, Qiskit
0.23.0 will likely change the definition of IGate to be a typical
identity which will be optimized away (or translated to Rz(0) if no
optimization is specified) which will break user assumptions if they
were manually using Id as a single qubit gate delay.

This commit enables default translation during transpile() by creating a
separate translation stage plugin which is the default basis translation
with the ConvertIdToDelay prepended to it. This plugin is then set as the
default with the IBMBackend class using the backend default stage plugin
hook points which override the default stage plugin to use during
transplation when targeting the backend. This means if a user runs
transpile() targeting an IBMBackend object on a cirucit that contains id
gate it will be translated to delay as part of that process.
@mtreinish
Copy link
Copy Markdown
Member Author

The docs failure will be fixed by #469

@mtreinish mtreinish requested a review from taalexander December 9, 2022 15:43
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 19, 2022

Pull Request Test Coverage Report for Build 3823921282

  • 6 of 13 (46.15%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 50.131%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_provider/ibm_backend.py 1 2 50.0%
qiskit_ibm_provider/transpiler/plugin.py 3 9 33.33%
Files with Coverage Reduction New Missed Lines %
qiskit_ibm_provider/ibm_backend.py 1 59.31%
Totals Coverage Status
Change from base Build 3789927635: -0.02%
Covered Lines: 2871
Relevant Lines: 5727

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@taalexander taalexander left a comment

Choose a reason for hiding this comment

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

LGTM

@kt474 kt474 merged commit e332bf6 into Qiskit:main Jan 29, 2023
@kt474 kt474 mentioned this pull request Feb 1, 2023
@kt474 kt474 added this to the 0.2.0 milestone Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants