Skip to main content

Module execute

Module execute 

Source
Expand description

The dispatch entry the STEM substrate calls: accelerated_gemm_f32 runs C = A·B on the GPU when the measured capability matrix says it wins and the job is big enough to be worth the dispatch, and on a rayon CPU path otherwise. The CPU path is always present and never hard-fails (§7).

The machine benchmark (crate::device_benchmark) runs once here, lazily, to build the shared ComputePolicy; every subsequent call is the O(1) select.

f64 vs f32: this accelerated path is f32 (the GPU/WGSL reality and what the throughput-bound callers want). The exact-f64 scientific GEMM (crate::solvers::linear_algebra::gemm) is unchanged and stays on the CPU — the bridge never silently downcasts a caller that asked for f64.

Enums§

RanOn
Which backend actually ran a dispatch (for observability and the correctness gate).

Functions§

accelerated_gemm_f32
Accelerated C = A·B (f32). a is m×k, b is k×n, c is m×n (overwritten). Routes to the GPU when the measured matrix favours it for DenseLinear, the job clears [GPU_MIN_FLOPS], and it fits in GPU buffers; otherwise the CPU path. Returns which backend ran. On any GPU shortfall it falls back to CPU — never a hard fail.
shared_policy
The shared compute policy, built once by probing this machine (the benchmark). The heavy probe runs on first call; thereafter select is O(1).