Skip to main content
All accumulation is sequential from index 0, saturating at every step, at the width of the data. This is the target’s order; it is what makes host and device agree bit for bit.

sf.sum(x, axis=None)

int | None
default:"None"
Reduce everything, or along one axis.
Events: overflow, counted per output (an output that saturated at any step counts once).

sf.dot(a, b)

1-D · 1-D as a chain of fma: acc = fma(a[k], b[k], acc). Equals the scalar chain bit for bit. Higher ranks go to matmul. Events: overflow (per output), underflow (any product).

sf.matmul(a, b) and a @ b

NumPy’s rules: 1-D operands are promoted and the extra axis dropped; leading dimensions broadcast as a batch. Each output is dot of a row and a column. Shape mismatches raise SFShapeError on the host before any launch. Events: overflow (per output), underflow.

sf.addmm(a, b, d)

a @ b followed by one saturating add of d (broadcast). The bias-add semantics the PyTorch layer uses.

sf.max(x, axis=None), sf.min(x, axis=None)

Exact selection. No events. Also as methods.

sf.argmax(x, axis=None), sf.argmin(x, axis=None)

NumPy integer indices of the extreme codes.

On the device

sum, dot, matmul and addmm are heavy. Before launch, the host runs the range bound: for matmul it uses min(max_i ||a_i||_1 × max|b|, max|a| × max_j ||b_j||_1) in exact integer arithmetic, which is never looser than the specification’s K × max|A| × max|B|. When the bound proves no partial sum can saturate, the result’s status is exact. max, min, argmax and argmin run on the host.