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.
28 lines
799 B
28 lines
799 B
struct MatrixBatch {
|
|
size: vec4<u32>,
|
|
data: array<f32>,
|
|
}
|
|
|
|
@group(0) @binding(0)
|
|
var<storage, read> e: MatrixBatch;
|
|
@group(0) @binding(1)
|
|
var<storage, read> dlds: MatrixBatch;
|
|
@group(0) @binding(2)
|
|
var<storage, read_write> gtattw: MatrixBatch;
|
|
|
|
@compute @workgroup_size(1)
|
|
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
|
gtattw.size.z = e.size.z;
|
|
gtattw.size.y = e.size.x;
|
|
gtattw.size.x = e.size.x;
|
|
|
|
var s = 0f;
|
|
var li = global_id.z * e.size.x * e.size.y + global_id.x;
|
|
var ri = global_id.z * dlds.size.x * dlds.size.y + global_id.y;
|
|
for (var i = 0u; i < e.size.y; i++) {
|
|
s += e.data[li] * dlds.data[ri];
|
|
li += e.size.x;
|
|
ri += dlds.size.x;
|
|
}
|
|
gtattw.data[global_id.z * gtattw.size.y * gtattw.size.x + global_id.y * gtattw.size.x + global_id.x] = s;
|
|
}
|
|
|