Skip to content

Make the GPU probe harness name the helper it failed to extract - #11538

Merged
danielhanchen merged 1 commit into
mainfrom
fix/gpu-probe-harness-names-the-helper-it-lacks
Sep 22, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/gpu-probe-harness-names-the-helper-it-lacks

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/sh/test_setup_gpu_summary_probe_sources.sh builds a runnable block by sed-ing named functions out of studio/setup.sh. Nothing in it notices when setup.sh grows a helper that the selection block calls: the block just runs with that helper undefined, and every case reaching the call dies on a bare command not found.

That is not hypothetical. #11437 added _amd_prefer_discrete_gfx and _amd_gfx_is_shadowing_integrated, called them from the selection block, and the harness never extracted them:

/tmp/tmp.IBMBTbCUVZ/block.sh: line 202: _amd_prefer_discrete_gfx: command not found
  FAIL: amd-smi answers list but not static --asic (expected "|", got "")
Results: 8 passed, 29 failed, 0 skipped

Twenty-nine failures, each naming the symptom once, none naming the cause. It was red on every open PR that ran the shell suite until #11472 landed.

#11472 fixed it correctly: it added both helpers to the sed lines and a named grep guard for each. But that covers those two helpers. The next helper added to the selection block reproduces the same wall of failures, because the guard list is exactly the list somebody already remembered to add sed lines for.

The change

Give each extracted artifact a command_not_found_handle, so the first call that is actually reached says what is missing and how to supply it:

FATAL: the extracted block called "_amd_prefer_discrete_gfx", which studio/setup.sh defines
       but no sed line in this test pulled in. Add:
         sed -n "/^_amd_prefer_discrete_gfx()/,/^}/p" "$SETUP_SH"

The existing named greps are kept. They state which helpers must be present today, which is worth saying explicitly; this catches the ones nobody thought to state.

Reached, not merely present

I first wrote this as a static scan of the extracted text for calls to setup.sh functions that the artifact does not define. That is the wrong check, and it failed the suite on three names that are not defects: _setup_nv_banner_fields, step and substep. All three really are called from the extracted region and really are not extracted, but they sit in arms this test never takes, since the NVIDIA path is pinned false. Reachability is not decidable from the text, so the check has to run.

Verification

  • 37 passed, 0 failed on this file, unchanged from main
  • every other suite under tests/sh stays green (test_setup_*: 18, 23, 13, 28, 15, 13, 37, 37 passed, plus the ALL PASSED ones)
  • reproducing Studio: prefer the discrete AMD GPU when an iGPU enumerates first on Linux #11437 exactly, dropping the helper from the sed lines and removing the named grep guards so only the new handler can catch it, reports the function by name instead of command not found

Tests only, no behaviour change.

The harness builds a runnable block by sed-ing named functions out of
studio/setup.sh. When setup.sh gains a helper and the selection block
calls it, nothing here notices until the block runs with it undefined,
and then every case that reaches the call dies on a bare "command not
found". #11437 did exactly that with _amd_prefer_discrete_gfx: 8 passed,
29 failed, and not one of the 29 named the cause.

#11472 added the helper to the sed lines and a named grep guard for it,
which fixes that helper and only that helper. The next one repeats it.

Give each extracted artifact a command_not_found_handle instead, so the
first call that is actually reached says which function is missing and
which sed line would supply it.

Reached, not merely present: setup.sh arms this test never takes do call
helpers it never extracts (the NVIDIA banner, the step/substep
printers), so a static scan of the text reports those as defects when
they are not. A static version of this guard failed the suite on all
three.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 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 ✅ Completed 2026-09-22T14:17:54.600181Z 6835173 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 6835173ae9

ℹ️ 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 merged commit 5b6b7c3 into main Sep 22, 2026
0 of 18 checks passed
@danielhanchen
danielhanchen deleted the fix/gpu-probe-harness-names-the-helper-it-lacks branch September 22, 2026 14:33
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…othai#11538)

The harness builds a runnable block by sed-ing named functions out of
studio/setup.sh. When setup.sh gains a helper and the selection block
calls it, nothing here notices until the block runs with it undefined,
and then every case that reaches the call dies on a bare "command not
found". unslothai#11437 did exactly that with _amd_prefer_discrete_gfx: 8 passed,
29 failed, and not one of the 29 named the cause.

unslothai#11472 added the helper to the sed lines and a named grep guard for it,
which fixes that helper and only that helper. The next one repeats it.

Give each extracted artifact a command_not_found_handle instead, so the
first call that is actually reached says which function is missing and
which sed line would supply it.

Reached, not merely present: setup.sh arms this test never takes do call
helpers it never extracts (the NVIDIA banner, the step/substep
printers), so a static scan of the text reports those as defects when
they are not. A static version of this guard failed the suite on all
three.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant