Skip to content

GH-118093: Specialize CALL_KW - #123006

Merged
markshannon merged 12 commits into
python:mainfrom
faster-cpython:specialize-call-kw
Aug 16, 2024
Merged

markshannon merged 12 commits into
python:mainfrom
faster-cpython:specialize-call-kw

Conversation

@markshannon

@markshannon markshannon commented Aug 14, 2024 •

Copy link
Copy Markdown
Member

According to our stats the CALL_KW opcode is one of the most common opcodes that prevents projection of tier 2 traces.
Making CALL_KW suitable for tier 2 is infeasible, but we can specialize it in tier 1 such that the specializations can be handled by tier 2.

This PR adds three specializations:

  • CALL_KW_PY for calls to Python functions
  • CALL_KW_BOUND_METHODS for calls to bound methods
  • CALL_KW_NON_PY for calls to everything else.
@markshannon

markshannon commented Aug 15, 2024 •

Copy link
Copy Markdown
Member Author

No impact on performance
Stats show 99.9% specialization with a low (<1%) miss rate.

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good in general. Two questions.

Comment thread Lib/test/test_dis.py Resolved
Comment thread Python/bytecodes.c Resolved
Comment thread Include/internal/pycore_code.h Resolved
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@markshannon
markshannon merged commit c13e7d9 into python:main Aug 16, 2024
@markshannon
markshannon deleted the specialize-call-kw branch August 16, 2024 16:12
jeremyhylton pushed a commit to jeremyhylton/cpython that referenced this pull request Aug 19, 2024
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants