Skip to content

Commit

Permalink
Crank the warmup up to 16384
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtbucher committed Nov 21, 2024
1 parent bba66e4 commit 5092a50
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
7 changes: 3 additions & 4 deletions Include/internal/pycore_backoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,13 @@ initial_jump_backoff_counter(void)
* Must be larger than ADAPTIVE_COOLDOWN_VALUE,
* otherwise when a side exit warms up we may construct
* a new trace before the Tier 1 code has properly re-specialized. */
#define SIDE_EXIT_INITIAL_VALUE 4095
#define SIDE_EXIT_INITIAL_BACKOFF 12
#define SIDE_EXIT_INITIAL_VALUE 16383
#define SIDE_EXIT_INITIAL_BACKOFF 14

static inline _Py_BackoffCounter
initial_temperature_backoff_counter(void)
{
return make_backoff_counter(SIDE_EXIT_INITIAL_VALUE,
SIDE_EXIT_INITIAL_BACKOFF);
return forge_backoff_counter(SIDE_EXIT_INITIAL_VALUE);
}

/* Unreachable backoff counter. */
Expand Down
13 changes: 6 additions & 7 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4850,9 +4850,8 @@ dummy_func(
Py_CLEAR(exit->executor);
}
if (exit->executor == NULL) {
_Py_BackoffCounter temperature = exit->temperature;
if (!backoff_counter_triggers(temperature)) {
exit->temperature = advance_backoff_counter(temperature);
if (exit->temperature.value_and_backoff) {
exit->temperature.value_and_backoff--;
tstate->previous_executor = (PyObject *)current_executor;
GOTO_TIER_ONE(target);
}
Expand All @@ -4865,7 +4864,7 @@ dummy_func(
int chain_depth = current_executor->vm_data.chain_depth + 1;
int optimized = _PyOptimizer_Optimize(frame, target, stack_pointer, &executor, chain_depth);
if (optimized <= 0) {
exit->temperature = restart_backoff_counter(temperature);
exit->temperature = initial_temperature_backoff_counter();
if (optimized < 0) {
GOTO_UNWIND();
}
Expand Down Expand Up @@ -4965,13 +4964,13 @@ dummy_func(
Py_INCREF(executor);
}
else {
if (!backoff_counter_triggers(exit->temperature)) {
exit->temperature = advance_backoff_counter(exit->temperature);
if (exit->temperature.value_and_backoff) {
exit->temperature.value_and_backoff--;
GOTO_TIER_ONE(target);
}
int optimized = _PyOptimizer_Optimize(frame, target, stack_pointer, &executor, 0);
if (optimized <= 0) {
exit->temperature = restart_backoff_counter(exit->temperature);
exit->temperature = initial_temperature_backoff_counter();
if (optimized < 0) {
GOTO_UNWIND();
}
Expand Down
13 changes: 6 additions & 7 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5092a50

Please sign in to comment.