ADR 0073: CUBE Accumulator and Atomic Output Contract
Accepted with implementation by pull request 111. It depends on the accepted
PTO-CUBE-CELL-STATE-001 and PTO-CUBE-LOCAL-MATRIX-001 contracts.
Decision
Each TMATMUL_ACC and MX ACC operation reads one explicit accumulator C and publishes one explicit destination D. C and D must use different encoded relative Tile indices. Equal input and output indices raise Tile legality before destination allocation, source snapshots, or any other effect.
For a decoded block, C's encoded relative source selector is the stored
six-bit source TileIndex, while D's encoded relative destination index is the
zero-extended two-bit DstTile hand. These encoded values must differ before
physical destination renaming. For a direct Tile call, the destination and
accumulator TileIndex values must differ.
The architecture does not add a reuse bit, an implicit accumulator, or an in-place output form. Hardware renaming cannot make an unencodable equal-index input/output tuple legal.
Accumulator C
C has logical shape M x N, uses the same CUBE_M16 or CUBE_M32 layout class
as A, and contains the operation's accumulator dtype:
- FP32 for floating Matrix input pairs;
- S32 for signed integer Matrix input pairs; or
- U32 for unsigned integer Matrix input pairs.
Every valid C element must be defined before execution. C is snapshotted before the product and remains unchanged after success or rejection. C carries no hidden partial-sum provenance; its explicit dtype, shape, layout, definedness, and role establish accumulator legality.
Destination D
D has logical shape M x N and the same M layout class as A and C. Its concrete dtype is selected by the complete Matrix and B.FPATR contract. D may therefore have a different dtype, aligned storage geometry, CELL count, and required capacity from C while retaining the same logical result dimensions and M layout class.
An accumulator-preserving D uses the accumulator dtype and may become C in a later block through a new explicit binding. A converted or quantized D is not a legal later accumulator unless its dtype independently equals the required accumulator type.
Computation and reductions
The mathematical order is:
P = snapshot(C) + A * B
D = PostProcess(P)
The complete K reduction produces raw P before destination conversion. RowMax and GroupMax observe the raw accumulator at their operation-defined stage. Post-processing does not alter the already selected reduction source.
Atomic publication
Complete schema, index, alias, dtype, layout, shape, capacity, parameter, definedness, readiness, and output-allocation legality precedes every source snapshot and output effect.
D, RowMaxOut, GroupMaxOut, destination descriptors, definedness, and numeric status publish as one atomic output group. A late failure exposes none of the new outputs and preserves C, A, B, auxiliary sources, prior numeric status, and allocation state.
Defaults and protected behavior
- ACC forms have no omitted C or D default.
- Existing Matrix input-class and accumulator-dtype selection remains intact.
- Existing B.FPATR conversion, activation, reduction, flag, and parameter semantics remain intact.
- Source Tiles persist after successful execution.
- Matrix start function numbers and encodings remain unchanged.
Fault ordering
Equal relative C/D indices, accumulator-type mismatch, incompatible M layout class, shape mismatch, insufficient C or D capacity, undefined valid C data, invalid PostProcess parameters, and auxiliary-output failure raise Tile legality before effects. Decode-reserved forms remain illegal instruction and missing/duplicate complete-bundle attributes retain their bundle-control fault class.
Explicit exclusions
This decision defines no reuse encoding, physical in-place overwrite, implicit C, hidden partial-sum provenance, output-by-output commit, or fallback identity PostProcess path.
Acceptance criteria
The accepted ASL, generated documentation, and independent decoded tests prove:
- FP32, S32, and U32 explicit C behavior;
- equal relative C/D index rejection before effects;
- preserved C and newly allocated accumulator-type D;
- final converted D with the same M layout class and different CELL geometry;
- later reuse of a prior explicit accumulator-type D through a new binding;
- raw-accumulator RowMax and GroupMax behavior;
- atomic D/auxiliary/status publication;
- rollback on late output capacity and parameter failures; and
- unchanged source lifetime and Matrix instruction encodings.