gh-133171: Re-enable JUMP_BACKWARD to free-threading build (gh-137800)
This commit is contained in:
56
.github/workflows/jit.yml
vendored
56
.github/workflows/jit.yml
vendored
@@ -134,6 +134,34 @@ jobs:
|
|||||||
make all --jobs 4
|
make all --jobs 4
|
||||||
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
|
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
|
||||||
|
|
||||||
|
jit-with-disabled-gil:
|
||||||
|
name: Free-Threaded (Debug)
|
||||||
|
needs: interpreter
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 90
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
llvm:
|
||||||
|
- 19
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
- name: Build with JIT enabled and GIL disabled
|
||||||
|
run: |
|
||||||
|
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
|
||||||
|
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
|
||||||
|
./configure --enable-experimental-jit --with-pydebug --disable-gil
|
||||||
|
make all --jobs 4
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
no-opt-jit:
|
no-opt-jit:
|
||||||
name: JIT without optimizations (Debug)
|
name: JIT without optimizations (Debug)
|
||||||
needs: interpreter
|
needs: interpreter
|
||||||
@@ -160,31 +188,3 @@ jobs:
|
|||||||
- name: Run tests without optimizations
|
- name: Run tests without optimizations
|
||||||
run: |
|
run: |
|
||||||
PYTHON_UOPS_OPTIMIZE=0 ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
|
PYTHON_UOPS_OPTIMIZE=0 ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
|
||||||
|
|
||||||
# XXX: GH-133171
|
|
||||||
# jit-with-disabled-gil:
|
|
||||||
# name: Free-Threaded (Debug)
|
|
||||||
# needs: interpreter
|
|
||||||
# runs-on: ubuntu-24.04
|
|
||||||
# timeout-minutes: 90
|
|
||||||
# strategy:
|
|
||||||
# fail-fast: false
|
|
||||||
# matrix:
|
|
||||||
# llvm:
|
|
||||||
# - 19
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v4
|
|
||||||
# with:
|
|
||||||
# persist-credentials: false
|
|
||||||
# - uses: actions/setup-python@v5
|
|
||||||
# with:
|
|
||||||
# python-version: '3.11'
|
|
||||||
# - name: Build with JIT enabled and GIL disabled
|
|
||||||
# run: |
|
|
||||||
# sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
|
|
||||||
# export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
|
|
||||||
# ./configure --enable-experimental-jit --with-pydebug --disable-gil
|
|
||||||
# make all --jobs 4
|
|
||||||
# - name: Run tests
|
|
||||||
# run: |
|
|
||||||
# ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
|
|
||||||
|
|||||||
@@ -464,6 +464,12 @@ PyStackRef_CLOSE_SPECIALIZED(_PyStackRef ref, destructor destruct)
|
|||||||
PyStackRef_CLOSE(ref);
|
PyStackRef_CLOSE(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
PyStackRef_RefcountOnObject(_PyStackRef ref)
|
||||||
|
{
|
||||||
|
return (ref.bits & Py_TAG_REFCNT) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline _PyStackRef
|
static inline _PyStackRef
|
||||||
PyStackRef_DUP(_PyStackRef stackref)
|
PyStackRef_DUP(_PyStackRef stackref)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2940,9 +2940,10 @@ dummy_func(
|
|||||||
};
|
};
|
||||||
|
|
||||||
tier1 op(_SPECIALIZE_JUMP_BACKWARD, (--)) {
|
tier1 op(_SPECIALIZE_JUMP_BACKWARD, (--)) {
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION_FT
|
||||||
if (this_instr->op.code == JUMP_BACKWARD) {
|
if (this_instr->op.code == JUMP_BACKWARD) {
|
||||||
this_instr->op.code = tstate->interp->jit ? JUMP_BACKWARD_JIT : JUMP_BACKWARD_NO_JIT;
|
uint8_t desired = tstate->interp->jit ? JUMP_BACKWARD_JIT : JUMP_BACKWARD_NO_JIT;
|
||||||
|
FT_ATOMIC_STORE_UINT8_RELAXED(this_instr->op.code, desired);
|
||||||
// Need to re-dispatch so the warmup counter isn't off by one:
|
// Need to re-dispatch so the warmup counter isn't off by one:
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
|
|||||||
5
Python/generated_cases.c.h
generated
5
Python/generated_cases.c.h
generated
@@ -7589,9 +7589,10 @@
|
|||||||
/* Skip 1 cache entry */
|
/* Skip 1 cache entry */
|
||||||
// _SPECIALIZE_JUMP_BACKWARD
|
// _SPECIALIZE_JUMP_BACKWARD
|
||||||
{
|
{
|
||||||
#if ENABLE_SPECIALIZATION
|
#if ENABLE_SPECIALIZATION_FT
|
||||||
if (this_instr->op.code == JUMP_BACKWARD) {
|
if (this_instr->op.code == JUMP_BACKWARD) {
|
||||||
this_instr->op.code = tstate->interp->jit ? JUMP_BACKWARD_JIT : JUMP_BACKWARD_NO_JIT;
|
uint8_t desired = tstate->interp->jit ? JUMP_BACKWARD_JIT : JUMP_BACKWARD_NO_JIT;
|
||||||
|
FT_ATOMIC_STORE_UINT8_RELAXED(this_instr->op.code, desired);
|
||||||
next_instr = this_instr;
|
next_instr = this_instr;
|
||||||
DISPATCH_SAME_OPARG();
|
DISPATCH_SAME_OPARG();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ _PyOptimizer_Optimize(
|
|||||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||||
assert(interp->jit);
|
assert(interp->jit);
|
||||||
assert(!interp->compiling);
|
assert(!interp->compiling);
|
||||||
|
#ifndef Py_GIL_DISABLED
|
||||||
interp->compiling = true;
|
interp->compiling = true;
|
||||||
// The first executor in a chain and the MAX_CHAIN_DEPTH'th executor *must*
|
// The first executor in a chain and the MAX_CHAIN_DEPTH'th executor *must*
|
||||||
// make progress in order to avoid infinite loops or excessively-long
|
// make progress in order to avoid infinite loops or excessively-long
|
||||||
@@ -160,6 +161,9 @@ _PyOptimizer_Optimize(
|
|||||||
assert((*executor_ptr)->vm_data.valid);
|
assert((*executor_ptr)->vm_data.valid);
|
||||||
interp->compiling = false;
|
interp->compiling = false;
|
||||||
return 1;
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static _PyExecutorObject *
|
static _PyExecutorObject *
|
||||||
|
|||||||
3
configure
generated
vendored
3
configure
generated
vendored
@@ -10891,7 +10891,8 @@ printf "%s\n" "$tier2_flags $jit_flags" >&6; }
|
|||||||
if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then
|
if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then
|
||||||
# GH-133171: This configuration builds the JIT but never actually uses it,
|
# GH-133171: This configuration builds the JIT but never actually uses it,
|
||||||
# which is surprising (and strictly worse than not building it at all):
|
# which is surprising (and strictly worse than not building it at all):
|
||||||
as_fn_error $? "--enable-experimental-jit cannot be used with --disable-gil." "$LINENO" 5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-experimental-jit does not work correctly with --disable-gil." >&5
|
||||||
|
printf "%s\n" "$as_me: WARNING: --enable-experimental-jit does not work correctly with --disable-gil." >&2;}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$ac_cv_cc_name" in
|
case "$ac_cv_cc_name" in
|
||||||
|
|||||||
@@ -2799,7 +2799,7 @@ AC_MSG_RESULT([$tier2_flags $jit_flags])
|
|||||||
if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then
|
if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then
|
||||||
# GH-133171: This configuration builds the JIT but never actually uses it,
|
# GH-133171: This configuration builds the JIT but never actually uses it,
|
||||||
# which is surprising (and strictly worse than not building it at all):
|
# which is surprising (and strictly worse than not building it at all):
|
||||||
AC_MSG_ERROR([--enable-experimental-jit cannot be used with --disable-gil.])
|
AC_MSG_WARN([--enable-experimental-jit does not work correctly with --disable-gil.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$ac_cv_cc_name" in
|
case "$ac_cv_cc_name" in
|
||||||
|
|||||||
Reference in New Issue
Block a user