python / python/cpython

Compiling executors can result in excessively large amounts of machine code.

Open
#141,794 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core performance topic-JIT type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

With the tracing front-end to the JIT we are producing longer traces than before.
This should be good, but results in very large chunks of machine code.
Large chunks of machine code are bad because:

  • It takes longer and uses more memory
  • It puts a lot of pressure on the icache, possibly evicting the interpreter
  • It makes handling of inline data and branches less efficient as the targets are further away.

To be clear, the problem is not the number of uops per trace, but the amount of machine code per uop.

Things we can do to fix this:

  • Move code into helper functions for the larger uops
  • Move complex decref sequences for DECREF_INPUTS() into helper functions.

(We can also do more optimizations to remove more uops, but that's a separate issue and we're doing it anyway)

Linked PRs
  • gh-142228
  • gh-142263
  • gh-142257
  • gh-142386
  • gh-142409

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are named. Start by reviewing linked PRs gh-142228, gh-142263, gh-142257, gh-142386, and gh-142409 to see which parts of compiled executors and DECREF_INPUTS() they address. Done means reducing machine-code size without changing executor behavior, with relevant tests or benchmarks passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.