Skip to content

Commit

Permalink
Merge branch 'main' into mlir_parsing_printing_fix
Browse files Browse the repository at this point in the history
merge main
  • Loading branch information
martin-luecke committed Jan 9, 2023
2 parents d647295 + 5f870d1 commit 9f8471c
Show file tree
Hide file tree
Showing 84 changed files with 3,545 additions and 1,349 deletions.
24 changes: 24 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[run]
branch = True
omit =
# Autogenerated missed code handles other VCSes.
xdsl/_version.py
concurrency = multiprocessing
parallel = True
source =
xdsl/
tests/



[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Don't complain about missing debug-only code:
def __repr__

# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError
raise ValueError
raise TypeError
raise RuntimeError
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application
name: CI - Python-based Testing

on:
# Trigger the workflow on push or pull request,
Expand Down Expand Up @@ -31,11 +31,11 @@ jobs:
run: |
pip install --upgrade pip
- name: Install the package locally
run: pip install -e .
run: pip install -e .[extras]
- name: Test with pytest
run: |
pytest tests/
pytest
- name: Execute lit tests
run: |
export PYTHONPATH=$(pwd)
lit -v tests/filecheck/
lit -v tests/filecheck/
109 changes: 109 additions & 0 deletions .github/workflows/ci-mlir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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: lukka/get-cmake@9e431acfe656e5db66cd4930386328fce59cfaba

- 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 .[extras]

- 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 with pytest and generate code coverage
run: |
cd xdsl
# Add the MLIR Python bindings to the PYTHONPATH
export PYTHONPATH=$PYTHONPATH:${GITHUB_WORKSPACE}/llvm-project/build/tools/mlir/python_packages/mlir_core
pytest --cov --cov-config=.coveragerc tests
- name: Execute lit tests
run: |
cd xdsl
export PYTHONPATH=$(pwd)
# Add mlir-opt to the path
export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/
# Add the MLIR Python bindings to the PYTHONPATH
export PYTHONPATH=$PYTHONPATH:${GITHUB_WORKSPACE}/llvm-project/build/tools/mlir/python_packages/mlir_core
lit -v tests/filecheck/ -DCOVERAGE -DEXEC_DIR=$(pwd)
- name: Combine coverage data
run: |
cd xdsl
coverage combine --append
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
directory: ${GITHUB_WORKSPACE}/../
files: coverage.xml
41 changes: 41 additions & 0 deletions .github/workflows/ci-notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI - Python Notebooks

on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: |
pip install --upgrade pip
- name: Install the package locally
run: pip install -e .
- name: Install nbval
run: |
pip install nbval
- name: Run examples/tutorials
run: |
pytest --nbval-lax docs/irdl.ipynb --maxfail 1 -vv
pytest --nbval docs/tutorial.ipynb --maxfail 1 -vv
11 changes: 7 additions & 4 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ cython_debug/

# lit tests results
tests/filecheck/.lit_test_times.txt
tests/**/Output/*

# Mac
.DS_Store
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include versioneer.py
include xdsl/_version.py
include requirements.txt requirements-optional.txt
include xdsl/py.typed
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
# xDSL
# xDSL: A common ecosystem for DSL development

[![Build Status for the Core backend](https://github.com/xdslproject/xdsl/actions/workflows/ci-core.yml/badge.svg)](https://github.com/xdslproject/xdsl/actions/workflows/ci-core.yml?query=workflow%3A%22CI+-+Python+application%22++)
[![PyPI version](https://badge.fury.io/py/xdsl.svg)](https://badge.fury.io/py/xdsl)
[![Code Coverage](https://codecov.io/gh/xdslproject/xdsl/main/graph/badge.svg)](https://codecov.io/gh/xdslproject/xdsl)

[![Zulip Status](https://img.shields.io/badge/chat-on%20zulip-%2336C5F0)](https://xdsl.zulipchat.com)

[xDSL](http://www.xdsl.dev) is a compiler toolkit natively developed in Python.
It allows users to reuse existing domain-specific intermediate representations
(IRs), or to define their own custom IRs. xDSL uses multi-level IRs, meaning
that during the compilation process, a program will be lowered through several
of these IRs. This allows the implementation of abstraction-specific
optimization passes, similar to the structure of common DSL compilers (such as
Devito, Psyclone, and Firedrake). To simplify the writing of these passes, xDSL
uses a uniform data structure based on SSA, basic blocks, and regions, which
additionally enables the writing of generic passes.

An inherent advantage of a design close to [MLIR](https://mlir.llvm.org/) is
the easy interaction between the two frameworks, making it possible to
translate abstractions and programs back and forth. This results in one big
SSA-based abstraction ecosystem that can be worked with through Python, making
analysis through simple scripting languages possible. Additionally, xDSL can
leverage MLIR's code generation and low-level optimization capabilities.

## Prerequisites

To install XDSL you can either clone the Github repository and install the requirements by following:
To install XDSL you can either clone the GitHub repository and install the requirements by following:

### Clone and install
```bash
Expand Down
23 changes: 23 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
codecov:
require_ci_to_pass: yes
notify:
wait_for_ci: yes

coverage:
precision: 2
round: down
range: 80...90

status:
# Learn more at http://docs.codecov.io/docs/codecov-yaml
project:
default:
enabled: yes
target: 1
threshold: 0.1
patch:
default:
enabled: off

ignore:
- "**/*.ipynb"
Loading

0 comments on commit 9f8471c

Please sign in to comment.