From: Georgi Gerganov Date: Sun, 25 Jun 2023 13:39:57 +0000 (+0300) Subject: ggml : fix invalid src0 dereference X-Git-Tag: upstream/0.0.1642~1376 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=c33ece789df4ad32343c3d244221c272139c884b;p=pkg%2Fggml%2Fsources%2Fggml ggml : fix invalid src0 dereference --- diff --git a/src/ggml-cuda.cu b/src/ggml-cuda.cu index 36a251ec..010682ed 100644 --- a/src/ggml-cuda.cu +++ b/src/ggml-cuda.cu @@ -2635,7 +2635,7 @@ void ggml_cuda_free_scratch() { bool ggml_cuda_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor){ ggml_cuda_func_t func; const bool any_on_device = tensor->backend == GGML_BACKEND_GPU - || tensor->src0->backend == GGML_BACKEND_GPU || tensor->src0->backend == GGML_BACKEND_GPU_SPLIT + || (tensor->src0 != nullptr && (tensor->src0->backend == GGML_BACKEND_GPU || tensor->src0->backend == GGML_BACKEND_GPU_SPLIT)) || (tensor->src1 != nullptr && tensor->src1->backend == GGML_BACKEND_GPU); switch (tensor->op) { diff --git a/src/ggml.c b/src/ggml.c index 2a5c469e..1a441eb9 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -15194,7 +15194,7 @@ static void ggml_compute_forward(struct ggml_compute_params * params, struct ggm if (skip_cpu) { return; } - GGML_ASSERT(tensor->src0->backend == GGML_BACKEND_CPU); + GGML_ASSERT(tensor->src0 == NULL || tensor->src0->backend == GGML_BACKEND_CPU); GGML_ASSERT(tensor->src1 == NULL || tensor->src1->backend == GGML_BACKEND_CPU); #endif // GGML_USE_CUBLAS