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-117457: Correct pystats uop "miss" counts #117477

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

mdboom
Copy link
Contributor

@mdboom mdboom commented Apr 2, 2024

These were "broken" after trace stitching because only "_DEOPT" and "_SIDE_EXIT" opcodes were being counted, rather than the instruction that jumped there.

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Looks good! Do you have an example of the new stats?

@brandtbucher brandtbucher self-assigned this Apr 2, 2024
@mdboom
Copy link
Contributor Author

mdboom commented Apr 2, 2024

Looks good! Do you have an example of the new stats?

I'll run the whole thing on our infra (just to confirm it works there) and then post here.

@mdboom mdboom requested a review from brandtbucher April 4, 2024 16:26
@brandtbucher brandtbucher merged commit 0edde64 into python:main Apr 4, 2024
63 checks passed
@erlend-aasland
Copy link
Contributor

erlend-aasland commented Apr 5, 2024

I now get a complaint regarding generated files on my PRs. Did you forget to make regen-all?

Here's what I get if I do make regen-all on current main (HEAD at 9c1dfe2):

diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 9c6e42a1a8..a3447da004 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -3984,8 +3984,14 @@
         case _CHECK_STACK_SPACE_OPERAND: {
             uint32_t framesize = (uint32_t)CURRENT_OPERAND();
             assert(framesize <= INT_MAX);
-            if (!_PyThreadState_HasStackSpace(tstate, framesize)) JUMP_TO_JUMP_TARGET();
-            if (tstate->py_recursion_remaining <= 1) JUMP_TO_JUMP_TARGET();
+            if (!_PyThreadState_HasStackSpace(tstate, framesize)) {
+                UOP_STAT_INC(uopcode, miss);
+                JUMP_TO_JUMP_TARGET();
+            }
+            if (tstate->py_recursion_remaining <= 1) {
+                UOP_STAT_INC(uopcode, miss);
+                JUMP_TO_JUMP_TARGET();
+            }
             break;
         }
 

PR:

erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Apr 5, 2024
@gvanrossum
Copy link
Member

I'm surprised this didn't fail a CI test.

@erlend-aasland
Copy link
Contributor

I'm surprised this didn't fail a CI test.

Yes. IIRC, similar things have happened before, and I think we have an open issue for it.

@mdboom
Copy link
Contributor Author

mdboom commented Apr 5, 2024

I'm surprised this didn't fail a CI test.

Yes. IIRC, similar things have happened before, and I think we have an open issue for it.

I imagine it's something that falls through the cracks between a new opcode being added, and the merge conflict detection not picking that up in this PR.

@brandtbucher
Copy link
Member

Yeah, probably the CI for this PR ran on an older merge commit, then somebody pushed something that didn't conflict at the source level but changes after regen. (Exactly the sort of thing merge queues are meant to solve!)

Thanks for the fix!

diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
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.

None yet

4 participants