PR #5097 (6 of 6 in the Megatron prefill/decode stack) · main a723b597, #5097 head 751efd79
stage_completed, on the decode engine.Four pages on #5097, one question each; the first chip is an earlier PR in the stack. This one: does Megatron run a Gym call through the same steps as vLLM?
| Step | Same on all four? | What differs, and does it matter today |
|---|---|---|
| ① prepare (TQ read) | vLLM ×2 and #5097: yes, one function. Aggregated Megatron: its own copy. | Aggregated Megatron splices with replace_prefix_tokens, not the shared splice_prefix_tokens. Already on main; not this stack. |
| ② begin (before generation) | vLLM: before. Both Megatron paths: after, inside staging. | The weight version comes out the same (taken from policy_epoch). What vLLM does before generation — cut restore, media copy, top-k — #5097 refuses (here). So no ask now; it matters when a later PR lifts those refusals. |
| ④ finalize (TQ write) | No. #5097 adds a second Megatron copy. | It writes no routed experts (C2), and its failure handling differs from native: an admission error escapes to the adapter's except ValueError and becomes a 400 (C3). |
Nothing below is implemented. Both Megatron paths should finalize through one function, so the Dynamo path gets routes and the native failure rule for free.
Decode engine rank 0, after generation (proposed)
# token_capture.py, called by native stage() and by the Dynamo adapter def _stage_call(admission, *, prompt_ids, gen_ids, logprobs, policy_epoch, routes, media): call = None try: call = begin_call(CaptureAdmission.model_validate(admission), weight_version=_weight_version(policy_epoch)) # inside the try now return complete_call(call, prompt_ids, gen_ids, logprobs, extras=routed_experts(routes), # C2: no more extras=None attachments=media) except Exception: # C3: as native stage() return fail_call(call) if call else None # None → answer the call, no coords
💬 review comment C2 — token_capture.py:571 C3 — token_capture.py:598