2020-08-05 09:57:59 +08:00
|
|
|
name: Build and Test
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2020-08-07 14:51:05 +08:00
|
|
|
env:
|
|
|
|
LLVM: external/llvm-project
|
2020-08-05 09:57:59 +08:00
|
|
|
jobs:
|
|
|
|
build-llvm:
|
|
|
|
name: Build LLVM
|
2020-08-08 01:32:02 +08:00
|
|
|
runs-on: ubuntu-20.04
|
2020-08-05 09:57:59 +08:00
|
|
|
steps:
|
|
|
|
- name: Configure Environment
|
2020-10-16 20:21:36 +08:00
|
|
|
run: echo "$GITHUB_WORKSPACE/${LLVM}/install/bin" >> $GITHUB_PATH
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Get npcomp
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2020-11-23 05:01:15 +08:00
|
|
|
- name: Install python depends
|
2020-10-13 12:49:39 +08:00
|
|
|
run: |
|
2020-11-23 08:23:36 +08:00
|
|
|
python3 -m pip install pytest pybind11 numpy
|
2021-02-22 05:36:06 +08:00
|
|
|
- name: Install pytorch_nightly depends
|
|
|
|
run: |
|
2021-03-17 08:52:40 +08:00
|
|
|
python3 -m pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Get LLVM Hash
|
|
|
|
id: get-llvm-hash
|
|
|
|
run: echo "::set-output name=hash::$(git submodule status)"
|
|
|
|
shell: bash
|
2021-03-10 13:31:30 +08:00
|
|
|
- name: Get workflow spec hash
|
|
|
|
id: get-workflow-hash
|
|
|
|
run: echo "::set-output name=hash::$(md5sum $GITHUB_WORKSPACE/.github/workflows/buildAndTest.yml)"
|
|
|
|
shell: bash
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Cache LLVM
|
|
|
|
id: cache-llvm
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2020-08-07 14:51:05 +08:00
|
|
|
path: ${{ env.LLVM }}
|
2021-03-10 13:31:30 +08:00
|
|
|
key: ${{ runner.os }}-llvm-20.04-install-${{ steps.get-llvm-hash.outputs.hash }}-${{ steps.get-workflow-hash.outputs.hash }}
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Rebuild and Install LLVM
|
2020-08-07 23:36:03 +08:00
|
|
|
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
2020-08-05 09:57:59 +08:00
|
|
|
run: |
|
2020-08-07 14:51:05 +08:00
|
|
|
mkdir -p ${LLVM}/build
|
|
|
|
mkdir -p ${LLVM}/install
|
2020-08-05 10:19:26 +08:00
|
|
|
cd ${LLVM}/build
|
2021-06-11 09:06:46 +08:00
|
|
|
cmake ../llvm -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="host" -DCMAKE_INSTALL_PREFIX=../install -DLLVM_ENABLE_PROJECTS='mlir' -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INSTALL_UTILS=ON -DLLVM_BUILD_TOOLS=ON -DLLVM_INCLUDE_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DMLIR_ENABLE_BINDINGS_PYTHON=ON
|
2020-08-05 09:57:59 +08:00
|
|
|
cmake --build . --target install -- -j$(nproc)
|
|
|
|
build:
|
|
|
|
name: Build and Test
|
|
|
|
needs: build-llvm
|
2020-08-08 01:32:02 +08:00
|
|
|
runs-on: ubuntu-20.04
|
2020-08-05 09:57:59 +08:00
|
|
|
steps:
|
|
|
|
- name: Configure Environment
|
2020-10-16 20:21:36 +08:00
|
|
|
run: echo "$GITHUB_WORKSPACE/${LLVM}/install/bin" >> $GITHUB_PATH
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Get npcomp
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: 'true'
|
2020-11-23 05:01:15 +08:00
|
|
|
- name: Install python depends
|
2020-10-13 12:49:39 +08:00
|
|
|
run: |
|
2020-11-23 08:23:36 +08:00
|
|
|
python3 -m pip install pytest pybind11 numpy
|
2021-02-22 05:36:06 +08:00
|
|
|
- name: Install pytorch_nightly depends
|
|
|
|
run: |
|
2021-03-17 08:52:40 +08:00
|
|
|
python3 -m pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Get LLVM Hash
|
|
|
|
id: get-llvm-hash
|
|
|
|
run: echo "::set-output name=hash::$(git submodule status)"
|
|
|
|
shell: bash
|
2021-03-10 13:31:30 +08:00
|
|
|
- name: Get workflow spec hash
|
|
|
|
id: get-workflow-hash
|
|
|
|
run: echo "::set-output name=hash::$(md5sum $GITHUB_WORKSPACE/.github/workflows/buildAndTest.yml)"
|
|
|
|
shell: bash
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Cache LLVM
|
|
|
|
id: cache-llvm
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2020-08-07 14:51:05 +08:00
|
|
|
path: ${{ env.LLVM }}
|
2021-03-10 13:31:30 +08:00
|
|
|
key: ${{ runner.os }}-llvm-20.04-install-${{ steps.get-llvm-hash.outputs.hash }}-${{ steps.get-workflow-hash.outputs.hash }}
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Rebuild and Install LLVM
|
|
|
|
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
2020-08-05 10:19:26 +08:00
|
|
|
mkdir ${LLVM}/build
|
|
|
|
mkdir ${LLVM}/install
|
|
|
|
cd ${LLVM}/build
|
2021-06-11 09:06:46 +08:00
|
|
|
cmake ../llvm -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="host" -DCMAKE_INSTALL_PREFIX=../install -DLLVM_ENABLE_PROJECTS='mlir' -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INSTALL_UTILS=ON -DLLVM_BUILD_TOOLS=ON -DLLVM_INCLUDE_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DMLIR_ENABLE_BINDINGS_PYTHON=ON
|
2020-08-05 09:57:59 +08:00
|
|
|
cmake --build . --target install -- -j$(nproc)
|
|
|
|
- name: Build and Test npcomp (Assert)
|
|
|
|
run: |
|
|
|
|
mkdir build_assert
|
|
|
|
cd build_assert
|
2020-08-07 23:36:03 +08:00
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DMLIR_DIR=../${LLVM}/install/lib/cmake/mlir/ -DLLVM_DIR=../${LLVM}/install/lib/cmake/llvm/ -DCMAKE_LINKER=lld -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DLLVM_EXTERNAL_LIT=`pwd`/../${LLVM}/build/bin/llvm-lit
|
2021-02-22 05:36:06 +08:00
|
|
|
make check-npcomp check-frontends-pytorch -j$(nproc)
|
2020-08-05 09:57:59 +08:00
|
|
|
- name: Build and Test npcomp (Release)
|
|
|
|
run: |
|
|
|
|
mkdir build_release
|
|
|
|
cd build_release
|
2020-08-07 14:51:05 +08:00
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF -DMLIR_DIR=../${LLVM}/install/lib/cmake/mlir/ -DLLVM_DIR=../${LLVM}/install/lib/cmake/llvm/ -DCMAKE_LINKER=lld -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DLLVM_EXTERNAL_LIT=`pwd`/../${LLVM}/build/bin/llvm-lit
|
2021-02-22 05:36:06 +08:00
|
|
|
make check-npcomp check-frontends-pytorch -j$(nproc)
|