#1869 Fix null reference errors when training from scratch with CUDA build

Calling ggml_compute_forward when node->src0 was null was causing train-text-from-scratch.exe to terminate unexpectedly.
This commit is contained in:
Robyn 2023-06-17 15:55:57 +10:00
parent d411968e99
commit 2a2f39ef45

6
ggml.c
View file

@ -16012,7 +16012,9 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph)
/*.wdata =*/ cgraph->work ? cgraph->work->data : NULL, /*.wdata =*/ cgraph->work ? cgraph->work->data : NULL,
}; };
if (node->src0) {
ggml_compute_forward(&params, node); ggml_compute_forward(&params, node);
}
// COMPUTE // COMPUTE
if (node->n_tasks > 1) { if (node->n_tasks > 1) {
@ -16048,7 +16050,9 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph)
} }
params.type = GGML_TASK_COMPUTE; params.type = GGML_TASK_COMPUTE;
if (node->src0) {
ggml_compute_forward(&params, node); ggml_compute_forward(&params, node);
}
// wait for thread pool // wait for thread pool
if (node->n_tasks > 1) { if (node->n_tasks > 1) {
@ -16103,7 +16107,9 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph)
} }
params.type = GGML_TASK_FINALIZE; params.type = GGML_TASK_FINALIZE;
if (node->src0) {
ggml_compute_forward(&params, node); ggml_compute_forward(&params, node);
}
// wait for thread pool // wait for thread pool
if (node->n_tasks > 1) { if (node->n_tasks > 1) {