Improving trace quality by tracking "fitness" and "exit quality"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Proposal:
The performance of the JIT depends heavily on the quality of the traces that the front-end produces. If traces are too short, very long, overlap a lot, or drop into the interpreter too often, performance suffers.
To avoid those cases of poor performance, we should track two values during tracing:
- The fitness of the current trace
- The quality of the end of the trace as a point to stop the trace.
If fitness < exit_quality we should stop the trace.
Fitness:
Fitness should:
- start high
- be reduced by branches, how much depending on the bias of branch
- be reduced (by quite a lot) by backward edges
- be reduced a small amount by each instruction (to discourage excessively long traces)
- start lower for non-branch side exits to reduce code replication
Exit quality
Exit quality should be high for:
- The starting point of the trace (very high for this)
ENTER_EXECUTORinstructions- Merge points in the control flow graph (will need the bytecode compiler to generate this data)
Exit quality should be low for:
- Specializable instructions
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
- gh-147966
- gh-148082
- gh-148089
- gh-148301
- gh-148840
- gh-148959
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposal's fitness and exit-quality criteria, then examine the linked PRs gh-147966, gh-148082, gh-148089, gh-148301, gh-148840, and gh-148959. The work is done when tracing stops when fitness falls below exit quality and the listed trace, branch, backward-edge, instruction, and merge-point behaviors are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100