Commit 8899a09
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 30c5194 commit 8899a09
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2007 | 2007 | | |
2008 | 2008 | | |
2009 | 2009 | | |
| 2010 | + | |
2010 | 2011 | | |
2011 | 2012 | | |
2012 | 2013 | | |
| |||
4674 | 4675 | | |
4675 | 4676 | | |
4676 | 4677 | | |
| 4678 | + | |
4677 | 4679 | | |
4678 | 4680 | | |
4679 | 4681 | | |
| |||
5600 | 5602 | | |
5601 | 5603 | | |
5602 | 5604 | | |
| 5605 | + | |
5603 | 5606 | | |
5604 | 5607 | | |
5605 | 5608 | | |
| |||
0 commit comments