From 77bc11eb72d2eee2255f9c72ee297d9744c14685 Mon Sep 17 00:00:00 2001 From: Masahiro Hiramori Date: Thu, 1 Jun 2023 21:54:33 +0900 Subject: [PATCH] update TVM to 0.12.0 --- .github/workflows/pythonapp.yml | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 29f56a990..24b260ed6 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -78,32 +78,34 @@ jobs: run: | python -m pip install .[extra,onnx,sparkml] python -m pip install pandas - - name: Install TVM from pypi if Ubuntu - if: ${{ startsWith(matrix.os, 'ubuntu') }} - 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')}} + 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-0.12.0 # 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 + sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-14 10 - name: Install LLVM if Mac 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') }} + - 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 checkout tags/v0.12.0 git submodule update --recursive --init cmake -E make_directory build - name: CMake TVM if Mac @@ -115,13 +117,22 @@ jobs: "-DUSE_GRAPH_RUNTIME=ON" "-DUSE_LLVM=$(brew --prefix llvm@14)/bin/llvm-config --link-static" .. - - name: Build TVM if Mac - if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'macos') }} + - name: CMake TVM if Ubuntu + if: ${{ steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu') }} + working-directory: ../tvm/build + run: >- + cmake + "-DUSE_RPC=ON" + "-DUSE_GRAPH_RUNTIME=ON" + "-DUSE_LLVM=llvm-config --link-static" + .. + - 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 - if: ${{ startsWith(matrix.os, 'macos') }} + - 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