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

Fix tests failing against Qiskit main due to change in delay behavior #1509

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

wshanks
Copy link
Collaborator

@wshanks wshanks commented Feb 8, 2025

A long-standing bug in qpy leads to the units of delay instructions being overwritten to dt. See:

Qiskit/qiskit#10662

Some experiments test that their circuits are round-trip serializable through qpy (perhaps not as necessary as it once was as the room for sticking arbitrary Python into circuits is reduced with the move to Rust). The T1 and Tphi circuits have delays and so were affected by the qpy bug. However, there is a second bug related to delays which canceled this bug out for those tests. Delay.__eq__ does not check that the units are the same for the two delay instructions, so the loss of the original unit did not matter for the tests. Following this change:

Qiskit/qiskit#13486

Comparing circuits with delays now includes the delay units in the determination of equality. Delay.__eq__ itself still does not consider the unit but some part of adding the delay to a circuit converts it into a Rust object that does check the unit.

Here the tests are given a backend with a dt value so that the experiments will generate circuits with delays in dt and so still have delays with the same dt after the qpy roundtrip.

A long-standing bug in qpy leads to the units of delay instructions
being overwritten to `dt`. See:

Qiskit/qiskit#10662

Some experiments test that their circuits are round-trip serializable
through qpy (perhaps not as necessary as it once was as the room for
sticking arbitrary Python into circuits is reduced with the move to
Rust). The T1 and Tphi circuits have delays and so were affected by the
qpy bug. However, there is a second bug related to delays which canceled
this bug out for those tests. `Delay.__eq__` does not check that the
units are the same for the two delay instructions, so the loss of the
original unit did not matter for the tests. Following this change:

Qiskit/qiskit#13486

Comparing circuits with delays now includes the delay units in the
determination of equality. `Delay.__eq__` itself still does not consider
the unit but some part of adding the delay to a circuit converts it into
a Rust object that does check the unit.

Here the tests are given a backend with a `dt` value so that the
experiments will generate circuits with delays in `dt` and so still have
delays with the same `dt` after the qpy roundtrip.
@wshanks
Copy link
Collaborator Author

wshanks commented Feb 8, 2025

I opened Qiskit/qiskit#13812 for the delay comparison bug. It looks like there is some other unrelated bug with fake backends to address as well.

Copy link
Collaborator

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

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

It looks like there is some other unrelated bug with fake backends to address as well.

Are you referring to the bug that's solved in #1509 ?

@wshanks
Copy link
Collaborator Author

wshanks commented Feb 11, 2025

Are you referring to the bug that's solved in #1509 ?

Right, except it is #1510.

@wshanks wshanks enabled auto-merge February 11, 2025 23:07
@wshanks wshanks added this pull request to the merge queue Feb 11, 2025
Merged via the queue into qiskit-community:main with commit ad2341d Feb 11, 2025
11 checks passed
wshanks added a commit to wshanks/qiskit-experiments that referenced this pull request Feb 17, 2025
…qiskit-community#1509)

A long-standing bug in qpy leads to the units of delay instructions
being overwritten to `dt`. See:

Qiskit/qiskit#10662

Some experiments test that their circuits are round-trip serializable
through qpy (perhaps not as necessary as it once was as the room for
sticking arbitrary Python into circuits is reduced with the move to
Rust). The T1 and Tphi circuits have delays and so were affected by the
qpy bug. However, there is a second bug related to delays which canceled
this bug out for those tests. `Delay.__eq__` does not check that the
units are the same for the two delay instructions, so the loss of the
original unit did not matter for the tests. Following this change:

Qiskit/qiskit#13486

Comparing circuits with delays now includes the delay units in the
determination of equality. `Delay.__eq__` itself still does not consider
the unit but some part of adding the delay to a circuit converts it into
a Rust object that does check the unit.

Here the tests are given a backend with a `dt` value so that the
experiments will generate circuits with delays in `dt` and so still have
delays with the same `dt` after the qpy roundtrip.
@wshanks wshanks added the backport stable potential The issue or PR might be minimal and/or import enough to backport to stable label Feb 25, 2025
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
…#1509)

A long-standing bug in qpy leads to the units of delay instructions
being overwritten to `dt`. See:

Qiskit/qiskit#10662

Some experiments test that their circuits are round-trip serializable
through qpy (perhaps not as necessary as it once was as the room for
sticking arbitrary Python into circuits is reduced with the move to
Rust). The T1 and Tphi circuits have delays and so were affected by the
qpy bug. However, there is a second bug related to delays which canceled
this bug out for those tests. `Delay.__eq__` does not check that the
units are the same for the two delay instructions, so the loss of the
original unit did not matter for the tests. Following this change:

Qiskit/qiskit#13486

Comparing circuits with delays now includes the delay units in the
determination of equality. `Delay.__eq__` itself still does not consider
the unit but some part of adding the delay to a circuit converts it into
a Rust object that does check the unit.

Here the tests are given a backend with a `dt` value so that the
experiments will generate circuits with delays in `dt` and so still have
delays with the same `dt` after the qpy roundtrip.

(cherry picked from commit ad2341d)
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
…#1509)

A long-standing bug in qpy leads to the units of delay instructions
being overwritten to `dt`. See:

Qiskit/qiskit#10662

Some experiments test that their circuits are round-trip serializable
through qpy (perhaps not as necessary as it once was as the room for
sticking arbitrary Python into circuits is reduced with the move to
Rust). The T1 and Tphi circuits have delays and so were affected by the
qpy bug. However, there is a second bug related to delays which canceled
this bug out for those tests. `Delay.__eq__` does not check that the
units are the same for the two delay instructions, so the loss of the
original unit did not matter for the tests. Following this change:

Qiskit/qiskit#13486

Comparing circuits with delays now includes the delay units in the
determination of equality. `Delay.__eq__` itself still does not consider
the unit but some part of adding the delay to a circuit converts it into
a Rust object that does check the unit.

Here the tests are given a backend with a `dt` value so that the
experiments will generate circuits with delays in `dt` and so still have
delays with the same `dt` after the qpy roundtrip.

(cherry picked from commit ad2341d)
wshanks added a commit that referenced this pull request Feb 25, 2025
… (backport #1509) (#1520)

A long-standing bug in qpy leads to the units of delay instructions
being overwritten to `dt`. See:

Qiskit/qiskit#10662

Some experiments test that their circuits are round-trip serializable
through qpy (perhaps not as necessary as it once was as the room for
sticking arbitrary Python into circuits is reduced with the move to
Rust). The T1 and Tphi circuits have delays and so were affected by the
qpy bug. However, there is a second bug related to delays which canceled
this bug out for those tests. `Delay.__eq__` does not check that the
units are the same for the two delay instructions, so the loss of the
original unit did not matter for the tests. Following this change:

Qiskit/qiskit#13486

Comparing circuits with delays now includes the delay units in the
determination of equality. `Delay.__eq__` itself still does not consider
the unit but some part of adding the delay to a circuit converts it into
a Rust object that does check the unit.

Here the tests are given a backend with a `dt` value so that the
experiments will generate circuits with delays in `dt` and so still have
delays with the same `dt` after the qpy roundtrip.<hr>This is an
automatic backport of pull request #1509 done by
[Mergify](https://mergify.com).

Co-authored-by: Will Shanks <willshanks@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable 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.

2 participants