Skip to content

Commit

Permalink
add timing article
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Nov 14, 2023
1 parent 3244f36 commit 78b0b28
Show file tree
Hide file tree
Showing 41 changed files with 3,379 additions and 278 deletions.
1 change: 1 addition & 0 deletions toc.hanson
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'webgpu-memory-layout.md',
'webgpu-copying-data.md',
'webgpu-limits-and-features.md',
'webgpu-timing.md',
'webgpu-wgsl.md',
'webgpu-how-it-works.md',
],
Expand Down
98 changes: 98 additions & 0 deletions webgpu/lessons/resources/euclidean-modulo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions webgpu/lessons/resources/modulo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions webgpu/lessons/webgpu-compute-shaders-histogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ We can now setup the commands to run the compute shader
```js
const encoder = device.createCommandEncoder({ label: 'histogram encoder' });
const pass = encoder.beginComputePass(encoder);
const pass = encoder.beginComputePass();
pass.setPipeline(pipeline);
pass.setBindGroup(0, bindGroup);
pass.dispatchWorkgroups(1);
Expand All @@ -499,7 +499,7 @@ We need to copy the histogram buffer to the result buffer
```js
const encoder = device.createCommandEncoder({ label: 'histogram encoder' });
const pass = encoder.beginComputePass(encoder);
const pass = encoder.beginComputePass();
pass.setPipeline(pipeline);
pass.setBindGroup(0, bindGroup);
pass.dispatchWorkgroups(1);
Expand All @@ -512,7 +512,7 @@ and then execute the commands
```js
const encoder = device.createCommandEncoder({ label: 'histogram encoder' });
const pass = encoder.beginComputePass(encoder);
const pass = encoder.beginComputePass();
pass.setPipeline(pipeline);
pass.setBindGroup(0, bindGroup);
pass.dispatchWorkgroups(1);
Expand Down Expand Up @@ -1308,7 +1308,7 @@ dispatches until we've reduced things to 1 chunk
- pass.setBindGroup(0, chunkSumBindGroup);
- pass.dispatchWorkgroups(1);
+ // reduce the chunks
+ const pass = encoder.beginComputePass(encoder);
+ const pass = encoder.beginComputePass();
+ pass.setPipeline(chunkSumPipeline);
+ let chunksLeft = numChunks;
+ sumBindGroups.forEach(bindGroup => {
Expand Down
Loading

0 comments on commit 78b0b28

Please sign in to comment.