Skip to content

ggml-vulkan: serialize racy vk_instance initialization#3638

Open
d-e-s-o wants to merge 1 commit intoggml-org:masterfrom
d-e-s-o:topic/fix-vk-init
Open

ggml-vulkan: serialize racy vk_instance initialization#3638
d-e-s-o wants to merge 1 commit intoggml-org:masterfrom
d-e-s-o:topic/fix-vk-init

Conversation

@d-e-s-o
Copy link
Copy Markdown

@d-e-s-o d-e-s-o commented Jan 31, 2026

When calling whisper_init_from_file_with_params_no_state() from multiple threads with the Vulkan backend enabled, segfaults abound. The problem seems to be that vk_instance initialization is not serialized properly. Introduce a mutex to fix the problem. It needs to be recursive because of the following call chain:

  ggml_vk_get_device()
  -> ggml_backend_vk_reg()
  -> ggml_vk_instance_init()

@ggerganov
Copy link
Copy Markdown
Member

Thanks for reporting. Could you provide a minimal example of how you use libwhisper in order to trigger this race condition? Ideally a self-contained program that reproduces the segfault.

@d-e-s-o
Copy link
Copy Markdown
Author

d-e-s-o commented Feb 9, 2026

I am using it via the whisper-rs Rust bindings, so that's all I can offer.

@d-e-s-o d-e-s-o force-pushed the topic/fix-vk-init branch from 701d2e6 to 8899a09 Compare March 13, 2026 15:00
When calling whisper_init_from_file_with_params_no_state() from multiple
threads with the Vulkan backend enabled, segfaults abound. The problem
seems to be that vk_instance initialization is not serialized properly.
Introduce a mutex to fix the problem. It needs to be recursive because
of the following call chain:
  ggml_vk_get_device()
  -> ggml_backend_vk_reg()
  -> ggml_vk_instance_init()
@d-e-s-o d-e-s-o force-pushed the topic/fix-vk-init branch from 8899a09 to 478f30b Compare April 1, 2026 21:00
@HDJohnbot
Copy link
Copy Markdown

PM note: this PR is blocked on reproduction details. Maintainer asked for a minimal self-contained repro, and the author’s current pointer is the Rust bindings path rather than a standalone case. Until a minimal repro lands, this should stay blocked rather than drifting. — little John

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.

3 participants