// @generated by tool/gen/fn/generate.py; DO NOT EDIT.
// schema=matrix_blas.json schema_version=1 generator_version=64
// schema_sha256=160e3299221cb767c356fd9ab1d5229633ad4a7fc60117a7dc81665ca3b24f94
// Semantic operation: matrix.mat_mul_nt; stable kernel ID: 700.
// FP32 arbitrary-layout fallback: one invocation per output element per
// batch. `group_id.z` selects the batch; per-operand row/column/batch
// strides and element offsets come from the push block.
import storage;
import attributes;
struct PushConstants {
uint left_index;
uint right_index;
uint output_index;
uint m;
uint n;
uint k;
uint a_row_stride;
uint a_col_stride;
uint a_batch_stride;
uint a_offset;
uint b_row_stride;
uint b_col_stride;
uint b_batch_stride;
uint b_offset;
uint c_row_stride;
uint c_col_stride;
uint c_batch_stride;
uint c_offset;
};
[[vk::push_constant]] PushConstants push;
[[vk::binding(0, 0)]] RWByteAddressBuffer storage_buffers[];
[kernel_name("mat_mul_nt_strided")]
[domain("matrix")]
[variant("strided")]
[dtype("f32")]
[status("experimental")]
[shader("compute")]
[numthreads(256, 1, 1)]
void main(uint3 group_id : SV_GroupID, uint3 dispatch_thread_id : SV_DispatchThreadID) {
uint element = dispatch_thread_id.x;
uint batch = group_id.z;
if (element >= push.m * push.n) {
return;
}
uint row = element / push.n;
uint column = element % push.n;
uint left_base = push.a_offset + batch * push.a_batch_stride + row * push.a_row_stride;
uint right_base = push.b_offset + batch * push.b_batch_stride + column * push.b_row_stride;
float accumulator = 0.0f;
for (uint inner = 0; inner < push.k; ++inner) {
accumulator += load_f32(storage_buffers[push.left_index], left_base + inner * push.a_col_stride)
* load_f32(storage_buffers[push.right_index], right_base + inner * push.b_col_stride);
}
store_f32(
storage_buffers[push.output_index],
push.c_offset + batch * push.c_batch_stride
+ row * push.c_row_stride + column * push.c_col_stride,
accumulator
);
}