From 212eb807397eec148614ea734bbd10bf5134dff4 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 4 Jan 2025 23:10:13 -0800 Subject: [PATCH] Remove extraneous commenting. Move XOR to start of for loop. Whitespace. --- src/lib/workers/powgpu.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/lib/workers/powgpu.ts b/src/lib/workers/powgpu.ts index e9e5901..7c5b826 100644 --- a/src/lib/workers/powgpu.ts +++ b/src/lib/workers/powgpu.ts @@ -150,9 +150,7 @@ export class PowGpu extends WorkerInterface { @builtin(workgroup_id) workgroup_id: vec3, @builtin(local_invocation_id) local_id: vec3 ) { - if (atomicLoad(&work.found) != 0u) { - return; - } + if (atomicLoad(&work.found) != 0u) { return; } /** * Flatten 3D workgroup and local identifiers into u32 for each thread @@ -199,9 +197,10 @@ export class PowGpu extends WorkerInterface { 0x04BE4294u, 0xE07C2654u, 0x137E2179u, 0x5BE0CD19u ); - for (var i: u32 = 0u; i < 0xFFFFu; i = i + 1u) { + for (var i: u32 = 0u; i < 0xFFu; i = i << 1u) { + m[0u] = m[0u] ^ i; /** - * Twelve rounds of mixing as part of compression step + * Twelve rounds of mixing as part of BLAKE2b compression step */ for (var r: u32 = 0u; r < 12u; r = r + 1u) { G(&v, &m, 0u, 8u, 16u, 24u, SIGMA82[r * 16u + 0u], SIGMA82[r * 16u + 1u]); @@ -223,17 +222,10 @@ export class PowGpu extends WorkerInterface { work.nonce.y = m[1]; return; } - - /** - * If not found, move on to the next nonce candidate. - * For example, increment by the total number of *active* threads, - * or simply increment by 1. - */ - m[0u] = m[0u] + 1u; } - - // No valid nonce found by this thread in 'maxIterations' attempts - // Exit. Another dispatch or CPU fallback might handle continuing. + /** + * Nonce not found in this execution context + */ return; } `; -- 2.34.1