Skip to content

Pure builtins

A pure builtin computes from its arguments without requesting an effect such as a draw. The Quivers Indexed Effect Core (QIEC) lowering resolves each builtin by the types of its arguments so that the core can run or translate it. A pure builtin still returns a random value when its arguments are random.

Internal module

This module is an implementation detail of the compiler and its tooling. Its __all__ is empty, so none of the names below are part of the public API, and they may change without notice.

pure_builtins

The pure-expression builtins the QIEC lowering resolves by type.

Operators and builtin applications in program let steps and in QIEC values resolve to primitives of the closed registry by their operand types; reductions and last-axis operations resolve to their own terms. The tables here are the checked, portable registry shared by QIEC lowering and program elaboration. The eager PyTorch compiler has a deliberately larger native extension table; names in that extension do not become checked QIEC primitives implicitly.

BuiltinSpec didactic-model

BuiltinSpec(*, name: str, eager: Callable[..., HeldValue] | None = field(opaque=True, extras=OPAQUE_BY_IDENTITY), eager_arities: frozenset[int] = field(opaque=True, extras=OPAQUE_BY_VALUE), qiec_arities: frozenset[int] = field(opaque=True, extras=OPAQUE_BY_VALUE), purity: Literal['pure', 'random'], shape_rule: str, qiec_form: QiecBuiltinForm, qiec_overloads: Mapping[tuple[TypeExpr, ...], str] = field(opaque=True, extras=OPAQUE_BY_IDENTITY), qiec_operator: ReductionOperator | RowwiseOperator | None = field(opaque=True, extras=OPAQUE_BY_VALUE), targets: frozenset[str] = field(opaque=True, extras=OPAQUE_BY_VALUE))

Bases: QiecModel

One source builtin's eager and checked capabilities.

qiec_form records how checked lowering consumes the call. filter deliberately has the unsupported form: it is a known surface operation with a stable dynamic-shape diagnostic, not an accidentally unknown name.

Eager callables and overload registries retain their runtime identities. Arity sets, operator tags, and supported targets compare by value.