Task 2 of 6
output is not just a size — it's a shape.
output: [16] launches a line of 16 threads; output: [16, 16]
launches a 16×16 grid of 256 threads, and each one gets two coordinates:
this.thread.x (column) and this.thread.y (row).
The result comes back with the same shape: a 2D kernel returns an array of rows,
indexed result[y][x].
[y][x] holds (x + 1) * (y + 1).output to a 16×16 grid: [16, 16]this.thread.x and this.thread.y(x + 1) * (y + 1) so row 1 counts 1…16, row 2 counts 2…32, …output: [width, height] — x runs over width,
y over height. The returned value lands in result[y][x].
dim3
grid/block sizes, WebGPU's workgroup_size and dispatch dimensions. Choosing
the launch shape to match the output shape is the same design move on every platform.
This page is an interactive exercise — the editor, the GPU runner and your saved progress need JavaScript. The text above is the full brief.