]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml: Fix data race in ggml threadpool (#11736)
authorKarol Kontny <redacted>
Sat, 8 Feb 2025 14:30:53 +0000 (15:30 +0100)
committerGitHub <redacted>
Sat, 8 Feb 2025 14:30:53 +0000 (15:30 +0100)
commit4d3465c5aeca8be29cac77f1535c35f4fb274eca
treea9b013889c6df39afcac886be0f0a3d440935cb8
parentd80be897acdca45f8f7ea2e52c930b1d0e738a14
ggml: Fix data race in ggml threadpool (#11736)

After the barrier in last iteration is executed, still the loop termination
condition will be executed. However main thread can destroy the cgraph object
and its nodes already, then another thread will access it, but the thing is already gone.
Also trouble can happen when n_nodes == 0 or abort is called, but I'm not sure if the
prior situation is possible.

Last syncronization should be done after the loop to ensure the cgraph/cplan won't be
accessed after the main thread exits from the function.
ggml/src/ggml-cpu/ggml-cpu.c