]> zoso.dev Git - libnemo.git/commitdiff
Set workload dynamically based on hardware.
authorChris Duncan <chris@zoso.dev>
Mon, 6 Jan 2025 21:13:26 +0000 (13:13 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 6 Jan 2025 21:13:26 +0000 (13:13 -0800)
src/lib/workers/powgpu.ts

index 3476b159d66290f6e842dde54950dd732758efc8..23e33101252c56a9675c164c79add9700c6d2d27 100644 (file)
@@ -33,7 +33,8 @@ export class PowGpu extends WorkerInterface {
                })
        }
 
-       static workload = 256
+       // Between 8-256 threads per workgroup based on hardware
+       static workload: number = Math.min(256, Math.max(64, 2 ** (navigator.hardwareConcurrency / 2)))
 
        // WebGPU Compute Shader
        static shader = `