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

GH-113710: Improve _SET_IP and _CHECK_VALIDITY #115248

Merged
merged 9 commits into from
Feb 13, 2024

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Feb 10, 2024

  • Changes _SET_IP to take the pointer as its operand, saving a couple of machine instructions
  • Creates a _CHECK_VALIDITY_AND_SET_IP "super micro op"
  • Slightly improves the logic for eliminating _SET_IP and _CHECK_VALIDITY.

The _CHECK_VALIDITY_AND_SET_IP "super micro op" isn't that useful at runtime as _SET_IP is needed before an escaping instruction, and _CHECK_VALIDITY is needed after an escaping instruction, so they tend to be independent.
However, it means that half of the uop buffer is useful instructions rather than a third.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

LG!

@markshannon
Copy link
Member Author

Stats and performance show a ~2% speedup (which seems high, so is probably mostly noise) but some meaningful improvement in the stats:

  • "Trace too long" is reduced by ~90%
  • There is a very small reduction in uops executed as the longer traces is more than cancelled out the ~1.5 billion reduction in uops from combining _SET_IP and _CHECK_VALIDITY.
  • There is a small ~0.5% reduction in tier 1 instructions executed.

@mdboom
Copy link
Contributor

mdboom commented Feb 12, 2024

Stats and performance show a ~2% speedup (which seems high, so is probably mostly noise)

Yes, and the HPT result confirms your hunch that it's mostly noise: 1.00x faster at 99th %ile

@markshannon markshannon enabled auto-merge (squash) February 13, 2024 15:33
@markshannon markshannon merged commit 681778c into python:main Feb 13, 2024
49 checks passed
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
@markshannon markshannon deleted the better-set-ip-check-valid branch August 6, 2024 10:17
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.

3 participants