One cell of the three Convolution-3SUM matrices #
This directly adapts fillCells of Anthropic's pinned graph builder at
16a5ce41304fcdaea4e0be7c132e1c361dc26da5, using native unsigned word-RAM instructions.
The row and column, all three input indices, and the three destination addresses are computed
by the program. A negative BC index is replaced with the negative sentinel -1: both select
the filler. Registers 22 through 25 are additional scratch; registers 14 through 21 belong to
the caller. The AB and BC destinations follow the input, preserving it for subsequent reads.
The final AC write may alias the input; the complete matrix loop uses disjoint blocks.
Main definitions #
Cell.step: compute and write one cell of each matrix.
Main results #
Cell.exec_step: exact memory effect and a constant charged native instruction bound.
References #
Current row-major cell.
Instances For
Number of vertices per part.
Instances For
Instance number.
Instances For
Base address of matrix AB.
Instances For
Base address of matrix BC.
Instances For
Base address of matrix AC.
Instances For
Input length.
Instances For
Input base address.
Instances For
Signed encoded filler.
Instances For
Encoded source index.
Instances For
Current destination address.
Instances For
Saved encoded filler.
Instances For
Encoded negation of the filler.
Instances For
Computed row of the current cell.
Instances For
Computed column of the current cell.
Instances For
Place the fourteen weight registers at the start of the cell register file.
Instances For
The existing weight kernel embedded in the larger register file.
Instances For
Save the filler, compute the coordinates and prepare its negation operands.
Instances For
Compute the row and column, save the filler, and form its signed negation.
Instances For
Write the AB cell, including encoding its index and calculating its address.
Instances For
Write the AB cell after computing its index and destination.
Instances For
Write BC, testing for a negative index before unsigned subtraction.
Instances For
Write BC after computing its guarded signed index and destination.
Instances For
Write AC with negated filler before negating the selected value, then restore the filler.
Instances For
Write AC and restore the caller's positive filler.
Instances For
Compute and write all three entries at the current row-major cell.
Instances For
All index computations, three guarded loads, optional signed negation, stores and argument preparation take at most 128 native instructions. The final halt is excluded. Input cells precede all destinations; the three writes occur in AB, BC, AC order.