Skip to content

[OrcJIT] Add LLVM ORC JIT v2 dynamic object loader addon #1

[OrcJIT] Add LLVM ORC JIT v2 dynamic object loader addon

[OrcJIT] Add LLVM ORC JIT v2 dynamic object loader addon #1

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: OrcJIT Build
on:
push:
paths:
- "addons/tvm_ffi_orcjit/**"
- ".github/workflows/tvm_ffi_orcjit.yml"
pull_request:
paths:
- "addons/tvm_ffi_orcjit/**"
- ".github/workflows/tvm_ffi_orcjit.yml"
workflow_dispatch:
jobs:
build_wheels:
name: ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, arch: x86_64, build: "cp312-manylinux_x86_64"}
- {os: ubuntu-24.04-arm, arch: aarch64, build: "cp312-manylinux_aarch64"}
- {os: macos-14, arch: arm64, build: "cp312-macosx_arm64"}
- {os: windows-latest, arch: AMD64, build: "cp312-win_amd64"}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: ./.github/actions/detect-env-vars
id: env_vars
# ---- Cache LLVM prefix ----
- name: Cache LLVM
uses: actions/cache@v4
id: llvm-cache
with:
path: ${{ runner.os == 'Windows' && 'C:/opt/llvm' || '/opt/llvm' }}
key: llvm-22.1.0-${{ runner.os }}-${{ matrix.arch }}-v3
# ---- Install LLVM via conda (cache miss only) ----
- name: Setup conda
if: steps.llvm-cache.outputs.cache-hit != 'true'
uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
continue-on-error: true
id: conda1
with:
miniforge-version: latest
- name: Setup conda (retry with tar.bz2)
if: steps.llvm-cache.outputs.cache-hit != 'true' && steps.conda1.outcome == 'failure'
uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-only-tar-bz2: true
- name: Create /opt/llvm (macOS)
if: steps.llvm-cache.outputs.cache-hit != 'true' && runner.os == 'macOS'
run: sudo mkdir -p /opt/llvm && sudo chown -R $(whoami) /opt/llvm
- name: Install LLVM (Unix)
if: steps.llvm-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
shell: bash -l {0}
run: |
conda create -q -p /opt/llvm -c conda-forge \
llvmdev=22.1.0 clangdev=22.1.0 compiler-rt=22.1.0 zlib zstd-static \
-y
- name: Install LLVM (Windows)
if: steps.llvm-cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: cmd /C call {0}
run: |
conda create -q -p C:\opt\llvm -c conda-forge llvmdev=22.1.0 zlib zstd-static -y
# ---- Build and test wheels ----
- name: Build and test wheels
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
with:
package-dir: addons/tvm_ffi_orcjit
output-dir: wheelhouse
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }}
CIBW_BUILD_VERBOSITY: 1
CMAKE_BUILD_PARALLEL_LEVEL: ${{ steps.env_vars.outputs.cpu_count }}
CIBW_ENVIRONMENT: LLVM_PREFIX=/opt/llvm
CIBW_ENVIRONMENT_WINDOWS: LLVM_PREFIX="C:/opt/llvm"
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume /opt/llvm:/opt/llvm"
CIBW_TEST_REQUIRES: pytest ninja
CIBW_TEST_COMMAND: >-
pip install --force-reinstall {project} &&
python {project}/addons/tvm_ffi_orcjit/tests/run_all_tests.py
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: wheelhouse/*.whl