Skip to content

Conversation

@brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commented Jul 17, 2024

This adds tier two support to all of the the trivial instructions that our stats indicate are causing traces to end (CALL_LIST_APPEND, IMPORT_NAME, LOAD_NAME, BUILD_SET, SEND_GEN, and IMPORT_FROM). Some other, more complicated, instructions will come in their own PRs. It also turns _FOR_ITER_TIER_TWO from a deopting instruction into an exiting instruction, since we expect it to fail fairly often (since this represents normal control flow in the program).

Perf is neutral. Stats have improved, as expected (4% fewer tier one instructions, 24% fewer too-short traces, 20% fewer optimization attempts, 7% fewer traces executed, 4% more traces created, and 4% more uops executed).

@brandtbucherbrandtbucher added performance Performance or resource usage skip news interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jul 17, 2024
@brandtbucherbrandtbucher self-assigned this Jul 17, 2024
Copy link
Member

@markshannonmarkshannon left a comment

Choose a reason for hiding this comment

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

One minor clarification needed, otherwise LGTM.

Regarding handling CALL_LIST_APPEND in tier 2:
Instead of asserting that the next instruction is POP_TOP and skipping it, we could emit a LOAD_CONST_BORROW None.
If the following instruction is not POP_TOP then then code is still correct. If there is a POP_TOP following, then optimizer will eliminate the LOAD; POP_TOP.

@bedevere-app
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@brandtbucher
Copy link
MemberAuthor

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

@markshannon: please review the changes made to this pull request.

@brandtbucher
Copy link
MemberAuthor

JIT failures are unrelated: GH-121946

@brandtbucherbrandtbucher merged commit 7b36b67 into python:mainJul 18, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usageskip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brandtbucher@markshannon