Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE #248

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/ci-mlir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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
- mlir_based_ci
- mlir-based-ci5
pull_request:
branches:
- main
- mlir_based_ci
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 }}
restore-keys: ${{ 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/