diff --git a/.github/workflows/testing-linux.yml b/.github/workflows/testing-linux.yml new file mode 100644 index 000000000000..3548fdf2c2a0 --- /dev/null +++ b/.github/workflows/testing-linux.yml @@ -0,0 +1,105 @@ +name: Linux + +on: + pull_request: + types: [ opened, synchronize, reopened ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + linux: + name: linux-${{ matrix.bits }} / ${{ matrix.uv_group }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet. + uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ] + include: + - bits: 32 + arch: i686 + python: cpython-3.11.5-linux-x86-gnu # latest available on uv + # - bits: 64 # Intentionally not 64, as we haven't configured self-hosted runners for it yet. + # arch: x86_64 + # python: cpython-3.10-linux-x86_64-gnu + + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v5 + + - name: Install system dependencies + run: | + if [[ "${{ matrix.bits }}" == "32" ]]; then + sudo dpkg --add-architecture i386 + fi + + apt_update() { + for i in 1 2 3; do + if sudo apt-get update; then return 0; fi + echo "apt-get update failed (attempt $i/3), retrying in 10s..." + sleep 10 + done + return 1 + } + apt_update + + if [[ "${{ matrix.bits }}" == "32" ]]; then + sudo apt-get install -y \ + gcc-multilib \ + g++-multilib \ + libpng-dev:i386 \ + libjpeg-dev:i386 + else + sudo apt-get install -y \ + libpng-dev \ + libjpeg-dev + fi + + - name: Sync CI environment + run: | + setarch ${{ matrix.arch }} bash -ec " + CC='gcc -m${{ matrix.bits }}' CXX='g++ -m${{ matrix.bits }}' \ + uv sync --python '${{ matrix.python }}' --group '${{ matrix.uv_group }}' --no-install-project + echo '${GITHUB_WORKSPACE}/.venv/bin' >> '$GITHUB_PATH' + echo 'VIRTUAL_ENV=${GITHUB_WORKSPACE}/.venv' >> '$GITHUB_ENV' + " + + - name: Configure LLVM + run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV" + + - name: Configure CMake + run: | + TOOLCHAIN_ARGS=() + if [[ "${{ matrix.bits }}" == "32" ]]; then + TOOLCHAIN_ARGS+=( + "-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/cmake/toolchain.linux-i386.cmake" + "-DWITH_PYTHON_BINDINGS=OFF" + ) + fi + + cmake -G Ninja -S . -B build \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \ + "${TOOLCHAIN_ARGS[@]}" + + - name: Initial build + run: cmake --build build + + - name: Test (host) + run: | + cmake -S . -B build -DHalide_TARGET=host + cmake --build build + ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)" + + - name: Test (no extensions) + run: | + cmake -S . -B build -DHalide_TARGET=cmake + cmake --build build + ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)" diff --git a/.github/workflows/testing-windows.yml b/.github/workflows/testing-windows.yml new file mode 100644 index 000000000000..27e566c16aea --- /dev/null +++ b/.github/workflows/testing-windows.yml @@ -0,0 +1,95 @@ +name: Windows + +on: + pull_request: + types: [ opened, synchronize, reopened ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + windows: + name: windows-${{ matrix.bits }} / ${{ matrix.uv_group }} + runs-on: windows-2022 + strategy: + fail-fast: false + matrix: + bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet. + uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21", "ci-llvm-20" ] + include: + - bits: 32 + arch: x86 + python: cpython-3.10.20-windows-x86-none + # - bits: 64 # Intentionally not 64, as we haven't configured self-hosted runners for it yet. + # arch: x64 + # python: cpython-3.10.20-windows-x86_64-none + + steps: + - uses: actions/checkout@v4 + + - uses: astral-sh/setup-uv@v5 + + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: Sync CI environment + run: | + # uv uses the host platform for dependency resolution regardless of the target + # Python, so on Windows it would download x86_64 halide-llvm (~250MB) even for + # a 32-bit build. Instead: read the pinned version from the lockfile (no download), + # sync only ci-base (no LLVM), then fetch the correct win32 wheel directly. + LLVM_VER=$(uv export --group '${{ matrix.uv_group }}' --no-emit-project \ + | awk -F'==' '/^halide-llvm==/ { gsub(/ .*/, "", $2); print $2 }') + + uv sync --python '${{ matrix.python }}' --group ci-base --no-install-project + uv pip install --python-platform i686-pc-windows-msvc --only-binary :all: \ + --extra-index-url https://pypi.halide-lang.org/simple/ \ + "halide-llvm==${LLVM_VER}" + + echo "${GITHUB_WORKSPACE}/.venv/Scripts" >> "$GITHUB_PATH" + echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}/.venv" >> "$GITHUB_ENV" + + - name: Configure LLVM + run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV" + + - name: Configure CMake + run: | + # NB: vcpkg docs use VCPKG_ROOT, but GHA runners use VCPKG_INSTALLATION_ROOT + TOOLCHAIN_ARGS=( + "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" + "-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows" + "-DVCPKG_MANIFEST_FEATURES=developer" + ) + if [[ "${{ matrix.bits }}" == "32" ]]; then + TOOLCHAIN_ARGS+=("-DWITH_PYTHON_BINDINGS=OFF") + fi + + cmake -G Ninja -S . -B build \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \ + "${TOOLCHAIN_ARGS[@]}" + + - name: Initial build + run: cmake --build build + + - name: Test (host) + run: | + cmake -S . -B build -DHalide_TARGET=host + cmake --build build + ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)" + + - name: Test (no extensions) + run: | + cmake -S . -B build -DHalide_TARGET=cmake + cmake --build build + ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -j "$(nproc)" diff --git a/cmake/toolchain.linux-i386.cmake b/cmake/toolchain.linux-i386.cmake index bca44475e752..f7b4dae5df70 100644 --- a/cmake/toolchain.linux-i386.cmake +++ b/cmake/toolchain.linux-i386.cmake @@ -15,6 +15,4 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -# Set to empty string to indicate the resulting binaries can be natively executed -set(CMAKE_CROSSCOMPILING_EMULATOR) - +set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/env) diff --git a/test/performance/packed_planar_fusion.cpp b/test/performance/packed_planar_fusion.cpp index 3c23f9f5f62d..9819db4c88ee 100644 --- a/test/performance/packed_planar_fusion.cpp +++ b/test/performance/packed_planar_fusion.cpp @@ -79,9 +79,9 @@ int main(int argc, char **argv) { delete[] storage_1; delete[] storage_2; - if (t_planar_planar > t_packed_packed * 2 || - t_packed_packed > t_packed_planar * 2 || - t_planar_packed > t_packed_planar * 2) { + if (t_planar_planar > t_packed_packed * 4 || + t_packed_packed > t_packed_planar * 4 || + t_planar_packed > t_packed_planar * 4) { printf("Times were not in expected order:\n" "planar -> planar: %f \n" "packed -> packed: %f \n"