Skip to content

Studio: judge an HSA_OVERRIDE_GFX_VERSION GPU by its override in the cold engine status - #16670

Merged
danielhanchen merged 5 commits into
mainfrom
fix/16469-rocm-cold-status
Nov 5, 2026
Merged

danielhanchen merged 5 commits into
mainfrom
fix/16469-rocm-cold-status

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

What changes

Since #16469 made startup ML warmup opt-in, torch is no longer imported at startup. On a ROCm host that sets HSA_OVERRIDE_GFX_VERSION (for example 11.0.0 on a gfx1102 Radeon), the vLLM / SGLang status endpoint then answered "Checking for a supported AMD GPU." on every poll and never reached a verdict until something else imported torch (the Settings Resources tab does; About and the download manager do not). Before #16469 it probed torch and answered "supported".

The cold path now reads a readable global override the way libhsakmt does (ROCR-Runtime libhsakmt/src/topology.c, topology_sysfs_get_node_props: sscanf("%u.%u.%u%c"), so trailing text such as a space is rejected, major at most 63; the name is gfx<major><minor><stepping in hex>, so 11.0.0 is gfx1100 and 9.0.10 is gfx90a) and applies it to every GPU the KFD topology lists, as libhsakmt does for every GPU node. That is the target torch reports for each device, so the poll reaches the same verdict as before #16469 without importing torch.

Unchanged and still provisional ("Checking") until torch reports: an unreadable override, any per-device HSA_OVERRIDE_GFX_VERSION_<n>, and an unreadable KFD topology. Hosts without an override, CUDA, CPU-only, Windows and macOS take the same code path as before. No UI text changes. The new helper is a pure function of the environment, so repeated polls give the same answer.

  • studio/backend/utils/hardware/amd.py: hsa_override_gfx_target(), the same name rule as install_python_stack._hsa_override_gfx_arch, but stricter on input: a value libhsakmt rejects (trailing whitespace or text, major above 63) stays unreadable here, so the status never reports supported for an override the runtime refuses.
  • studio/backend/core/inference/engine_install.py: _rocm_reason uses it before falling back to "Checking".

Results

Cold status (support_reason("vllm", wait=False), 3 polls) over mocked hosts. "torch" = whether the poll ran hardware detection or the torch probe.

Host ee3fa40 (before #16469) main this PR
CUDA Linux Checking, then supported (torch: yes) Checking, then supported (no) Checking, then supported (no)
ROCm gfx1100 (listed) supported (yes) supported (no) supported (no)
ROCm gfx1102 (unlisted) unsupported (yes) unsupported (no) unsupported (no)
ROCm gfx1102, override 11.0.0 supported (yes) Checking forever (no) supported (no)
same, gpu_id 0 supported (yes) Checking forever (no) supported (no)
2 x gfx1102, override 11.0.0, gpu_id 1 supported (yes) Checking forever (no) supported (no)
ROCm gfx1102, override 10.3.0 unsupported (yes) Checking forever (no) unsupported (no)
ROCm gfx1032, override 9.0.10 (gfx90a) supported (yes) Checking forever (no) supported (no)
ROCm gfx1100, override 10.3.0 unsupported (yes) Checking forever (no) unsupported (no)
ROCm, override "11" (unreadable) per torch Checking (no) Checking (no)
ROCm, per-device override per torch Checking (no) Checking (no)
ROCm, override, no KFD per torch Checking (no) Checking (no)
ROCm, no KFD per torch Checking (no) Checking (no)
Windows (non-WSL path) platform message (no) same same
macOS platform message (no) same same
CPU-only Linux Checking, then requires NVIDIA (yes) same (no) same (no)

Tests

  • New test_cold_status_judges_an_overridden_gpu_by_the_override_without_torch (gpu_id None, 0, 1; the torch probe raises if called) and test_hsa_override_gfx_target; both fail on main.
  • test_hsa_override_gfx_target also covers "11.0.0 " and "64.0.0" (both unreadable, as in libhsakmt).
  • test_cold_status_does_not_judge_an_overridden_gpu_by_its_kernel_target now expects the override verdict instead of "Checking".
  • test_managed_engines_rocm.py, test_engine_status_stays_cold.py, test_ml_warmup_idle_runtime.py, every backend test touching engine_install or HSA_OVERRIDE_GFX_VERSION, and tests/studio -k "engine or rocm or amd or hsa": same failing IDs on main and this branch.

Not covered

  • Checked on a real gfx1151 (Linux, ROCm torch): with overrides 11.0.0, 10.3.0, 11.5.1 and 9.0.10 the base cold poll stays at "Checking", while the head's cold answer equals the answer after torch reports (torch's gcnArchName was gfx1100, gfx1030, gfx1151 and gfx90a), and the poll never imports torch. With "11.0.0 " (trailing space) torch sees no device at all, so treating it as unreadable matches the runtime.
  • The installer's own _hsa_override_gfx_arch still strips trailing whitespace, so it accepts a value libhsakmt rejects; that is a separate, pre-existing difference and is not changed here.
  • An override naming a target ROCm does not know (for example 11.0.7) is still reported by name; the answer is then "unsupported", never a wrong "supported".
  • Device masks (HIP_VISIBLE_DEVICES ordinal or stacked masks) are not modelled: the override applies to every device, so the per-GPU answer is the override target either way.
  • Staging (latest head): ubuntu, macos-15 and windows legs all green.

…cold engine status

Since startup ML warmup became opt-in (#16469), an idle managed-engine status poll on a
ROCm host with HSA_OVERRIDE_GFX_VERSION answered Checking for a supported AMD GPU on every
poll until something else imported torch. Read a readable global override as the gfx target
ROCr presents for every GPU KFD lists, so the cold poll reaches the verdict torch would
report without importing torch. Unreadable or per-device overrides and an unreadable KFD
topology stay provisional as before.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T13:32:44.052161Z
We couldn’t complete this review. Comment @codex review to try again.
4e5e171 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danielhanchen added a commit to Etherll/unsloth that referenced this pull request Nov 5, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 79b0e7b243

ℹ️ 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".

@danielhanchen
danielhanchen marked this pull request as ready for review November 5, 2026 13:32
@danielhanchen
danielhanchen merged commit c9f786f into main Nov 5, 2026
@danielhanchen
danielhanchen deleted the fix/16469-rocm-cold-status branch November 5, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant