From 3f4391a6a74f5bfa06828bcc33a271832d641545 Mon Sep 17 00:00:00 2001 From: Michel Weber Date: Mon, 28 Nov 2022 14:13:26 +0100 Subject: [PATCH 1/5] CI: Add MLIR-based CI --- .github/workflows/ci-mlir.yml | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/ci-mlir.yml diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml new file mode 100644 index 0000000000..5578c26f3e --- /dev/null +++ b/.github/workflows/ci-mlir.yml @@ -0,0 +1,85 @@ +# This workflow will install MLIR, Python dependencies, run tests and lint with a single version of Python + +name: CI - MLIR-based Testing + +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ['3.10'] + + env: + LLVM_SYMBOLIZER_PATH: /usr/lib/llvm-11/bin/llvm-symbolizer + MLIR-Version: 74992f4a5bb79e2084abdef406ef2e5aa2024368 + steps: + - uses: actions/checkout@v3 + + - name: Python Setup + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Clang Setup + uses: egor-tensin/setup-clang@v1 + + - name: Ninja Setup + uses: llvm/actions/install-ninja@main + + - name: CCache Setup (C++ compilation) + uses: hendrikmuhs/ccache-action@v1.2.5 + with: + key: ${{ runner.os }}-${{ env.MLIR-Version }} + # LLVM needs serious cache size + max-size: 6G + + - name: Checkout project + uses: actions/checkout@v3 + with: + path: xdsl + + - name: Checkout MLIR + uses: actions/checkout@v3 + with: + repository: llvm/llvm-project.git + path: llvm-project + ref: ${{ env.MLIR-Version }} + + - name: Upgrade pip + run: | + pip install --upgrade pip + + - name: Install the package locally + run: | + pip install -e ${GITHUB_WORKSPACE}/xdsl + + - name: MLIR Build Setup + run: | + pip install -r ${GITHUB_WORKSPACE}/llvm-project/mlir/python/requirements.txt + mkdir llvm-project/build + cd llvm-project/build + cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_LLD=ON -DMLIR_ENABLE_BINDINGS_PYTHON=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + + - name: MLIR Build + run: | + cd llvm-project/build + cmake --build . --target mlir-opt MLIRPythonModules + + - name: Test + run: | + # Add the Python Bindings to the pythonpath + export PYTHONPATH=$PYTHONPATH:${GITHUB_WORKSPACE}/llvm-project/build/tools/mlir/python_packages/mlir_core + # Add mlir-opt to the path + export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/ + lit -v ${GITHUB_WORKSPACE}/xdsl/tests/filecheck/mlir-conversion/with-bindings/ From 348a5f0ab4710914e645867c9afffa9a92078b08 Mon Sep 17 00:00:00 2001 From: Michel Weber Date: Wed, 30 Nov 2022 08:45:55 +0100 Subject: [PATCH 2/5] look for cache on main --- .github/workflows/ci-mlir.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml index 5578c26f3e..c24c9006b3 100644 --- a/.github/workflows/ci-mlir.yml +++ b/.github/workflows/ci-mlir.yml @@ -41,6 +41,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.5 with: key: ${{ runner.os }}-${{ env.MLIR-Version }} + ref: refs/heads/main # LLVM needs serious cache size max-size: 6G From bf2f86a6b2b0e772199a27b7089fcff7a039a8b6 Mon Sep 17 00:00:00 2001 From: Michel Weber Date: Wed, 30 Nov 2022 08:58:26 +0100 Subject: [PATCH 3/5] build cache on branch --- .github/workflows/ci-mlir.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml index c24c9006b3..bdd09ef18d 100644 --- a/.github/workflows/ci-mlir.yml +++ b/.github/workflows/ci-mlir.yml @@ -8,6 +8,7 @@ on: push: branches: - main + - mlir_based_ci pull_request: branches: - main @@ -41,7 +42,6 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.5 with: key: ${{ runner.os }}-${{ env.MLIR-Version }} - ref: refs/heads/main # LLVM needs serious cache size max-size: 6G From a3da3df912c7e550b9a408f4f39625eba1c8faca Mon Sep 17 00:00:00 2001 From: Michel Weber Date: Wed, 30 Nov 2022 10:09:46 +0100 Subject: [PATCH 4/5] add restore keys --- .github/workflows/ci-mlir.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml index bdd09ef18d..94a9b22996 100644 --- a/.github/workflows/ci-mlir.yml +++ b/.github/workflows/ci-mlir.yml @@ -9,9 +9,11 @@ on: branches: - main - mlir_based_ci + - mlir_based_ci4 pull_request: branches: - main + - mlir_based_ci workflow_dispatch: jobs: @@ -42,6 +44,7 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.5 with: key: ${{ runner.os }}-${{ env.MLIR-Version }} + restore-keys: ${{ runner.os }}-${{ env.MLIR-Version }} # LLVM needs serious cache size max-size: 6G From ae4058d302c65a71d9dd560b9b97836c4cee47ee Mon Sep 17 00:00:00 2001 From: Michel Weber Date: Wed, 30 Nov 2022 10:22:47 +0100 Subject: [PATCH 5/5] small change --- .github/workflows/ci-mlir.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml index 94a9b22996..7c10357fb0 100644 --- a/.github/workflows/ci-mlir.yml +++ b/.github/workflows/ci-mlir.yml @@ -9,7 +9,7 @@ on: branches: - main - mlir_based_ci - - mlir_based_ci4 + - mlir-based-ci5 pull_request: branches: - main