back to home

xdslproject / xdsl

A Python compiler design toolkit.

501 stars
156 forks
169 issues
PythonMLIRMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing xdslproject/xdsl in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/xdslproject/xdsl)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

xDSL: A Python-native SSA Compiler Framework xDSL is a Python-native framework for building compiler infrastructure. It provides *SSA-based intermediate representations (IRs)* and Pythonic APIs to define, assemble, and optimize custom IRs—all with seamless compatibility with MLIR from the LLVM project. Inspired by MLIR, xDSL enables smooth translation of programs and abstractions between frameworks. This lets users prototype compilers entirely in Python, while still accessing MLIR's powerful optimization and code generation pipeline. All IRs in xDSL employ a unified SSA-based data structure, with regions and basic blocks, making it easy to write generic analyses and transformation passes. xDSL supports assembling compilers from predefined or custom IRs, and organizing transformations across a multi-level IR stack. This layered approach enables abstraction-specific optimization passes, similar to the architecture of projects like Devito, PSyclone, and Firedrake. In short, xDSL makes it possible to: • Prototype compilers quickly in Python • Build DSLs with custom IRs • Run analyses and transformations with simple scripts • Interoperate smoothly with MLIR and benefit from LLVM's backend Contents • Installation • Getting Started • Discussion Installation To contribute to xDSL, follow the xDSL Developer Setup Guide. To use xDSL as part of a larger project for developing your own compiler, just install xDSL via pip: To quickly install xDSL for development and contribution purposes, use: This may be useful for projects wanting to replicate the xDSL testing setup. *Note:* This version of xDSL is validated against a specific MLIR version, interoperability with other versions is not guaranteed. The supported MLIR version is 21.1.1. > [!IMPORTANT] > > ### Experimental Pyright Features > > xDSL currently relies on an experimental feature of Pyright called TypeForm. > TypeForm is in discussion > and will likely land in some future version of Python. > > For xDSL to type check correctly using Pyright, please add this to your : > > Subprojects With Extra Dependencies xDSL has a number of subprojects, some of which require extra dependencies. To keep the set of dependencies to a minimum, these extra dependencies have to be specified explicitly, e.g. by using: Getting Started Check out the dedicated Getting Started guide for a comprehensive tutorial. To get familiar with xDSL, we recommend starting with our Jupyter notebooks. The notebooks provide hands-on examples and documentation of xDSL's core concepts: data structures, the Python-embedded abstraction definition language, and end-to-end custom compilers construction, like a database compiler. There also exists a small documentation showing how to connect xDSL with MLIR for users interested in that use case. • A Database example • A simple introduction • A DSL for defining new IRs • Connecting xDSL with MLIR We provide a Makefile containing a lot of common tasks, which might provide an overview of common actions. Discussion You can also join the discussion at our Zulip chat room, kindly supported by community hosting from Zulip.