PR #4801 (first of five:
#4912 โ
#5023 โ
#5024 โ
#5025) ยท
builds on the merged #4905 ยท
permalinks pinned to head 1a2eca34; the removed path links to main before #4905 (95095b71)
Pages on this design, one question each. This one: how the Megatron switch fits next to main's Dynamo path.
dynamo: true means NeMo RL's own vLLM workers behind a Dynamo frontend (#4905, merged). Main's config check allows it only for backend: vllm.dynamo: true also mean Megatron prefill/decode engines, adds their config and engine-width math, and teaches refit about shards of different widths. The switch itself is refused until #5025.control_timeout_s as "removed" (review comment C9), and part of the Megatron config is a hand copy of main's (C10).All three end at a Dynamo frontend. They differ in who owns the engine workers. The first was removed by #4905. The second is main today. This stack adds the third, using the same dynamo: true switch.
C9. This PR adds dynamo_cfg.control_timeout_s for Megatron. #4905 put the same key on main's
list of removed keys, and
the check ignores the backend. It runs first at startup
(run_grpo_single_controller.py), so a Megatron config that sets the field stops with "refit and pause use the vLLM backend's own controls".
C10. MegatronDynamoFrontendArgs repeats five fields of main's
DynamoFrontendArgs, and dynamo_enabled is defined twice. This PR's Dynamo 1.8 commit already had to copy main's changes over by hand.
๐ฌ review comment C9 โ dynamo_config.py:83 C10 โ dynamo_config.py:47
dynamo: true โ before, after, and the C9 fix (proposed)Three checks run in order on the driver before any engine starts. Before this PR, a Megatron config with dynamo: true stopped at the second one. After it, the config gets through the backend checks and is refused on purpose by MegatronGeneration until #5025 builds the engines. On the way, it now requires P/D: there is no Megatron + Dynamo without disaggregation, while vLLM + Dynamo on main has no P/D yet.
Startup, before (main)
# driver, run_grpo_single_controller.py, in this order check_outdated_config(config) # dynamo_cfg.control_timeout_s: 'was removed' configure_generation_config(gen) if gen.dynamo and gen.backend != "vllm": raise # megatron + dynamo stops here if gen.dynamo_cfg and not gen.dynamo: raise resolve_generation_class(gen) # picks the class by backend name .validate_settings(master) # MegatronGeneration: no Dynamo branch
Startup, after (this PR)
# driver, same order check_outdated_config(config) # C9: still rejects control_timeout_s configure_generation_config(gen) if gen.dynamo and gen.backend != "vllm": raise if gen.dynamo and gen.backend not in ("vllm", "megatron"): raise if gen.dynamo_cfg and not gen.dynamo: raise resolve_generation_class(gen) if gen.dynamo and backend not in ("vllm", "megatron"): raise # same check, a second copy .validate_settings(master) # MegatronGeneration if gen.dynamo: validate_megatron_dynamo_generation(gen) # needs disaggregation on raise NotImplementedError("fleet not built") # #5025 removes this
Real code: check_outdated_config, configure_generation_config, resolve_generation_class, MegatronGeneration.validate_settings, validate_megatron_dynamo_generation (the P/D requirement is at L233-L238).
The fix for C9, as pseudocode (proposed, not run)
Where the fix lands: this PR's config, two lines. Remove the key, as main did for vLLM. On main the caller passes each control call its timeout (pause_generation_for_refit(timeout_s=โฆ), filled by the SingleController from async_rl.generation_fleet_health). The engine calls that read the key come later in the stack, so that part is staged on #5024. Main's check, its test and its migration note stay as they are.
# this PR, dynamo_config.py class MegatronDynamoCfg(BaseModel): startup_timeout_s: PositiveFloat = 600.0 request_timeout_s: PositiveFloat | None = None control_timeout_s: PositiveFloat = 600.0 # main already rejects this key # #5024, MegatronDynamoGeneration (staged there) timeout_s = self._control_timeout_s if timeout_s is None else timeout_s deadline = None if timeout_s is None else time.monotonic() + timeout_s # caller decides, as on main
๐ฌ review comment C9 โ dynamo_config.py:83
This PR also changes how refit numbers engines of different widths. That, and how all three refit transports work, is on one refit page.
dynamo: true. Two things to settle before #5025 turns the switch on: fix C9 by removing control_timeout_s, or every Megatron Dynamo config that sets it fails at startup with a vLLM error; and decide whether Megatron + Dynamo should exist without P/D, as vLLM + Dynamo does today. The review links work for others only after the review is published.