]> zoso.dev Git - libnemo.git/commitdiff
Reintroduce workload variable to allow hardware to control workgroup size, considered...
authorChris Duncan <chris@zoso.dev>
Sun, 5 Jan 2025 11:27:39 +0000 (03:27 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 5 Jan 2025 11:27:39 +0000 (03:27 -0800)
src/lib/workers/powgpu.ts

index 61e8543ed740e465f95a1d818567660d09e5c20e..e3a851802d38a4ee17093f7dd4b4fc6acc901a92 100644 (file)
@@ -43,6 +43,8 @@ export class PowGpu extends WorkerInterface {
                })
        }
 
+       static workload = 256
+
        // WebGPU Compute Shader
        static #shader = `
                struct UBO {
@@ -145,7 +147,7 @@ export class PowGpu extends WorkerInterface {
                * 8-byte work is split into two 4-byte u32. Low 4 bytes are random u32 from
                * UBO. High 4 bytes are the random value XOR'd with index of each thread.
                */
-               @compute @workgroup_size(256)
+               @compute @workgroup_size(${this.workload})
                fn main(
                        @builtin(workgroup_id) workgroup_id: vec3<u32>,
                        @builtin(local_invocation_id) local_id: vec3<u32>