]> zoso.dev Git - nano-pow.git/commitdiff
Some final steps are unnecessary since we only use v0 and v8 in the threshold compari...
authorChris Duncan <chris@zoso.dev>
Thu, 16 Jan 2025 15:21:38 +0000 (07:21 -0800)
committerChris Duncan <chris@zoso.dev>
Thu, 16 Jan 2025 15:21:38 +0000 (07:21 -0800)
src/shaders/compute.wgsl

index f4efcea56ebe4ecc81293f871084d46790052bd6..2da6c741214fed9cbee4aae7cd89ee0d26c4e568 100644 (file)
@@ -1551,21 +1551,12 @@ fn main(id: vec3<u32>) {
        // skip since adding 0u does nothing
        v13 = ((v13 ^ v2).xy >> ROTATE_16) | ((v13 ^ v2).yx << ROTATE_16);
        v8 = v8 + v13 + vec2(0u, u32(v8.x + v13.x < v8.x));
-       v7 = ((v7 ^ v8).xy << ROTATE_1) | ((v7 ^ v8).yx >> ROTATE_31);
+       // skip since we already have the final values of `v0` and `v8`
 
        /**
        * r=11, i=7, a=v[3], b=v[4], c=v[9], d=v[14]
        */
-       v3 = v3 + v4 + vec2(0u, u32(v3.x + v4.x < v3.x));
-       // skip since adding 0u does nothing
-       v14 = v14.yx ^ v3.yx;
-       v9 = v9 + v14 + vec2(0u, u32(v9.x + v14.x < v9.x));
-       v4 = ((v4 ^ v9).xy >> ROTATE_24) | ((v4 ^ v9).yx << ROTATE_8);
-       v3 = v3 + v4 + vec2(0u, u32(v3.x + v4.x < v3.x));
-       v3 = v3 + m3 + vec2(0u, u32(v3.x + m3.x < v3.x));
-       v14 = ((v14 ^ v3).xy >> ROTATE_16) | ((v14 ^ v3).yx << ROTATE_16);
-       v9 = v9 + v14 + vec2(0u, u32(v9.x + v14.x < v9.x));
-       v4 = ((v4 ^ v9).xy << ROTATE_1) | ((v4 ^ v9).yx >> ROTATE_31);
+       // skip entire step since we already have the final values of `v0` and `v8`
 
 
 
@@ -1576,7 +1567,7 @@ fn main(id: vec3<u32>) {
        ****************************************************************************/
 
        /**
-       * Set m0 if it passes the threshold and no other thread has set it
+       * Set nonce if it passes the threshold and no other thread has set it
        */
        if ((BLAKE2B_IV32_1 ^ v0.y ^ v8.y) > threshold && atomicLoad(&work.found) == 0u) {
                atomicStore(&work.found, 1u);