struct Dims { x: u32; y: u32; }; struct Array { data: [[stride(4)]] array; }; [[group(0), binding(0)]] var dims: Dims; // Array dimensions [[group(1), binding(0)]] var a: Array; [[group(1), binding(1)]] var b: Array; [[group(1), binding(2)]] var c: Array; // fn main_fn_1([[builtin(global_invocation_id)]] global_id: vec3) { // let idx = global_id.x; // c.data[idx] = a.data[idx] + b.data[idx]; // } [[stage(compute), workgroup_size(32, 32)]] fn main_fn_2([[builtin(global_invocation_id)]] global_id: vec3) { let id = (global_id.x * dims.x) + global_id.y; c.data[id] = a.data[id] + b.data[id]; }