Skip to content

Commit a688428

Browse files
committed
Add a flag for compiling with clang
1 parent 69aee62 commit a688428

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

bench_runner/flags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Flag:
1717
Flag("tier2", "PYTHON_UOPS", "tier 2 interpreter", "T2"),
1818
Flag("jit", "JIT", "JIT", "JIT"),
1919
Flag("nogil", "NOGIL", "free threading", "NOGIL"),
20+
Flag("clang", "CLANG", "build with latest clang", "CLANG"),
2021
]
2122

2223

bench_runner/templates/_benchmark.src.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,19 @@ jobs:
109109
repository: mdboom/pyperformance
110110
path: pyperformance
111111
ref: ${{ env.PYPERFORMANCE_HASH }}
112+
- name: Build with clang
113+
if: ${{ inputs.clang }}
114+
run: |
115+
Write-Error "Using the latest clang compiler on Windows isn't currently supported by bench-runner"
116+
exit 1
112117
- name: Build Python
113118
if: ${{ steps.should_run.outputs.should_run != 'false' }}
114119
run: |
115120
cd cpython
116121
PCbuild\build.bat ($env:BUILD_FLAGS -split ' ') ${{ inputs.pgo == true && '--pgo' || '' }} ${{ inputs.jit == true && '--experimental-jit' || '' }} ${{ inputs.tier2 == true && '--experimental-jit-interpreter' || '' }} ${{ inputs.nogil == true && '--disable-gil' || '' }} -c Release
117122
# Copy the build products to a place that libraries can find them.
118123
Copy-Item -Path $env:BUILD_DEST -Destination "libs" -Recurse
124+
$env:BUILD_DEST\python.exe -VV
119125
- name: Install pyperformance
120126
if: ${{ steps.should_run.outputs.should_run != 'false' }}
121127
run: |
@@ -198,12 +204,17 @@ jobs:
198204
repository: mdboom/pyperformance
199205
path: pyperformance
200206
ref: ${{ env.PYPERFORMANCE_HASH }}
207+
- name: Build with clang
208+
if: ${{ inputs.clang }}
209+
run: |
210+
echo "CC=clang-19" >> $GITHUB_ENV
201211
- name: Build Python
202212
if: ${{ steps.should_run.outputs.should_run != 'false' }}
203213
run: |
204214
cd cpython
205215
./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} ${{ inputs.nogil == true && '--disable-gil' || '' }}
206216
make ${{ runner.arch == 'ARM64' && '-j' || '-j4' }}
217+
./python -VV
207218
- name: Install pyperformance
208219
if: ${{ steps.should_run.outputs.should_run != 'false' }}
209220
run: |
@@ -299,12 +310,20 @@ jobs:
299310
if: ${{ steps.should_run.outputs.should_run != 'false' }}
300311
run: |
301312
echo "PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig" >> $GITHUB_ENV
313+
- name: Setup latest clang, if requested
314+
if: ${{ inputs.clang }}
315+
run: |
316+
echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> $GITHUB_ENV
317+
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
318+
echo "LDFLAGS=-L$(brew --prefix llvm)/lib" >> $GITHUB_ENV
319+
echo "CFLAGS=-I$(brew --prefix llvm)/include" >> $GITHUB_ENV
302320
- name: Build Python
303321
if: ${{ steps.should_run.outputs.should_run != 'false' }}
304322
run: |
305323
cd cpython
306324
./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} ${{ inputs.nogil == true && '--disable-gil' || '' }}
307325
make -j4
326+
./python.exe -VV
308327
# On macos ARM64, actions/setup-python isn't available, so we rely on a
309328
# pre-installed homebrew one, used through a venv
310329
- name: Install pyperformance

0 commit comments

Comments
 (0)