Skip to content
Tilefish

Tilefish

github.com • November 28, 2026

A typed tensor language for GPU inference. The shape, dtype, layout and quantization format of every tensor live in its type, operators come from a typed library, and a model is built once into GPU binaries plus a manifest. Thin Python, C++ and Rust hosts are generated from the same signatures.

Status: early preview (0.0.16 on PyPI, 0.0.11 on crates.io; the C++ host builds from this repository). tilefish types GPU kernels written in Triton, Gluon, CuTe DSL or PTX, pinned cuBLASLt and cuDNN calls and kernels it lowers itself, builds a model's graphs into launch plans over one arena, and runs the same pinned artefact from Python, Rust and C++. What it is and is not, and how features are added from now on, is in docs/en/scope.md ; the other documents are listed in docs/en/README.md .

In inference code the contract of a kernel is usually written three times and checked by none of them:

the shape, dtype, alignment and aliasing rules sit in a docstring, a few assert s and a above a C ABI;

a block-scaled weight format (MXFP8, MXFP4, NVFP4) is described in prose, together with the per-architecture byte layout of its scales;

the same kernel is ported by hand from Triton to CUDA C++ to Rust, and parity tests chase the last ULP (FMA contraction, flush-to-zero, reduction order) after the fact;

which implementation runs at which (M, N, K) on which GPU is a table someone measured once.

tilefish moves all of that into types, so the compiler can check it, generate it and reason it.

Note on BlockScaled (MXFP8 / MXFP4 / NVFP4): BlockScaled formats and sub-byte dtypes ( e2m1 , ue8m0 ) are currently implemented at the type-declaration and tracing layer only — they are not yet wired into AOT compilation specs, library operators, or the Python/Rust/C++ runtime hosts. Runnable builds today use standard dtypes ( bf16 , f16 , f32 , i32 , i64 , u8 , and e4m3 / e5m2 in externs).

Note on BlockScaled (MXFP8 / MXFP4 / NVFP4): BlockScaled formats and sub-byte dtypes ( e2m1 , ue8m0 ) are currently implemented at the type-declaration and tracing layer only — they are not yet wired into AOT compilation specs, library operators, or the Python/Rust/C++ runtime hosts. Runnable builds today use standard dtypes ( bf16 , f16 , f32 , i32 , i64 , u8 , and e4m3 / e5m2 in externs).

Declare. Types ( Dim , Tensor , BlockScaled , DevScalar , views) and four declarations: @tilefish.kernel (a body tilefish lowers to Triton itself), @tilefish.extern (a Triton, Gluon or CuTe DSL kernel, or prebuilt PTX or cubin, given a type), @tilefish.library (a pinned cuBLASLt GEMM or cuDNN convolution) and @tilefish.graph (a model step over them).

Build once. tilefish.runtime.export traces and checks the graph, compiles every kernel ahead of time, pins every library algorithm, and writes the cubins, manifest.json and the launch plans ( plan.json : every launch of a step over one arena). The manifest's digest covers every binary and pin, the plan's digest the plan and its manifest; a host pins one, and an export is reproducible from any directory and on another machine with the same toolchain and GPU architecture.

Run the same artefact. Python ( replay ), the Rust crate and the C/C++ library load the directory, verify it against the pin and check every precondition before a launch. jit runs the same machine code built in memory, reference the same bodies in torch.

Look inside. tilefish-explain maps each SASS instruction to its source line, and SASS assertions are checked at every build; probes time the phases inside a kernel; tilefish-explain --advise ranks the steps of a plan that could be one kernel.

The details of each stage are in the guide .

The Rust and C/C++ hosts default to cuda-12080 bindings (requiring a CUDA 12.8 or newer driver); to target another driver version ( cuda-12040 , cuda-13000 , cuda-13020 ), pass --no-default-features --features cuda-12040 (or -DTILEFISH_CARGO_FEATURES=cuda-12040 to CMake).

Building for sm_103 needs a newer ptxas than the one Triton 3.5.1 bundles (CUDA 12.8's, which cannot target sm_103a ): set TRITON_PTXAS_PATH to the ptxas of CUDA 12.9 or newer. A build that fails for this reason says so, and the GPU tests that build for an architecture the ptxas cannot target skip, naming it.

New to tilefish? docs/en/guide/tutorial.md goes from the install to a small model running from Python, Rust and C++, step by step, and docs/en/guide/migrate.md is the method for moving a model you already have, with GPT-2 from transformers as the worked example. The snippets below are the short form.

A @tilefish.graph exports its launch plan to the manifest, and tilefish.run(graph, ..., mode="replay", plan="build/", pin=p.digest) replays it ( build , plans ).

tilefish.hosts.rust.emit writes typed launchers for a pinned manifest ( guide , crates/tilefish/README.md ).

find_package(tilefish) after cmake --install ; tilefish.hosts.cpp.emit writes typed launchers and plan runners ( guide ).

Not a kernel compiler. Triton, CuTe DSL, cuTile, Helion and TileLang write kernels. tilefish types them, builds them and hosts them.

Not a serving runtime. Scheduling, KV cache, batching and request handling stay in the host program. tilefish owns one forward step over buffers it has planned.

Not a promise to generate every kernel. Hand-tuned attention and GEMMs enter as extern or library operators and keep their own numerics contract.

Early preview: the API will change.

The manifest is schema 3 and the plan tilefish.plan.v1 . There is no list of features to come. A feature is added when a real model migration needs it ( docs/en/scope.md ); the open items are tracked in issue #4 , and #5 (SASS traceability, probes, CuTe DSL externs) is closed. What each release changed is in CHANGELOG.md , and every document is listed in docs/en/README.md .

Licensed under either of Apache License, Version 2.0 or MIT license at your option.