Skip to content

Fix race condition bug in non-inplace ggml_compute_forward_diag_mask_f32#1454

Merged
ggerganov merged 4 commits intoggml-org:masterfrom
xaedes:fix-race-condition-diag-mask
May 14, 2023
Merged

Fix race condition bug in non-inplace ggml_compute_forward_diag_mask_f32#1454
ggerganov merged 4 commits intoggml-org:masterfrom
xaedes:fix-race-condition-diag-mask

Conversation

@xaedes
Copy link
Copy Markdown
Collaborator

@xaedes xaedes commented May 14, 2023

test-grad0.c catched a bug in ggml_compute_forward_diag_mask_f32 when running in threaded mode.

This only affects non-inplace occurences of diag_mask.

memcpy needs to be synchronized across threads to avoid race conditions, so just do it in INIT phase.

Use memcpy instead of the dup function, because the dup function just returns in INIT phase.

memcpy needs to be synchronized across threads to avoid race conditions.
=> do it in INIT phase
@ggerganov
Copy link
Copy Markdown
Member

I already made a fix for this in #1450

But will use your version as it is less hacky

@ggerganov
Copy link
Copy Markdown
Member

Resolve the CI error + conflict and will merge it

@xaedes
Copy link
Copy Markdown
Collaborator Author

xaedes commented May 14, 2023

Oh didnt see that commit with the fixes. Trailing whitespace removed. Do you resolve the conflict or should I?

Comment thread ggml.c Outdated
@ggerganov ggerganov merged commit 79b2d5b into ggml-org:master May 14, 2023
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
…pute_forward_diag_mask_f32 (ggml-org#1454)

* fix race condition bug in non-inplace ggml_compute_forward_diag_mask_f32

memcpy needs to be synchronized across threads to avoid race conditions.
=> do it in INIT phase

* remove trailing whitespace

* Update ggml.c

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
…pute_forward_diag_mask_f32 (ggml-org#1454)

* fix race condition bug in non-inplace ggml_compute_forward_diag_mask_f32

memcpy needs to be synchronized across threads to avoid race conditions.
=> do it in INIT phase

* remove trailing whitespace

* Update ggml.c

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants