Giter VIP home page Giter VIP logo

xdsl's Introduction

Build Status for the Core backend PyPI version Code Coverage Zulip Status

xDSL: A Python-native SSA Compiler Framework

xDSL is a Python-native compiler framework built around SSA-based intermediate representations (IRs). Users of xDSL build a compiler by assembling predefined domain-specific IRs and, optionally, defining 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.

The design of xDSL is influenced by MLIR, a compiler framework developed in C++, that is part of the LLVM project. An inherent advantage of a close design 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.

Installation

To use xDSL as part of a larger project for developing your own compiler, just install xDSL via pip:

pip install xdsl

Note: This version of xDSL is validated against a specific MLIR version, interoperability with other versions may result in problems. The supported MLIR version is commit 04fc02e583b06b846315904a55af9c273c8b20b9.

Getting Started

To get familiar with xDSL, we recommend starting with our Jupyter notebooks. The notebooks consist of examples and documentation concerning the core xDSL data structures and the xDSL's Python-embedded abstraction definition language, as well as examples of implementing custom compilers, like a database compiler. There also exists a small documentation showing how to connect xDSL with MLIR for users interested in that use case.

xDSL Developer Setup

To contribute to the development of xDSL follow the subsequent steps.

Developer Installation

git clone https://github.com/xdslproject/xdsl.git
cd xdsl
pip install --editable ".[extras]"

Testing

The xDSL project uses pytest unit tests and LLVM-style filecheck tests. They can be executed from the root directory:

# Executes pytests which are located in tests/
pytest

# Executes filecheck tests
lit tests/filecheck

Formatting

All python code used in xDSL uses black to format the code in a uniform manner.

To automate the formatting, we use pre-commit hooks from the pre-commit package.

# Install pre-commit version in the optional requirement files
pip install --requirement requirement-optional.txt

# Install the pre-commit on your `.git` folder
# Be sure to run this in your virtual environment
pre-commit install

# Optionally test the hook by running it on all files
pre-commit run --all-files

Discussion

You can also join the discussion at our Zulip chat room, kindly supported by community hosting from Zulip.

xdsl's People

Contributors

math-fehr avatar superlopuh avatar webmiche avatar georgebisbas avatar antonlydike avatar papychacal avatar tobiasgrosser avatar mesham avatar dinistro avatar meshtag avatar dependabot[bot] avatar georgemitenkov avatar nazavode avatar michel-steuwer avatar k-w-li avatar martin-luecke avatar shaolunwang avatar jossevandelm avatar fergtic avatar purvi-h avatar taobi22 avatar bringlein avatar ingomueller-net avatar karelpeeters avatar moxinilian avatar afd avatar goens avatar pingshiyu avatar lukamac avatar eymay avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.