Skip to content

feat(vllm): GLM-5.2-MXFP4 vLLM P4D4 example on one MI355X node, image, and the infera changes it needs - #256

Open
llying-001 wants to merge 12 commits into
mainfrom
llying/vllm-p4d4-glm5.2
Open

llying-001 wants to merge 12 commits into
mainfrom
llying/vllm-p4d4-glm5.2

Conversation

@llying-001

@llying-001 llying-001 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a runnable kit for GLM-5.2-MXFP4 served with vLLM, PD-disaggregated inside one 8×MI355X node (P4D4): a TP1 × PP4 prefill with a CPU KV tier on GPUs 0-3, a DP4 decode on GPUs 4-7, MTP 4, KV over Mooncake RDMA loopback (both ends on the same-named NIC, never HIP IPC), and the infera router choosing the decode DP rank. It comes with its image and the infera changes it depends on. Same layout as the SGLang kits of #210.

Not an InferenceX submission: InferenceX maps GLM-5.2 to SGLang (inferencex-e2e/docs/MODELS.md, "Engine submission policy"), and the image carries unmerged patches. The kit measures with InferenceX's own client, eval and scoring as an internal reference for vLLM PD on MI355X.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

infera

  • Rust router, --vllm-mooncake-serial (from feat(router): serial vLLM Mooncake legs (INFERA_VLLM_MOONCAKE_SERIAL=1) #246, now a flag): posts a vLLM Mooncake PD request's decode leg only after the prefill has answered. Concurrent legs could deadlock a prefill that reorders its queue (cache-aware admission) against a decode that had reserved KV. Requires --request-transport http (the serial legs are HTTP; this answers the review on feat(router): serial vLLM Mooncake legs (INFERA_VLLM_MOONCAKE_SERIAL=1) #246 about NATS-registered workers skipping the NATS backlog limits). Forwarded by the Python launcher; Rust-only like --pd-prefill-guard-release. Rust test for the ordering and the failed-prefill case; config and launcher tests.
  • Server (from fix(server): raise the RLIMIT_NOFILE soft limit at start-up #248): raise the RLIMIT_NOFILE soft limit to the hard limit at start-up; a container's 1024 ran out at C104 (accept() EMFILE).
  • vLLM engine (from fix(vllm): parse vllm serve args with vLLM >= 0.34 #251): parse vllm serve args with vLLM >= 0.34 (make_arg_parser moved to vllm.entrypoints.common.cli_args and needs its FlexibleArgumentParser).
  • vLLM engine: infera.engine.vllm.gem_mooncake, vLLM's MooncakeConnector with its KV cache in amdgpu GEM BOs (kv_connector_module_path; allocator named by INFERA_AMD_GEM_ALLOCATOR, unset = upstream). amdgpu 6.19, and 6.16 without peer memory, charge NIC-pinned VRAM twice in the KFD limit through dma-buf.
  • Tests: tests/unit/engine/test_vllm_gem_mooncake.py, test_vllm_server_arg_parser.py, tests/unit/server/test_nofile_limit.py, test_launch_rust.py; Rust config and disagg tests. manual/reference/cli.md lists the new flag.

Image (deploy/docker/Dockerfile.vllm.glm52, new file next to the canonical Dockerfile.vllm, which stays on v0.25.1)

Example (examples/vllm_p4d4_glm5.2)

  • One site file (env.sh); engine/up.sh, worker.sh, smoke.sh, eval.sh, agentx/agentx.sh, down.sh, and a read-only check_node.sh (driver / peer memory → GEM, NICs, host memory). Each run records its settings; up.sh waits until the previous deployment's VRAM is free.
  • Recipe: prefill TP1 × PP4 (layers 20/20/20/18), chunk 4096, cache-aware admission, 1.9 TB CPU KV tier; decode DP4, chunk 2048, --stream-interval 30; FP8 KV, prefix cache, MTP 4 on both legs; MXFP4 indexer K cache and online FP8 dense projections on target layers 0-77, draft layer 78 at shipped precision; router kv-aware with prefill session affinity and --decode-input-demand on --decode-request-weight W.
  • README: KV registration per driver (GEM), the recipe, validation, reference numbers for C16-C152 (conventional and E2E-normalized interactivity), how to choose W (125000 while the decode is saturated, 1000000 below), notes.

Pareto (MI355X, AgentX, InferenceX d490919c)

Each point on a freshly started deployment, 3,600 s measured, 10 warm-up requests per lane, forced MTP acceptance 3.33 (MTP 4); throughput per GPU over all 8 GPUs. C152 is this PR's validation run; full table in the README.

point decode request weight tok/s/GPU interactivity p90 E2E normalized p90
C152 125,000 70,432 59.9 11.2
C128 125,000 65,496 61.4 24.8
C96 1,000,000 56,611 74.6 37.6
C64 125,000 43,508 81.9 43.3
C48 1,000,000 31,673 90.8 48.5
C32 125,000 22,500 97.5 53.1
C16 125,000 10,581 111.8 59.2

Pareto

Validation

Image built from this branch (at 8519af1) on one 8×MI355X node (amdgpu 6.16.13 with peer memory, GEM=0), then the kit as its README says. Since then the serial legs became the --vllm-mooncake-serial router flag (same dispatch code), the base image is pinned by digest (same image), and patches / docs were renamed; at the head, CI-equivalent pytest and Rust checks pass; the image was rebuilt at 8f2c9d0a (before the patch renames), and smoke.sh on it passes 6/6 with the router running --vllm-mooncake-serial. The Mooncake topology now lists host buffers only (its cuda:<i> GPU entries never matched the HIP build's hip:<i> locations; pinning GPUs with hip:<i> entries broke transfers on these one-rail-per-NIC hosts, 27,731 tok/s/GPU at C152), the same resolved topology as the measured runs; smoke 6/6 at 85488ee.

item result
pytest -m "not slow and not integration" (Python 3.10, as CI) 3,100 passed, 176 skipped
Rust: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo test --locked clean, all suites pass
image: 11 / 11 patches applied, imports, changed unit tests inside it 124 passed
smoke.sh (real acceptance) 6/6
GSM8K (InferenceX infx.bench eval, 1,319 questions, concurrency 152, real acceptance) 0.9704 / 0.9704
AL gate (InferenceX infx.bench al-gate, MTP 4) 3.240 vs golden 3.33 (0.973, pass)
AgentX C152 (InferenceX infx.bench agentic, 3600 s, SIM_ACCEPT_LEN=3.33) 70,432 tok/s/GPU, 0 failed of 16,394; interactivity p50 / p90 69.6 / 59.9; TTFT p50 4.9 s; ITL p50 14.4 ms

The same engine and router settings (with the inactive llying-001/vllm#7 also in the series) gave 70,672 / 70,209 / 70,647 / 70,122 at C152 on three other nodes, GEM and non-GEM, and the C16-C128 points in the README.

AI assistance was used to write this change and description.

Checklist:

  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

🤖 Generated with Claude Code

llying-001 and others added 10 commits November 30, 2026 12:45
…g after the prefill answers

With vLLM's MooncakeConnector the router posts the prefill and decode legs of a PD request at once.
The decode reserves KV for a request as soon as its leg arrives, while a prefill that reorders its
queue (cache-aware admission, priority) can hold finished KV the decode has not reserved; under
memory pressure each side waits on the other (a GLM-5.2 PD deployment stalled with the prefill at
0 running / 76 waiting / 99.7% KV and zero prompt throughput).

--vllm-mooncake-serial (Rust backend, forwarded by the Python launcher) posts the decode leg only
after the prefill has answered, through serial_decode shared with ATOM's serial pull; a failed
prefill is returned to the client and never reaches the decode. The serial legs go over HTTP, so
the flag requires --request-transport http (NATS-registered workers would otherwise be dialled
directly and skip the NATS backlog limits). Default: concurrent legs, unchanged.

Signed-off-by: liyingli <liyingli@amd.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every proxied PD request holds a client, a prefill and a decode
connection, so a container's default soft limit of 1024 open files runs
out at a few hundred concurrent requests: accept() fails with EMFILE and
the router answers 502. Lift the soft limit to the hard limit (1M when the
hard limit is unlimited) before the backend is chosen, so the Rust router
inherits it across exec.

Tests: tests/unit/server/test_nofile_limit.py (raised to the hard limit,
unlimited hard limit, already at the limit, setrlimit failure).

Signed-off-by: liyingli <liyingli@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
vLLM 0.34 moved make_arg_parser from vllm.entrypoints.openai.cli_args to
vllm.entrypoints.common.cli_args and expects its FlexibleArgumentParser, so
the vLLM worker launcher died with an ImportError before starting vllm
serve. _vllm_server_arg_parser() imports the new location first and falls
back to the old one for earlier releases.

Tests: stub modules for both layouts (runs without vLLM); in a vLLM 0.34
container tests/engine/vllm/test_disagg_allow_tcp_args.py fails without
this change and passes with it.

Signed-off-by: liyingli <liyingli@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…er objects

amdgpu-dkms 6.16 .. 7.1 charges a KFD allocation pinned by an RDMA NIC through dma-buf twice
in the KFD limit, and hosts without a peer-memory client can only register VRAM through
dma-buf; a large KV cache then leaves the engine out of memory well below its utilization
target. infera.engine.vllm.gem_mooncake (kv_connector_module_path) allocates the KV cache from
a GEM-BO pluggable allocator named by INFERA_AMD_GEM_ALLOCATOR; unset, it is the upstream
connector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
…series, Mooncake v0.3.14 + #4540/#4541, GEM allocator)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
TP1 x PP4 prefill (GPUs 0-3, CPU KV tier) and DP4 decode (GPUs 4-7), MTP 4, Mooncake RDMA loopback
with one NIC per GPU, GEM or peer-memory KV registration per driver, and the infera router choosing
the decode DP rank (--decode-request-weight). InferenceX d490919c client, GSM8K and AL gate.
patch.upstream.status.md records the image's vLLM patch series.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
…, C152 70,432 tok/s/GPU, GSM8K 0.9704, AL 3.240)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
…ized interactivity p90)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
- Dockerfile.vllm.glm52: pin the nightly base by digest (nightly tags roll off Docker Hub).
- up.sh: --vllm-mooncake-serial on the router instead of the environment variable.
- worker.sh: say why MC_HIP_KFD_PIN_FIX=0 is set (the GEM allocator refuses to start otherwise).
- agentx.sh: say why a one-node PD shape sets IS_MULTINODE=true.
- One description of which amdgpu releases double-charge pinned VRAM (gem_mooncake, hip_gem_alloc.c, README).
- README: C152 from this image; Pareto figure and text with PR #235's points; cli.md lists the new flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
@llying-001
llying-001 force-pushed the llying/vllm-p4d4-glm5.2 branch from a2d5f93 to a5c7d17 Compare November 30, 2026 12:51
@llying-001
llying-001 marked this pull request as ready for review November 30, 2026 13:10
Copilot AI balanced review requested due to automatic review settings November 30, 2026 13:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved issues alter prefill-load accounting and stream-completion semantics, allow failed or unmeasurable acceptance checks to pass, and prevent worker startup when optional host groups are absent.

4 open issues
What changed in this PR

Adds a GLM-5.2-MXFP4 vLLM deployment kit for prefill/decode disaggregation on one eight-GPU MI355X node, alongside its image and required Infera support. Benchmarks use InferenceX as an internal reference, not an official submission.

Changes:

  • Adds optional serial Mooncake dispatch, startup file-limit handling, vLLM parser compatibility, and GEM-backed KV allocation.
  • Provides a pinned ROCm image with vLLM and Mooncake patches.
  • Adds deployment, correctness, evaluation, and AgentX scripts with configuration and reference results.
File Description
tests/​unit/​server/​test_nofile_limit.py Tests startup file-limit handling.
tests/​unit/​server/​test_launch_rust.py Tests serial flag forwarding and backend validation.
tests/​unit/​engine/​test_vllm_server_arg_parser.py Tests old and new vLLM parser layouts.
tests/​unit/​engine/​test_vllm_gem_mooncake.py Tests GEM connector selection and pool reuse.
rust/​router/​tests/​functional.rs Initializes the new router setting in fixtures.
rust/​router/​src/​prefill_guard_tests.rs Updates guard-test state for the new setting.
rust/​router/​src/​main.rs Wires serial dispatch configuration into router state.
rust/​router/​src/​handlers.rs Adds the serial Mooncake state field.
rust/​router/​src/​disagg.rs Implements serial vLLM dispatch and ordering tests.
rust/​router/​src/​config.rs Adds the flag and HTTP transport validation.
manual/​reference/​cli.md Documents the serial dispatch flag.
infera/​server/​launch_rust.py Forwards the flag to Rust.
infera/​server/​args.py Exposes the Rust-only launcher option.
infera/​server/​__main__.py Raises the open-file soft limit at startup.
infera/​engine/​vllm/​gem_mooncake.py Adds optional GEM-backed Mooncake allocation.
infera/​engine/​vllm/​args.py Supports the relocated vLLM argument parser.
examples/​vllm_p4d4_glm5.2/​README.md Documents deployment, validation, and benchmark results.
examples/​vllm_p4d4_glm5.2/​env.sh Defines site and recipe settings.
examples/​vllm_p4d4_glm5.2/​engine/​worker.sh Launches prefill and decode engine containers.
examples/​vllm_p4d4_glm5.2/​engine/​up.sh Starts services and records deployment settings.
examples/​vllm_p4d4_glm5.2/​engine/​smoke.sh Runs checks with real MTP acceptance.
examples/​vllm_p4d4_glm5.2/​engine/​smoke.py Checks registration, responses, streaming, and long prompts.
examples/​vllm_p4d4_glm5.2/​engine/​eval.sh Runs GSM8K and acceptance-length evaluation.
examples/​vllm_p4d4_glm5.2/​engine/​down.sh Saves logs and removes deployment containers.
examples/​vllm_p4d4_glm5.2/​engine/​dense_fp8_qcfg.json Selects target-layer dense projections for FP8.
examples/​vllm_p4d4_glm5.2/​engine/​common.sh Shares configuration, health, and client helpers.
examples/​vllm_p4d4_glm5.2/​engine/​check_node.sh Reports driver, NIC, GPU, and memory details.
examples/​vllm_p4d4_glm5.2/​engine/​agentx/​agentx.sh Runs AgentX and captures scores and metadata.
deploy/​docker/​scripts/​build_mooncake_vllm.sh Rebuilds and verifies the patched transfer engine.
deploy/​docker/​patches/​vllm_glm52/​series.txt Defines vLLM patch application order.
deploy/​docker/​patches/​vllm_glm52/​moe-mxfp4-dispatch.diff Adds optional quantization before MoE all-gather.
deploy/​docker/​patches/​vllm_glm52/​aiter-agrs-full-graph.diff Enables AITER collectives in full graphs.
deploy/​docker/​patches/​vllm_glm52/​69616-rocm-fused-shared-experts-once-per-token-dp.diff Corrects shared-expert ownership after dispatch.
deploy/​docker/​patches/​vllm_glm52/​68845-coalesce-adjacent-hit-ranges.diff Reduces cache-hit accounting work.
deploy/​docker/​patches/​vllm_glm52/​61985-followup-mtp-draft-fp8-indexer-cache.diff Preserves FP8 indexer caches for draft layers.
deploy/​docker/​patches/​vllm_glm52/​60909-exact-size-pinned-host-buffers.diff Adds exact-size pinned host allocations.
deploy/​docker/​patches/​vllm_glm52/​58710-rebased-seq-lens-sync-skip.diff Avoids unnecessary sequence-length synchronization.
deploy/​docker/​patches/​mooncake_v0314/​mooncake-zz-v0314-gpu-prefix-include.diff Adds the destination-NIC patch’s required include.
deploy/​docker/​patches/​mooncake_v0314/​mooncake-pr4541-ib-timeout.diff Adds configurable RDMA acknowledgment timeouts.
deploy/​docker/​patches/​mooncake_v0314/​mooncake-pr4540-dest-nic.diff Adds destination-preferred NIC selection for writes.
deploy/​docker/​patch.upstream.status.md Records patch origins, status, and purpose.
deploy/​docker/​gem/​hip_gem_alloc.c Implements GEM allocation and registration safeguards.
deploy/​docker/​Dockerfile.vllm.glm52 Builds the dedicated patched vLLM image.

Review effort: Balanced

Comment thread rust/router/src/disagg.rs Resolved
Comment thread rust/router/src/disagg.rs Resolved
…letion tracking; kit checks

- rust router: serial vLLM Mooncake releases the prefill's load early only in
  --pd-prefill-guard-release completion mode (take_prefill_guard, as the concurrent path),
  and its decode stream keeps SSE terminator tracking ([DONE] marks completion). New test:
  serial_vllm_holds_prefill_load_until_decode_unless_completion_mode.
- eval.sh: the AL gate is report-only; require its verdict to be pass.
- worker.sh: a host without a video or render group no longer aborts the worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The ROCm topology uses cuda: keys instead of Mooncake HIP’s hip: keys, causing GPU buffers to fall back to all-NIC routing and allowing cross-socket KV traffic.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Use hip: keys for ROCm GPU topology entries

examples/​vllm_p4d4_glm5.2/​engine/​worker.sh:34

The rebuilt Mooncake HIP backend names GPU locations hip:<i>, not cuda:<i> (GPU_PREFIX definition, also verified at the pinned v0.3.14 tag). Consequently, GPU buffers never match these topology entries and NIC selection falls back to the all-NIC wildcard, defeating the recipe's one-NIC-per-GPU routing and allowing cross-socket KV traffic. Generate hip: keys for this ROCm-only kit.

4 resolved since last review

Review effort: Balanced

The topology keyed GPUs as cuda:<i>, which Mooncake's HIP build never matches (it names GPU
locations hip:<i>), so GPU buffers have always used the all-NIC wildcard, with
MC_RDMA_WRITE_PREFER_DEST_NIC putting both ends of a write on the same-named NIC. Keying them
hip:<i> pins each GPU to its nearest NIC instead, and on these hosts (ionic_k reaches only
ionic_k) prefill / decode pairs on different NICs cannot reach each other: at C152 the decode
logged 182 failed KV receives and throughput fell to 27,731 tok/s/GPU (5% failed requests).
Drop the GPU entries (the same resolved topology as before) and say why (review on #256).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.com>
@llying-001

Copy link
Copy Markdown
Contributor Author

Re the "Use hip: keys for ROCm GPU topology entries" finding: the diagnosis is right — Mooncake's HIP build names GPU locations hip:<i>, so the cuda:<i> entries never matched and GPU buffers used the all-NIC wildcard. But switching to hip:<i> (each GPU pinned to its nearest NIC) broke the deployment: on these hosts ionic_k only reaches ionic_k, so prefill / decode pairs pinned to different NICs cannot reach each other. Measured on the same node and image at C152: the decode logged 182 failed KV receives, 5.1% of requests failed and throughput fell from 70,432 to 27,731 tok/s/GPU.

The working path is the one we had measured: GPU buffers not pinned, and MC_RDMA_WRITE_PREFER_DEST_NIC=1 (Mooncake#4540) putting both ends of a write on the same-named NIC. 85488ee makes that explicit: the topology now lists only the host-buffer (cpu:<socket>) entries — the same resolved topology as before, since the cuda: entries were never used — and worker.sh / README note 5 say why the GPUs are not pinned, with the numbers above. Smoke on 85488ee: 6/6, 0 failed KV receives.

llying-001 added a commit that referenced this pull request Nov 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: liyingli <liyingli@amd.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.

2 participants