Skip to content

Commit

Permalink
update tvm to the latest
Browse files Browse the repository at this point in the history
  • Loading branch information
mshr-h committed Jan 9, 2024
1 parent 94ce98c commit 1047324
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
python-version: ['3.8', '3.9', '3.10', '3.11']
Expand Down Expand Up @@ -81,66 +82,74 @@ jobs:
run: |
python -m pip install .[extra,onnx,sparkml]
python -m pip install pandas
- name: Install TVM from pypi if Ubuntu and not python 3.11
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.python-version != '3.11' }}
run: python -m pip install apache-tvm==0.10.0
- uses: actions/cache@v3
# TVM takes forever, we try to cache it.
if: ${{ startsWith(matrix.os, 'macos') && matrix.python-version != '3.11' }}
if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')}}
id: cache
env:
CACHE_NUMBER: 9
with:
path: ~/work/hummingbird/tvm
key: ${{ matrix.os }}-${{ env.CACHE_NUMBER }}-${{ matrix.python-version }}-tvm-0.10
key: ${{ matrix.os }}-${{ env.CACHE_NUMBER }}-${{ matrix.python-version }}-tvm-main
# Getting TVM requires: 1) Install LLVM 2) fetching TVM from github, 3) cmake, 4) make, 5) install python dependency.
# 2 to 4 will be retrieved from the cache.
# The pipeline only works for Unix systems. For windows we will have to compile LLVM from source which is a no go.
- name: Install LLVM if Ubuntu
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt install -y llvm-14
- name: Install LLVM if Mac
if: ${{ startsWith(matrix.os, 'macos') && matrix.python-version != '3.11'}}
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
brew install llvm@14
- name: Fetch and prepare TVM for compilation if Mac
if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'macos') && matrix.python-version != '3.11' }}
- name: Fetch and prepare TVM for compilation if Mac or Ubuntu
if: ${{ steps.cache.outputs.cache-hit != 'true' && (startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')) }}
run: |
cd ~/work/hummingbird
git clone https://github.com/apache/tvm.git
cd tvm
git checkout tags/v0.10.0
git submodule update --recursive --init
cmake -E make_directory build
- name: CMake TVM if Mac
if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'macos') && matrix.python-version != '3.11' }}
if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'macos') }}
working-directory: ../tvm/build
run: >-
cmake
"-DUSE_RPC=ON"
"-DUSE_GRAPH_RUNTIME=ON"
"-DUSE_LLVM=$(brew --prefix llvm@14)/bin/llvm-config"
..
- name: CMake TVM if Ubuntu
if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu') }}
working-directory: ../tvm/build
run: >-
MACOSX_DEPLOYMENT_TARGET=10.13 cmake
cmake
"-DUSE_RPC=ON"
"-DUSE_GRAPH_RUNTIME=ON"
"-DUSE_LLVM=$(brew --prefix llvm@14)/bin/llvm-config --link-static"
"-DUSE_LLVM=llvm-config-14"
..
- name: Build TVM if Mac
if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'macos') && matrix.python-version != '3.11' }}
- name: Build TVM if Mac or Ubuntu
if: ${{ steps.cache.outputs.cache-hit != 'true' && (startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')) }}
working-directory: ../tvm/build
run: |
make -j3
- name: Install python TVM if Mac and not python 3.11
if: ${{ startsWith(matrix.os, 'macos') && matrix.python-version != '3.11' }}
- name: Install python TVM if Mac or Ubuntu
if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
working-directory: ../tvm/python
run: |
python -m pip install -U wheel packaging
python -m pip install cython==0.29.34
python setup.py bdist_wheel
python -m pip install dist/tvm-*.whl
# We don't run pytest for Linux py3.8 since we do coverage for that case.
- name: Test with pytest
if: ${{ matrix.python-version != '3.8' || startsWith(matrix.os, 'ubuntu') != true }}
run: pytest
run: pytest -v
# Run and push coverage only for Linux py3.8
- name: Coverage 3.8 Linux
if: ${{ matrix.python-version == '3.8' && startsWith(matrix.os, 'ubuntu') }}
run: |
coverage run -a -m pytest tests
coverage run -a -m pytest tests -v
coverage xml
- name: Upload coverage to Codecov
if: ${{ matrix.python-version == '3.8' && startsWith(matrix.os, 'ubuntu') }}
Expand Down

0 comments on commit 1047324

Please sign in to comment.