pub fn plan_dispatch_1d(
limits: &Limits,
total_threads: u64,
workgroup_x: u32,
) -> Result<(DispatchGrid, u32), String>Expand description
Plan a 1-D dispatch covering total_threads items with workgroup_x
threads each, automatically folding into a 2-D grid when the required
workgroup count would exceed the per-axis limit.
The companion shader must decode its linear slot as
wgid.y * grid_x + wgid.x (exactly as crate::shader::reduction_nd_wgsl
does) and early-return when the slot is out of range.
grid_x (the second return value) is the fold width to embed as the
grid_x uniform; for a non-folded dispatch it equals the X workgroup
count and the decode is still correct (wgid.y == 0).
Returns an error string if total_threads is so large that even a square
2-D grid would exceed the per-axis cap on both axes.