Skip to main content

xDSL package

Project description

xDSL

Prerequisites

To install the required dependencies, execute the following command:

pip install -r requirements.txt

Optional dependencies, necessary for formatting the code may be installed via:

pip install -r requirements-optional.txt

TODO: check if PYTHONPATH is required or if there exists an easy fix for it.

Testing

This project includes pytest unit test and llvm-style filecheck tests. They can be executed using to following commands from within the root directory of the project:

# Executes pytests which are located in tests/
pytest

# Executes filecheck tests
lit tests/filecheck

Generating executables through MLIR

xDSL can generate executables using MLIR as the backend. To use this functionality, make sure to install the MLIR Python Bindings. Given an input file input.xdsl, that contains IR with only the mirrored dialects found in src/xdsl/dialects (arith, builtin, cf, func, irdl, llvm, memref, and scf), run:

### Prints MLIR generic from to tmp.mlir
./src/tools/xdsl_opt -t mlir  -o tmp.mlir `input.xdsl`

mlir-opt --convert-scf-to-cf --convert-cf-to-llvm --convert-func-to-llvm --convert-arith-to-llvm --convert-memref-to-llvm --reconcile-unrealized-casts tmp.mlir | mlir-translate --mlir-to-llvmir > tmp.ll

The generated tmp.ll file contains LLVMIR, so it can be directly passed to a compiler like clang. Notice that a main function is required for clang to build. Refer to tests/filecheck/arith_ops.test for an example. The functionality is tested with MLIR git commit hash: 74992f4a5bb79e2084abdef406ef2e5aa2024368

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

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.5.3.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xdsl-0.5.3-py3-none-any.whl (56.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xdsl-0.5.3.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdsl-0.5.3.tar.gz
Algorithm Hash digest
SHA256 1ea3034a7e8bd740267bd08ea63c371530bb40bebc930b5e8cee31fd82ce9183
MD5 2febdae303602c2eb01e454d4b346596
BLAKE2b-256 3b672cc4085e72d011f206234a1bd5e577f5948a981c1af8c9c8989b1a8ab705

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xdsl-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 56.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for xdsl-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b1e0385743c010c2beddeda38833b10b467a43a833400baebbc76e9baefbe810
MD5 06775162a1f2dbdcd7b2f9da179bfef2
BLAKE2b-256 d1f83d2452f7f8a3661075c2b05d3fb8e03ef3618ef715fff40e952ee47bc668

See more details on using hashes here.

Supported by

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