Thread-scoped operations (glass::thread::)#
Sequential, one-problem-per-thread variants of the branch-free primitives:
a single thread owns the whole operation — no barriers, no shuffles, no
threadIdx read — so 32 independent problems pack into one warp. They
target the low-DOF corner (robot DOF ≲ 7) where even a warp per problem
leaves most lanes idle: a thread-per-problem launch
(<<<ceil(P/TPB), TPB>>>, see glass::suggested_threads_per_block<>())
keeps every lane busy on its own problem.
Contract: compile-time sizes only. The tier’s value is operands that nvcc
keeps register-resident, which requires fully-unrolled, compile-time-resolvable
indexing — the measured ceiling is N ≤ 7 (both dtypes; larger N still
computes correctly but demotes the operands to local memory, forfeiting the
tier’s premise). Operands may be thread-local register arrays; nothing is read
from threadIdx, so the functions are launch-shape-agnostic.
Every op delegates to the same *_impl body its block-scoped sibling uses,
collapsed through ThreadBarrier (rank 0, size 1, no-op sync) — the same
algorithm and operand order as glass::block:: on one thread, agreeing to within a
few ULP (FMA contraction may differ between the two instantiations;
test/test_thread.py pins the bound). They live in the same base headers as
their block-scoped siblings (under namespace thread), so their rendered
signatures appear on the L1 — Vector Operations, L2 — Matrix-Vector Operations, and L3 — Matrix Operations pages.
Deliberately absent (see the glass::thread:: constraints block in
CLAUDE.md): the _fast / _lowmem reduction twins (they name reduction
strategies; one thread has none — thread::dot simply returns a serially
accumulated T), the contraction-parallel *_reduced family, and every
data-dependent / pivoted op (iamax, pivoted ldlt, getrf / gesv,
inv_pivoted, syev) — when every lane owns a different problem, a
data-dependent branch diverges the whole warp, which is exactly the cost the
tier exists to avoid.
Surface (mirrors the branch-free warp surface):
L1:
dot(returnsT), the serial reductionsreduce/nrm2/asum/nrm1_diff, and the mapsaxpy/axpy_strided/scal/copy/copy_strided/rot/symmetrize. See L1 — Vector Operations.L2:
gemv(flags:TRANSPOSE/ROW_MAJOR),trsv(FillMode/Diag/TRANSPOSE). See L2 — Matrix-Vector Operations.L3:
gemm,syrk/syr2k,trsm, the factor/solve chainpotrf/posv/potrs/ldlt(non-pivoted) /ldlt_solve/inv(non-pivoted), and the fused familiestensor_vec_contract/vec_tensor_vec,congruence_sym/bilinear/congruence_accum,riccati_gain. See L3 — Matrix Operations.
The dispatch ladder (Backend Picker (glass-defaults.cuh)) contends the tier alongside warp / block /
nvidia, and the sm_120 tables ship thread verdicts (2026-07-18 sweep): thread
takes the low-DOF corner of every op except gemm — up to 7.5× on posv
f64 at N≤6 (docs sweep-results page + bench/RESULTS.md). Run bench/tune.py --sm auto
to contend it on your own GPU.