[WIP] bench: add GLM-5.2 PD AgentX workflow - #161
Draft
llying-001 wants to merge 6 commits into
Draft
Conversation
Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: liyingli <liyingli@amd.com> Co-authored-by: Cursor <cursoragent@cursor.com>
llying-001
requested review from
JohnQinAMD,
jiejingzhangamd,
limou102 and
xiaobochen-amd
as code owners
September 8, 2026 14:17
llying-001
marked this pull request as draft
September 8, 2026 14:17
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new ready-timeout unit test injects stub sglang modules into sys.modules without restoring them, which can leak into other tests and cause session-level flakiness.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds supporting infrastructure for a reproducible GLM-5.2 PD benchmark workflow by tightening engine startup/port-allocation contracts, expanding Mooncake KV preflight diagnostics to cover producer-push (WRITE), and scoping a fork-only SGLang patch behind an explicit build opt-in.
Changes:
- Add Mooncake preflight
read/writeoperation selection and WRITE-side verification, with accompanying unit tests and documentation. - Make delayed-bind publishers avoid ephemeral-port reuse by consistently using
free_tcp_port_block(1)and by hardeningfree_tcp_port_block’s contract. - Introduce a fork-only SGLang rejection-sampling patch applied only when explicitly enabled at image build time, and document its scope/status.
File summaries
| File | Description |
|---|---|
| tests/unit/tools/test_preflight_kv.py | Adds unit coverage for Mooncake preflight opcode selection, WRITE dispatch, and target-side verification. |
| tests/unit/engine/test_ready_timeout.py | Adds tests asserting the INFERA_ENGINE_READY_TIMEOUT contract across SGLang/vLLM wrappers. |
| tests/unit/common/test_net_ports.py | Updates port-allocation tests for non-ephemeral single-port blocks and invalid count handling. |
| manual/reference/environment.md | Documents INFERA_PREFLIGHT_MOONCAKE_OPCODE and INFERA_ENGINE_READY_TIMEOUT. |
| infera/tools/preflight/network/mooncakeperf.py | Adds WRITE-mode (producer-push) Mooncake probe support plus verification/reporting updates. |
| infera/engine/vllm/main.py | Uses free_tcp_port_block(1) for KV-events port selection to avoid ephemeral reuse during long startup. |
| infera/engine/sglang/worker.py | Uses free_tcp_port_block(dp_size) even for DP=1 to avoid ephemeral reuse during long startup. |
| infera/engine/atom/main.py | Uses free_tcp_port_block(1) for ATOM KV-events port selection to avoid ephemeral reuse during long startup. |
| infera/common/net.py | Clarifies free_tcp_port vs free_tcp_port_block guidance and rejects non-positive block sizes. |
| examples/sglang_1p1d_glm5.2/engine/up.sh | Passes through HOST_RDMA_MOUNT into the container environment. |
| examples/sglang_1p1d_glm5.2/engine/leg.sh | Renames the example startup timeout env var to INFERA_ENGINE_READY_TIMEOUT. |
| deploy/docker/patches/sglang_disagg/README.md | Updates patch documentation and describes the fork-only rejection-sampling patch rationale. |
| deploy/docker/patches/sglang_disagg_fork/patch_pd_disable_implicit_rocm_rejection_sampling.py | New fork-specific patch script disabling implicit ROCm rejection sampling for PD decode. |
| deploy/docker/patch.upstream.status.md | Documents the fork-only patch scope and retirement criteria. |
| deploy/docker/Dockerfile.sglang | Derives SGLANG_DIR from the installed package location and applies the fork-only patch behind a build arg. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
375
to
+379
| json.dump(info, fh) | ||
| os.replace(tmp, os.path.join(sig, "target.json")) | ||
| _wait_file(os.path.join(sig, "done"), _DONE_TIMEOUT) | ||
| if operation == "write" and info.get("ok") and buf is not None: | ||
| verified = _verify(buf.host_bytes(), gpu_id, buf.chunk, buf.nchunk) |
Comment on lines
+20
to
+37
| def _load_sglang_ready_timeout(): | ||
| # The dev/unit-test extra intentionally does not install the vendor SGLang | ||
| # package. The worker only needs this type at import time for these tests. | ||
| if importlib.util.find_spec("sglang") is None: | ||
| sglang = ModuleType("sglang") | ||
| sglang.__path__ = [] | ||
| srt = ModuleType("sglang.srt") | ||
| srt.__path__ = [] | ||
| server_args = ModuleType("sglang.srt.server_args") | ||
| server_args.ServerArgs = object | ||
| sys.modules.update( | ||
| { | ||
| "sglang": sglang, | ||
| "sglang.srt": srt, | ||
| "sglang.srt.server_args": server_args, | ||
| } | ||
| ) | ||
| return import_module("infera.engine.sglang.worker")._ready_timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
This WIP PR adds a reproducible GLM-5.2 1P1D benchmark and validation workflow for two MI355X nodes.
Planned benchmark coverage includes:
Supporting changes already included
/sglangsource layout.WIP status
The supporting shared changes have been pushed.
bench/glm5p2_1p1d/is still local and has not yet been committed to this PR.Validation
tests/unit/tools: 31 passedRemaining validation
The main
libionic1-only image still needs to be rebuilt and rerun for production Mooncake WRITE on the target cluster.