From 147033ac895c9220ea66073f198ca764263330fa Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 30 Apr 2024 11:03:28 -0400 Subject: [PATCH 1/5] Support the new way to support Tier2 and JIT --- bench_runner/scripts/should_run.py | 4 ++++ bench_runner/templates/_benchmark.src.yml | 4 ++-- bench_runner/templates/_pystats.src.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bench_runner/scripts/should_run.py b/bench_runner/scripts/should_run.py index bde3fd10..5a4dff16 100644 --- a/bench_runner/scripts/should_run.py +++ b/bench_runner/scripts/should_run.py @@ -30,6 +30,10 @@ def _main( ) sys.exit(1) + if tier2 and jit: + print("Tier 2 interpreter and JIT may not be selected at the same time") + sys.exit(1) + # Now that we've assert we are Python 3.11 or later, we can import # parts of our library. from bench_runner import git diff --git a/bench_runner/templates/_benchmark.src.yml b/bench_runner/templates/_benchmark.src.yml index 884ba52f..dadf6eab 100644 --- a/bench_runner/templates/_benchmark.src.yml +++ b/bench_runner/templates/_benchmark.src.yml @@ -211,7 +211,7 @@ jobs: if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | cd cpython - ./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit' || '' }} + ./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} make -j4 - name: Install pyperformance if: ${{ steps.should_run.outputs.should_run != 'false' }} @@ -308,7 +308,7 @@ jobs: if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | cd cpython - ./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit' || '' }} + ./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} make -j4 # On macos ARM64, actions/setup-python isn't available, so we rely on a # pre-installed homebrew one, used through a venv diff --git a/bench_runner/templates/_pystats.src.yml b/bench_runner/templates/_pystats.src.yml index dceae3b8..751bc647 100644 --- a/bench_runner/templates/_pystats.src.yml +++ b/bench_runner/templates/_pystats.src.yml @@ -109,7 +109,7 @@ jobs: if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | cd cpython - ./configure --enable-pystats --prefix=$PWD/install ${{ inputs.jit == true && '--enable-experimental-jit' || '' }} + ./configure --enable-pystats --prefix=$PWD/install ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} make -j4 make install - name: Install pyperformance into the system python From 1d8501229fa14f41b74aad4c146f4e6049923ee4 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 1 May 2024 10:47:50 -0400 Subject: [PATCH 2/5] Add Windows. Remove legacy env vars --- bench_runner/scripts/run_benchmarks.py | 2 +- bench_runner/templates/_benchmark.src.yml | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/bench_runner/scripts/run_benchmarks.py b/bench_runner/scripts/run_benchmarks.py index 5d480ed5..1f15a98d 100644 --- a/bench_runner/scripts/run_benchmarks.py +++ b/bench_runner/scripts/run_benchmarks.py @@ -30,7 +30,7 @@ "GITHUB_REPOSITORY", "faster-cpython/bench_runner" ) # Environment variables that control the execution of CPython -ENV_VARS = ["PYTHON_UOPS"] +ENV_VARS = ["PYTHON_JIT"] class NoBenchmarkError(Exception): diff --git a/bench_runner/templates/_benchmark.src.yml b/bench_runner/templates/_benchmark.src.yml index dadf6eab..e93515e3 100644 --- a/bench_runner/templates/_benchmark.src.yml +++ b/bench_runner/templates/_benchmark.src.yml @@ -119,15 +119,11 @@ jobs: repository: python/pyperformance path: pyperformance ref: ${{ env.PYPERFORMANCE_HASH }} - - name: Enable Tier 2 - if: ${{ inputs.tier2 }} - run: | - echo "PYTHON_UOPS=1" >> $env:GITHUB_ENV - name: Build Python if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | cd cpython - PCbuild\build.bat ($env:BUILD_FLAGS -split ' ') ${{ inputs.pgo == true && '--pgo' || '' }} ${{ inputs.jit == true && '--experimental-jit' || '' }} -c Release + PCbuild\build.bat ($env:BUILD_FLAGS -split ' ') ${{ inputs.pgo == true && '--pgo' || '' }} ${{ inputs.jit == true && '--experimental-jit' || '' }} ${{ inputs.tier2 == true && '--experimental-interpreter' || '' }} -c Release # Copy the build products to a place that libraries can find them. Copy-Item -Path $env:BUILD_DEST -Destination "libs" -Recurse - name: Install pyperformance @@ -203,10 +199,6 @@ jobs: repository: python/pyperformance path: pyperformance ref: ${{ env.PYPERFORMANCE_HASH }} - - name: Enable Tier 2 - if: ${{ inputs.tier2 }} - run: | - echo "PYTHON_UOPS=1" >> "$GITHUB_ENV" - name: Build Python if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | @@ -300,10 +292,6 @@ jobs: if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | echo "PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig" >> $GITHUB_ENV - - name: Enable Tier 2 - if: ${{ inputs.tier2 }} - run: | - echo "PYTHON_UOPS=1" >> "$GITHUB_ENV" - name: Build Python if: ${{ steps.should_run.outputs.should_run != 'false' }} run: | From 0af6e8636d079a50b4dee38c962d1bac74b49131 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 1 May 2024 10:58:58 -0400 Subject: [PATCH 3/5] Try to fix Windows --- bench_runner/scripts/should_run.py | 4 ++++ bench_runner/templates/_benchmark.src.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bench_runner/scripts/should_run.py b/bench_runner/scripts/should_run.py index 5a4dff16..e28e9785 100644 --- a/bench_runner/scripts/should_run.py +++ b/bench_runner/scripts/should_run.py @@ -87,6 +87,10 @@ def main(): parser.add_argument("jit") args = parser.parse_args() + print(repr(args.tier2)) + print(repr(args.jit)) + print(args.tier2 != "false", args.jit != "false") + _main( args.force != "false", args.fork, diff --git a/bench_runner/templates/_benchmark.src.yml b/bench_runner/templates/_benchmark.src.yml index e93515e3..83163424 100644 --- a/bench_runner/templates/_benchmark.src.yml +++ b/bench_runner/templates/_benchmark.src.yml @@ -184,7 +184,7 @@ jobs: if: ${{ always() }} id: should_run run: | - venv/bin/python -m bench_runner should_run ${{ inputs.force }} ${{ inputs.fork }} ${{ inputs.ref }} ${{ inputs.machine }} false ${{ inputs.tier2 }} ${{ inputs.jit }}>> $GITHUB_OUTPUT + venv/bin/python -m bench_runner should_run ${{ inputs.force }} ${{ inputs.fork }} ${{ inputs.ref }} ${{ inputs.machine }} false ${{ inputs.tier2 }} ${{ inputs.jit }} >> $GITHUB_OUTPUT - name: Checkout python-macrobenchmarks uses: actions/checkout@v4 if: ${{ steps.should_run.outputs.should_run != 'false' }} From e178ec019c596a5f849c8987f3f4923049488ea8 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 1 May 2024 11:20:36 -0400 Subject: [PATCH 4/5] Remove print statements --- bench_runner/scripts/should_run.py | 4 ---- bench_runner/templates/_benchmark.src.yml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/bench_runner/scripts/should_run.py b/bench_runner/scripts/should_run.py index e28e9785..5a4dff16 100644 --- a/bench_runner/scripts/should_run.py +++ b/bench_runner/scripts/should_run.py @@ -87,10 +87,6 @@ def main(): parser.add_argument("jit") args = parser.parse_args() - print(repr(args.tier2)) - print(repr(args.jit)) - print(args.tier2 != "false", args.jit != "false") - _main( args.force != "false", args.fork, diff --git a/bench_runner/templates/_benchmark.src.yml b/bench_runner/templates/_benchmark.src.yml index 83163424..0ef7d939 100644 --- a/bench_runner/templates/_benchmark.src.yml +++ b/bench_runner/templates/_benchmark.src.yml @@ -104,7 +104,7 @@ jobs: if: ${{ always() }} id: should_run run: | - venv\Scripts\python.exe -m bench_runner should_run ${{ inputs.force }} ${{ inputs.fork }} ${{ inputs.ref }} ${{ inputs.machine }} false ${{ inputs.tier2 }} ${{ inputs.jit }}>> $GITHUB_OUTPUT + venv\Scripts\python.exe -m bench_runner should_run ${{ inputs.force }} ${{ inputs.fork }} ${{ inputs.ref }} ${{ inputs.machine }} false ${{ inputs.tier2 }} ${{ inputs.jit }} >> $GITHUB_OUTPUT - name: Checkout python-macrobenchmarks uses: actions/checkout@v4 if: ${{ steps.should_run.outputs.should_run != 'false' }} From 49972cb6606e645ba936935380989d02307c4745 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 1 May 2024 11:22:37 -0400 Subject: [PATCH 5/5] Fix syntax --- bench_runner/templates/_benchmark.src.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench_runner/templates/_benchmark.src.yml b/bench_runner/templates/_benchmark.src.yml index 0ef7d939..8436dd6f 100644 --- a/bench_runner/templates/_benchmark.src.yml +++ b/bench_runner/templates/_benchmark.src.yml @@ -273,7 +273,7 @@ jobs: if: ${{ always() }} id: should_run run: | - venv/bin/python -m bench_runner should_run ${{ inputs.force }} ${{ inputs.force }} ${{ inputs.ref }} ${{ inputs.machine }} false ${{ inputs.tier2 }} ${{ inputs.jit }}>> $GITHUB_OUTPUT + venv/bin/python -m bench_runner should_run ${{ inputs.force }} ${{ inputs.force }} ${{ inputs.ref }} ${{ inputs.machine }} false ${{ inputs.tier2 }} ${{ inputs.jit }} >> $GITHUB_OUTPUT - name: Checkout python-macrobenchmarks uses: actions/checkout@v4 if: ${{ steps.should_run.outputs.should_run != 'false' }}