TorchLean API

NN.Tensor.Internal.Elab.Einsum.Contraction.Flat

Flat contraction lowering #

This module decodes a native row-major counter into certified tensor coordinates and lowers sufficiently large multi-axis tiled contractions to one flat native loop.

Decode a concrete native flat counter into row-major coordinate components.

Each component uses native quotient or remainder arithmetic. The accompanying equalities identify those executable components with the nested Fin.divNat and Fin.modNat coordinates used by Coord.unlinearize.

Instances For

    Compile a large concrete multi-axis contraction as one native flat loop.

    The executable callback decodes its row-major counter with native quotient and remainder operations. Its certificate identifies those coordinates with Coord.unlinearize, then transports the native fold to coordinateFoldl. The optimization is retained only when the callback is a generated four- or eight-lane update, so every scalar accumulator remains live across the complete contraction.

    Instances For