mirror of https://github.com/llvm/torch-mlir
Fix precommit workflow (#13)
parent
111ba12e7f
commit
a5f3b16f92
|
@ -2,10 +2,11 @@ name: Build and Test
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-llvm:
|
|
||||||
env:
|
env:
|
||||||
LLVM: external/llvm-project
|
LLVM: external/llvm-project
|
||||||
|
LLVMconfig: -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=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
|
||||||
|
jobs:
|
||||||
|
build-llvm:
|
||||||
name: Build LLVM
|
name: Build LLVM
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -23,19 +24,17 @@ jobs:
|
||||||
id: cache-llvm
|
id: cache-llvm
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${LLVM}
|
path: ${{ env.LLVM }}
|
||||||
key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }}
|
key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }}
|
||||||
- name: Rebuild and Install LLVM
|
- name: Rebuild and Install LLVM
|
||||||
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
mkdir ${LLVM}/build
|
mkdir -p ${LLVM}/build
|
||||||
mkdir ${LLVM}/install
|
mkdir -p ${LLVM}/install
|
||||||
cd ${LLVM}/build
|
cd ${LLVM}/build
|
||||||
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=OFF -DLLVM_INCLUDE_TEST=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
|
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++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
|
||||||
|
make bin/llvm-lit
|
||||||
cmake --build . --target install -- -j$(nproc)
|
cmake --build . --target install -- -j$(nproc)
|
||||||
build:
|
build:
|
||||||
env:
|
|
||||||
LLVM: external/llvm-project
|
|
||||||
name: Build and Test
|
name: Build and Test
|
||||||
needs: build-llvm
|
needs: build-llvm
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -54,7 +53,7 @@ jobs:
|
||||||
id: cache-llvm
|
id: cache-llvm
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${LLVM}
|
path: ${{ env.LLVM }}
|
||||||
key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }}
|
key: ${{ runner.os }}-llvm-install-${{ steps.get-llvm-hash.outputs.hash }}
|
||||||
- name: Rebuild and Install LLVM
|
- name: Rebuild and Install LLVM
|
||||||
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
||||||
|
@ -62,17 +61,32 @@ jobs:
|
||||||
mkdir ${LLVM}/build
|
mkdir ${LLVM}/build
|
||||||
mkdir ${LLVM}/install
|
mkdir ${LLVM}/install
|
||||||
cd ${LLVM}/build
|
cd ${LLVM}/build
|
||||||
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=OFF -DLLVM_INCLUDE_TEST=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
|
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_INCLUDE_TESTS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON
|
||||||
cmake --build . --target install -- -j$(nproc)
|
cmake --build . --target install -- -j$(nproc)
|
||||||
|
- name: Install pytest
|
||||||
|
run: |
|
||||||
|
pip3 install pytest
|
||||||
|
- name: Install pybind11
|
||||||
|
run: |
|
||||||
|
sudo apt-get install python3-pybind11
|
||||||
|
wget https://github.com/pybind/pybind11/archive/v2.2.3.tar.gz
|
||||||
|
tar xvf v2.2.3.tar.gz
|
||||||
|
cd pybind11-2.2.3
|
||||||
|
mkdir build
|
||||||
|
mkdir install
|
||||||
|
cd build
|
||||||
|
cmake .. -DCMAKE_INSTALL_PREFIX=../install
|
||||||
|
make -j$(nproc)
|
||||||
|
make install
|
||||||
- name: Build and Test npcomp (Assert)
|
- name: Build and Test npcomp (Assert)
|
||||||
run: |
|
run: |
|
||||||
mkdir build_assert
|
mkdir build_assert
|
||||||
cd build_assert
|
cd build_assert
|
||||||
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++
|
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 -DCMAKE_PREFIX_PATH=../pybind11-2.2.3/install -DLLVM_EXTERNAL_LIT=`pwd`/../${LLVM}/build/bin/llvm-lit
|
||||||
make check-npcomp -j$(nproc)
|
make check-npcomp -j$(nproc)
|
||||||
- name: Build and Test npcomp (Release)
|
- name: Build and Test npcomp (Release)
|
||||||
run: |
|
run: |
|
||||||
mkdir build_release
|
mkdir build_release
|
||||||
cd build_release
|
cd build_release
|
||||||
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++
|
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
|
||||||
make check-npcomp -j$(nproc)
|
make check-npcomp -j$(nproc)
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
# Resources that must be packaged into the python tree
|
# Resources that must be packaged into the python tree
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/npcomp/compiler/backend/refjit_resources")
|
||||||
add_custom_target(NPCOMPPythonResources)
|
add_custom_target(NPCOMPPythonResources)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET NPCOMPPythonResources
|
TARGET NPCOMPPythonResources
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
# TODO: Make the runtime library work for windows.
|
# TODO: Make the runtime library work for windows.
|
||||||
${CMAKE_BINARY_DIR}/lib/runtime/libNPCOMPCompilerRuntimeShlib.so
|
${CMAKE_BINARY_DIR}/lib/libNPCOMPCompilerRuntimeShlib.so
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/npcomp/compiler/backend/refjit_resources/libNPCOMPCompilerRuntimeShlib.so
|
${CMAKE_CURRENT_BINARY_DIR}/npcomp/compiler/backend/refjit_resources/libNPCOMPCompilerRuntimeShlib.so
|
||||||
)
|
)
|
||||||
add_dependencies(NPCOMPPythonResources
|
add_dependencies(NPCOMPPythonResources
|
||||||
|
|
Loading…
Reference in New Issue