ARKHĒ ← OPEN SOURCE
Arkhē / Compiler engineering

From compiler IR to checked numerical results.

An engineering preview for running typed xDSL programs on NumPy arrays and checking what they compute.

SOURCE-ONLY PREVIEW ↗
The problem

Structure is not the answer.

A compiler can accept a well-formed program that still computes the wrong answer. This work helps test the computation, not just the structure of the generated code.

The experimental jit_numpy adapter takes an already-built typed xDSL module, lowers a selected function through the existing LLVM JIT, and calls it on supported NumPy arrays. It borrows their storage without copying and checks the supported input contract before entering native code.

What is included

Small surface.
Executable checks.

Existing convolution and pooling programs exercise real numerical work and compare results with independent reference calculations. The packet also contains separately reviewable LLVM compatibility changes and instructions for replaying its focused tests.

It builds on xDSL and MLIR's ranked-memref C-wrapper convention. MLIR also provides an existing NumPy-to-memref helper; this preview introduces no new ABI.

Current evidence. In the development environment (Python 3.12.13, NumPy 2.5.3), the revision passed 377 tests on each of MLIR 22.1.2 and 21.1.8 on native macOS ARM64, plus typing, style, examples and FileChecks. The tested Python 3.10.20 / NumPy 1.24.0 pair passed runtime checks but failed strict Pyright. These are overlapping regression suites, not a benchmark or a proof of all inputs.

Scope and limits

Useful, bounded, unfinished.

Supported hereNative f64 arrays of ranks 1–4, selected strided layouts, f64 scalar parameters and synchronous borrowed-buffer calls.
Not claimedA new compiler, a native-code sandbox, a speedup, a formal proof, full NumPy support, full CI or upstream acceptance.

The README records the supported array subset, tool versions and the minimum-dependency typing limitation. For ordinary Python/NumPy numerical code, use the existing compiler ecosystem first; this adapter is for people who specifically need xDSL IR, dialects or passes to execute and be checked end to end.

This was developed with substantial AI assistance. No xDSL maintainer acceptance or endorsement, and no independent human review, is claimed.

Inspect the work

The preview is source-only and keeps the patch stack, replay instructions, examples, evidence and limits together.