-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
gh-109329: Count tier2 miss opcodes #110561
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
Conversation
22212fb
to
a08a127
Compare
Looks like a useful feature. Do you have example output for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark put in a question, I can merge once you've answered that.
@@ -283,7 +283,7 @@ extern int _PyStaticCode_Init(PyCodeObject *co); | |||
do { if (_Py_stats && PyFunction_Check(callable)) _Py_stats->call_stats.eval_calls[name]++; } while (0) | |||
#define GC_STAT_ADD(gen, name, n) do { if (_Py_stats) _Py_stats->gc_stats[(gen)].name += (n); } while (0) | |||
#define OPT_STAT_INC(name) do { if (_Py_stats) _Py_stats->optimization_stats.name++; } while (0) | |||
#define UOP_EXE_INC(opname) do { if (_Py_stats) _Py_stats->optimization_stats.opcode[opname].execution_count++; } while (0) | |||
#define UOP_STAT_INC(opname, name) do { if (_Py_stats) { assert(opname < 512); _Py_stats->optimization_stats.opcode[opname].name++; } } while (0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have named this arg opcode
(or OPCODE
, per recent Discourse thread), since to me opname
is a variable of type char *
giving the opcode's name; opcode
is the (named) constant representing the opcode, which it is. (I did a small double take when I saw assert(opname < 512)
. :-) But it's too late, and opname
is used in several places above as well, so let's keep it this way.
Here's an example from the raytrace benchmark:
|
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
This records the number of times a specific uop causes a DEOPT (in the same way this is already done for Tier 1). The
summarize_stats.py
script already supports the display, by virtue of reusing the code from Tier 1.Marked as draft because it is necessarily built on #110398 which should be merged first.