pub struct SplitPlan {
pub lanes: usize,
pub cpu_lanes: usize,
pub gpu_lanes: usize,
pub cpu_backend: ComputeBackend,
pub co_execution: CoExecution,
}Expand description
A resolved, deterministic plan for one batch.
Produced by SplitPlan::for_lanes. Holds no borrows and no lifetimes,
per the workspace rules.
Fields§
§lanes: usizeTotal lanes in the batch.
cpu_lanes: usizeLanes 0 .. cpu_lanes run on the CPU backend.
gpu_lanes: usizeLanes cpu_lanes .. lanes run on the GPU.
cpu_backend: ComputeBackendThe CPU backend the plan will actually use, already resolved.
co_execution: CoExecutionPrecision policy for the CPU half.
Implementations§
Source§impl SplitPlan
impl SplitPlan
Sourcepub fn for_lanes(
lanes: usize,
ratio: SplitRatio,
co_execution: CoExecution,
) -> Self
pub fn for_lanes( lanes: usize, ratio: SplitRatio, co_execution: CoExecution, ) -> Self
Build the deterministic plan for lanes work items.
§Arguments
lanes— total independent work items, dimensionless.ratio— how much to give the GPU; seeSplitRatio.co_execution— precision policy for the CPU half.
§Returns
A plan whose cpu_lanes + gpu_lanes == lanes exactly. When the GPU is
unavailable — no gpu feature, Android, or no adapter — gpu_lanes is
0 and the whole batch is planned for the CPU; that is the graceful
degradation contract, not an error.
§Determinism
A pure function of its arguments and the machine’s backend availability. It performs no timing, samples no load, and consults no random source, so two runs on one machine always plan identically.
Sourcepub fn is_co_executing(&self) -> bool
pub fn is_co_executing(&self) -> bool
Whether this plan actually uses both sides.
false for a CPU-only or GPU-only plan, which is the common case on
hardware where one side dominates.
Sourcepub fn precision_note(&self) -> &'static str
pub fn precision_note(&self) -> &'static str
A one-line, caller-facing statement of the precision this plan will produce — the per-call form of the mixed-precision caveat #18 required be documented rather than discovered.
Intended to be logged or surfaced by anything recording a V&V run, so a result set carries the precision story with it.
Sourcepub fn harmonise_cpu_half(&self, cpu_values: &mut [f64])
pub fn harmonise_cpu_half(&self, cpu_values: &mut [f64])
Apply the CoExecution policy to the CPU half of a completed result.
Call this on the CPU-computed lanes before splicing the two halves
together. Under CoExecution::NativePrecision it is a no-op; under
CoExecution::MatchGpuPrecision it rounds each value through f32.