Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: stop the Vulkan probe from popping "Entry point not found" on old Vulkan loaders (#12762)
oobabooga5d696bdc8327
diff --git a/studio/backend/core/inference/_vulkan_probe.py b/studio/backend/core/inference/_vulkan_probe.pyindex 3a29480cf62..e94cce6ef94 100644--- a/studio/backend/core/inference/_vulkan_probe.py+++ b/studio/backend/core/inference/_vulkan_probe.py@@ -24,6 +24,8 @@ import sys# ggml_backend_dev_type enum (ggml-backend.h): CPU=0, GPU=1, IGPU=2, ..._GGML_BACKEND_DEVICE_TYPE_IGPU = 2+# winbase.h+_SEM_FAILCRITICALERRORS = 0x0001def _igpu_flags_and_names(base, lib, count: int) -> tuple[list[bool], list[str], list[bool]]:@@ -120,6 +122,12 @@ def main() -> int:_dll_dir = os.add_dll_directory(bindir)except Exception:pass+ # Else a pre-1.1 vulkan-1.dll pops a modal "Entry point not found" box instead of failing CDLL (as ggml's dl_load_library).+ try:+ kernel32 = ctypes.WinDLL("kernel32")+ kernel32.SetErrorMode(kernel32.GetErrorMode() | _SEM_FAILCRITICALERRORS)+ except Exception:+ passelse:base_name, vk_name = "libggml-base.so", "libggml-vulkan.so"diff --git a/studio/backend/tests/test_llama_cpp_vulkan_probe.py b/studio/backend/tests/test_llama_cpp_vulkan_probe.pyindex ecb72f14271..47f744d1ef3 100644--- a/studio/backend/tests/test_llama_cpp_vulkan_probe.py+++ b/studio/backend/tests/test_llama_cpp_vulkan_probe.py@@ -304,5 +304,57 @@ def test_versioned_only_vulkan_soname_is_probed(tmp_path):assert gpus == [(0, 23 * 1024, 24 * 1024)], gpus+def test_windows_probe_sets_the_error_mode_before_loading_ggml(tmp_path, monkeypatch, capsys):+ """SEM_FAILCRITICALERRORS is OR-ed into the inherited mode before either ggml DLL loads."""+ from core.inference import _vulkan_probe as probe++ for name in ("ggml-base.dll", "ggml-vulkan.dll"):+ (tmp_path / name).write_bytes(b"stub")+ error_mode = {"value": 0x8000}++ class _Kernel32:+ def GetErrorMode(self):+ return error_mode["value"]++ def SetErrorMode(self, value):+ previous, error_mode["value"] = error_mode["value"], value+ return previous++ loads = []++ def fake_cdll(path, mode = 0):+ loads.append((Path(path).name, error_mode["value"]))+ if Path(path).name == "ggml-vulkan.dll":+ raise OSError(127, "The specified procedure could not be found")+ return object()++ monkeypatch.setattr(probe.sys, "argv", ["_vulkan_probe.py", str(tmp_path)])+ monkeypatch.setattr(probe.os, "add_dll_directory", lambda _path: None, raising = False)+ monkeypatch.setattr(probe.ctypes, "WinDLL", lambda _name: _Kernel32(), raising = False)+ monkeypatch.setattr(probe.ctypes, "CDLL", fake_cdll)+ monkeypatch.setattr(probe.sys, "platform", "win32")++ assert probe.main() == 1+ assert loads == [("ggml-base.dll", 0x8001), ("ggml-vulkan.dll", 0x8001)]+ assert "ggml-vulkan load failed" in capsys.readouterr().err++[email protected](sys.platform != "win32", reason = "real kernel32 error mode")+def test_windows_probe_sets_the_real_process_error_mode(tmp_path):+ probe_script = Path(__file__).resolve().parents[1] / "core" / "inference" / "_vulkan_probe.py"+ code = (+ "import ctypes, runpy, sys\n"+ "k = ctypes.WinDLL('kernel32'); k.SetErrorMode(0)\n"+ f"sys.argv = ['_vulkan_probe.py', {str(tmp_path)!r}]\n"+ f"g = runpy.run_path({str(probe_script)!r})\n"+ "rc = g['main']()\n"+ "print(rc, k.GetErrorMode() & 1)\n"+ )+ result = subprocess.run(+ [sys.executable, "-c", code], capture_output = True, text = True, timeout = 60+ )+ assert result.stdout.split() == ["1", "1"], (result.stdout, result.stderr)++if __name__ == "__main__":raise SystemExit(pytest.main([__file__, "-v"]))