Repository navigation
Keep the #8577 AMD peer guards message-only, and fix the table drift they exposed - #8689
Conversation
…er-matching Adversarial verification of the "message-only" claim found two ways this branch had started changing what gets installed, both introduced by my own review fixes. studio/setup.ps1: widening the adapter scan gate from $HasROCm to the arch let CIM fill $script:ROCmGpuLabels on the amd-smi path. That variable feeds $gpuNames and so the arch inference, and the existing unpinned "borrow another adapter's arch" rule then resolved an arch where none was resolved before. On a host where amd-smi confirms a runtime but reports no gfx token, an RX 9070 XT went from CPU torch to gfx1201, and an RX 5700 beside an RX 7900 went to gfx1100, with --rocm-gfx forwarded to the llama.cpp and whisper installers. install.ps1: the Get-WmiObject to Get-CimInstance swap had the same effect on PowerShell 7, where the old call threw and the catch swallowed it. A host CIM can see but the ROCm tools cannot went from CPU torch to a repo.amd.com index. Both scans are now exactly what they were before this branch, byte for byte, and the peer names live in their own variable that only the uncovered-card verdict reads: $wmiAmdNames in install.ps1, $script:ROCmPeerLabels in studio/setup.ps1. Neither block writes a label or an arch. The pwsh suite asserts that through the AST rather than asserting the gate, which is the property that actually matters; appending a label or arch assignment to either block fails it. The PowerShell 7 Get-WmiObject defect is therefore still there. Fixing it changes what every pwsh 7 AMD host without a HIP SDK installs, so it belongs in its own PR. Separately, the five copies of the unsupported table were not pinned to each other, only the supported ones were, and they had already drifted: the regex copies carry (?!0) so "RX 5800" is not Polaris, while the shell globs matched it through "RX 580". The shell arms now carry the same guard, and a new test compares all five tables by EVALUATING them in their own languages over a shared name corpus. Adding a row to one file alone fails it. Also pinned: a blank UNSLOTH_TORCH_INDEX_URL / _FAMILY must not read as a pin in the Python path, which dropping the .strip() previously passed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02dc1a1644
ℹ️ 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".
| foreach ($peerName in $script:ROCmPeerLabels) { | ||
| if (Get-GfxArchFromGpuName -Name $peerName -Table $nameArchTable) { |
There was a problem hiding this comment.
Respect the visible-device mask when checking peers
When amd-smi sets $HasROCm without returning a gfx token on a mixed unsupported/supported host, this loop examines every CIM peer without applying HIP_VISIBLE_DEVICES or ROCR_VISIBLE_DEVICES. If the mask selects the unsupported adapter, a supported but masked-out peer sets $unsupPeerCovered, suppressing $script:ROCmUnsupportedGfxArch; the later report consequently takes the generic $HasROCm branch instead of warning that the selected adapter has no supported wheels. Limit this peer suppression to unpinned runs or resolve the peer using the same visible-device selection as $nameIdx.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch, fixed in 065b49d. Both installers now skip the peer suppression under a mask, which is the rule setup.ps1 already applies to its arch-borrowing branch: the mask names the card, so the verdict is about that one and a masked-out peer cannot answer for it.
One thing worth recording. My first attempt reused Test-VisibleDevicesPinned, whose set includes CUDA_VISIBLE_DEVICES, and two pwsh cases failed straight away. That turned out to be substantive rather than a test artefact: CUDA_VISIBLE_DEVICES masks NVIDIA devices and says nothing about which Radeon was chosen, so counting it would fire the verdict beside a covered Radeon on any host that sets it. Both files check HIP_VISIBLE_DEVICES and ROCR_VISIBLE_DEVICES only, with the exclusion written down at the site.
Three assertions per file pin it: the mask read exists, it counts HIP and ROCR, and it does not count CUDA. Emptying the list fails the first pair, adding CUDA back fails the third.
The peer check walked every adapter without looking at HIP_VISIBLE_DEVICES or ROCR_VISIBLE_DEVICES, so on a mixed host a masked-out supported card could silence the verdict about the card the user had actually selected. Both installers now skip the suppression under a mask, which is the rule studio/setup.ps1 already applies to its arch-borrowing branch: the mask names the card, so the verdict is about that one. HIP and ROCR only, deliberately, not Test-VisibleDevicesPinned's set: CUDA_VISIBLE_DEVICES masks NVIDIA devices and says nothing about which Radeon was chosen, and counting it fired the verdict beside a covered Radeon on every host that sets it, which two of the pwsh cases caught immediately. Three assertions per file pin it. Emptying the mask list fails one, adding CUDA_VISIBLE_DEVICES back fails another.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 065b49dcc9
ℹ️ 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".
| $amdAdapters = @(Get-WmiObject Win32_VideoController -ErrorAction SilentlyContinue | | ||
| Where-Object { $_.Name -match "AMD|Radeon" }) |
There was a problem hiding this comment.
Use CIM for the PowerShell 7 routing scan
When install.ps1 runs under PowerShell 7 on a Windows AMD host without a working hipinfo/amd-smi probe, Get-WmiObject is unavailable and the surrounding catch silently leaves $ROCmGpuLabel and $ROCmGfxArch unset. A supported GPU that should be resolved by its Windows device name therefore takes the CPU torch path, and the subsequent CIM peer scan cannot repair this because it is report-only. Keep this routing scan on Get-CimInstance, which works on both supported PowerShell editions.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed, and fixed in 8d2a95d. That was the only Get-WmiObject call left in install.ps1: the driver-date scan at 3489, the Intel scan at 3591 and the process lookup at 1876 are all already on CIM, as is studio/setup.ps1's equivalent adapter scan. Under PowerShell 7 the cmdlet is gone, the catch is silent, and a supported Radeon known only by its Windows name took the CPU torch path with nothing downstream able to repair it. Same class and same two fields (Name, ConfigManagerErrorCode), so Windows PowerShell 5.1 is unchanged. The pwsh suite now asks the parser for Get-WmiObject command nodes in both files and fails if one comes back.
| $unsupMasked = @($env:HIP_VISIBLE_DEVICES, $env:ROCR_VISIBLE_DEVICES) | | ||
| Where-Object { $null -ne $_ } | ||
| foreach ($peerName in $(if ($unsupMasked) { @() } else { $wmiAmdNames })) { |
There was a problem hiding this comment.
Resolve the masked Radeon before declaring it unsupported
When amd-smi confirms multiple GPUs but supplies no gfx token, the code retains only the first Market Name; setting HIP_VISIBLE_DEVICES=1 does not make that label describe GPU 1. If GPU 0 is an RX 5700 and the selected GPU 1 is a supported RX 7900, this new masked branch skips every peer and classifies the stale RX 5700 label as the selected unsupported device, producing the false claim that no override can help. Under an AMD mask, resolve the corresponding WMI peer using the selected index rather than simply disabling peer suppression; the same logic is duplicated in studio/setup.ps1.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and the stale label is the part that matters: amd-smi's Market Name branch keeps $Matches[1], and the WMI fallback keeps adapter [0], so neither follows HIP_VISIBLE_DEVICES=1. Yielding to the mask therefore handed the verdict to a card that may not be the selected one.
I did not resolve the peer by index though. Win32_VideoController enumerates in driver-stack order, which is not promised to match HIP's device order, so an index map would trade a knowable wrong answer for an unknowable one. Instead the masked branch now stays silent whenever a peer exists that was never indexed: $wmiAmdNames.Count -gt 1 in install.ps1, and $script:ROCmPeerLabels.Count -gt $gpuNames.Count in studio/setup.ps1, which also covers that file's non-HasROCm path where $nameIdx already selects per adapter. A masked single-adapter host keeps the verdict, since there is nothing else the mask could point at. Three cases added to the pwsh guard driver, mutation-checked in both directions.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
Follow-up to #8577. That PR was meant to be message-only, and two of the guards I added
to it went further than that: on some AMD hosts they changed which PyTorch got installed.
This puts the scope back and closes a table drift the tests were not looking for.
What was changing installs
studio/setup.ps1. The adapter scan was gated on$HasROCm, and #8577 widened thatto the arch so the peer list would exist on the amd-smi path. That variable,
$script:ROCmGpuLabels, feeds$gpuNames, which feeds the arch inference, so wideningit let the existing unpinned "borrow another adapter's arch" rule resolve an arch where
none was resolved before:
gfx1201, ROCm wheelsgfx1100, ROCm wheels,--rocm-gfx gfx1100forwarded to the llama.cpp and whisper installersinstall.ps1. TheGet-WmiObjecttoGet-CimInstanceswap did the same thing onPowerShell 7, where the old call throws and the surrounding
catch {}swallows it. A hostCIM can enumerate but the ROCm tools cannot went from CPU torch to a repo.amd.com index.
What this PR does
Both scans are byte-identical to what they were before #8577 again, and the peer names
live in their own variable that only the uncovered-card verdict reads:
$wmiAmdNamesininstall.ps1,$script:ROCmPeerLabelsinstudio/setup.ps1. Neither block writes alabel or an arch, so the guards are message-only as intended.
The PowerShell 7
Get-WmiObjectdefect is therefore still present. It is real, and worthfixing, but fixing it changes what every pwsh 7 AMD host without a HIP SDK installs, so it
belongs in its own PR rather than riding along in a wording change.
The table drift
The five copies of the supported name table are pinned to each other by tests. The
unsupported ones added in #8577 were not, and they had already drifted: the regex copies
carry
(?!0), so an "RX 5800" is not Polaris, while the shell globs matched it throughRX 580. The shell arms now carry the same guard, written as*"RX 580"|*"RX 580"[!0]*since POSIX
casehas no lookahead.A new test compares all five tables by evaluating them in their own languages over a
shared 38-name corpus, so a copy that spells the same rule differently still counts as
agreeing. Adding a row to one file alone fails it, which is exactly the mutation that
passed the whole suite before.
Checks
bash -non both shell installers, the PowerShell parser on both.ps1files, andast.parseonstudio/install_python_stack.py.install.sh's index selector run at the merge base and at this head under identicalstubs: 1920 cells, 0 stdout differences, 0 exit-code differences, 0 unexpected stderr
differences. The harness fails closed if any run reports a missing function.
tests/studio/installplus the Windows scan and parity suites. The threetest_managed_node_runtime.pyfailures reproduce onmainwith these changes stashed.old gate, adding a table row to one file alone, and dropping the
.strip()from the pinread each fail a test.