Skip to content

gh-117457: Correct pystats uop "miss" counts#117477

Merged
brandtbucher merged 1 commit intopython:mainfrom
mdboom:tier2-pystats-misses
Apr 4, 2024
Merged

gh-117457: Correct pystats uop "miss" counts#117477
brandtbucher merged 1 commit intopython:mainfrom
mdboom:tier2-pystats-misses

Conversation

@mdboom
Copy link
Copy Markdown
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.

Comment thread Tools/jit/template.c
Copy link
Copy Markdown
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
Copy Markdown
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
Copy link
Copy Markdown
Contributor Author

mdboom commented Apr 3, 2024

@mdboom mdboom requested a review from brandtbucher April 4, 2024 16:26
@brandtbucher brandtbucher merged commit 0edde64 into python:main Apr 4, 2024
@erlend-aasland
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@erlend-aasland
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

4 participants