Typed interchange programs #
Program attaches element types and an input/output interface to the existing
Graph. Shapes and dependencies remain in that graph; there is no second node
language. Ordinary operators have homogeneous signatures, so a frontend must
make its promotions explicit. Casts and registered heterogeneous primitives use
the existing custom-node shape contract and a separate element-type signature.
The custom node's name is for display. Its typed primitive entry, indexed by node id, determines its meaning. An unregistered custom operation is rejected rather than inferred from a spelling. Interpreters must supply the implementation of every primitive they execute.
Type checking establishes consistency of the declared program, not equivalence with a frontend or correctness of an external numerical backend.
Typed extension of a custom node; shape contracts remain in OpKind.custom.
- cast
(rounding : FloatLib.Floats.Formats.BinaryInterchange.Model.IEEERoundingMode :=
FloatLib.Floats.Formats.BinaryInterchange.Model.IEEERoundingMode.nearest)
: Primitive
Convert one tensor to the node's result type, with an explicit rounding direction.
- call
(name : Lean.Name)
(inputs : Array DType)
(output : DType)
: Primitive
A registered operation with an explicit, possibly heterogeneous element-type signature.
Instances For
Instances For
One canonical graph together with its SSA type assignment and external interface.
- graph : Graph
Shared graph syntax, including all operation shape attributes.
Element type of every node result, indexed by node id.
All runtime input nodes, in argument order.
Designated result nodes, in return order.
Typed bodies for custom nodes. Empty means no registrations; otherwise aligned with nodes.
Instances For
Passing the typed checker supplies the shape hypothesis used by graph semantics.
Append a shape-preserving cast to a typed program and return its result id.
The target type is the result's entry in the typing context; the rounding direction is the primitive's explicit attribute. Existing custom-node shape checks remain applicable.