IR Lowering Primitives #
Typed state, indices, and shape operations used by the checked IR lowering pass. These declarations
remain under IRExec.Internal; the public lowering entry point lives in IRExec.Lowering.
Internal lowering state used by buildFrom.
It is a dependent pair of:
ss: shapes of already-lowered IR nodes,ForwardData α [inShape] ss: forward closures for exactly that shape list.
Instances For
Build a typed runtime index (Idx) for a numeric IR parent id.
The forward executor's context is typed by [inShape] ++ ss, matching ForwardData's
input-plus-node representation. mkIdx checks that:
idis in bounds, and- the context shape at that position matches the expected shape
s.
On failure, this returns a descriptive error string used directly by buildFrom.
Instances For
Package a typed forward closure as one node of the executable IR graph.
Instances For
Evaluation projection for mkForwardNode.
Internal list recursion used to track the dependent output shape of adjacent swaps.
Instances For
Apply adjacent swaps, represented by their axis depths, to a shape.
Instances For
Internal dependent recursion underlying applySwapsTensor.
Instances For
Apply the same adjacent-swap sequence as swapShapeBySwaps to a tensor value.
Instances For
One typed concat input: a leading extent together with a closure that reads the tensor with that extent from the runtime context. Inputs for a nonzero concat axis permute the parent before returning it, so the closure is the common shape for every concat branch.
Instances For
Concatenate typed tensors along their leading axis, folding from the first tensor.
The empty list yields the empty tensor with leading extent 0. This is the same fold shape as
the IR evaluator's NN.IR.Graph.evalConcatLeadingAxisFold.
Instances For
The leading extent of the fold in concatLeadingAxisList is a plain sum of extents.
Concatenate the tensors produced by concat inputs along their leading axis.
Instances For
The concatenated size reported by concatLeadingAxisFromInputs is the sum of the input extents.
This theorem justifies the output-shape cast in the concat lowering branches.