Repository navigation
Studio: an AMD Windows host without usable ROCm takes Vulkan, not the CPU bundle - #10908
Conversation
… CPU bundle The Linux Vulkan gate reads has_intel_gpu or has_amd_gpu_without_rocm; both Windows gates read has_intel_gpu alone, and has_amd_gpu_without_rocm was never populated on Windows at all. The same silicon therefore took Vulkan on Linux and windows-cpu on Windows. Measured on a gfx1151 (Radeon 8060S) runner whose amd-smi.exe could not load its library and where HIP_PATH and ROCM_PATH were both unset: v0.1.804-beta, v0.1.808-beta and main all resolved app-<tag>-windows-x64-cpu.zip, with a windows-vulkan bundle present in the same release. detect_host now reads AMD display adapters on Windows through the registry probe (vendor id 0x1002) with the CIM query as the fallback, honouring ROCR_VISIBLE_DEVICES exactly as the Linux branch does, and both Windows Vulkan gates accept an AMD host with no usable ROCm. The Linux ARM64 gate is left alone.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2038435d67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not has_intel_gpu: | ||
| if not _amd_hidden_by_mask: | ||
| has_amd_gpu_without_rocm = windows_amd_gpu_in_registry() | ||
| if not has_intel_gpu or not has_amd_gpu_without_rocm: |
There was a problem hiding this comment.
Preserve the successful registry fast path
On a typical single-vendor Windows host, this or remains true after a successful registry probe: Intel-only hosts have no AMD match, and AMD-only hosts have no Intel match. Consequently, detect_host() still launches the slow Get-CimInstance PowerShell probe and may incur its full 15-second timeout, defeating the registry fast path and breaking the existing test_detect_host_registry_intel_skips_cim_probe expectation. The CIM fallback should run only when neither relevant adapter was found.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it was already failing: test_detect_host_registry_intel_skips_cim_probe in studio/backend/tests/test_install_resolve_prebuilt.py went red on this branch. or defeated the fast path on every single-vendor host, since an Intel-only box has no AMD match and an AMD-only box has no Intel match, so both paid the CIM probe's full 15s timeout for nothing.
Changed to if not has_intel_gpu and not has_amd_gpu_without_rocm:. Either flag alone already carries the Vulkan gate, so a hit on one makes the other irrelevant to the decision. Added test_detect_host_registry_amd_skips_cim_probe so the AMD half of the fast path is pinned the same way the Intel half is.
| resolve_release_asset_choice( | ||
| self._host(has_rocm = True), self.TAG, self._release(), self._checksums() | ||
| ) |
There was a problem hiding this comment.
Stub the upstream fetch in the ROCm guard test
When this test supplies has_rocm=True but the synthetic release has no windows-rocm artifact, resolve_release_asset_choice() falls through to resolve_asset_choice(), which calls github_release_assets() before it can raise PrebuiltFallback. Because the test does not monkeypatch that fetch, an offline or restricted test environment performs four real GitHub retries and raises URLError instead of the expected exception; running this test in isolation in the inspected environment reproduced that failure. Stub github_release_assets here as the nearby fallback test does.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct. resolve_release_asset_choice reaches the upstream fetch before it can raise, so on an offline runner the test spent four real GitHub retries and then failed with URLError instead of the PrebuiltFallback it was asserting.
Stubbed it: monkeypatch.setattr(INSTALL_LLAMA_PREBUILT, "github_release_assets", lambda repo, tag: {}). The assertion now exercises the ROCm guard itself rather than the network.
Blast radiusBase-vs-head matrix over the cartesian product of [Linux, WSL, Windows, macOS] x [NVIDIA, AMD, Intel, CPU-only] with their sub-conditions (masked GPU, Blackwell sm_120, ancient sm_61, NVIDIA + AMD iGPU, ROCm covered and uncovered, arm64, Apple Silicon, Intel Mac), 44 scenarios. Real Exactly 1 of 44 scenarios changes:
Every other row is byte-identical. In particular these all stay exactly as they were, which are the ones that would show a widened gate leaking:
Note the CPU bundle is kept as the tail rather than replaced, so a host whose Vulkan bundle fails validation still has the same fallback it had before. This is not a new hardware path bolted on; it is the Windows side of a gate Linux has had since #6310, so the ordering, the Why an over-eager AMD detection is not dangerousThe registry probe is advisory and can outlive removed hardware, same as the Intel one. The existing comment on
I confirmed that class of behaviour directly on the equivalent CUDA bundle, which takes the same "GPU build, no usable device" path. Real The binary starts, enumerates nothing, and generates correct output on CPU. So the worst case of a false positive here is the Vulkan bundle behaving like the CPU bundle, not a broken install. Masks
Existing installsReal
So the affected Windows AMD users move to Vulkan on their next update without a manual reinstall, and anyone who deliberately chose ScopeNo frontend, TypeScript, Rust,
|
…ard test Two review fixes on the Windows AMD Vulkan branch. The CIM skip was gated on `not has_intel_gpu or not has_amd_gpu_without_rocm`, which is true on every single-vendor host: an Intel-only box has no AMD match and an AMD-only box has no Intel match, so both paid the CIM probe's full 15s timeout after the registry had already answered. `test_detect_host_registry_intel_skips_cim_probe` was failing on that. Gate on neither having been found instead; either flag alone already carries the Vulkan gate. Added the AMD counterpart of that test so both halves of the fast path are pinned. `test_a_host_with_usable_rocm_is_not_diverted_to_vulkan` reached the upstream fetch inside `resolve_release_asset_choice` before it could raise, so on an offline runner it spent four real GitHub retries and then failed with URLError instead of the PrebuiltFallback it asserts. Stub `github_release_assets`.
Comment-only pass over what this branch adds. Measured numbers and the mechanism write-ups move to the PR description, where they belong; what stays is the invariants the code does not state on its own.
|
@codex review |
|
@codex security review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 427f725c25
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not _amd_hidden_by_mask: | ||
| has_amd_gpu_without_rocm = windows_amd_gpu_in_registry() |
There was a problem hiding this comment.
Honor all HIP masks before enabling AMD Vulkan
On Windows, when HIP_VISIBLE_DEVICES or CUDA_VISIBLE_DEVICES hides every AMD device, the HIP probe reports no usable ROCm, but _amd_hidden_by_mask only checks ROCR_VISIBLE_DEVICES. This newly added registry probe then sets has_amd_gpu_without_rocm, causing the resolver to select the Vulkan bundle even though Vulkan ignores those HIP masks and may use the GPU the caller explicitly hid. The Windows path should use the same three-variable presence check already implemented by _hip_visible_device_mask_set().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and the comment directly above the line already claimed the behaviour you are asking for: "Windows reads all three: its probe is hipinfo, a HIP application." The code read ROCR_VISIBLE_DEVICES only, so the comment documented a rule the code did not implement.
Windows now goes through _hip_visible_device_mask_set(), the same three-variable check _pick_rocm_gfx_target uses, so the two cannot disagree about the host. Linux keeps ROCR alone on the existing reasoning: its probe is a sysfs walk that no HIP mask touches, and counting HIP_VISIBLE_DEVICES or CUDA_VISIBLE_DEVICES there would cost Vulkan to any host merely exporting the latter.
test_detect_host_windows_amd_honours_every_hip_mask is parametrized over all three variables. On the previous commit 2 of the 3 fail (HIP_VISIBLE_DEVICES and CUDA_VISIBLE_DEVICES) and ROCR passes, which is the split you predicted. _detect_windows_host also had to grow an env parameter applied after its own delenv loop, or the wipe undid the mask under test.
…lkan The comment above _amd_hidden_by_mask already said Windows reads all three variables, because its arch probe is hipinfo, a HIP application. The code read ROCR_VISIBLE_DEVICES only. So HIP_VISIBLE_DEVICES or its CUDA_VISIBLE_DEVICES alias hiding every AMD device left the HIP probe reporting no usable ROCm, the registry probe setting has_amd_gpu_without_rocm, and the resolver selecting Vulkan, which honours none of those masks and would use the GPU the caller explicitly hid. Windows now goes through _hip_visible_device_mask_set, the same three-variable check _pick_rocm_gfx_target uses. Linux keeps ROCR alone: its probe is a sysfs walk that no HIP mask touches, and counting the others would cost Vulkan to any host merely exporting CUDA_VISIBLE_DEVICES. Parametrized over all three variables in studio/backend/tests; two of the three fail without this change. _detect_windows_host now applies a caller's env after its own wipe, or the wipe would undo the mask under test. tests/studio/install/ + test_install_resolve_prebuilt.py: 4344 passed, 7 skipped.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb361d533d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (host.has_intel_gpu or host.has_amd_gpu_without_rocm) | ||
| and not host.has_physical_nvidia | ||
| and not host.has_rocm |
There was a problem hiding this comment.
Widen the direct upstream Vulkan gate too
When a Windows AMD-without-ROCm user selects --published-repo ggml-org/llama.cpp or another non-default mirror, planning bypasses this widened gate and uses direct_upstream_release_plan(), whose Windows Vulkan branch still requires host.has_intel_gpu at line 1060. Even when that release contains a win-vulkan archive, the newly detected AMD host therefore receives the CPU attempt instead; apply the same AMD-or-Intel condition to the direct upstream planner.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is the same asymmetry this PR is about, in the third place it appears. direct_upstream_release_plan's Linux x86_64 branch was already has_intel_gpu or has_amd_gpu_without_rocm; its Windows branch was not, so a Windows AMD host planning against a pinned --published-repo took the CPU attempt with win-vulkan sitting in the release.
Widened to match. Still gated on no PHYSICAL NVIDIA, so a card hidden by CUDA_VISIBLE_DEVICES is not reached through Vulkan.
TestDirectUpstreamWindowsAmdTakesVulkan covers four cases: AMD without ROCm takes Vulkan with the CPU attempt still behind it, Intel is unchanged, a host with no GPU at all still takes windows-cpu, and a masked NVIDIA host is not routed to Vulkan. The first fails on the previous commit.
The Linux ARM64 gate at the third site stays Intel-only deliberately, as its own comment says: that widening was only measured on x86_64.
direct_upstream_release_plan is the path taken when the caller pins a non-default --published-repo. Its Linux x86_64 Vulkan branch was already Intel-or-AMD; the Windows one was still Intel-only, so a Windows AMD host with no usable ROCm got the CPU attempt even when the release carries win-vulkan. That is the same asymmetry this PR fixes in the published planner, in the third place it appears. Still gated on no PHYSICAL NVIDIA, so a card hidden by CUDA_VISIBLE_DEVICES is not reached through Vulkan, which ignores that mask. TestDirectUpstreamWindowsAmdTakesVulkan covers the four cases: AMD without ROCm takes Vulkan with the CPU attempt still behind it, Intel is unchanged, a host with no GPU still takes windows-cpu, and a masked NVIDIA host is not routed to Vulkan. The first fails on the previous commit. The Linux ARM64 gate stays Intel-only, as its own comment says: that widening was only measured on x86_64. tests/studio/install/ + test_install_resolve_prebuilt.py: 4348 passed, 7 skipped.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
A Windows machine with a working AMD GPU is handed the CPU llama.cpp bundle, while the same silicon running Linux is handed Vulkan.
I hit this while checking whether the recent GPU-to-CPU reports were platform specific. Running the installer's own resolver on a self-hosted Strix Halo runner (gfx1151, Radeon 8060S, Windows 11, no Docker):
That release ships
app-b10909-mix-bea84f7-windows-x64-vulkan.zip. It is never considered.Host state on that box, captured before the probe:
amd-smi.exe listfails withError LoadLibraryA, andHIP_PATHandROCM_PATHare both empty. Sohas_rocm = Falseis the correct reading. There is still an AMD GPU in the machine.The same runner pool on Linux resolves
app-b10909-mix-bea84f7-linux-x64-vulkan.tar.gz.Cause
The two gates disagree by one term:
And the field was scoped out of Windows by construction, so even widening the gate alone would not have helped:
detect_host's Windows branch only ever looked for Intel, so an AMD host fell straight through towindows-cpu. The existing log line"Intel GPU detected on Windows but no Vulkan prebuilt found -- falling back to CPU"was unreachable for AMD.This is not a regression. All three refs above agree, so it is not the cause of the recent update reports; it is a long-standing gap that leaves every Windows AMD-without-ROCm user on CPU. It is the Windows half of what v0.1.808-beta's notes describe for Linux only: "AMD iGPUs without ROCm now use Vulkan instead of CPU on Linux".
Change
detect_hostreads AMD display adapters on Windows, registry first (PCI vendor id0x1002, plusamd/radeoninDriverDesc) with the existing CIM query as the fallback. The registry walk is now shared by both vendors rather than duplicated.has_intel_gpu or has_amd_gpu_without_rocm, matching Linux: the two on the published path, and the one indirect_upstream_release_plan, which is what a caller pinning--published-repogoes through. Leaving the last one Intel-only sent a Windows AMD host to the CPU attempt even when the release carrieswin-vulkan.Kept deliberately:
Masks
Vulkan honours no HIP mask (it selects via
GGML_VK_VISIBLE_DEVICES), so a masked host must not be auto-routed there. Windows goes through_hip_visible_device_mask_set(), which reads all three ofHIP_VISIBLE_DEVICES,ROCR_VISIBLE_DEVICESandCUDA_VISIBLE_DEVICES, the same set_pick_rocm_gfx_targetreads, so the two cannot disagree about the host. That is the right set on Windows because the arch probe there is hipinfo, itself a HIP application.Linux keeps
ROCR_VISIBLE_DEVICESalone. Its probe is a sysfs walk that no HIP mask touches, and counting the other two would cost Vulkan to any host merely exportingCUDA_VISIBLE_DEVICES.Tests
TestWindowsAmdWithoutRocmTakesVulkanintests/studio/install/test_selection_logic.py, built on the same host the runner reported:windows-vulkan, withwindows-cpuremaining as the tail exactly as it does for Intelwindows-cpuTestDirectUpstreamWindowsAmdTakesVulkancovers the same four cases on the pinned-repo path, including that a masked NVIDIA host is not routed to Vulkan there either.In
studio/backend/tests/test_install_resolve_prebuilt.py:orthere is true on every single-vendor host, so an Intel-only box and an AMD-only box both paid the CIM probe's full 15s timeout after the registry had already answered.tests/studio/install/plusstudio/backend/tests/test_install_resolve_prebuilt.py: 4697 passed, 19 skipped, after mergingmain.Scope
Windows x86_64 asset selection. The registry and CIM probes cannot run on this Linux host, so those two are covered by the shared-helper refactor and the gate tests rather than executed; the gate itself is what the gfx1151 run exercised.