Commit 701d2e6
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 aa1bc0d commit 701d2e6
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1963 | 1963 | | |
1964 | 1964 | | |
1965 | 1965 | | |
| 1966 | + | |
1966 | 1967 | | |
1967 | 1968 | | |
1968 | 1969 | | |
| |||
4487 | 4488 | | |
4488 | 4489 | | |
4489 | 4490 | | |
| 4491 | + | |
4490 | 4492 | | |
4491 | 4493 | | |
4492 | 4494 | | |
| |||
5415 | 5417 | | |
5416 | 5418 | | |
5417 | 5419 | | |
| 5420 | + | |
5418 | 5421 | | |
5419 | 5422 | | |
5420 | 5423 | | |
| |||
0 commit comments