Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
webgpu: Use (16, 1, 1) as the work group size for binary and unary ops
With this change, the add benchmark has close to 100% speedup.
And PoseNet+ResNet demo improves from 3 fps to 6 fps.

We should try to avoid using (1, 1, 1) as the default work group size.

PERF
  • Loading branch information
qjia7 committed Sep 11, 2019
commit 0a9227995c6de8b5cab605b6e478f970c04fe249
2 changes: 1 addition & 1 deletion tfjs-backend-webgpu/src/kernels/binary_op_webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class BinaryOpProgram implements WebGPUProgram {
dispatch: [number, number, number];
variableNames = ['A', 'B'];
workPerThread = 4;
workGroupSize: [number, number, number] = [1, 1, 1];
workGroupSize: [number, number, number] = [16, 1, 1];

constructor(op: string, aShape: number[], bShape: number[]) {
this.outputShape = backend_util.assertAndGetBroadcastShape(aShape, bShape);
Expand Down
2 changes: 1 addition & 1 deletion tfjs-backend-webgpu/src/kernels/unary_op_webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class UnaryOpProgram implements WebGPUProgram {
dispatch: [number, number, number];
variableNames = ['A'];
workPerThread = 4;
workGroupSize: [number, number, number] = [1, 1, 1];
workGroupSize: [number, number, number] = [16, 1, 1];

constructor(outputShape: number[], op: string) {
this.outputShape = outputShape;
Expand Down