Repository navigation
Studio (AMD Linux): keep the bundled ROCm runtime when the system ROCm prepend hides the GPU - #14933
Conversation
…m prepend hides the GPU
|
@codex review |
|
@codex security review |
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. |
|
Codex Review: Didn't find any major issues. Nice work! 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 Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
`Repo tests (CPU, studio-install)` fails on `main` (c5482a5). Four tests fail in two groups, and both reproduce on a clean `main` checkout. ## `test_uv_boolish_parity.py::test_every_resolver_variable_in_shipped_powershell_goes_through_a_reader[install.ps1, setup.ps1]` #14686 added `Test-MirrorConfigured`'s uv config discovery. It decides `UV_NO_SYSTEM_CONFIG` and `UV_NO_CONFIG` with an inlined copy of uv's boolish set, because `setup.ps1` reaches that code before it defines `Test-UvEnvFlag`. The guard exists so every `UV_*` / `PIP_*` switch goes through the one reader, so the code is what needed to change: - Both scripts now call `Test-UvEnvFlag 'UV_NO_SYSTEM_CONFIG'` and `Test-UvEnvFlag 'UV_NO_CONFIG'`. - `setup.ps1` defines `Test-UvEnvFlag` / `Test-PipEnvFlag` ahead of `Test-MirrorConfigured`. The block moved unchanged, with one added comment line. `install.ps1` already defines it earlier in the same function. - New test `test_setup_defines_the_uv_reader_before_its_first_mirror_probe` pins that order. This hazard is what led to the inline copy in the first place. Behaviour is unchanged. Under `Set-StrictMode -Version Latest`, `Test-MirrorConfigured -Tool uv` returns the same answer on base and head, in both scripts, with a user `uv.toml` carrying an index and `UV_NO_CONFIG` set to each of unset, `off`, `0`, `no`, `YES`, ` 1 `, `true`. ## `test_rocm_native_linux_lib_dirs.py::TestLlamaCppRuntimeNativeOrdering` #14933 now holds the native-Linux ROCm dirs in `_system_rocm`, so it can skip them when they hide the GPU. The source check still looked for the old one-line `lib_dirs.extend(_native_linux_system_rocm_lib_dirs(binary_dir))`. The test was out of date. It now finds the helper call, follows the local it is assigned to, and still asserts two orderings: - helper call, then `lib_dirs.extend(...)`, then `lib_dirs.append(binary_dir)` - the WSL DXG decision comes before the native dirs ## Verification - `tests/studio/install/test_rocm_native_linux_lib_dirs.py` and `test_uv_boolish_parity.py`: 4 failed on `main`, 581 passed on this branch. - `tests/studio/install/test_denied_llama_cpp_preflight.py` (byte parity of the shared install/setup helpers): passes. - `pwsh tests/studio/test_mirror_fallback.ps1`: 142 PASS, 0 FAIL. - Sabotage checks: - Moving `lib_dirs.append(binary_dir)` above the native block fails the ROCm ordering test. - Restoring `main`'s `setup.ps1` fails both the reader test and the new ordering test.
Fixes #14906
Problem
On native Linux AMD hosts, Studio puts the system ROCm lib dir (
/opt/rocm/lib, or theHIP_PATH/ROCM_PATHroot) ahead of the prebuilt's bundled ROCm runtime when it spawnsllama-server(#7233, for #7208 where the bundled ROCR crashed inhsa_init). On hosts where the bundled runtime is the working one and the system copy is the mismatch, HIP initialisation fails without a crash:llama-server --list-devicesprints(none),-ngl -1becomes a no-op and the model runs on the CPU with no error. The existing bundle-only retry inload_modelonly fires on a startup crash with a ROCm symbol lookup error, so it never triggers here.Reporter's bisection (RX 7900 XTX, ROCm 7.2, CachyOS):
Fix
When the system ROCm prepend would apply,
_llama_server_env_for_binarynow asks the binary once per build (keyed on build dir + inode/size/mtime, like the existing bundle-only latch):--list-deviceswith the prepend. Lists a GPU, crashes, or gives no parseable answer: keep the prepend (today's behaviour, so [Bug] [ROCm] llama-server silently falls back to CPU on native Linux AMD: bundled ROCR runtime crashes inhsa_init(), system-ROCm override only applied on WSL #7208 / RDNA4 (gfx1201 / Radeon AI PRO R9700): prebuiltllama-serversegfaults on startup — plus an iGPU/HIP crash Studio doesn't guard against #7307 hosts are unchanged and pay one probe).--list-deviceswith the bundled runtime only. If that lists a GPU, log a warning and latch the existing bundle-only preference, so every later child (chat server, STT sidecar, device enumeration) uses the bundle.No probe runs off native Linux, without
/dev/kfd, without a bundledlibggml-hip, without a system ROCm install, or withUNSLOTH_LLAMA_NO_SYSTEM_ROCM=1, so CUDA, Vulkan, CPU, macOS, Windows and WSL hosts see no change.Tests
studio/backend/tests/test_system_rocm_hides_gpu.pydrives a stubllama-serverwhose--list-devicesanswer depends onLD_LIBRARY_PATH:_run_list_devicesthen reportsROCm0hsa_init(), system-ROCm override only applied on WSL #7208 shape): prepend kept on 3 env builds, 1 probeWith only the call-site hunk reverted, the three behavioural tests fail and the five keep-the-prepend guards pass. The related backend suites (17 files, 4078 tests) give the same failure set on the merge base and on this branch (7 pre-existing failures, all also red on main).