Fix crash when running train with CUDA enabled

This commit is contained in:
Howard Su 2023-06-20 23:58:37 +08:00
parent 20568fe60f
commit 0dcfe45c1c

View file

@ -2634,6 +2634,10 @@ void ggml_cuda_free_scratch() {
bool ggml_cuda_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor){
ggml_cuda_func_t func;
if (tensor->op == GGML_OP_NONE)
return true;
const bool any_on_device = tensor->backend == GGML_BACKEND_GPU
|| tensor->src0->backend == GGML_BACKEND_GPU || tensor->src0->backend == GGML_BACKEND_GPU_SPLIT
|| (tensor->src1 != nullptr && tensor->src1->backend == GGML_BACKEND_GPU);