Skip to main content
An annotation answers one question: which part of which model does this kernel claim to compute, and under which preconditions? It is a decorator placed above @triton.jit (and above @triton.autotune, if any).
Annotations are no-ops at runtime: implements returns the kernel unchanged. The CLI never imports your modules. It reads annotations from the source, so every argument must be a literal (string, number, list, tuple, dict) or a tfe.layout constructor call.

Parameters

string | string[]
required
A Spec Key, or a list of keys when the same kernel is used in several places. Each key is verified separately.
tuple[str, ...]
required
The launch grid, one expression per grid dimension (at most three). Expressions use shape-domain symbols (T, B, S), constexpr names, integer literals, + - * //, and cdiv(a, b). Examples: ("T",), ("T", "cdiv(17408, BLOCK)"), ("B", "heads").
dict[str, str]
Kernel parameter → spec tensor or scalar name. A value can also be an integer expression for an integer parameter: {"n": "T * 5120"}, or {"stride_bt": "cdiv(S, 16)"}. Entries you leave out are inferred from conventional names (x/X, w/W, y/out, eps, …).
dict[str, Layout]
Pointer parameter → layout mapping. The default is row-major, with the outer strides taken from the kernel’s stride parameters in signature order.
dict[str, tuple[int, int]]
Narrows the shape domain, for example {"T": (1, 8192)}. It can only narrow: domain: T ∈ [1, 300000] widens the default domain [1, 262144] is an error.
list[str]
Extra preconditions, for example ["T % 16 == 0", "contiguous(X)"]. They become hypotheses of the proof, and theformalera guards turns each one into a runtime check.
list[dict]
Constexpr combinations to verify. By default every @triton.autotune config is verified, plus module-level integer constants (BLOCK = 1024) as defaults.
str
The minimum guarantee level for this kernel (proof or bounded). It is recorded in the request; this release’s policy uses [policy] require_level and allow_bounded_on instead.

Binding

The engine has to know which kernel argument is which tensor of the spec node. Run theformalera spec show <key> to see the node’s tensor names:
So bind={"GU": "gate_up", "Y": "y"} maps the pointers. "T": "T" binds the integer parameter T to the symbolic dimension. Model constants such as I = 17408 are constexprs, and the engine checks that the values you pass equal the spec’s. If the engine cannot match a spec tensor, it tells you what to add:

Autotune configs

Every config of @triton.autotune is a different program, and any of them may be chosen at runtime, so each is verified:
This covers exactly the case differential testing misses: the config picked on the test machine works, and the one picked on production hardware does not. To verify a fixed set instead, pass configs=[{"BLOCK": 1024}].

Kernels with several keys

Each key produces its own row in the results table and its own proof.

Launcher-level annotations

You can annotate a Python wrapper that launches one or more kernels instead of a kernel itself. This is useful for split-KV attention, where two kernels together compute attn.core:
scan lists launchers, and trace records their launches for L3 sign-off. Static verification of launchers is on the roadmap. Today a launcher reports UNKNOWN, so for now put the annotation on each kernel.

Draft annotations automatically

The draft is printed, never written. Check the grid: here the kernel’s second grid dimension (cdiv(17408, BLOCK)) has to be added by hand.

Require annotations

A kernel without an annotation is never verified, so it can never fail. Close that gap with:
theformalera.toml
Any @triton.jit function under these paths that has no annotation, and is not called by an annotated launcher, fails verify: