opencl: handle OOB write in noshuffle GEMV kernels (odd ne01) (#25640)

This commit is contained in:
Hongqiang Wang
2026-07-14 13:46:54 -07:00
committed by GitHub
parent a4ce2595c5
commit 00fa7cb284
11 changed files with 63 additions and 11 deletions
@@ -190,6 +190,10 @@ __kernel void kernel_gemv_noshuffle_q8_0_f32(
// 1 outputs per fiber in wave 0
if (groupId == 0) {
dst = (global float*)((global char*)dst + offsetd);
dst[gid] = totalSum;
// Guard the output row. The x-grid is padded to CEIL_DIV(M,wavesize)*wavesize,
// so when ne01 is not a multiple of the wave size the tail work-items run past
// row ne01 and would overrun dst into the adjacent tensor. No-op / byte-identical
// when ne01 is wave-aligned (no padding).
if (gid < M) dst[gid] = totalSum;
}
}