ScalarBlockKernels
Scalar reference for direct, left-packed, right-packed, both-packed, and retained matrix products. Operands supply logical m, n, k; no packing group determines a compute tile or solve order. Every packed input must have the matching left/right role. Layout and context rejection, scratch validation, and allocation occur before output mutation. There is no retry after writes start.
Each call evaluates a caller-selected logical block. Shared portable Kotlin owns the Level 2/3 algorithm, cache and panel traversal, packing strategy, workspace lifetime, kernel selection, and semantic fallback policy. A native implementation of this contract receives an explicit bounded window of work; internal microtile loops may reuse registers or streaming state within that window. The scalar reference remains independently callable regardless of the selected backend.
Alpha zero or depth zero scales only selected C entries and does not read A or B. Beta zero never loads original C. Unselected output, array gaps, and padding are untouched. Nonalias calls need no scratch; aliases stage the selected result in caller scratch or one temporary array, then commit it. No workspace is retained by this object, and no native state survives the call. Callers may reuse their scratch and retained operands across blocks. Exact consumers validate a retained SVL restriction on every call.
Functions
product
Computes the selected entries of alpha * A * B + beta * C with explicit evaluation. Baked operand transforms are already represented in their values. contribution applies beta only to the first depth block; splitting a dot into blocks can round differently, so ordered fallback callers keep depth order. svlBytes is the consumer's current checked context, with zero meaning unknown. Scalar arithmetic itself is length independent, but an operand's declared restriction remains enforced.
scratchSize
Number of scratch doubles needed for an alias-safe call. A conservative shared-array check avoids an address-set allocation. The supplied scratch must not share any operand's backing array.