add CI with github workflow
This commit is contained in:
79
.github/workflows/validate_operations.yml
vendored
Normal file
79
.github/workflows/validate_operations.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
name: Validate Operations
|
||||
|
||||
env:
|
||||
LLVM_COMMIT: 0c2701fe7fa002e1befc5f86c268a7964f96d286
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y cmake ninja-build build-essential protobuf-compiler
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: pip install numpy onnx colorama
|
||||
|
||||
- name: Clone LLVM
|
||||
run: |
|
||||
git clone -n https://github.com/llvm/llvm-project.git onnx-mlir/llvm-project
|
||||
cd onnx-mlir/llvm-project && git checkout ${{ env.LLVM_COMMIT }}
|
||||
|
||||
- name: Cache MLIR build
|
||||
id: cache-mlir
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: onnx-mlir/llvm-project/build
|
||||
key: mlir-${{ runner.os }}-${{ env.LLVM_COMMIT }}
|
||||
|
||||
- name: Build MLIR
|
||||
if: steps.cache-mlir.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p onnx-mlir/llvm-project/build
|
||||
cd onnx-mlir/llvm-project/build
|
||||
cmake -G Ninja ../llvm \
|
||||
-DLLVM_ENABLE_PROJECTS="mlir;clang" \
|
||||
-DLLVM_ENABLE_RUNTIMES="openmp" \
|
||||
-DLLVM_TARGETS_TO_BUILD="host" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_ENABLE_ASSERTIONS=ON \
|
||||
-DLLVM_ENABLE_RTTI=ON \
|
||||
-DENABLE_LIBOMPTARGET=OFF \
|
||||
-DLLVM_ENABLE_LIBEDIT=OFF
|
||||
cmake --build .
|
||||
|
||||
- name: Build Raptor
|
||||
run: |
|
||||
MLIR_DIR=$(pwd)/onnx-mlir/llvm-project/build/lib/cmake/mlir
|
||||
mkdir -p build && cd build
|
||||
cmake .. -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DONNX_MLIR_ACCELERATORS=PIM \
|
||||
-DLLVM_ENABLE_ASSERTIONS=ON \
|
||||
-DMLIR_DIR=${MLIR_DIR}
|
||||
cmake --build .
|
||||
|
||||
- name: Run validation
|
||||
run: |
|
||||
python validate.py \
|
||||
--raptor-path build/Debug/bin/onnx-mlir \
|
||||
--onnx-include-dir onnx-mlir/include
|
||||
Reference in New Issue
Block a user