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: 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