Transformer architecture implemented in TypeScript with WebGPU.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
nn/shader/base.wgsl

18 lines
429 B

struct MatrixBatch {
size: vec4<u32>,
data: array<f32>,
}
@group(0) @binding(3)
var<storage, read_write> m: MatrixBatch;
@compute @workgroup_size(1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
for (var z = 0u; z < m.size.z; z++) {
for (var y = 0u; y < m.size.y; y++) {
for (var x = 0u; x < m.size.x; x++) {
m.data[z * m.size.y * m.size.x + y * m.size.x + x] = 0f;
}
}
}
}