Skip to content

Commit 1e8df9b

Browse files
authored
Move x86-32 Windows and Linux testing to GHA (#8988)
* Add 32-bit Linux and Windows workflows * Loosen condition on performance_packed_planar_fusion
1 parent 5e2e6c7 commit 1e8df9b

4 files changed

Lines changed: 204 additions & 6 deletions

File tree

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Linux
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
linux:
17+
name: linux-${{ matrix.bits }} / ${{ matrix.uv_group }}
18+
runs-on: ubuntu-24.04
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet.
23+
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ]
24+
include:
25+
- bits: 32
26+
arch: i686
27+
python: cpython-3.11.5-linux-x86-gnu # latest available on uv
28+
# - bits: 64 # Intentionally not 64, as we haven't configured self-hosted runners for it yet.
29+
# arch: x86_64
30+
# python: cpython-3.10-linux-x86_64-gnu
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- uses: astral-sh/setup-uv@v5
36+
37+
- name: Install system dependencies
38+
run: |
39+
if [[ "${{ matrix.bits }}" == "32" ]]; then
40+
sudo dpkg --add-architecture i386
41+
fi
42+
43+
apt_update() {
44+
for i in 1 2 3; do
45+
if sudo apt-get update; then return 0; fi
46+
echo "apt-get update failed (attempt $i/3), retrying in 10s..."
47+
sleep 10
48+
done
49+
return 1
50+
}
51+
apt_update
52+
53+
if [[ "${{ matrix.bits }}" == "32" ]]; then
54+
sudo apt-get install -y \
55+
gcc-multilib \
56+
g++-multilib \
57+
libpng-dev:i386 \
58+
libjpeg-dev:i386
59+
else
60+
sudo apt-get install -y \
61+
libpng-dev \
62+
libjpeg-dev
63+
fi
64+
65+
- name: Sync CI environment
66+
run: |
67+
setarch ${{ matrix.arch }} bash -ec "
68+
CC='gcc -m${{ matrix.bits }}' CXX='g++ -m${{ matrix.bits }}' \
69+
uv sync --python '${{ matrix.python }}' --group '${{ matrix.uv_group }}' --no-install-project
70+
echo '${GITHUB_WORKSPACE}/.venv/bin' >> '$GITHUB_PATH'
71+
echo 'VIRTUAL_ENV=${GITHUB_WORKSPACE}/.venv' >> '$GITHUB_ENV'
72+
"
73+
74+
- name: Configure LLVM
75+
run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV"
76+
77+
- name: Configure CMake
78+
run: |
79+
TOOLCHAIN_ARGS=()
80+
if [[ "${{ matrix.bits }}" == "32" ]]; then
81+
TOOLCHAIN_ARGS+=(
82+
"-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/cmake/toolchain.linux-i386.cmake"
83+
"-DWITH_PYTHON_BINDINGS=OFF"
84+
)
85+
fi
86+
87+
cmake -G Ninja -S . -B build \
88+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
89+
-DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \
90+
"${TOOLCHAIN_ARGS[@]}"
91+
92+
- name: Initial build
93+
run: cmake --build build
94+
95+
- name: Test (host)
96+
run: |
97+
cmake -S . -B build -DHalide_TARGET=host
98+
cmake --build build
99+
ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)"
100+
101+
- name: Test (no extensions)
102+
run: |
103+
cmake -S . -B build -DHalide_TARGET=cmake
104+
cmake --build build
105+
ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)"
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Windows
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
windows:
21+
name: windows-${{ matrix.bits }} / ${{ matrix.uv_group }}
22+
runs-on: windows-2022
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet.
27+
uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ]
28+
include:
29+
- bits: 32
30+
arch: x86
31+
python: cpython-3.10.20-windows-x86-none
32+
# - bits: 64 # Intentionally not 64, as we haven't configured self-hosted runners for it yet.
33+
# arch: x64
34+
# python: cpython-3.10.20-windows-x86_64-none
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: astral-sh/setup-uv@v5
40+
41+
- uses: ilammy/msvc-dev-cmd@v1
42+
with:
43+
arch: ${{ matrix.arch }}
44+
45+
- name: Sync CI environment
46+
run: |
47+
# uv uses the host platform for dependency resolution regardless of the target
48+
# Python, so on Windows it would download x86_64 halide-llvm (~250MB) even for
49+
# a 32-bit build. Instead: read the pinned version from the lockfile (no download),
50+
# sync only ci-base (no LLVM), then fetch the correct win32 wheel directly.
51+
LLVM_VER=$(uv export --group '${{ matrix.uv_group }}' --no-emit-project \
52+
| awk -F'==' '/^halide-llvm==/ { gsub(/ .*/, "", $2); print $2 }')
53+
54+
uv sync --python '${{ matrix.python }}' --group ci-base --no-install-project
55+
uv pip install --python-platform i686-pc-windows-msvc --only-binary :all: \
56+
--extra-index-url https://pypi.halide-lang.org/simple/ \
57+
"halide-llvm==${LLVM_VER}"
58+
59+
echo "${GITHUB_WORKSPACE}/.venv/Scripts" >> "$GITHUB_PATH"
60+
echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}/.venv" >> "$GITHUB_ENV"
61+
62+
- name: Configure LLVM
63+
run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV"
64+
65+
- name: Configure CMake
66+
run: |
67+
# NB: vcpkg docs use VCPKG_ROOT, but GHA runners use VCPKG_INSTALLATION_ROOT
68+
TOOLCHAIN_ARGS=(
69+
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
70+
"-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows"
71+
"-DVCPKG_MANIFEST_FEATURES=developer"
72+
)
73+
if [[ "${{ matrix.bits }}" == "32" ]]; then
74+
TOOLCHAIN_ARGS+=("-DWITH_PYTHON_BINDINGS=OFF")
75+
fi
76+
77+
cmake -G Ninja -S . -B build \
78+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
79+
-DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \
80+
"${TOOLCHAIN_ARGS[@]}"
81+
82+
- name: Initial build
83+
run: cmake --build build
84+
85+
- name: Test (host)
86+
run: |
87+
cmake -S . -B build -DHalide_TARGET=host
88+
cmake --build build
89+
ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)"
90+
91+
- name: Test (no extensions)
92+
run: |
93+
cmake -S . -B build -DHalide_TARGET=cmake
94+
cmake --build build
95+
ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)"

cmake/toolchain.linux-i386.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
1515
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
1616
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
1717

18-
# Set to empty string to indicate the resulting binaries can be natively executed
19-
set(CMAKE_CROSSCOMPILING_EMULATOR)
20-
18+
set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/env)

test/performance/packed_planar_fusion.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ int main(int argc, char **argv) {
7979
delete[] storage_1;
8080
delete[] storage_2;
8181

82-
if (t_planar_planar > t_packed_packed * 2 ||
83-
t_packed_packed > t_packed_planar * 2 ||
84-
t_planar_packed > t_packed_planar * 2) {
82+
if (t_planar_planar > t_packed_packed * 4 ||
83+
t_packed_packed > t_packed_planar * 4 ||
84+
t_planar_packed > t_packed_planar * 4) {
8585
printf("Times were not in expected order:\n"
8686
"planar -> planar: %f \n"
8787
"packed -> packed: %f \n"

0 commit comments

Comments
 (0)