Skip to content

Commit adf3de4

Browse files
authored
ggml : fix soft max out-of-bounds access (#4307)
ggml-ci
1 parent 33e171d commit adf3de4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: ggml.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -15629,7 +15629,6 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads) {
1562915629
} break;
1563015630
case GGML_OP_DIAG_MASK_ZERO:
1563115631
case GGML_OP_DIAG_MASK_INF:
15632-
case GGML_OP_SOFT_MAX:
1563315632
case GGML_OP_SOFT_MAX_BACK:
1563415633
case GGML_OP_ROPE:
1563515634
case GGML_OP_ROPE_BACK:
@@ -15645,6 +15644,10 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads) {
1564515644
{
1564615645
n_tasks = 1; //TODO
1564715646
} break;
15647+
case GGML_OP_SOFT_MAX:
15648+
{
15649+
n_tasks = MIN(MIN(4, n_threads), ggml_nrows(node->src[0]));
15650+
} break;
1564815651
case GGML_OP_CONV_TRANSPOSE_1D:
1564915652
{
1565015653
n_tasks = n_threads;

0 commit comments

Comments
 (0)