mirror of
https://github.com/python/cpython.git
synced 2026-04-26 22:01:08 +00:00
gh-146073: Add fitness/exit quality mechanism for JIT trace frontend (GH-148089)
* Replaces ad-hoc logic for ending traces with a simple inequality: `fitness < exit_quality` * Fitness starts high and is reduced for branches, backward edges, calls and trace length * Exit quality reflect how good a spot that instruction is to end a trace. Closing a loop is very, specializable instructions are very low and the others in between.
This commit is contained in:
parent
448d7b96c1
commit
618b726d68
10 changed files with 205 additions and 45 deletions
|
|
@ -630,6 +630,11 @@ init_interpreter(PyInterpreterState *interp,
|
|||
"PYTHON_JIT_SIDE_EXIT_INITIAL_BACKOFF",
|
||||
SIDE_EXIT_INITIAL_BACKOFF, 0, MAX_BACKOFF);
|
||||
|
||||
// Trace fitness configuration
|
||||
init_policy(&interp->opt_config.fitness_initial,
|
||||
"PYTHON_JIT_FITNESS_INITIAL",
|
||||
FITNESS_INITIAL, EXIT_QUALITY_CLOSE_LOOP, UOP_MAX_TRACE_LENGTH - 1);
|
||||
|
||||
interp->opt_config.specialization_enabled = !is_env_enabled("PYTHON_SPECIALIZATION_OFF");
|
||||
interp->opt_config.uops_optimize_enabled = !is_env_disabled("PYTHON_UOPS_OPTIMIZE");
|
||||
if (interp != &runtime->_main_interpreter) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue