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

Run truncation after resolving parameters #1428

Merged

Conversation

hhorii
Copy link
Collaborator

@hhorii hhorii commented Jan 17, 2022

Summary

Resolve #1427.

Details and comments

Perform truncation after resolving parameters.
This solution is not optimal but acceptable. Truncation for all sets of parameters results the same. Ideally, one truncation for all the sets of parameters.
However, truncation can change indices of instructions in parameter map and mapping instruction indices of before- and after-truncation needs codes.

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This should have a test to validate this works after the fix.

@chriseclectic chriseclectic added Changelog: Bugfix Include in the Fixed section of the changelog stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable labels Jan 18, 2022
@hhorii hhorii force-pushed the resolve_parameters_before_truncation branch from a23d976 to 26825df Compare January 19, 2022 04:26
@hhorii hhorii force-pushed the resolve_parameters_before_truncation branch 4 times, most recently from 4246739 to 4846c44 Compare January 24, 2022 16:03
Since 0.9.0, Aer reduces qubits and their instructions if they do not affect measured qubits.
On the other hand, parameterized QObj contains indices of instructions and their values.
Previously these values are set to instructions of a circuit after running truncation,
which may reduce some of instructions. Consequently, indices of parameterized QObj may address
wrong instructions in a truncated cicuit.

This fix changes the order of processing of truncation and parameterization: First, Aer
resolves paramers, and then runs truncation.
@hhorii hhorii force-pushed the resolve_parameters_before_truncation branch from 4846c44 to 47f2765 Compare January 27, 2022 21:03
@hhorii hhorii added this to the Aer 0.10.3 milestone Feb 2, 2022
@jakelishman jakelishman changed the title run truncation after resolving parameters Run truncation after resolving parameters Feb 4, 2022
@jakelishman jakelishman merged commit 917c194 into Qiskit:main Feb 4, 2022
hhorii added a commit that referenced this pull request Feb 9, 2022
* run truncation after resolving parameters

Since 0.9.0, Aer reduces qubits and their instructions if they do not affect measured qubits.
On the other hand, parameterized QObj contains indices of instructions and their values.
Previously these values are set to instructions of a circuit after running truncation,
which may reduce some of instructions. Consequently, indices of parameterized QObj may address
wrong instructions in a truncated cicuit.

This fix changes the order of processing of truncation and parameterization: First, Aer
resolves paramers, and then runs truncation.

* Reword release note

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
hhorii added a commit to hhorii/qiskit-aer that referenced this pull request Feb 9, 2022
* run truncation after resolving parameters

Since 0.9.0, Aer reduces qubits and their instructions if they do not affect measured qubits.
On the other hand, parameterized QObj contains indices of instructions and their values.
Previously these values are set to instructions of a circuit after running truncation,
which may reduce some of instructions. Consequently, indices of parameterized QObj may address
wrong instructions in a truncated cicuit.

This fix changes the order of processing of truncation and parameterization: First, Aer
resolves paramers, and then runs truncation.

* Reword release note

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the Fixed section of the changelog stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

instruction param position out of range when truncation is processed
4 participants