]> git.djapps.eu Git - pkg/ggml/sources/ggml/commit
ggml: Fix data race in ggml threadpool (llama/11736)
authorKarol Kontny <redacted>
Sat, 8 Feb 2025 14:30:53 +0000 (15:30 +0100)
committerGeorgi Gerganov <redacted>
Wed, 12 Feb 2025 20:00:20 +0000 (22:00 +0200)
commiteec41f3ff416634dcb2a34088368a548fef8b226
tree0b0f175b627e585e36149d01b7af6af7e224634f
parent70a6de58ddb2da7c061ba4c98b66f00ec215f7d2
ggml: Fix data race in ggml threadpool (llama/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.
src/ggml-cpu/ggml-cpu.c