Four-register output tiling #
This module implements one concrete scalar-register lowering selected by
static cost analysis. Its update step refines the arbitrary-width semantics
from Tiling.Semantics; the width is an implementation choice rather than a
semantic restriction.
Every lane observes contracted coordinates in the same row-major order as the scalar lowering, so tiling requires no reassociation, commutativity, or distributivity argument.
Select one of four values by a statically bounded lane index.
Instances For
Selecting a concrete four-lane contraction after summing each lane agrees
with summing the selected lane. This representation lemma preserves the
coordinate order of Semantics.coordinateSum.
Update the proof-facing state of a four-lane tile.
For concrete contractions, compileCoordinateFold recognizes this exact
update and first emits nativeFinSum4, whose four totals are separate loop
arguments. The surrounding output pass fuses an immediately consumed result
into nativeFinSum4Push.
Instances For
Append one completed four-lane tile to a row-major output buffer.
Instances For
Pointwise equal lane values determine equal four-lane vectors.
Appending a four-lane function vector emits its values in lane order.
Projecting a four-lane update gives the corresponding scalar update.
The four-register update implements the width-polymorphic tile update.
Run a native finite sum while carrying four lane totals as separate scalar arguments.
Each recursive step advances one contraction coordinate. This keeps the generated callback small enough for Lean's native compiler to inline it into the loop, matching the eight-lane implementation.
Instances For
Sum four lanes over a native finite interval without vector operations inside the loop.
Instances For
Run four scalar accumulators and append their final values directly to an existing output buffer.
Instances For
Sum four lanes and append them without materializing the result vector.
Instances For
The four-scalar native loop is exactly the ordinary native fold using
updateTile4. Every lane therefore retains its original reduction order.
Directly appending the scalar loop totals is exactly pushTile4 applied to
the vector-valued loop result.
Run four scalar accumulators, apply one terminal function to each total, and append the results directly to an existing output buffer.
The terminal functions are never called inside the contraction loop. This is the execution path used when semiring laws move contraction-invariant factors outside a shared tiled sum.
Instances For
Sum four lanes and apply their terminal functions directly at the output buffer boundary.
Instances For
The finalized four-lane append is exactly the vector-valued contraction
followed by lane-wise finalization and pushTile4.