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
YJIT: Avoid undercounting retired_in_yjit #8038
Conversation
Going to the dentist but I would like to read through this a bit more carefully when I am back. Please wait before merging. |
I feel a bit uncomfortable about this because we need to be really careful with how we do the accounting for those metrics and be very clear about what they mean exactly. It's really important because this affects how we compute percentage in YJIT, which is our number one key metric.
AFAIK we're already counting the operations that cause YJIT to exit as part of You want to differentiate specifically for exits due to unsupported instructions? If so, maybe a more descriptive name, like
The thing that has me worried here is that in the case of
I think I like the previous metric, |
Oops, you're right. I thought the
I understood you do want to distinguish (1) and (2) in the counters. To me, they're essentially the same thing and in fact they should be generating the same code in the first place (for performance, (2) should immediately bail because it never successfully retires), but it's not the scope of this PR. The problem I see in the current implementation is that I thought it's simpler and more intuitive to simply include (1) in |
e8a6246
to
9671be7
Compare
An exit is left in place in both (1) and (2) (see around line 884). The exit increments By the way I think the variable is mis-named in |
I quote the original definition of (1) and (2) here since I already modified the description.
You're right that we're not overcounting. But my point is that we're undercounting because (1) is not in |
Updated the patch and the PR description. |
9671be7
to
f208cd7
Compare
f208cd7
to
dc38104
Compare
Still not really liking the change from Maybe just a patch to introduce an |
I think we should hoist out the
Without any changes, the counter already include immediate bails, in cases like the following, where
We do end up with code that exits right away, exactly the same as when there is no codegen function. But we increment |
If you think yjit_insns_count is less intuitive, can we just call it exec_instructions on stats_string as well? I only want to avoid using two different names for the same thing. |
You're saying if we bail out early (codegen function exits, but it bails), then we report a lower value than we should for Isn't the value for |
That case is accurate. The inaccuracy comes from the no codegen function case. There is an increment to the exit count, but no corresponding increment to Lines 852 to 856 in 7f2bd17
|
02c52ca
to
6610a88
Compare
6610a88
to
0f50f13
Compare
I updated the patch to reflect what two of you seem to want. |
This PR fixes an undercount problem of
retired_in_yjit
.Currently, we don't count the number of YARV instructions that YJIT doesn't support. Specifically, it's when
get_gen_fn
returnsNone
(formerCantCompile
). This PR hoists out theexec_instructions
counter to avoid the undercount.Also, because there's naming inconsistency between
yjit_insns_count
andexec_instruction
while they're just the same thing, I unified them toexec_instruction
.