Update llvm #1323
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2022 Intel Corporation | |
# | |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
name: Cross-compile Numba-MLIR on CPUs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TBB_VER: 2021.10.0 | |
LLVM_SHA_FILE: llvm-sha.txt | |
NUMBA_DISABLE_ERROR_MESSAGE_HIGHLIGHTING: "1" | |
NUMBA_DISABLE_PERFORMANCE_WARNINGS: "1" | |
jobs: | |
build_win: | |
env: | |
CORE_ENV_FILE: scripts/core-env-win.yml | |
name: Builds Windows Numba-MLIR core | |
runs-on: windows-2019 | |
timeout-minutes: 450 | |
steps: | |
- name: Disable Defender | |
shell: powershell | |
run: | | |
Set-MpPreference -DisableRealtimeMonitoring $true | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache conda packages | |
uses: actions/cache@v3 | |
env: | |
CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(env.CORE_ENV_FILE) }} | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channel-priority: "disabled" | |
activate-environment: test-env | |
environment-file: ${{ env.CORE_ENV_FILE }} | |
python-version: "3.10" | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Setup Cache Vars | |
run: | | |
$sha = (cat "$env:GITHUB_WORKSPACE\$env:LLVM_SHA_FILE") | |
echo "LLVM_SHA=$sha" >> $env:GITHUB_ENV | |
$wspath = (Resolve-Path "$env:GITHUB_WORKSPACE\..\") | |
echo "WORKSPACE=$wspath" >> $env:GITHUB_ENV | |
cat $env:GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v3 | |
env: | |
LLVM_CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: | | |
D:\a\numba-mlir\llvm-mlir\_mlir_install\** | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build LLVM-MLIR | |
if: steps.cache-llvm-mlir.outputs.cache-hit != 'true' | |
timeout-minutes: 420 | |
run: | | |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts") | |
$env:patchPath = (Resolve-Path "$env:GITHUB_WORKSPACE\patches\llvm.diff") | |
pushd $env:vcvarsPath | |
./vcvars.ps1 | |
popd | |
conda list | |
cd $env:WORKSPACE | |
mkdir -ea 0 -p llvm-mlir | |
pushd llvm-mlir | |
echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found" | |
git clone https://github.com/llvm/llvm-project | |
cd llvm-project | |
git checkout $env:LLVM_SHA | |
git apply $env:patchPath | |
mkdir _build | |
cd _build | |
$env:CXX="cl.exe" | |
$env:CC="cl.exe" | |
cmake ../llvm ` | |
-GNinja ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DLLVM_ENABLE_PROJECTS=mlir ` | |
-DLLVM_ENABLE_ASSERTIONS=ON ` | |
-DLLVM_ENABLE_RTTI=ON ` | |
-DLLVM_INSTALL_UTILS=ON ` | |
-DLLVM_TARGETS_TO_BUILD=X86 ` | |
-DLLVM_ENABLE_BINDINGS=OFF ` | |
-DLLVM_ENABLE_ZSTD=OFF ` | |
-DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-cpu-runner" ` | |
-DCMAKE_INSTALL_PREFIX="$env:WORKSPACE/llvm-mlir/_mlir_install" | |
ninja install-distribution-stripped | |
cp bin/FileCheck.exe $env:WORKSPACE/llvm-mlir/_mlir_install/bin/ | |
cp bin/count.exe $env:WORKSPACE/llvm-mlir/_mlir_install/bin/ | |
cp bin/not.exe $env:WORKSPACE/llvm-mlir/_mlir_install/bin/ | |
popd | |
- name: Build Numba-MLIR | |
run: | | |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts") | |
pushd $env:vcvarsPath | |
./vcvars.ps1 | |
popd | |
$external_lit="$env:GITHUB_WORKSPACE\scripts\runlit.py" | |
mkdir -p _build | |
cd _build | |
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1" | |
$env:LLVM_DIR=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install") | |
cmake "$env:GITHUB_WORKSPACE" ` | |
-GNinja ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DLLVM_DIR="$env:LLVM_DIR/lib/cmake/llvm" ` | |
-DMLIR_DIR="$env:LLVM_DIR/lib/cmake/mlir" ` | |
-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON ` | |
-DNUMBA_MLIR_ENABLE_TESTS=ON ` | |
-DNUMBA_MLIR_ENABLE_TBB_SUPPORT=ON ` | |
-DLLVM_EXTERNAL_LIT="$external_lit" | |
ninja all | |
- name: Run Numba-MLIR core test cases | |
run: | | |
cd _build | |
ninja check-numba-mlir | |
build_win_python: | |
name: Builds Windows Numba-MLIR | |
runs-on: windows-2019 | |
timeout-minutes: 450 | |
needs: build_win | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.9", "3.10", "3.11"] | |
steps: | |
- name: Disable Defender | |
shell: powershell | |
run: | | |
Set-MpPreference -DisableRealtimeMonitoring $true | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Cache Vars | |
run: | | |
$sha = (cat "$env:GITHUB_WORKSPACE\$env:LLVM_SHA_FILE") | |
echo "LLVM_SHA=$sha" >> $env:GITHUB_ENV | |
$wspath = (Resolve-Path "$env:GITHUB_WORKSPACE\..\") | |
echo "WORKSPACE=$wspath" >> $env:GITHUB_ENV | |
cat $env:GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v3 | |
env: | |
LLVM_CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: | | |
D:\a\numba-mlir\llvm-mlir\_mlir_install\** | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build Python frontend | |
run: | | |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts") | |
pushd $env:vcvarsPath | |
./vcvars.ps1 | |
popd | |
cd numba_mlir | |
conda create -y -n test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge | |
conda info | |
conda activate test-env | |
conda install dpcpp_win-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/ | |
echo "Conda prefix: $env:CONDA_PREFIX" | |
echo "Patch broken Windows MKLConfig.cmake" | |
cp "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/MKLConfig.cmake" "$env:CONDA_PREFIX/Library/lib/cmake/mkl" -Force | |
conda list | |
python -c "import numba; print('numba', numba.__version__)" | |
python -c "import numpy; print(numpy.get_include())" | |
cmake --version | |
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1" | |
$env:LLVM_PATH=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install") | |
$env:NUMBA_MLIR_USE_SYCL="ON" | |
$env:LIB = "$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" | |
$env:INCLUDE = "$env:CONDA_PREFIX\include;$env:INCLUDE" | |
$env:CXX="cl.exe" | |
$env:CC="cl.exe" | |
python setup.py develop | |
- name: Test Python frontend | |
run: | | |
cd numba_mlir | |
conda activate test-env | |
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose | |
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose replace_parfors | |
- name: Run offload tests | |
if: false # Doesn't work | |
run: | | |
cd numba_mlir | |
conda activate test-env | |
conda install greenlet "dpctl=0.18" dpcpp-cpp-rt -c dppy/label/dev -c conda-forge -c https://software.repos.intel.com/python/conda/ | |
conda list | |
$env:NUMBA_MLIR_DEFAULT_DEVICE="opencl:cpu:0" | |
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose gpu | |
- name: Test bench | |
# TODO: investigate | |
if: matrix.python != '3.9' | |
run: | | |
cd benchmarks | |
conda activate test-env | |
conda install asv=0.6 py-cpuinfo -c conda-forge | |
conda list | |
python runner.py machine | |
python runner.py test .numba_mlir. | |
python runner.py test .numba_replace_parfor. | |
- name: Build wheels | |
run: | | |
$env:vcvarsPath = (Resolve-Path "$env:GITHUB_WORKSPACE\scripts") | |
pushd $env:vcvarsPath | |
./vcvars.ps1 | |
popd | |
mkdir numba_mlir_wheels | |
pushd numba_mlir_wheels | |
conda activate test-env | |
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1" | |
$env:LLVM_PATH=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install") | |
$env:NUMBA_MLIR_USE_SYCL="ON" | |
$env:LIB = "$env:CONDA_PREFIX\Library\lib;$env:CONDA_PREFIX\compiler\lib;$env:LIB" | |
$env:INCLUDE = "$env:CONDA_PREFIX\include;$env:INCLUDE" | |
$env:CXX="cl.exe" | |
$env:CC="cl.exe" | |
pip wheel --no-deps -v ../numba_mlir | |
ls . | |
popd | |
rm -r numba_mlir_cmake_build | |
- name: Test wheels | |
run: | | |
cd numba_mlir_wheels | |
conda create -y -n wheels-test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge | |
conda info | |
conda activate wheels-test-env | |
conda install dpcpp_win-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/ | |
conda list | |
ls . | |
ls *.whl | Foreach-Object { pip install $_.FullName } | |
python "$env:GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py" verbose smoke | |
build_win_conda_package: | |
name: Builds Windows Numba-MLIR conda package | |
runs-on: windows-2019 | |
timeout-minutes: 450 | |
needs: build_win | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.9", "3.10", "3.11"] | |
is_main: | |
- ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Disable Defender | |
shell: powershell | |
run: | | |
Set-MpPreference -DisableRealtimeMonitoring $true | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Cache Vars | |
run: | | |
$sha = (cat "$env:GITHUB_WORKSPACE\$env:LLVM_SHA_FILE") | |
echo "LLVM_SHA=$sha" >> $env:GITHUB_ENV | |
$wspath = (Resolve-Path "$env:GITHUB_WORKSPACE\..\") | |
echo "WORKSPACE=$wspath" >> $env:GITHUB_ENV | |
cat $env:GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v3 | |
env: | |
LLVM_CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: | | |
D:\a\numba-mlir\llvm-mlir\_mlir_install\** | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build conda package | |
run: | | |
conda create -y -n test-env python=${{ matrix.python }} conda-build conda-verify boa -c conda-forge | |
conda info | |
mkdir numba_mlir_conda | |
pushd numba_mlir_conda | |
conda activate test-env | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\vsicvars.bat" -NewName "vsicvars.bat.bak" | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\ConnectionManagerExe.bat" -NewName "ConnectionManagerExe.bat.bak" | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\clang_cl.bat" -NewName "clang_cl.bat.bak" | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\fsharp.bat" -NewName "fsharp.bat.bak" | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\html_help.bat" -NewName "html_help.bat.bak" | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\perf_tools.bat" -NewName "perf_tools.bat.bak" | |
Rename-Item -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\ext\vssdk.bat" -NewName "vssdk.bat.bak" | |
$env:LEVEL_ZERO_VERSION_CHECK_OFF="1" | |
$env:LLVM_PATH=(Resolve-Path "$env:WORKSPACE/llvm-mlir/_mlir_install") | |
$env:NUMBA_MLIR_USE_SYCL="ON" | |
$env:CXX="cl.exe" | |
$env:CC="cl.exe" | |
$env:VSCMD_DEBUG = 3 | |
conda build --output-folder=. ../numba_mlir/conda-recipe --python=${{ matrix.python }} -c https://software.repos.intel.com/python/conda/ -c conda-forge -c numba --override-channels | |
cd win-64 | |
ls . | |
popd | |
- name: Upload artifact | |
if: matrix.is_main | |
uses: actions/upload-artifact@v2 | |
with: | |
name: numba-mlir ${{ runner.os }} Python ${{ matrix.python }} SHA ${{ github.sha }} | |
path: numba_mlir_conda/win-64/*.tar.bz2 | |
retention-days: 30 | |
build_linux: | |
env: | |
CORE_ENV_FILE: scripts/core-env-linux.yml | |
name: Builds Linux Numba-MLIR core | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 450 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache conda packages | |
uses: actions/cache@v3 | |
env: | |
CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: ~/.conda/pkgs | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(env.CORE_ENV_FILE) }} | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channel-priority: "disabled" | |
activate-environment: test-env | |
environment-file: ${{ env.CORE_ENV_FILE }} | |
python-version: "3.10" | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Setup Cache Vars | |
run: | | |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV | |
cat $GITHUB_WORKSPACE/$LLVM_SHA_FILE >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v3 | |
env: | |
LLVM_CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: | | |
/home/runner/work/llvm-mlir/_mlir_install/** | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build LLVM-MLIR | |
if: steps.cache-llvm-mlir.outputs.cache-hit != 'true' | |
shell: bash -l {0} | |
timeout-minutes: 420 | |
run: | | |
mkdir -p /home/runner/work/llvm-mlir | |
pushd /home/runner/work/llvm-mlir | |
echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found" | |
np=`nproc` | |
echo "INFO: nproc $np" | |
git clone https://github.com/llvm/llvm-project || exit 1 | |
cd llvm-project || exit 1 | |
git checkout $LLVM_SHA || exit 1 | |
git apply $GITHUB_WORKSPACE/patches/llvm.diff | |
mkdir _build || exit 1 | |
cd _build || exit 1 | |
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc | |
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++ | |
cmake ../llvm \ | |
-GNinja \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_PROJECTS=mlir \ | |
-DLLVM_ENABLE_ASSERTIONS=ON \ | |
-DLLVM_ENABLE_RTTI=ON \ | |
-DLLVM_INSTALL_UTILS=ON \ | |
-DLLVM_TARGETS_TO_BUILD=X86 \ | |
-DLLVM_ENABLE_BINDINGS=OFF \ | |
-DLLVM_ENABLE_ZSTD=OFF \ | |
-DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-cpu-runner" \ | |
-DCMAKE_INSTALL_PREFIX=/home/runner/work/llvm-mlir/_mlir_install || exit 1 | |
ninja install-distribution-stripped || exit 1 | |
cp bin/FileCheck /home/runner/work/llvm-mlir/_mlir_install/bin/ | |
cp bin/count /home/runner/work/llvm-mlir/_mlir_install/bin/ | |
cp bin/not /home/runner/work/llvm-mlir/_mlir_install/bin/ | |
popd | |
- name: Build Numba-MLIR | |
shell: bash -l {0} | |
run: | | |
mkdir -p _build | |
cd _build | |
source $CONDA/bin/activate test-env | |
export EXTERNAL_LIT=${GITHUB_WORKSPACE}/scripts/runlit.py | |
export LEVEL_ZERO_VERSION_CHECK_OFF=1 | |
export LLVM_DIR=/home/runner/work/llvm-mlir/_mlir_install | |
export CC=${CONDA_PREFIX}/bin/x86_64-conda-linux-gnu-cc | |
export CXX=${CONDA_PREFIX}/bin/x86_64-conda-linux-gnu-c++ | |
cmake ${GITHUB_WORKSPACE} \ | |
-GNinja \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_DIR=${LLVM_DIR}/lib/cmake/llvm \ | |
-DMLIR_DIR=${LLVM_DIR}/lib/cmake/mlir \ | |
-DNUMBA_MLIR_ENABLE_IGPU_DIALECT=ON \ | |
-DNUMBA_MLIR_ENABLE_TESTS=ON \ | |
-DNUMBA_MLIR_ENABLE_TBB_SUPPORT=ON \ | |
-DLLVM_EXTERNAL_LIT=${EXTERNAL_LIT} \ | |
|| exit 1 | |
ninja all || exit 1 | |
- name: Run Numba-MLIR core test cases | |
shell: bash -l {0} | |
run: | | |
cd _build || exit 1 | |
ninja check-numba-mlir || exit 1 | |
build_linux_python: | |
name: Builds Linux Numba-MLIR | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 450 | |
needs: build_linux | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.9", "3.10", "3.11"] | |
is_main: | |
- ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Cache Vars | |
run: | | |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV | |
cat $GITHUB_WORKSPACE/$LLVM_SHA_FILE >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v3 | |
env: | |
LLVM_CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: | | |
/home/runner/work/llvm-mlir/_mlir_install/** | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build Python frontend | |
shell: bash -l {0} | |
run: | | |
cd numba_mlir | |
conda create -y -n test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge | |
conda info | |
source $CONDA/bin/activate test-env | |
conda install dpcpp_linux-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/ | |
conda install gxx_linux-64 -c conda-forge | |
conda list | |
python -c "import numba; print('numba', numba.__version__)" | |
python -c "import numpy; print(numpy.get_include())" | |
cmake --version | |
export LLVM_PATH=/home/runner/work/llvm-mlir/_mlir_install | |
export LEVEL_ZERO_VERSION_CHECK_OFF=1 | |
export NUMBA_MLIR_USE_SYCL=ON | |
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc | |
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++ | |
python setup.py develop | |
- name: Test Python frontend | |
shell: bash -l {0} | |
run: | | |
cd numba_mlir | |
source $CONDA/bin/activate test-env | |
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose | |
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose replace_parfors | |
- name: Run offload tests | |
shell: bash -l {0} | |
run: | | |
cd numba_mlir | |
source $CONDA/bin/activate test-env | |
conda install greenlet "dpctl=0.18" dpcpp-cpp-rt -c dppy/label/dev -c conda-forge -c https://software.repos.intel.com/python/conda/ | |
conda list | |
export NUMBA_MLIR_DEFAULT_DEVICE=opencl:cpu:0 | |
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose gpu | |
- name: Test bench | |
shell: bash -l {0} | |
# TODO: investigate | |
if: matrix.python != '3.9' | |
run: | | |
cd benchmarks | |
source $CONDA/bin/activate test-env | |
conda install asv=0.6 py-cpuinfo -c conda-forge | |
conda list | |
python runner.py machine | |
python runner.py test .numba_mlir. | |
python runner.py test .numba_replace_parfor. | |
- name: Build wheels | |
shell: bash -l {0} | |
run: | | |
mkdir numba_mlir_wheels | |
pushd numba_mlir_wheels | |
source $CONDA/bin/activate test-env | |
export LLVM_PATH=/home/runner/work/llvm-mlir/_mlir_install | |
export LEVEL_ZERO_VERSION_CHECK_OFF=1 | |
export NUMBA_MLIR_USE_SYCL=ON | |
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-cc | |
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-c++ | |
pip wheel --no-deps -v ../numba_mlir | |
ls -l --block-size=M | |
popd | |
rm -rf numba_mlir_cmake_build | |
- name: Test wheels | |
shell: bash -l {0} | |
run: | | |
cd numba_mlir_wheels | |
conda create -y -n wheels-test-env python=${{ matrix.python }} --file ../scripts/numba-mlir.env -c conda-forge | |
conda info | |
source $CONDA/bin/activate wheels-test-env | |
conda install dpcpp_linux-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/ | |
conda list | |
pip install *.whl | |
python $GITHUB_WORKSPACE/numba_mlir/conda-recipe/run_package_tests.py verbose smoke | |
build_linux_conda_package: | |
name: Builds Linux Numba-MLIR conda package | |
runs-on: ubuntu-latest | |
timeout-minutes: 450 | |
needs: build_linux | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.9", "3.10", "3.11"] | |
is_main: | |
- ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Setup conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Cache Vars | |
run: | | |
echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV | |
cat $GITHUB_WORKSPACE/$LLVM_SHA_FILE >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Cache LLLVM-MLIR | |
id: cache-llvm-mlir | |
uses: actions/cache@v3 | |
env: | |
LLVM_CACHE_NUMBER: 1 # Increase to reset cache | |
with: | |
path: | | |
/home/runner/work/llvm-mlir/_mlir_install/** | |
key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} | |
- name: Build conda package | |
shell: bash -l {0} | |
run: | | |
mkdir numba_mlir_conda | |
pushd numba_mlir_conda | |
conda create -y -n conda-build-env python=${{ matrix.python }} conda-build conda-verify boa -c conda-forge | |
conda activate conda-build-env | |
export LLVM_PATH=/home/runner/work/llvm-mlir/_mlir_install | |
export LEVEL_ZERO_VERSION_CHECK_OFF=1 | |
export NUMBA_MLIR_USE_SYCL=ON | |
# conda build --output-folder=. ../numba_mlir/conda-recipe --python=${{ matrix.python }} -c conda-forge -c numba -c https://software.repos.intel.com/python/conda/ || exit 1 | |
conda build --output-folder=. ../numba_mlir/conda-recipe --python=${{ matrix.python }} -c https://software.repos.intel.com/python/conda/ -c conda-forge -c numba --override-channels || exit 1 | |
cd linux-64 | |
ls -l --block-size=M | |
popd | |
rm -rf numba_mlir_cmake_build | |
- name: Upload artifact | |
if: matrix.is_main | |
uses: actions/upload-artifact@v2 | |
with: | |
name: numba-mlir ${{ runner.os }} Python ${{ matrix.python }} SHA ${{ github.sha }} | |
path: numba_mlir_conda/linux-64/*.tar.bz2 | |
retention-days: 30 | |
upload_packages: | |
name: Upload conda packages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
timeout-minutes: 450 | |
needs: [build_win_python, build_win_conda_package, build_linux_python, build_linux_conda_package] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, windows-latest] | |
python: ["3.9", "3.10", "3.11"] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: numba-mlir ${{ runner.os }} Python ${{ matrix.python }} SHA ${{ github.sha }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
run-post: false | |
auto-activate-base: true | |
activate-environment: "" | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
channel-priority: "disabled" | |
channels: conda-forge,https://software.repos.intel.com/python/conda/ | |
- name: Install anaconda-client | |
run: conda install anaconda-client | |
- name: Add conda to system path | |
if: matrix.os == 'ubuntu-20.04' | |
run: echo $CONDA/bin >> $GITHUB_PATH | |
- name: Upload | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
run: | | |
anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev numba-mlir-*.tar.bz2 | |
cleanup_packages: | |
name: Clean up anaconda packages | |
needs: [upload_packages] | |
runs-on: 'ubuntu-latest' | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
run-post: false | |
channel-priority: "disabled" | |
channels: conda-forge | |
python-version: '3.11' | |
- name: Install anaconda-client | |
run: conda install anaconda-client | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
repository: IntelPython/devops-tools | |
fetch-depth: 0 | |
- name: Cleanup old packages | |
run: | | |
python scripts/cleanup-old-packages.py \ | |
--verbose --force --token ${{ secrets.ANACONDA_TOKEN }} \ | |
--package dppy/numba-mlir --label dev |