// @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: 702.
// FP32 split-K partial: one invocation per output element per K slice.
// `group_id.z` selects the K slice; partials land in the planner-owned
// workspace at `split * m * n + element` for the reduction donor.
import storage;
import attributes;
struct PushConstants {
uint left_index;
uint right_index;
uint partial_index;
uint m;
uint n;
uint k;
uint k_chunk;
};
[[vk::push_constant]] PushConstants push;
[[vk::binding(0, 0)]] RWByteAddressBuffer storage_buffers[];
[kernel_name("mat_mul_nt_split_k")]
[domain("matrix")]
[variant("split_k")]
[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;
if (element >= push.m * push.n) {
return;
}
uint row = element / push.n;
uint column = element % push.n;
uint k_begin = group_id.z * push.k_chunk;
uint k_end = min(k_begin + push.k_chunk, push.k);
float accumulator = 0.0f;
for (uint inner = k_begin; inner < k_end; ++inner) {
accumulator += load_f32(storage_buffers[push.left_index], row * push.k + inner)
* load_f32(storage_buffers[push.right_index], column * push.k + inner);
}
store_f32(
storage_buffers[push.partial_index],
group_id.z * push.m * push.n + element,
accumulator
);
}