From d2b2224b0d81cf388d39442bce0ecbf46647b18c Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 17 Jan 2026 10:34:45 +0800 Subject: [PATCH] vulkan env var always take priority --- expose.cpp | 3 ++- otherarch/embeddings_adapter.cpp | 3 ++- otherarch/sdcpp/sdtype_adapter.cpp | 3 ++- otherarch/tts_adapter.cpp | 3 ++- otherarch/whispercpp/whisper_adapter.cpp | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/expose.cpp b/expose.cpp index d4c1877d7..ab479975b 100644 --- a/expose.cpp +++ b/expose.cpp @@ -60,7 +60,8 @@ extern "C" vulkan_info_str += ","; } } - if(vulkan_info_str!="") + const char* existingenv = getenv("GGML_VK_VISIBLE_DEVICES"); + if(!existingenv && vulkan_info_str!="") { vulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str; putenv((char*)vulkandeviceenv.c_str()); diff --git a/otherarch/embeddings_adapter.cpp b/otherarch/embeddings_adapter.cpp index 8a63c9e57..71b1d05e3 100644 --- a/otherarch/embeddings_adapter.cpp +++ b/otherarch/embeddings_adapter.cpp @@ -101,7 +101,8 @@ bool embeddingstype_load_model(const embeddings_load_model_inputs inputs) vulkan_info_str += ","; } } - if(vulkan_info_str!="") + const char* existingenv = getenv("GGML_VK_VISIBLE_DEVICES"); + if(!existingenv && vulkan_info_str!="") { ttsvulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str; putenv((char*)ttsvulkandeviceenv.c_str()); diff --git a/otherarch/sdcpp/sdtype_adapter.cpp b/otherarch/sdcpp/sdtype_adapter.cpp index 8983b89fe..f9afb4e4d 100644 --- a/otherarch/sdcpp/sdtype_adapter.cpp +++ b/otherarch/sdcpp/sdtype_adapter.cpp @@ -303,7 +303,8 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) { vulkan_info_str += ","; } } - if(vulkan_info_str!="") + const char* existingenv = getenv("GGML_VK_VISIBLE_DEVICES"); + if(!existingenv && vulkan_info_str!="") { sdvulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str; putenv((char*)sdvulkandeviceenv.c_str()); diff --git a/otherarch/tts_adapter.cpp b/otherarch/tts_adapter.cpp index f9a09ef22..42051b216 100644 --- a/otherarch/tts_adapter.cpp +++ b/otherarch/tts_adapter.cpp @@ -636,7 +636,8 @@ bool ttstype_load_model(const tts_load_model_inputs inputs) vulkan_info_str += ","; } } - if(vulkan_info_str!="") + const char* existingenv = getenv("GGML_VK_VISIBLE_DEVICES"); + if(!existingenv && vulkan_info_str!="") { ttsvulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str; putenv((char*)ttsvulkandeviceenv.c_str()); diff --git a/otherarch/whispercpp/whisper_adapter.cpp b/otherarch/whispercpp/whisper_adapter.cpp index b39545079..8c5b3e136 100644 --- a/otherarch/whispercpp/whisper_adapter.cpp +++ b/otherarch/whispercpp/whisper_adapter.cpp @@ -95,7 +95,8 @@ bool whispertype_load_model(const whisper_load_model_inputs inputs) vulkan_info_str += ","; } } - if(vulkan_info_str!="") + const char* existingenv = getenv("GGML_VK_VISIBLE_DEVICES"); + if(!existingenv && vulkan_info_str!="") { whispervulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str; putenv((char*)whispervulkandeviceenv.c_str());