Native weight selection for the Convolution-3SUM reduction #
Directly adapts pickStmt and putStmt of Anthropic's pinned graph builder.
This code uses the existing unsigned word RAM,
its sign-and-magnitude encoding, and its proved subtraction block. No source machine is copied.
One input register holds a signed index, which may be negative or out of range. The code reads
only when the index is nonnegative and below N; otherwise it uses the filler. It optionally
negates the selected value and stores it at a supplied destination. Addresses and lengths are
unsigned; index, filler and input values are encoded signed integers. The nine arithmetic
registers are scratch, and the five argument registers are preserved. Destination/input overlap
is allowed for this single read-then-write operation; graph-building loops need their own frame.
The theorem charges selection, optional negation and the store, excluding a final halt.
Exec.executes adds one instruction for that halt. Computing the index, arranging
arguments, traversing matrices and invoking Exact Triangle are not included. This is a graph
construction kernel, not a complete reduction or a subquadratic 3SUM solver.
Main definitions #
Weight.select: guarded read, falling back to the encoded filler.Weight.store: select, optionally negate, and store one graph weight.
Main results #
Weight.exec_store: at most twenty-eight native instructions at widthw + 2.
References #
Encoded signed index to read.
Instances For
Unsigned input length.
Instances For
Unsigned input base address.
Instances For
Encoded fallback value.
Instances For
Unsigned destination address.
Instances For
Select a signed input word into right, rejecting negative indices before any load.
Instances For
Store a selected weight, optionally negated; all five argument registers are preserved.
Instances For
A selected signed weight is stored within twenty-eight unsigned instructions. All address arithmetic is charged, but computing the signed index and preparing arguments are caller costs. The signed bounds are satisfiable even for negative, zero and out-of-range indices.