]> zoso.dev Git - libnemo.git/commitdiff
Fix nonce output to CPU which is expecting the 32-bit values in reverse for reasons...
authorChris Duncan <chris@zoso.dev>
Fri, 3 Jan 2025 22:58:23 +0000 (14:58 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 3 Jan 2025 22:58:23 +0000 (14:58 -0800)
src/lib/workers/powgpu.ts

index ed449860ee6356cb7b6207a0e9fdc1e7b442d402..e19bf187db3a2c26ac2e0762cadacbba770fd846 100644 (file)
@@ -153,7 +153,7 @@ export class PowGpu extends WorkerInterface {
                                                                                ((workgroup_id.z & 0xff) << 8) |
                                                                                (local_id.x & 0xff);
                        var m: array<u32, 16>;
-                       m[0u] = 0u;
+                       m[0u] = id;
                        m[1u] = id;
                        m[2u] = ubo.blockhash[0u].x;
                        m[3u] = ubo.blockhash[0u].y;
@@ -190,7 +190,7 @@ export class PowGpu extends WorkerInterface {
                        /**
                        * Iterate and hash until nonce found
                        */
-                       for (var j: u32 = 0u; j < 1u; j = j + 1u) {
+                       for (var j: u32 = id; j < id + 1u; j = j + 1u) {
                                if (atomicLoad(&work.found) != 0u) {
                                        return;
                                }
@@ -211,8 +211,8 @@ export class PowGpu extends WorkerInterface {
                                // Store the result directly into work array
                                if ((BLAKE2B_IV32_1 ^ v[1u] ^ v[17u]) > ubo.threshold) {
                                        atomicStore(&work.found, 1u);
-                                       work.nonce.x = j;
-                                       work.nonce.y = id;
+                                       work.nonce.x = id;
+                                       work.nonce.y = j;
                                        return;
                                }
                        }