Skip to main content

level_wave_program

Function level_wave_program 

Source
pub fn level_wave_program(
    step_body: Vec<Node>,
    depth_buf: &str,
    max_depth: u32,
    lane_count: u32,
) -> Program
Expand description

Build a Program that runs step_body per lane in depth-ordered waves.

Each lane reads depth_buf[invocation_id]. The kernel walks current_depth = 0..max_depth. At each depth, every lane whose depth equals current_depth executes step_body. A Barrier is emitted between depths so the caller can rely on depth-N effects being globally visible before depth-N+1 begins.

§Parameters

  • step_body: caller’s per-lane work body. Free to read/write any buffer the caller declares; it does NOT need to re-check the depth predicate (the wrapper does that).
  • depth_buf: buffer-name holding per-lane depth (u32). Read-only.
  • max_depth: number of waves to execute.
  • lane_count: total number of lanes in the dispatch grid.