Giter Site home page Giter Site logo

xdsl's Introduction

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.

xdsl's People

Contributors

dependabot[bot] avatar dinistro avatar georgebisbas avatar ingomueller-net avatar k-w-li avatar martin-luecke avatar math-fehr avatar michel-steuwer avatar purvi-h avatar superlopuh avatar tobiasgrosser avatar webmiche 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.