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

Remove _t_complexity_ #1377

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Remove _t_complexity_ #1377

merged 3 commits into from
Oct 15, 2024

Conversation

mpharrigan
Copy link
Collaborator

@mpharrigan mpharrigan commented Sep 3, 2024

Final part of #1251

This PR removes the legacy _t_complexity_ override from all bloqs. These were already redundant: during development of previous PRs I had removed use of these anyways. Those PRs did careful accounting of all bloq_example and unit test t complexity values and made sure they matched the QECGatesCost values (with some small, contained legacy shims). This PR shows that off!

See my inline comments, but I left in a getattrs-based shim so that the _t_complexity_ override will still be used if QECGatesCost() is in legacy mode. The only thing left in qualtran that uses it is a specific unit test I added to test it.

Comment on lines 291 to 310
if self.legacy_shims:
legacy_val = bloq._t_complexity_()
if legacy_val is not NotImplemented:
warnings.warn(
"Please migrate explicit cost annotations to the general "
"`Bloq.my_static_costs` method override.",
DeprecationWarning,
)
return GateCounts(
t=legacy_val.t, clifford=legacy_val.clifford, rotation=legacy_val.rotations
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please see that all tests pass without this shim; but I think I'll put this back in (using getattr(bloq, '_t_complexity_', None) for a bit of backwards compatibility support

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Latest commit puts this back in

@mpharrigan mpharrigan added this to the v1.0 milestone Oct 10, 2024
@mpharrigan mpharrigan marked this pull request as ready for review October 11, 2024 18:16
@mpharrigan
Copy link
Collaborator Author

End of an era! ptal @tanujkhattar

@mpharrigan mpharrigan merged commit 801bee5 into quantumlib:main Oct 15, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants