gh-109329: Count tier2 miss opcodes#110561
Merged
gvanrossum merged 4 commits intopython:mainfrom Oct 31, 2023
Merged
Conversation
22212fb to
a08a127
Compare
Member
|
Looks like a useful feature. Do you have example output for this? |
gvanrossum
approved these changes
Oct 30, 2023
Member
gvanrossum
left a comment
There was a problem hiding this comment.
Mark put in a question, I can merge once you've answered that.
| #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) |
Member
There was a problem hiding this comment.
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.
Contributor
Author
Here's an example from the raytrace benchmark:
|
FullteaR
pushed a commit
to FullteaR/cpython
that referenced
this pull request
Nov 3, 2023
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pyscript 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.