Spaces:
Running
Running
Download kernels/flowscale.wgsl from EncryptidSystems/EdgeAI: direct link, hf CLI and curl.
- Browser
- Download file 954 Bytes
-
https://huggingface.co/spaces/EncryptidSystems/EdgeAI/resolve/main/kernels/flowscale.wgsl
- Command line
-
hf download hf://spaces/EncryptidSystems/EdgeAI/kernels/flowscale.wgsl
-
curl -L -o flowscale.wgsl https://huggingface.co/spaces/EncryptidSystems/EdgeAI/resolve/main/kernels/flowscale.wgsl
954 Bytes
| // flow.wgsl's integer currents into a HodgeLinear limb's real ones: flow[i] (+)= acc[i] * act_scale * | |
| // weight_scale, and acc is cleared for the next capture. ACCUM adds a further limb onto limb 0's. | |
| override N: u32; // output cells x input cells | |
| override ACCUM: bool = false; | |
| var<storage, read_write> acc: array<atomic<i32>>; | |
| var<storage, read> xs: array<f32>; // [0]: the activations' dequant scale | |
| var<storage, read> ws: array<f32>; // [0]: the limb's weight scale | |
| var<storage, read_write> flow: array<f32>; | |
| fn main( gid: vec3u, nwg: vec3u) { | |
| let i = gid.y * nwg.x * 256u + gid.x; | |
| if (i >= N) { | |
| return; | |
| } | |
| let v = f32(atomicExchange(&acc[i], 0)) * (xs[0] * ws[0]); | |
| if (ACCUM) { | |
| flow[i] = flow[i] + v; | |
| } else { | |
| flow[i] = v; | |
| } | |
| } | |