Skip to content

Commit 2a3e17e

Browse files
author
Stratum
committed
fix(dsv4): lightning-indexer bounds (as built into b10867 from a dirty tree)
1 parent 4323c7a commit 2a3e17e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎ggml/src/ggml-cuda/lightning-indexer.cu‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ static __global__ void lightning_indexer_kernel_vec(
327327

328328
constexpr int n_q = N_HEAD_INNER * (N_EMBD / 4);
329329
#pragma unroll
330-
for (int i_q = tid; i_q < n_q; i_q += THREADS_PER_BLOCK) {
330+
for (int i_q0 = 0; i_q0 < n_q; i_q0 += THREADS_PER_BLOCK) {
331+
const int i_q = i_q0 + tid;
332+
if (i_q >= n_q) {
333+
break;
334+
}
331335
const int i_head_inner = i_q / (N_EMBD / 4);
332336
const int i_head = i_head_0 + i_head_inner;
333337
const int i_embd = i_q % (N_EMBD / 4);

0 commit comments

Comments
 (0)