Registry / ai-ml / xdsl
library0.66.0pypypi✓ verified 84d ago

xDSL is a Python library for defining and manipulating domain-specific languages (DSLs) with a focus on compiler infrastructure. It provides IR building blocks, pattern rewrites, and verification passes. Current version: 0.63.0. Released monthly.

pip install xdsl
INSTALL
IMPORT
SIG · XDSL
X
xdsl
ai-mlpythonv0.66.0
Install
2.8s avg
Import
248ms
Disk
38MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.66.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.202s · 42MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.194s · 42MB
38MB installed
● package 38MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IR builtins
from xdsl.ir import Block, Region, Operation, SSAValue
from xdsl import Block
Top-level imports are not available; use xdsl.ir submodule.
MLIR type conversion (legacy)
from xdsl.interpreters.mlir import MLIRConverter
from xdsl.mlir import MLIRConverter
MLIR converter moved to xdsl.interpreters.mlir.

Construct an MLIR-like module with a function containing an add operation.

from xdsl.ir import Block, Region, Operation, SSAValue from xdsl.dialects.builtin import ModuleOp, IntegerType, FunctionType from xdsl.dialects import arith, func # Create a simple function: i32 add int32 = IntegerType(32) func_type = FunctionType.from_lists([int32, int32], [int32]) # Build region with add operation block = Block.from_ops([ arith.Addi(SSAValue(0), SSAValue(1)), func.Return() ]) region = Region(block) # Wrap in FunctionOp func_op = func.FuncOp("add", func_type, region) module = ModuleOp([func_op]) print(module)
Debug
Known issues
breakingIn version 0.60.0, the entire IR API was refactored. Operations now require explicit operands and results; the old mutable operation pattern is removed.
fix
Use Block.from_ops() with SSAValue references and explicit operands. See migration guide.
affects: <0.60.0 => >=0.60.0
deprecatedThe xdsl.util module is deprecated; use xdsl.utils or xdsl.ir utilities instead.
fix
Replace xdsl.util imports with xdsl.utils equivalents.
affects: >=0.60.0
gotchaSSAValue indices are positional and must match the block's arguments. A common mistake is to assume SSAValue(0) refers to the first operation's result; it refers to the first block argument.
fix
Ensure block arguments are defined first, then use SSAValue(index) where index corresponds to the argument list order.
affects: all
Errors
Common errors & fixes
AttributeError: module 'xdsl' has no attribute 'ir'
Import path is wrong; the package does not expose submodules at top level.
fix
Use `from xdsl.ir import Block, Region, Operation, SSAValue`.
ValueError: Operation must have at least one operand or result
Creating an operation without specifying operands and results in the new API (post 0.60).
fix
Pass operands and result_types when constructing an operation: `arith.Addi(operands=[...], result_types=[...])` or use helper methods.
TypeError: cannot instantiate 'Block' with positional arguments
Block no longer accepts operations as positional arguments in newer versions.
fix
Use `Block.from_ops([op1, op2])` or `Block(ops=[op1, op2])` keyword argument.
Upgrade
Version history
0.66.0latest on PyPI · released Jun 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
52 hits · last 30 days
node
46
OpenAI (training)
1
Resources
xdsl — pip install xdsl · libregistry