fix ggml_compute_forward_dup_same_cont for when nelements < nthreads
when more threads are used than elements exist ie1 was less than ie0, resulting in invalid negative byte count argument in memcpy
This commit is contained in:
parent
c1a8893de3
commit
83fa6b3bcb
1 changed files with 6 additions and 4 deletions
2
ggml.c
2
ggml.c
|
@ -6662,10 +6662,12 @@ static void ggml_compute_forward_dup_same_cont(
|
||||||
const int ie0 = dr * ith;
|
const int ie0 = dr * ith;
|
||||||
const int ie1 = MIN(ie0 + dr, ne);
|
const int ie1 = MIN(ie0 + dr, ne);
|
||||||
|
|
||||||
|
if (ie0 < ie1) {
|
||||||
memcpy(
|
memcpy(
|
||||||
((char *) dst->data + ie0*nb0),
|
((char *) dst->data + ie0*nb0),
|
||||||
((char *) src0->data + ie0*nb00),
|
((char *) src0->data + ie0*nb00),
|
||||||
(ie1 - ie0) * GGML_TYPE_SIZE[src0->type]);
|
(ie1 - ie0) * GGML_TYPE_SIZE[src0->type]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void ggml_compute_forward_dup_f16(
|
static void ggml_compute_forward_dup_f16(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue