Skip to content

Commit 58a4352

Browse files
committed
fix: zero-init ids_dst before mm_ids_helper — garbage tail entries in the
compact map caused pool-layout-dependent illegal memory accesses when ids contain -1 (tile-padded reads consumed uninitialized row indices)
1 parent 447f549 commit 58a4352

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ggml/src/ggml-cuda/mmq.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ void ggml_cuda_mul_mat_q(
187187
// sentinel-fill: compact slots belonging to skipped ids (-1, hot/cold expert
188188
// split) are never written by mm_ids_helper; quantize kernels skip on i < 0
189189
CUDA_CHECK(cudaMemsetAsync(ids_src1.get(), 0xFF, ne_get_rows*sizeof(int32_t), stream));
190+
// ids_dst tail likewise: unwritten compact slots must hold a safe row index,
191+
// not pool garbage — tile-padded reads in the mm kernel touch them
192+
CUDA_CHECK(cudaMemsetAsync(ids_dst.get(), 0, ne_get_rows*sizeof(int32_t), stream));
190193
const int si1 = ids->nb[1] / ggml_element_size(ids);
191194
const int sis1 = nb12 / nb11;
192195

0 commit comments

Comments
 (0)