Expand description
KernelTeam v0: the persistent worker pool for int8 GEMV/GEMM output-column partitions.
This is the doctrine’s “persistent, dispatch-free steady state” in its first shippable form: workers are spawned once per process, parked on a condvar between operations (no busy wait, no work stealing, no task submission), and each dispatch hands every worker a disjoint contiguous range of output columns. Integer accumulation makes the parallel result exactly the serial result per element — partitioning never changes a single output bit, so thread count is a pure speed knob.
§The safety argument, in full
A [Job] carries raw pointers into the caller’s slices. Three facts make that sound:
- Lifetime:
Team::linear_q8does not return until every worker has decrementedremainingto zero, so the pointers outlive every access. - Aliasing: workers write only
out[row * n + col]forcolinside their own disjoint column range; reads (x_q, scales, weights, bias) are shared and immutable for the whole dispatch because the caller holds the only&mut(toout) and blocks. - One parallel owner:
dispatch_gateserializes whole dispatches, so a second engine thread cannot overwrite the job while workers are mid-partition, and workers themselves never dispatch (their compute is a leaf loop).
A stress test drives thousands of mixed-shape dispatches and a watchdog test bounds wall
time, per the many_utterances_without_deadlock policy.
Structs§
- Team
- The process-wide team. Exists only when
FTTS_INT8_THREADSrequests more than one thread.
Functions§
- armed
- The team for this process, if parallel execution is enabled.
- bypass_
team_ on_ this_ thread - Makes THIS thread run its int8 linears serially, never dispatching to the team.
- partitions
- Partitions the armed team runs with, or 1 when execution is serial.
- thread_
bypassed - Whether the current thread opted out of team dispatch.