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

Expand instruction_supported() to optionally check parameters #7807

Merged
merged 17 commits into from
Jun 22, 2022

Conversation

mtreinish
Copy link
Member

Summary

This commit expands the recently added instruction_supported() method of
the Target class to also enable optionally checking if a parameter on an
instruction is supported. This is anticipating future changes around how
instruction parameters are represented in terra more generally as part
of #7624 and specifically in the Target for #7797. Before we do any
refactoring around this having a standard API for checking if a
parameter is supported is useful. This commit expands the interface for
the insturction_supported() method to check any combination of
operation name, qargs, operation class, or parameters (either operation
name or class is required) and the method will return True if that
instruction can be run on the Target device.

Details and comments

This commit expands the recently added instruction_supported() method of
the Target class to also enable optionally checking if a parameter on an
instruction is supported. This is anticipating future changes around how
instruction parameters are represented in terra more generally as part
of Qiskit#7624 and specifically in the Target for Qiskit#7797. Before we do any
refactoring around this having a standard API for checking if a
parameter is supported is useful. This commit expands the interface for
the insturction_supported() method to check any combination of
operation name, qargs, operation class, or parameters (either operation
name or class is required) and the method will return True if that
instruction can be run on the Target device.
@mtreinish mtreinish requested a review from a team as a code owner March 22, 2022 22:58
@mtreinish mtreinish added the Changelog: None Do not include in changelog label Mar 22, 2022
@mtreinish mtreinish added this to the 0.20 milestone Mar 22, 2022
@coveralls
Copy link

coveralls commented Mar 22, 2022

Pull Request Test Coverage Report for Build 2544541175

  • 39 of 41 (95.12%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 84.294%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/target.py 39 41 95.12%
Totals Coverage Status
Change from base Build 2544538674: 0.006%
Covered Lines: 55024
Relevant Lines: 65276

💛 - Coveralls

ajavadia
ajavadia previously approved these changes Mar 31, 2022
Copy link
Member

@ajavadia ajavadia left a comment

Choose a reason for hiding this comment

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

LGTM - just a few typos

qiskit/transpiler/target.py Outdated Show resolved Hide resolved
qiskit/transpiler/target.py Outdated Show resolved Hide resolved
qiskit/transpiler/target.py Outdated Show resolved Hide resolved
qiskit/transpiler/target.py Outdated Show resolved Hide resolved
qiskit/transpiler/target.py Outdated Show resolved Hide resolved
test/python/transpiler/test_target.py Outdated Show resolved Hide resolved
qiskit/transpiler/target.py Outdated Show resolved Hide resolved
qiskit/transpiler/target.py Outdated Show resolved Hide resolved
@mtreinish mtreinish added Changelog: New Feature Include in the "Added" section of the changelog and removed Changelog: None Do not include in changelog labels Jun 7, 2022
@mtreinish
Copy link
Member Author

I need to add a release note now since instruction_supported() was initially added in 0.20.0 this PR now is adding new functionality on top of that API now. I'll do that in a little while.

@jakelishman jakelishman self-assigned this Jun 21, 2022
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

This looks fine to me. You commented before you wanted to add a supplemental feature release note - if you add that, we're good to merge, I think.

@mtreinish
Copy link
Member Author

Oops my bad I left the comment to remind myself and forgot to circle back and add the release note. I just pushed it up in 2777b1f

@mergify mergify bot merged commit 5d93d8a into Qiskit:main Jun 22, 2022
@mtreinish mtreinish deleted the expand-target-instruction-supported branch May 15, 2024 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants