Skip to content

feat: resolve --hardware from the node in every launcher - #2738

Merged
yueming-yuan merged 7 commits into
mainfrom
yueming/hardware-everywhere
Aug 25, 2026
Merged

feat: resolve --hardware from the node in every launcher#2738
yueming-yuan merged 7 commits into
mainfrom
yueming/hardware-everywhere

Conversation

@yueming-yuan

Copy link
Copy Markdown
Collaborator

Summary

Make --hardware the single source for a launcher's machine profile: it defaults to detecting the node it runs on, and num_gpus_per_node follows from it.

Stacked on #2735 — the first three commits are that PR. Review from ca4fcba01.

Problem

Every launcher hardcodes two things about the machine:

num_gpus_per_node: int = 8
hardware: Literal["H200", "B200", "GB300"] = "H200"

Two ways to get a silently wrong profile out of that:

  1. Forget --hardware. You get whichever machine the recipe was first written on. fix(dsv4): fix deepseek v4 hareware branch #2735 is one instance of the same class — a 4-GPU H200 smoke test took the Grace TP8 rollout profile and hung at 4/8 clients joined.
  2. Pass --hardware GB300 but not --num-gpus-per-node 4. The topology is still sized for 8 GPUs per node.

Fix

--hardware defaults to "auto", resolved once in __post_init__:

self.hardware = U.resolve_hardware(self)
self.num_gpus_per_node = self.num_gpus_per_node or U.NUM_GPUS_OF_HARDWARE[self.hardware]

detect_hardware() (added in #2735) maps the node to a NUM_GPUS_OF_HARDWARE key: compute capability picks the generation, the host CPU separates Grace from the x86 part carrying the same die, HBM capacity splits H100 from H200. resolve_hardware() additionally rejects a hardware the launcher declares no profile for, rather than letting a match args.hardware fall through it:

AssertionError: ScriptArgs has no verified profile for B200

An explicit --hardware still overrides, and an explicit --num-gpus-per-node still wins over the derivation — that is how a job takes four GPUs of an eight-GPU node.

Scope

19 launchers declare hardware; all of them change. The 33 that do not keep their literal, because there num_gpus_per_node is often a deliberate partial node (run_qwen3_0_6b_fsdp takes 4, examples/verifiers takes 2) rather than the machine's shape.

Verification

The replaced literals were all consistent — every launcher that declares hardware hardcoded exactly NUM_GPUS_OF_HARDWARE[its default hardware], 13/13, so this is behavior-preserving at the default:

script                                     hw default  gpus  NUM[hw]
scripts/run_deepseek_v32.py                B200           8        8
scripts/run_glm45_355b_a32b.py             GB200          4        4
scripts/run_glm5_744b_a40b.py              H200           8        8
...                                        (13/13 match; 6 more already derived)
  • tests/manual/launch_scripts/test_py_launch_scripts.py: snapshots unchanged, 182 passed (the 8 failures and 4 errors are the same set as on main in this checkout, all under scripts/amd/** and run_kimi_k25).
  • tests/fast/utils/test_command_utils.py + tests/fast/launch_scripts/test_run_deepseek_v4.py: 80 passed.
  • pre-commit run --files <changed>: passed.

Two new tests keep the recording pins honest: every pinned hardware must be one the launcher accepts, and a launcher the frozen default already covers may not be pinned twice.

Review focus

  • resolve_hardware() reads the supported set off the field's Literal — that is the one piece of reflection here.
  • _HARDWARE_A_RECORDING_REPRESENTS in the snapshot suite: a launcher that reads the node cannot be recorded on a CPU runner, so the suite states which machine each recording is.
  • detect_hardware()'s capability table is not yet verified on real hardware (sm_103 for B300/GB300, aarch64 for Grace are derived from the architecture, not measured). Worth one run on a B300 / GB300 / H200 node before merge.

guapisolo and others added 6 commits August 24, 2026 13:02
A 4-GPU H200 smoke test was routed through the multi-node GB300 TP8 path,
so SGLang waited for ranks that the Ray pool could not provide.

Choose TP8 only when the rollout pool has at least eight GPUs, validate the
engine topology before submission, and cover both H200 and GB300 launchers.
PR #2717 treated every four-GPU node as the GB300 full-model profile,
which routed the single-node 4-layer H200 smoke test into TP8/EP8.

Exclude the 4-layer model from the GB300 branch and keep only the two
launcher regression cases that distinguish the intended profiles.
Launchers hardcode a --hardware default, so running one on anything else
silently applies the wrong profile unless the flag is passed. detect_hardware()
resolves the node to a NUM_GPUS_OF_HARDWARE key: compute capability picks the
generation, the host CPU separates Grace from the x86 part carrying the same
die, and HBM capacity splits H100 from H200. It is a lookup at the point of use,
not at construction, so prepare steps keep running GPU-free; the snapshot
harness freezes it.

GENERATION_HARDWARE gains H200/B200/B300, and the table check now derives the
hardware it requires from every launcher's --hardware literal instead of a
hardcoded list that #2585 already drifted from.
`num_gpus_per_node == 4` stood in for "GB300", so the 4-GPU H200 smoke test
picked up the Grace TP8/EP8 rollout profile and hung at 4/8 clients joined. The
reason for tp=8 is Grace CPU RAM under colocate, so read it off --hardware,
which falls back to detecting the node rather than guessing from a GPU count.
Excluding the 4-layer model by name left both halves wrong: a full-model run on
a 4-GPU H200 node still took TP8, and a 4-layer run on GB300 still lost it.

The profile now also requires eight rollout GPUs to exist, and an engine wider
than the pool asserts at submission instead of hanging in the router.

_is_blackwell and its private table go with it: the shared GENERATION_HARDWARE
answers the same question. The 4-layer CI test pins hardware="H200" the way the
v3.2 one does. Launcher snapshots are unchanged.
min() over the pool replaces the >= 8 guard: eight GPUs where the pool has them,
the whole pool where it does not. The assertion stays for the profiles that pick
a fixed size.
Every launcher hardcoded a --hardware default and, separately, a
num_gpus_per_node literal. Running one on anything else silently applied the
wrong profile: `--hardware GB300` without `--num-gpus-per-node 4` still sized
the topology for eight GPUs per node, and forgetting --hardware entirely picked
whatever machine the recipe was first written on.

--hardware now defaults to "auto", which asks the node through detect_hardware()
and overrides nothing that was passed explicitly. num_gpus_per_node follows from
the resolved hardware unless it is given, which is how a job takes four GPUs of
an eight-GPU node. resolve_hardware() also rejects a hardware the launcher has
no verified profile for, instead of letting a `match` fall through it.

The literals this replaces were all consistent: every launcher that declared
hardware hardcoded exactly NUM_GPUS_OF_HARDWARE[its default hardware], so the
snapshots are unchanged. The suite pins the machine each recording represents,
since a launcher that reads the node cannot be recorded on a CPU runner.

Launchers without a --hardware flag keep their literal: there a partial node is
often deliberate (run_qwen3_0_6b_fsdp takes 4 GPUs, examples/verifiers 2).

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

A test that builds ScriptArgs directly, rather than through the launch-script
harness, has nothing freezing detect_hardware, so `--hardware auto` looks for a
GPU the CPU runner does not have. Pin each of them to the default its launcher
carried before, which is also what keeps an e2e recipe from following whichever
runner picked it up.
@guapisolo

guapisolo commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Open disucssion: Should we keep the hardware detect -> num gpu per node assumption logic in script level like this PR, or move it into miles launch? (like arguments.py)

Okay I think current logic is better. We shouldn't let the engine know too many logics.

@yueming-yuan yueming-yuan added the run-ci-model-scripts Run model script smoke tests label Aug 24, 2026
@guapisolo

Copy link
Copy Markdown
Collaborator

/rerun-test tests/e2e/megatron/test_qwen3_4B_ppo.py

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

tests/e2e/megatron/test_qwen3_4B_ppo.py passed on stage-c-4-gpu-h200 in 17m15s — workflow run

@yueming-yuan
yueming-yuan merged commit 2c78e2a into main Aug 25, 2026
48 of 49 checks passed
@yueming-yuan
yueming-yuan deleted the yueming/hardware-everywhere branch August 25, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci-model-scripts Run model script smoke tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants