]> zoso.dev Git - nano-pow.git/commitdiff
Prune steps from final round that do not affect final outcome.
authorChris Duncan <chris@zoso.dev>
Thu, 16 Jan 2025 15:30:04 +0000 (07:30 -0800)
committerChris Duncan <chris@zoso.dev>
Thu, 16 Jan 2025 15:30:04 +0000 (07:30 -0800)
src/shaders/compute.wgsl

index 2da6c741214fed9cbee4aae7cd89ee0d26c4e568..2895232c95e0bcf0241b7b341dbeff9e6e5baf3d 100644 (file)
@@ -1467,7 +1467,7 @@ fn main(id: vec3<u32>) {
        // skip since adding 0u does nothing
        v12 = ((v12 ^ v0).xy >> ROTATE_16) | ((v12 ^ v0).yx << ROTATE_16);
        v8 = v8 + v12 + vec2(0u, u32(v8.x + v12.x < v8.x));
-       v4 = ((v4 ^ v8).xy << ROTATE_1) | ((v4 ^ v8).yx >> ROTATE_31);
+       // skip since it does not affect the final values of `v0` and `v8`
 
        /**
        * r=11, i=1, a=v[1], b=v[5], c=v[9], d=v[13]
@@ -1495,7 +1495,7 @@ fn main(id: vec3<u32>) {
        // skip since adding 0u does nothing
        v14 = ((v14 ^ v2).xy >> ROTATE_16) | ((v14 ^ v2).yx << ROTATE_16);
        v10 = v10 + v14 + vec2(0u, u32(v10.x + v14.x < v10.x));
-       v6 = ((v6 ^ v10).xy << ROTATE_1) | ((v6 ^ v10).yx >> ROTATE_31);
+       // skip since it does not affect the final values of `v0` and `v8`
 
        /**
        * r=11, i=3, a=v[3], b=v[7], c=v[11], d=v[15]
@@ -1521,23 +1521,14 @@ fn main(id: vec3<u32>) {
        v5 = ((v5 ^ v10).xy >> ROTATE_24) | ((v5 ^ v10).yx << ROTATE_8);
        v0 = v0 + v5 + vec2(0u, u32(v0.x + v5.x < v0.x));
        // skip since adding 0u does nothing
-       v15 = ((v15 ^ v0).xy >> ROTATE_16) | ((v15 ^ v0).yx << ROTATE_16);
-       v10 = v10 + v15 + vec2(0u, u32(v10.x + v15.x < v10.x));
-       v5 = ((v5 ^ v10).xy << ROTATE_1) | ((v5 ^ v10).yx >> ROTATE_31);
+       // skip since it does not affect the final values of `v0` and `v8`
+       // skip since it does not affect the final values of `v0` and `v8`
+       // skip since it does not affect the final values of `v0` and `v8`
 
        /**
        * r=11, i=5, a=v[1], b=v[6], c=v[11], d=v[12]
        */
-       v1 = v1 + v6 + vec2(0u, u32(v1.x + v6.x < v1.x));
-       v1 = v1 + m0 + vec2(0u, u32(v1.x + m0.x < v1.x));
-       v12 = v12.yx ^ v1.yx;
-       v11 = v11 + v12 + vec2(0u, u32(v11.x + v12.x < v11.x));
-       v6 = ((v6 ^ v11).xy >> ROTATE_24) | ((v6 ^ v11).yx << ROTATE_8);
-       v1 = v1 + v6 + vec2(0u, u32(v1.x + v6.x < v1.x));
-       v1 = v1 + m2 + vec2(0u, u32(v1.x + m2.x < v1.x));
-       v12 = ((v12 ^ v1).xy >> ROTATE_16) | ((v12 ^ v1).yx << ROTATE_16);
-       v11 = v11 + v12 + vec2(0u, u32(v11.x + v12.x < v11.x));
-       v6 = ((v6 ^ v11).xy << ROTATE_1) | ((v6 ^ v11).yx >> ROTATE_31);
+       // skip entire step since it does not affect the final values of `v0` and `v8`
 
        /**
        * r=11, i=6, a=v[2], b=v[7], c=v[8], d=v[13]