Skip to content

multinode: ATOM backend + atomesh router, and AgentX kernel extraction on ATOM - #648

Draft
zhaoan12-prc wants to merge 5 commits into
AMD-AGI:mainfrom
zhaoan12-prc:atom-agentx-main
Draft

zhaoan12-prc wants to merge 5 commits into
AMD-AGI:mainfrom
zhaoan12-prc:atom-agentx-main

Conversation

@zhaoan12-prc

@zhaoan12-prc zhaoan12-prc commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the ATOM backend to the multinode serving path that #530 introduced. Multinode
PD with ATOM engines behind the atomesh router now works in both provided and
generated modes. AgentX kernel extraction now runs end to end on ATOM: engine-log
parsing, sampling-point planning, per-point trace capture and step classification.
The only new launcher is atomesh as the PD router. Single-node behaviour is unchanged.

Commits

  1. multinode: serve the ATOM backend and the atomesh router (provided mode)
    • mn.py / run_e2e.py accept backend=atom and an atomesh launch router.
    • The trace gate reads ATOM's rank_<N>/ profiler layout.
    • Profile windows are clamped to the ATOM size guard.
  2. multinode: generated mode for ATOM P/D (atomesh router in front)
    • adapters/atom.sh renders each engine with its Mooncake --kv-transfer-config.
    • mn.py starts atomesh launch --pd-disaggregation on the master node.
  3. atom: AgentX kernel-extract on ATOM (log dialect, step dialect, serving probe)
    • observed_workload.py --log-format atom parses ATOM's Scheduled prefill batch rows and its periodic Engine … Running: R rows. It is only enabled by that flag.
    • parse_profile.py adds a step dialect for ATOM's prefill[...] / decode[...] / eager_decode[...] spans.
    • serving_probe.py --framework atom:
      • sends prompt_token_ids through the atomesh router;
      • detects steady state from ATOM's per-step decode_batch_size / prefill_batch_tokens histograms;
      • uses a short timed decode window (0.5 s), since ATOM's /start_profile takes no step bound;
      • links only finished *.trace.json.gz rank files.
    • multinode.sh adapter_probe_args gains an ATOM branch.
    • atom.sh:
      • records shapes without Python stacks or memory, matching sglang.sh / vllm.sh;
      • no longer forces --max-model-len 10240 under AgentX.
  4. multinode-traces: pd-points plans ATOM engine logs; AgentX notes for ATOM
    • pd-points recognises an ATOM engine log and plans with --log-format atom.
    • The AgentX / profiler multinode fragments describe the ATOM path.

Testing

  • Unit tests:
    • 650 passed.
    • test_multinode_args.js passes.
    • One failure: test_mn.py::CheckTest::test_takeover_stops_the_engine_group_on_the_port_and_nothing_else, a 30 s timeout that fails identically on unmodified main (f1ba2d8) in our container. It is environmental.
  • GPU smoke on this branch. Setup: 2× MI308X nodes, DeepSeek-V4-Flash, ATOM prefill TP8 + decode TP8, atomesh router, Mooncake RDMA. pd-points planned 6 points from a baseline's engine logs, and all 6 ran in one server launch.
    • Decode points (bs 3/4/5): ok; 100% of steps in the window at the target batch size; 8/8 rank traces, 11–13 MB per point.
    • Prefill points: partial. ATOM prefills a prompt's 256-aligned head and its tail as two forwards, so 16384 runs as 16128 + 256. This is noted in agentx_multinode.md.

Full GEAK e2e runs (2 workloads, both Director validated_win)

Common setup:

  • Hardware: 2× MI308X (gfx942) nodes.
  • Topology: ATOM PD 1P1D, prefill TP8 on one node and decode TP8 on the other, behind the atomesh router.
  • KV transfer: Mooncake over RDMA.
  • Code: this PR's commits at the time of each run.
  • Final validation: baseline and final stack measured in the same session.

Workload 1: DeepSeek-R1-0528, fixed-length (ISL/OSL 1024/1024, conc 128, 1280 prompts), 24 h budget

metric (Director validation) baseline final Δ
output throughput (primary) 2765.0 tok/s 2904.2 tok/s +5.03%
total token throughput 5530.9 tok/s 5809.3 tok/s +5.03%
TPOT p50 44.82 ms 42.55 ms −5.1%
TTFT p50 493.9 ms 480.3 ms −2.8%
  • Accuracy: lm-eval gsm8k 5-shot flexible-extract 0.9538 (reference 0.9553 ± 0.02, pass). Output parity was within the baseline's own run-to-run spread.
  • Where the gain came from: env only, identical on both engines. Three aiter tuned configs were added: fused-MoE CK 2-stage, router-gate bf16 GEMM, and the dense blockscale GEMM table. TuningSkill contributed +3.58% and the HeadKernel dense-GEMM bake-off +0.99%.

Workload 2: DeepSeek-V4-Flash, AgentX trace replay (inferencex-agentx-mvp, conc 8, 3600 s windows), 30 h budget

metric (Director validation, 3600 s legs) baseline final Δ
e2e_norm_intvty_p50 (primary, TTFT-inclusive) 42.38 tok/s/user 52.97 tok/s/user +25.0%
e2e_norm_intvty_p90 29.41 tok/s/user 35.73 tok/s/user +21.5%
total output throughput (aggregate) 220.6 tok/s 253.4 tok/s +14.8%
total token throughput (aggregate, in + out) 28,553 tok/s 31,373 tok/s +9.9%
TPOT p50 19.83 ms 15.43 ms −22.2%
TTFT p50 1115.6 ms 977.1 ms −12.4%
  • Accuracy: output_parity pass, judged on accuracy. Greedy decoding on this stack is not self-deterministic: candidate-vs-base similarity is at least as high as base-vs-itself, and the answers are correct.
  • Where the gain came from: a FlyDSL rewrite of _moe_gemm_a16w4, 2.25× in isolation and 29% of GPU time.
  • The whole AgentX kernel-extraction chain ran unassisted on ATOM: log parsing → pd-points → one-launch probes → coverage → pd-mass → targets.
  • Not yet in the stack: two bgemm candidates that showed +6.9% and +8.0% in single A/B runs but were not confirmed before the final phase.
  • Validation caveat (recorded by the Director): each 3600 s leg used its first full pass. ATOM's warm_server outer round would have doubled each leg past the deadline. The original baseline's pass 1 vs pass 2 differed by 0.15%.

Known limitations (follow-ups, not in this PR)

  1. Multi-stream models.
    • DeepSeek-V4 on ATOM runs each decode forward on three GPU streams: main, shared-expert / compressor, and indexer.
    • torch's profiler emits one gpu_user_annotation per stream, and parse_profile counts each one as a step. So n_decode_steps comes out 3× too high, and per-step decode mass 3× too low.
    • The mass model also sums kernel time across streams without subtracting overlap. That over-counts side-stream kernels, which were 82–96% hidden behind the main stream in our traces.
    • This lives in main's kernel-extract statistics and applies to any multi-stream forward. Examples in InferenceX recipes: vLLM DBO, SGLang TBO, VLLM_ROCM_DSA_MULTISTREAM. It deserves its own PR.
  2. ATOM P/D producer runs one extra decode per request.
    • Under non-PP parallelism, ATOM's deferred output makes the prefill engine run a decode[bs=1] forward to surface the first token (defers_output() in ATOM's scheduler).
    • That decode lands inside every prefill sampling window, and coverage_ledger then drops kernels tagged both.
    • This is an ATOM issue. The ATOM team considers the extra decode unintended, and it disappears once the producer stops deferring.

zhaoan12-prc and others added 4 commits November 25, 2026 04:04
A Hyperloom node_state.json with backend=atom was refused at the first
check (engine_facts knew only sglang and vllm), and an ATOM P/D pair
could not have been profiled or torn down. This lets the DeepSeek-R1 1P1D
case in ATOM's own pd_disaggregation_guide.md (two nodes, TP8/TP8,
Mooncake, atomesh in front) go through the provided-mode path.

Recognising ATOM:
- engine_facts: an ATOM command's HTTP port is --server-port (8000 when
  absent); --port is the engine's internal port and never the HTTP port.
  The PD role is read from --kv-transfer-config like vllm's.
- structural flags the command owns now include --server-port and --port.
- teardown and health: atom.entrypoints.openai_server, the ATOM::<name>
  process titles ATOM gives its engine children (setproctitle), and
  `atomesh launch`; a defunct ATOM:: child counts as a dead engine.
- SW_PACKAGES: ranks must agree on the atom version.
- replicas of one role may differ in their HTTP port.

Profiling ATOM engines:
- ATOM writes <dir>/rank_<N>/<name>.pt.trace.json.gz (dp<D>_tp<N> under
  DP) and names no rank in the file, so the gate reads the rank from the
  directory and looks one level down.
- /start_profile takes no body: its directory is fixed at launch. Under
  PD each role gets <profile>/<role>/ at launch (both engines would
  otherwise write rank_0/ into one directory); the wait for the traces
  looks one directory deeper. ATOM_PROFILER_MORE=1 under PROFILE=1.

generated mode (adapters/atom.sh dist/pd hooks) is not added: Hyperloom
hands over provided commands.

Tests: AtomProvidedSpecTest, AtomDeepseekR1CaseTest (the guide's commands, at the mn and
node_state levels), AtomTraceLayoutTest, AtomProfileDirTest, AtomProfileLaunchTest, and
PdProfileWindowTest, which runs multinode.sh's real pd_disagg profile window against two fake
engines (ATOM: no request body, traces found one directory down, gate passes; sglang: unchanged;
an engine launched without a profiler is named). All of them fail on the previous code except the
sglang and the rejected-window cases, which guard the existing behaviour.
adapters/atom.sh gains adapter_pd_mode / adapter_pd_args / adapter_pd_lb_launch, so a
pd_disagg launch with no launch_command renders ATOM engines (Mooncake kv-transfer-config
with the node's own IP as proxy_ip, the pd bootstrap port as handshake_port) and an
`atomesh launch --pd-disaggregation` router, with the flags of ATOM's
pd_disaggregation_guide.md. tp_span stays refused: ATOM's server has no --nnodes.

mn.py exports GEAK_NODE_IP in the rank head and gives the generated rank its per-role
profile dir, as the provided path already does.
…ng probe)

- observed_workload: --log-format atom (Scheduled prefill batch / Engine throughput rows)
- parse_profile: prefill[ / decode[ / eager_decode[ step spans
- serving_probe: --framework atom (prompt_token_ids through the atomesh router, per-step
  histogram phase counters, short timed decode window, links finished rank traces)
- multinode: ATOM probe args; atom.sh: record shapes without stacks, no 10240 max-model-len under AgentX

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ATOM

pd-points recognises an ATOM engine log (no server-args line) and runs observed_workload with
--log-format atom, so each engine's points come from its own log as for sglang. The AgentX and
profiler multinode fragments drop the 'ATOM drives no points' note and describe the ATOM path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zhaoan12-prc
zhaoan12-prc marked this pull request as draft November 26, 2026 08:55
The standalone "ATOM engines and the atomesh router" section is split into the
sections that already cover each topic for sglang and vLLM: how a backend runs
on several nodes, what check reads from a launch command, the version check,
the environment reference and the trace gate. The profiler note now matches
the code (shapes on, Python stacks and memory off). Docs only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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