Skip to main content

xDSL

Project description

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

Using xDSL

To use xDSL we recommend following the xDSL Developer Setup to clone the repository including the notebooks. The following tutorials will present xDSL basic concepts, how to use its irdl dialect to define new dialects in a user-friendly way, and how to work with both xDSL and MLIR.

xDSL Developer Setup

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

Developer Installation

git clone https://github.com/xdslproject/xdsl.git
pip install --editable .
# Optional installation of extra requirements
pip install --requirement requirements-optional.txt

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 yapf to format the code in a uniform manner.

To automate the formatting within vim, one can use https://github.com/vim-autoformat/vim-autoformat and trigger a :Autoformat on save.

Project details


Release history Release notifications | RSS feed

This version

0.9.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdsl-0.9.1.tar.gz (104.5 kB view details)

Uploaded Source

Built Distribution

xdsl-0.9.1-py3-none-any.whl (100.5 kB view details)

Uploaded Python 3

File details

Details for the file xdsl-0.9.1.tar.gz.

File metadata

  • Download URL: xdsl-0.9.1.tar.gz
  • Upload date:
  • Size: 104.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for xdsl-0.9.1.tar.gz
Algorithm Hash digest
SHA256 b85aa3bc4bd55a7b359e45ad9bf330ddf1319b46eb9310184745f84e26937ff9
MD5 9d9e4913313a78cb0fc4b2d55a8c6739
BLAKE2b-256 8f4db8bd14cd7b1fc624df754867bdd7761fc461787dd1167b703c2174b483be

See more details on using hashes here.

File details

Details for the file xdsl-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: xdsl-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 100.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for xdsl-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 315d6d6b40fd3f2664eee34f20d5d45a8220dc6b15f2fd25f3247e9ddbea6502
MD5 32ce2ada0c783d453f39ada6eb532f41
BLAKE2b-256 0b8ea07a1cd7ba606dbb8f73c7a9108fde38bc4dbd484db033622785a0f93550

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page