Skip to main content

dispatch_with_grid_sync_split

Function dispatch_with_grid_sync_split 

Source
pub fn dispatch_with_grid_sync_split(
    backend: &dyn VyreBackend,
    program: &Program,
    inputs: &[&[u8]],
    config: &DispatchConfig,
) -> Result<Vec<Vec<u8>>, BackendError>
Expand description

Universal dispatch helper that satisfies Node::Barrier { ordering: GridSync } on any backend by splitting at the barrier and running each segment as its own kernel launch.

Backends with native cooperative-launch grid sync (advertised via VyreBackend::supports_grid_sync) bypass the split - the program is dispatched once. Backends without it route here so the kernel-launch boundary becomes the grid-level fence: every prior write is globally visible to subsequent launches.

§Inputs

inputs matches the input slice the caller would have passed to dispatch_borrowed. After each segment, the helper refreshes every ReadWrite buffer’s slot from the segment’s readback so the next segment sees the prior writes.

§Errors

Propagates any BackendError raised by dispatch_borrowed on a segment, prefixed with the segment index for diagnosability.