From 42f8aee57ff1638e3f96abfe85212bbe49a2932e Mon Sep 17 00:00:00 2001 From: NiccoloN Date: Mon, 30 Mar 2026 17:43:22 +0200 Subject: [PATCH] use ccache for raptor build --- .github/workflows/validate_operations.yml | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validate_operations.yml b/.github/workflows/validate_operations.yml index 8e6d46c..38061f3 100644 --- a/.github/workflows/validate_operations.yml +++ b/.github/workflows/validate_operations.yml @@ -5,6 +5,11 @@ env: PROTOBUF_REF: v34.0 CMAKE_VERSION: 4.3.0 MOLD_LINKER_FLAGS: -fuse-ld=mold + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_MAXSIZE: 10G + CCACHE_BASEDIR: ${{ github.workspace }} + CCACHE_COMPILERCHECK: content + CCACHE_NOHASHDIR: "true" on: push: @@ -24,7 +29,7 @@ jobs: - name: Install system dependencies run: | sudo apt update - sudo apt install -y cmake ninja-build build-essential mold curl ca-certificates + sudo apt install -y cmake ninja-build build-essential mold curl ca-certificates ccache - name: Install CMake run: | @@ -69,34 +74,43 @@ jobs: - name: Install Python dependencies run: pip install numpy onnx colorama - - name: Restore Raptor Build Cache - id: restore-raptor-build-cache - uses: ./.github/actions/restore-raptor-build-cache + - name: Restore ccache + id: restore-ccache + uses: actions/cache/restore@v4 with: - key: raptor-build-${{ runner.os }}-${{ github.ref_name }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}-${{ github.sha }} + path: ${{ env.CCACHE_DIR }} + key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}-${{ github.sha }} restore-keys: | - raptor-build-${{ runner.os }}-${{ github.ref_name }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}- - raptor-build-${{ runner.os }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}- + ccache-${{ runner.os }}-${{ github.ref_name }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}- + ccache-${{ runner.os }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}- - name: Build Raptor id: build-raptor run: | + ccache --set-config=max_size=${CCACHE_MAXSIZE} + ccache --zero-stats + ccache --show-config + ccache --show-stats + MLIR_DIR=$(pwd)/onnx-mlir/llvm-project/build/lib/cmake/mlir cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ -DONNX_MLIR_ACCELERATORS=PIM \ + -DONNX_MLIR_CCACHE_BUILD=ON \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DMLIR_DIR=${MLIR_DIR} \ -DCMAKE_EXE_LINKER_FLAGS="${MOLD_LINKER_FLAGS}" \ -DCMAKE_SHARED_LINKER_FLAGS="${MOLD_LINKER_FLAGS}" \ -DCMAKE_MODULE_LINKER_FLAGS="${MOLD_LINKER_FLAGS}" cmake --build build + ccache --show-stats - - name: Save Raptor Build Cache - if: steps.build-raptor.outcome == 'success' && steps.restore-raptor-build-cache.outputs.cache-hit != 'true' - uses: ./.github/actions/save-raptor-build-cache + - name: Save ccache + if: steps.build-raptor.outcome == 'success' && steps.restore-ccache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 with: - key: raptor-build-${{ runner.os }}-${{ github.ref_name }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}-${{ github.sha }} + path: ${{ env.CCACHE_DIR }} + key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ env.LLVM_COMMIT }}-${{ env.PROTOBUF_REF }}-${{ env.CMAKE_VERSION }}-${{ github.sha }} - name: Run validation run: |