Files
Raptor/.github/workflows/validate_operations.yml
2026-03-06 15:44:23 +01:00

124 lines
3.6 KiB
YAML

name: Validate Operations
env:
LLVM_COMMIT: 0c2701fe7fa002e1befc5f86c268a7964f96d286
PROTOBUF_COMMIT: v34.0
on:
push:
pull_request:
jobs:
# Expose env vars as outputs so they can be passed to reusable workflows
config:
runs-on: ubuntu-latest
outputs:
llvm-commit: ${{ steps.set-vars.outputs.llvm-commit }}
steps:
- id: set-vars
run: echo "llvm-commit=$LLVM_COMMIT" >> "$GITHUB_OUTPUT"
build-mlir-cache:
needs: config
uses: ./.github/workflows/build_mlir_cache.yml
with:
llvm-commit: ${{ needs.config.outputs.llvm-commit }}
validate:
needs: build-mlir-cache
runs-on: ubuntu-latest
steps:
- name: Free disk space
if: runner.os == 'Linux'
run: |
df -h
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-cloud-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
df -h
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/.ghcup || true
sudo rm -rf /opt/hostedtoolcache/CodeQL || true
sudo docker system prune --all --volumes --force
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
df -h
- 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
- name: Cache protobuf build
id: cache-protobuf
uses: actions/cache@v4
with:
path: |
/usr/local/lib/libproto*
/usr/local/include/google/protobuf
key: protobuf-${{ runner.os }}-${{ env.PROTOBUF_COMMIT }}
- name: Install protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch ${{ env.PROTOBUF_COMMIT }} https://github.com/protocolbuffers/protobuf
cd protobuf
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja
sudo ninja install
cd ../..
rm -rf protobuf
- name: Register installed libraries
run: sudo ldconfig
- 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: Restore MLIR cache
uses: actions/cache/restore@v4
with:
path: onnx-mlir/llvm-project
key: mlir-${{ runner.os }}-${{ env.LLVM_COMMIT }}
fail-on-cache-miss: true
- 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