Repository navigation
fix(rocr): fix multi-GPU init failure from deprecated doorbell type - #4936
Conversation
dayatsin-amd
left a comment
There was a problem hiding this comment.
Thank you for the changes. They look ok to me.
Will monitor CI tests to confirm they pass before merging.
|
Great! Thanks. There are more PRs filed, I think probably the most serious is the container ID truncation |
|
@dayatsin-amd G'day! Heads up — the CI failure in What happened: The test reads KFD sysfs topology and sees all 8 GPUs on the CI host, but HSA only reports 1 because the container only has 1 GPU passed through. The strict The fix: Replaced the strict equality with a bounded check — HSA must expose at least 1 GPU (when KFD has supported nodes) and must never expose more than KFD reports as supported. This preserves the important invariant (deprecated GPUs never leak through) while working correctly in restricted environments. One thing this surfaced though — the integration test for this fix is designed to catch bugs on mixed GPU systems (deprecated + supported GPUs together), but with CI only passing 1 GPU per container, that scenario can never actually occur in CI. The standalone unit tests in Would it be feasible to pass through multiple GPUs to the rocrtst CI containers? Even 2 would make the test more meaningful, and it would probably benefit other multi-GPU tests in the suite too. Alternatively, a KFD topology mock/override mechanism (where the test injects a synthetic DoorbellType=1 node) would let us simulate deprecated hardware without needing the physical card — that might be the most robust long-term approach. Also — if it would help to have the exact card that triggered this bug for CI testing, the Radeon Pro WX 2100 (gfx803/Polaris12, DoorbellType=1) is available on eBay for ~$32: https://www.ebay.com/itm/287179806374. We'd be happy to purchase and ship one to AMD for the CI system. Even though this card isn't "supported" by ROCm, its mere presence in a system caused complete ROCm failure for all other GPUs — which is exactly the kind of thing CI should be catching. No urgency on the CI question — just flagging it while it's fresh. The fix should let CI pass now so this can merge. Thanks! |
|
G'day! Just a heads up — I've submitted #5135 to fix the flaky |
|
Sorry to bug you, but I think if you approve this again, the CI will work now. |
|
There is good progress by the AMD firmware team, so hopefully the cards will be a lot better soon, but without this PR getting merged, NONE of my AMD cards will work. |
dfd17ee to
879ce58
Compare
|
@cfreeamd @dayatsin-amd — thanks for the review. Rebased onto current 1. 2. 3. Branch was rebased onto |
|
This bug is still active. Look, I don't really care how we get this fixed. We can keep the code, but ultimately we need all the 2 bits covered please. This is beyond a joke now. |
|
Also running into this issue. I hope this can be sorted out soon. I mostly just want ROCm for the occasional Blender render (emphasis on occasional; otherwise I would have gone NVidia, but since I don't depend on Blender for anything serious, the easier desktop usability of AMD is much more important to me). Here's my system info just in case: |
@randomizedcoder It seems the CI is complaining about these errors:[rocrtst] ld.lld: error: duplicate symbol: DoorbellTypeValidation_Supported_Type2_Vega_And_Newer_Test::test_info_
|
|
@dayatsin-amd — quick update: build passes now (Linux 2h27m, Windows 2h15m). The original The one red mark left is That's the inter-process dma-buf shareable-handle test — different file, different feature. The 15-min timeout suggests the child process hangs after the failure. All other Linux test shards (hip-tests x4, rocgdb, rocprofiler-sdk, rocr-debug-agent, sanity) pass. Would you mind re-running just that job, or is there a path to merge from here? Happy to do whatever's most useful. |
46b7a11 to
fdcdd36
Compare
shwetagkhatri
left a comment
There was a problem hiding this comment.
Now new tests need to be added to test_categories.yaml. Otherwsie the test will not run in CI tier pipelines. Please add the test to all (quick/standard/comprehensive/full) tiers.
In test_categories.yaml under standard.test_patterns, add:
- "rocrtstFunc.GpuDiscoveryDeprecatedDoorbellTest"
|
Thanks for the review, @shwetagkhatri — all three points are addressed in
I'd also like to share some friendly feedback on the process. This PR has now been open for 84 days (since April 12), for a change that's small and low-risk — it's purely about how the 2-bit More broadly, I've found it discouraging that a number of the PRs and issues I've filed against this repo haven't received much traction — several PRs were closed without review, and I've had fixes go unlooked-at to the point where I opened a separate issue to escalate (e.g. #7081, the amdsmi container-ID truncation that's affecting a production MI300X deployment). I really want to be a constructive contributor here, and I'm very happy to keep addressing feedback — it would just help a lot to know these contributions are being seriously considered. This one already has an approval from @dayatsin-amd. I'd genuinely appreciate help getting it prioritized and merged, and I'm glad to make any further tweaks needed. Thanks for your time. |
|
Thanks so much for approving and running the CI — really appreciate it! 🙏 The results look great: all the substantive checks are green — The only two red marks look like unrelated CI infrastructure hiccups rather than anything in this change:
Neither touches the doorbell fix. @shwetagkhatri — given the green results everywhere the code is actually exercised, and the existing approval from @dayatsin-amd, I think this is in good shape to merge. A quick re-run of the Linux job should clear it to all-green, and I'm happy to rebase if that helps trigger a fresh run. Thanks again for the help getting this moving! |
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
|
Filed #8801 to document the root cause, and added I'll be direct: I'm extremely disappointed by how this has gone. This is an ~3-line fix for a pre-existing runtime bug — root cause traced in #8801 to commit That issue is now filed and referenced. Requesting a CI re-run and a path to merge. @dayatsin-amd's approval already stands; @shwetagkhatri's 2026-06-16 |
|
@shwetagkhatri can you review rocrtst changes. Thanks |
|
Hi @randomizedcoder , Thank you for your patience and for the care you put into this PR. You carried it through several rounds of successful feedbacks. The experience you have had getting a small, correct fix landed has not been good, and that is on us. I am sorry it has taken this long, and I want to get it merged. To get this unblocked I have rebased your branch cleanly onto the current develop. Your commits and authorship are preserved exactly, and I have added the two small items from the last review round on top: registering the DoorbellTypeValidation unit tests in all four CI tiers in test_categories.yaml, and narrowing the DiscoverGpu catch to HSA_STATUS_ERROR_INVALID_ISA so unrelated construction failures surface instead of being silently dropped. You can see the clean, conflict-free result on tip of develop here for reference: #10136 (opened as a draft. it is only a reference, the fix is still meant to land through this PR). There are two ways we can bring this in, and I am happy with whichever you prefer:
Let me know which you prefer and I will take care of my side promptly, and I will help shepherd it through the remaining CI and to merge. Thanks again for sticking with this. |
|
@shwetagkhatri - I really don't mind how we do it. This is a small fix for a 2 bit field. - I'd love to do a little debrief about this once we get this landed |
|
@shwetagkhatri please force push to this PR and let's get this merged. |
9b8ebec to
8d7a39c
Compare
|
Rebased this branch onto current Changes since the last review:
I also ran the project's static-analysis tools (semgrep / flawfinder / cpplint) scoped to the changed lines — no new findings remain. This supersedes the reference rebase in #10136 (same content plus the fixes above, authorship preserved). The red CI on #10136 was unrelated infrastructure — TheRock source-fetch failures and a test runner with no GPU |
8d7a39c to
5c9aab1
Compare
A GPU reporting a deprecated doorbell type causes GpuAgent construction to throw HSA_STATUS_ERROR_INVALID_ISA. Previously DiscoverGpu let this propagate, so a single unsupported device aborted runtime init for all GPUs on the system. Narrow the DiscoverGpu catch to HSA_STATUS_ERROR_INVALID_ISA so an unsupported GPU is skipped while genuine construction failures (e.g. GetWallclockFrequency, out-of-resources) are still rethrown. Harden the doorbell error path in amd_gpu_agent.cpp by including <sstream> directly and binding the message to a named std::string before .c_str(). Add DoorbellTypeValidation unit tests plus the GpuDiscoveryDeprecated suite, and register them across the rocrtst CI tiers.
5f61046 to
5d1b49e
Compare
|
Ok. All approvals are done. Now waiting on CI to complete. If you see Rebase and merge button Green, please go ahead and merge @randomizedcoder . I will circle back in couple of hours. |
|
Follow-up: verified on hardware that this fix works as merged. Setup: Lenovo ThinkStation P620, kernel 7.2.7, two AMD GPUs — a Radeon Instinct MI50 (gfx906, KFD doorbell type 2) and a Radeon PRO WX 2100 (Polaris12 / gfx803, KFD doorbell type 1). That is exactly the multi-GPU trigger from #8801. With ROCm 10.1.0 (ROCr from the exit 0, and the MI50 is enumerated ( Control: the previous ROCm 7.2.3 Thanks for getting it merged. |


Closes #8801
Summary
We moved a set of AMD GPUs (MI50/gfx906, W5700/gfx1010, WX 2100/gfx803) to a machine running Wayland while waiting for the amdgpu firmware reset issue to be resolved on our primary system. To our surprise,
rocminfoand all ROCm/HSA workloads (including llama.cpp with ROCm) failed completely — no GPUs detected at all.The root cause: the WX 2100 (gfx803/Polaris12) has
DoorbellType=1, and theGpuAgentconstructor throwsHSA_STATUS_ERRORfor any doorbell type other than 2. TheDiscoverGpuhandler inamd_topology.cpponly catchesHSA_STATUS_ERROR_INVALID_ISA, so the uncaught exception propagates up and killshsa_init()for all devices — including the perfectly supported MI50 and W5700.How this happened
Git blame shows this was introduced across three commits by different authors:
Nov 2020 —
ba667661c5(Konstantin Zhuravlyov): "Implement Target ID Proposal"try/catchinDiscoverGputhat catchesHSA_STATUS_ERROR_INVALID_ISAto gracefully skip GPUs with unrecognized ISAthrow hsa_exception(HSA_STATUS_ERROR_INVALID_ISA, ...)inGpuAgentfor unknown ISAMay 2025 —
0d70045817(David Yat Sin): "rocr: Remove deprecated doorbell type 1 support"amd_aql_queue.cppamd_gpu_agent.cpp:if (DoorbellType != 2) throw HSA_STATUS_ERRORHSA_STATUS_ERROR(generic) instead ofHSA_STATUS_ERROR_INVALID_ISA, so the existing catch handler doesn't catch itMar 2026 —
bc17c5424c(Sunday Clement): "rocr: Skip Unsupported GPUs from being enumerated (rocr: Skip Unsupported GPUs from being enumerated #4198)"GpuNodeDescription()HSA_STATUS_ERROR_INVALID_ISA— the doorbell guard'sHSA_STATUS_ERRORremained uncaughtThe removal of type-1 support was correct. The issue is just that the rejection path used the wrong exception status code for the existing catch handler.
Changes
The removal of type-1 support was correct; the only defect was the rejection path using
HSA_STATUS_ERRORwhere the existingDiscoverGpucatch expectsHSA_STATUS_ERROR_INVALID_ISA. The fix aligns the two.1.
amd_gpu_agent.cpp— the fixif (DoorbellType != 2) throw HSA_STATUS_ERRORwith a documentedswitchstatement.HSA_STATUS_ERROR_INVALID_ISAinstead ofHSA_STATUS_ERROR, so the existingDiscoverGpuhandler catches it and skips just that device.kfd_topology.c).<sstream>directly (previously only transitively available) and bind the message to a namedstd::stringbefore.c_str()to avoid a dangling-pointer smell.2.
amd_topology.cpp— skip pathDiscoverGpucatch scoped toHSA_STATUS_ERROR_INVALID_ISAonly; any other status is a genuine failure (e.g. out-of-memory,GetWallclockFrequency) and is still rethrown.ifdebug) so users can see why a device was skipped.Affected hardware
Any multi-GPU system containing a pre-Vega AMD GPU alongside supported GPUs:
Testing
Unit tests (standalone, no hardware required):
13 tests in
doorbell_type_test.cccovering exhaustive combinatorial validation of the 2-bit doorbell type field:All 13 tests pass:
Hardware integration test (MI50 + W5700 + WX 2100):
Validated on NixOS (kernel 6.19, ROCm 7.2) with all three GPUs present:
rocminfodetects MI50 (gfx906) and W5700 (gfx1010), skips WX 2100 gracefullyllama-cppservice on W5700 starts and runs successfully (Qwen3-8B, 5G VRAM)rocminfooutput confirms all supported agents:Build notes: Validating required multiple full ROCm stack rebuilds on NixOS. The dependency tree is deep — e.g.:
This is part of why we invested in the standalone unit tests — they compile in seconds and catch the combinatorial logic errors without requiring a full ROCm rebuild.
Also submitted
A corresponding patch has been submitted to nixpkgs for the packaged ROCm runtime.