Skip to content

Classify specialization failures. Provides more useful stats, with lower overhead. #27701

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

Merged

Conversation

markshannon
Copy link
Member

This PR classifies specializes failures, so that we can get numbers on specialization failures.
This replaces the previous dictionary of unstructured data with an array of numbers, which can be collated using the
summarize_specialization_stats.py script.

The downside is that interpretation of the data now needs cross referencing with the list of SPEC_FAIL #defines.
IMO, being able to gather precise numerical values is easily worth that minor inconvenience.

@markshannon
Copy link
Member Author

We should definitely turn on stats for debug builds, to be able to test it.
It would also make gathering stats a bit easier.

But that's for another PR.

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

I'll miss the old way a little -- it gave me an inkling of the exact attributes of types which were failing. However, this PR will definitely make collecting overall stats waaay better and the output seems less cluttered. Thanks Mark.

Comment on lines +402 to +404
#define SPEC_FAIL_LIST_NON_INT_SUBSCRIPT 8
#define SPEC_FAIL_TUPLE_NON_INT_SUBSCRIPT 9
#define SPEC_FAIL_NOT_TUPLE_LIST_OR_DICT 10
Copy link
Member

Choose a reason for hiding this comment

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

These numbers are repeated from above. Or is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, they can overlap with each other. They shouldn't overlap with the common values, though.

@markshannon markshannon merged commit 9816777 into python:main Aug 10, 2021
@markshannon
Copy link
Member Author

I'll miss the old way a little -- it gave me an inkling of the exact attributes of types which were failing.

When experimenting, it should be easy enough to change the set of SPEC_FAIL... values to add any additional ones that you want.
For example, I've just been using this branch to gather stats on LOAD_METHOD.

@markshannon markshannon deleted the classify-specialization-failures branch August 11, 2021 12:00
iritkatriel added a commit to iritkatriel/cpython that referenced this pull request Aug 11, 2021
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.

5 participants