Spaces:
Running
Running
Download kernels/encpos.wgsl from EncryptidSystems/EdgeAI: direct link, hf CLI and curl.
- Browser
- Download file 795 Bytes
-
https://huggingface.co/spaces/EncryptidSystems/EdgeAI/resolve/main/kernels/encpos.wgsl
- Command line
-
hf download hf://spaces/EncryptidSystems/EdgeAI/kernels/encpos.wgsl
-
curl -L -o encpos.wgsl https://huggingface.co/spaces/EncryptidSystems/EdgeAI/resolve/main/kernels/encpos.wgsl
795 Bytes
| // A vision encoder's learned position: x[t] += table[0][col] + table[1][row] for patch t at | |
| // (t / COLS, t % COLS). The table is [2, ROWS_MAX, D] f32. One workgroup per token. | |
| override D: u32; | |
| override COLS: u32; | |
| override PLANE: u32; // rows of one table plane | |
| var<storage, read> tab: array<f32>; // 2 x PLANE x D | |
| var<storage, read_write> x: array<f32>; // T x D | |
| fn main( wg: vec3u, nwg: vec3u, | |
| tid: u32) { | |
| let t = wg.y * nwg.x + wg.x; | |
| let col = t % COLS; | |
| let row = t / COLS; | |
| for (var i = tid; i < D; i += 256u) { | |
| x[t * D + i] = x[t * D + i] + tab[col * D + i] + tab[(PLANE + row) * D + i]; | |
| } | |
| } | |