Commit 478f30b
committed
ggml-vulkan: serialize racy vk_instance initialization
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()1 parent 95ea8f9 commit 478f30b
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2060 | 2060 | | |
2061 | 2061 | | |
2062 | 2062 | | |
| 2063 | + | |
2063 | 2064 | | |
2064 | 2065 | | |
2065 | 2066 | | |
| |||
4779 | 4780 | | |
4780 | 4781 | | |
4781 | 4782 | | |
| 4783 | + | |
4782 | 4784 | | |
4783 | 4785 | | |
4784 | 4786 | | |
| |||
5713 | 5715 | | |
5714 | 5716 | | |
5715 | 5717 | | |
| 5718 | + | |
5716 | 5719 | | |
5717 | 5720 | | |
5718 | 5721 | | |
| |||
0 commit comments