74 lines
2.4 KiB
YAML
74 lines
2.4 KiB
YAML
name: Build MLIR Cache
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
llvm-commit:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build-mlir:
|
|
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: Cache MLIR build
|
|
id: cache-mlir
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: onnx-mlir/llvm-project
|
|
key: mlir-${{ runner.os }}-${{ inputs.llvm-commit }}
|
|
|
|
- name: Install build dependencies
|
|
if: steps.cache-mlir.outputs.cache-hit != 'true'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y cmake ninja-build build-essential
|
|
|
|
- name: Clone LLVM
|
|
if: steps.cache-mlir.outputs.cache-hit != 'true'
|
|
run: |
|
|
git clone --filter=blob:none --no-checkout https://github.com/llvm/llvm-project.git onnx-mlir/llvm-project
|
|
cd onnx-mlir/llvm-project
|
|
git fetch --depth 1 origin ${{ inputs.llvm-commit }}
|
|
git checkout FETCH_HEAD
|
|
|
|
- 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 .
|