mirror of
https://github.com/debpalash/VoiceStudio.git
synced 2026-12-05 01:48:19 +00:00
* feat(gpu): add opt-in native Windows ROCm installation Use one pinned Windows recipe for source and Electron setup, verify native packages before reuse, and preserve explicit opt-in and sidecar compatibility boundaries. * docs(rocm): drop agent-instruction plan files; move the entry to a changelog fragment * fix(rocm): hash-pin every AMD artifact and keep dependencies at their locked versions Each repo.radeon.com wheel/sdist now carries a sha256 in the recipe, the loader refuses one without it, and the installer installs from a --hash requirements file (uv verifies; UV_NO_VERIFY_HASHES is stripped). A constraints file pins every installed package except the overlay (torch family, rocm*, triton*, ctranslate2), so transitive deps no longer resolve fresh from the index. The rocm sdist builds with the locked setuptools. * fix(rocm): ask before switching an existing runtime to Windows ROCm OMNIVOICE_TORCH_VARIANT=rocm used to be ignored on Windows; with this PR it would fail readiness on update and auto-repair into a multi-GB download from new hosts. A successful install now records its torch build (.runtime-torch); a runtime never installed with Windows ROCm goes to the setup screen instead of auto-repair. ROCm on Windows ARM64 reports not-ready instead of rejecting readiness, and the setup screen names repo.radeon.com as the Windows ROCm torch source. * fix(rocm): resolve ROCm packages from site-packages and remember a failed GPU probe package_root() finds torch, ctranslate2 and the ROCm SDK packages through their distribution records in this interpreter's site-packages, so a stray folder in the working directory of a -m child can't choose the DLL directories. A failed HIP CT2 probe (up to 90 s) is remembered for the process instead of 5 s, so catalogue refreshes don't re-run it; a restart, recipe or package change runs it again. * docs(rocm): record the owner-approved Windows ROCm endpoints and how setup checks them * docs(structure): count the pyannote compat service module * test(rocm): pin the host architecture in the setup-reuse readiness test * fix(repo): untrack the committed .venv symlink and ignore symlinked envs; follow the new ROCm copy in the GPU panel test .gitignore's '.venv/' only matches directories, so a worktree's symlinked .venv was committed and CI's uv sync failed on it. Ignore '.venv' without the slash and add a guard that no local environment path is ever tracked. * test(audio-io): allow the pyannote torchaudio shim, which applies the gate's own fix to third-party calls --------- Co-authored-by: debpalash <4178343+debpalash@users.noreply.github.com>
66 lines
3.1 KiB
Python
66 lines
3.1 KiB
Python
"""Direct Python post-install uses the shared Windows installer before imports."""
|
|
import importlib.util
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
from unittest.mock import Mock
|
|
|
|
import pytest
|
|
|
|
|
|
def load_setup():
|
|
spec = importlib.util.spec_from_file_location("windows_rocm_setup", Path(__file__).parents[1] / "scripts/setup.py")
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def test_direct_windows_opt_in_uses_shared_installer_before_torch(monkeypatch):
|
|
setup = load_setup()
|
|
monkeypatch.setattr(setup.sys, "platform", "win32")
|
|
monkeypatch.setenv("OMNIVOICE_TORCH_VARIANT", " ROCm ")
|
|
monkeypatch.setattr(setup, "_ensure_vcredist_windows", Mock())
|
|
native_probe = Mock(side_effect=AssertionError("native import before overlay"))
|
|
monkeypatch.setattr(setup, "_installed_torch_is_rocm", native_probe)
|
|
monkeypatch.setattr(setup, "_find_compat_dir", Mock(side_effect=AssertionError("CUDA path")))
|
|
install = Mock()
|
|
monkeypatch.setattr(setup.subprocess, "check_call", install)
|
|
setup.main()
|
|
command = install.call_args.args[0]
|
|
assert command == [setup.sys.executable, "-m", "backend.core.windows_rocm.install", "--uv", "uv"]
|
|
assert Path(install.call_args.kwargs["cwd"]) == Path(__file__).parents[1]
|
|
native_probe.assert_not_called()
|
|
|
|
|
|
def test_direct_windows_opt_in_failure_is_fatal(monkeypatch):
|
|
setup = load_setup()
|
|
monkeypatch.setattr(setup.sys, "platform", "win32")
|
|
monkeypatch.setenv("OMNIVOICE_TORCH_VARIANT", "rocm")
|
|
monkeypatch.setattr(setup, "_ensure_vcredist_windows", Mock())
|
|
monkeypatch.setattr(setup.subprocess, "check_call", Mock(side_effect=subprocess.CalledProcessError(1, "installer")))
|
|
with pytest.raises(subprocess.CalledProcessError):
|
|
setup.main()
|
|
|
|
|
|
def test_windows_prerequisites_mode_never_imports_or_installs_torch(monkeypatch):
|
|
setup = load_setup()
|
|
monkeypatch.setattr(setup.sys, "platform", "win32")
|
|
monkeypatch.setenv("OMNIVOICE_TORCH_VARIANT", "rocm")
|
|
prerequisite = Mock()
|
|
monkeypatch.setattr(setup, "_ensure_vcredist_windows", prerequisite)
|
|
monkeypatch.setattr(setup.subprocess, "check_call", Mock(side_effect=AssertionError("overlay too early")))
|
|
setup.main(["--windows-prerequisites-only"])
|
|
prerequisite.assert_called_once_with()
|
|
|
|
|
|
@pytest.mark.skipif(sys.platform != "win32" or sys.version_info[:2] == (3, 12), reason="needs non-cp312 Windows interpreter")
|
|
def test_electron_reuse_probe_rejects_wrong_abi_with_python_optimization():
|
|
root = Path(__file__).parents[1]
|
|
module = (root / "electron/src/main/runtime-windows-rocm.ts").as_uri()
|
|
script = f"const m = await import({json.dumps(module)}); console.log(m.WINDOWS_ROCM_ABI_PROBE);"
|
|
code = subprocess.check_output(["node", "--input-type=module", "-e", script], text=True).strip()
|
|
result = subprocess.run([sys.executable, "-O", "-c", code], cwd=root,
|
|
capture_output=True, text=True, check=False, timeout=10)
|
|
assert result.returncode != 0, "optimized Python must not bypass Windows ROCm ABI validation"
|