Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-143807: Fix JIT executor overflow caused by large backoff values #143812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions Include/internal/pycore_backoff.h
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ trigger_backoff_counter(void)
// Initial JUMP_BACKWARD counter.
// Must be larger than ADAPTIVE_COOLDOWN_VALUE, otherwise when JIT code is
// invalidated we may construct a new trace before the bytecode has properly
// re-specialized:
// Note: this should be a prime number-1. This increases the likelihood of
// finding a "good" loop iteration to trace.
// For example, 4095 does not work for the nqueens benchmark on pyperformance
// as we always end up tracing the loop iteration's
// exhaustion iteration. Which aborts our current tracer.
#define JUMP_BACKWARD_INITIAL_VALUE 4000
// re-specialized.
// Note: this should be a prime number-1. This increases the likelihood
// of finding a "good" loop iteration to trace.
// Large initial values can cause excessive executor creation and overflow
// MAX_EXECUTORS_SIZE in JIT builds. A smaller value keeps executor growth
// bounded while still satisfying cooldown and tracing requirements.
#define JUMP_BACKWARD_INITIAL_VALUE 63
#define JUMP_BACKWARD_INITIAL_BACKOFF 6
static inline _Py_BackoffCounter
initial_jump_backoff_counter(_PyPolicy *policy)
Expand All @@ -136,10 +136,13 @@ initial_jump_backoff_counter(_PyPolicy *policy)
}

/* Initial exit temperature.
* 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 4000
* 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.
* Large initial values can cause excessive executor creation and overflow
* MAX_EXECUTORS_SIZE in JIT builds. A smaller value keeps executor growth
* bounded while still satisfying cooldown requirements. */
#define SIDE_EXIT_INITIAL_VALUE 63
#define SIDE_EXIT_INITIAL_BACKOFF 6

static inline _Py_BackoffCounter
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /