Repository navigation
[Test] Add KV pool hit watch to A3 multi-nodes nightly cases - #23069
Shelleyaaa wants to merge 1 commit into
Conversation
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. 🤖 How to trigger CI
Note Until the CI gate has run on a commit, the required |
There was a problem hiding this comment.
Code Review
This pull request introduces new SIT test cases for KV pool watch in a two-node PD setup, adding configurations for DSv4.1 and GLM5.3 models, and updates the nightly test suite. The review comments provide actionable improvements for resource management in the control server, error handling for the decode node to facilitate debugging, and more robust exception handling during teardown.
| def __enter__(self) -> _ControlServer: | ||
| listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
| listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | ||
| listener.bind(("0.0.0.0", self.port)) | ||
| listener.listen(1) | ||
| listener.settimeout(float(self.timeout)) | ||
| self._listener = listener | ||
| print(f"[kv_pool_pd] wait decode node on control port {self.port}", flush=True) | ||
| try: | ||
| connection, peer = listener.accept() | ||
| except socket.timeout as exc: | ||
| raise TimeoutError(f"decode node did not connect on port {self.port} in {self.timeout}s") from exc | ||
| connection.settimeout(None) | ||
| print(f"[kv_pool_pd] decode node connected from {peer}", flush=True) | ||
| self.channel = _ControlChannel(connection) | ||
| return self |
There was a problem hiding this comment.
In _ControlServer.__enter__, if listener.accept() raises an exception (such as socket.timeout), the listener socket is leaked because __exit__ is never called. This can lead to resource leaks and 'Address already in use' errors on subsequent test runs. Wrap the connection acceptance in a try...except block to ensure the listener is closed if an exception occurs before returning.
def __enter__(self) -> _ControlServer:
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listener.bind(("0.0.0.0", self.port))
listener.listen(1)
listener.settimeout(float(self.timeout))
self._listener = listener
print(f"[kv_pool_pd] wait decode node on control port {self.port}", flush=True)
try:
connection, peer = listener.accept()
except socket.timeout as exc:
listener.close()
self._listener = None
raise TimeoutError(f"decode node did not connect on port {self.port} in {self.timeout}s") from exc
except Exception:
listener.close()
self._listener = None
raise
connection.settimeout(None)
print(f"[kv_pool_pd] decode node connected from {peer}", flush=True)
self.channel = _ControlChannel(connection)
return self| def _run_decode_legs(base: ExternalDPConfig, ranks: list[RankInfo], node_index: int, case: PDCase) -> None: | ||
| """Serve decode legs until the P node sends exit.""" | ||
| channel = _connect_control(base.cluster_ips[0], case.control_port) | ||
| try: | ||
| while True: | ||
| message = channel.recv() | ||
| command = message.get("cmd") | ||
| if command == "start": | ||
| use_pool = bool(message.get("use_pool")) | ||
| leg = str(message["leg"]) | ||
| config = _config_for_node(_leg_config(base, use_pool=use_pool), node_index) | ||
| log_root = LOG_ROOT / leg | ||
| with create_kv_pool_manager( | ||
| config=config, current_node_index=node_index, log_root=log_root | ||
| ) as pool_manager: | ||
| with _KVPoolServerManager( | ||
| config=config, | ||
| ranks=ranks, | ||
| current_node_index=node_index, | ||
| log_root=log_root, | ||
| extra_envs=pool_manager.server_envs, | ||
| ): | ||
| wait_ranks_ready(ranks, timeout=READY_TIMEOUT_SECONDS) | ||
| channel.send({"event": "ready"}) | ||
| stop = channel.recv() | ||
| if stop.get("cmd") != "stop": | ||
| raise RuntimeError(f"expected stop, got {stop!r}") | ||
| channel.send({"event": "stopped"}) | ||
| elif command == "exit": | ||
| with contextlib.suppress(Exception): | ||
| channel.send({"event": "closed"}) | ||
| return | ||
| else: | ||
| raise RuntimeError(f"unknown control command: {command!r}") | ||
| finally: | ||
| channel.close() | ||
|
|
There was a problem hiding this comment.
In _run_decode_legs, if an exception occurs during command execution (e.g., wait_ranks_ready times out), the decode node crashes and closes the channel. The prefill node only receives a generic ConnectionError instead of the actual error traceback, making debugging in CI extremely difficult. Wrap the command loop body in a try...except block to send the error event back to the prefill node before re-raising.
def _run_decode_legs(base: ExternalDPConfig, ranks: list[RankInfo], node_index: int, case: PDCase) -> None:
"""Serve decode legs until the P node sends exit."""
channel = _connect_control(base.cluster_ips[0], case.control_port)
try:
while True:
try:
message = channel.recv()
command = message.get("cmd")
if command == "start":
use_pool = bool(message.get("use_pool"))
leg = str(message["leg"])
config = _config_for_node(_leg_config(base, use_pool=use_pool), node_index)
log_root = LOG_ROOT / leg
with create_kv_pool_manager(
config=config, current_node_index=node_index, log_root=log_root
) as pool_manager:
with _KVPoolServerManager(
config=config,
ranks=ranks,
current_node_index=node_index,
log_root=log_root,
extra_envs=pool_manager.server_envs,
):
wait_ranks_ready(ranks, timeout=READY_TIMEOUT_SECONDS)
channel.send({"event": "ready"})
stop = channel.recv()
if stop.get("cmd") != "stop":
raise RuntimeError(f"expected stop, got {stop!r}")
channel.send({"event": "stopped"})
elif command == "exit":
with contextlib.suppress(Exception):
channel.send({"event": "closed"})
return
else:
raise RuntimeError(f"unknown control command: {command!r}")
except Exception as exc:
with contextlib.suppress(Exception):
channel.send({"event": "error", "error": str(exc)})
raise
finally:
channel.close()| try: | ||
| with pool_manager: | ||
| channel.send({"cmd": "start", "leg": case_name, "use_pool": use_pool}) | ||
| with _KVPoolServerManager( | ||
| config=config, | ||
| ranks=ranks, | ||
| current_node_index=node_index, | ||
| log_root=log_root, | ||
| extra_envs=pool_manager.server_envs, | ||
| ): | ||
| wait_ranks_ready(ranks, timeout=READY_TIMEOUT_SECONDS) | ||
| channel.recv() # {"event": "ready"} from the decode node | ||
| print(f"[kv_pool_pd] leg={case_name} pool={int(use_pool)} both nodes ready", flush=True) | ||
| yield _PDWatchClient( | ||
| _ranks_by_role(ranks, "prefiller"), | ||
| _ranks_by_role(ranks, "decoder"), | ||
| served_model_name, | ||
| ) | ||
| finally: | ||
| body_failed = sys.exc_info()[0] is not None | ||
| teardown_error: Exception | None = None | ||
| try: | ||
| channel.send({"cmd": "stop"}) | ||
| channel.recv() # {"event": "stopped"} from the decode node | ||
| except Exception as exc: # noqa: BLE001 - keep the body error as the diagnosis | ||
| teardown_error = exc | ||
| if teardown_error is not None and not body_failed: | ||
| raise RuntimeError(f"decode node did not stop cleanly: {teardown_error}") from teardown_error | ||
|
|
There was a problem hiding this comment.
Using sys.exc_info() inside a finally block to detect if the body failed is fragile and discouraged in modern Python. It is much cleaner and more robust to use an explicit try...except block around the yield statement to set a body_failed flag.
body_failed = False
try:
with pool_manager:
channel.send({"cmd": "start", "leg": case_name, "use_pool": use_pool})
with _KVPoolServerManager(
config=config,
ranks=ranks,
current_node_index=node_index,
log_root=log_root,
extra_envs=pool_manager.server_envs,
):
wait_ranks_ready(ranks, timeout=READY_TIMEOUT_SECONDS)
channel.recv() # {"event": "ready"} from the decode node
print(f"[kv_pool_pd] leg={case_name} pool={int(use_pool)} both nodes ready", flush=True)
yield _PDWatchClient(
_ranks_by_role(ranks, "prefiller"),
_ranks_by_role(ranks, "decoder"),
served_model_name,
)
except Exception:
body_failed = True
raise
finally:
teardown_error: Exception | None = None
try:
channel.send({"cmd": "stop"})
channel.recv() # {"event": "stopped"} from the decode node
except Exception as exc: # noqa: BLE001 - keep the body error as the diagnosis
teardown_error = exc
if teardown_error is not None and not body_failed:
raise RuntimeError(f"decode node did not stop cleanly: {teardown_error}") from teardown_error|
Last updated: 2026-11-25 14:59 UTC+8 for commit ci-gate failed. Reason:
See the workflow run for full logs. This comment is updated in place on each new failure and marked as passed once the gate passes (it is kept for history, not deleted). |
…kflow (#23112) ### What this PR does / why we need it? Nightly multi-node cases are launched by a single generic pytest entry (`tests/e2e/common/multi_node/test_multi_node.py` -> `test_external_dp()`), so a case YAML cannot currently choose a different test runner. The companion case PR #23069 adds the KV pool A/B hit-watch cases for the A3 PD multi-node jobs. Each of those cases keeps its own A/B parameters in the case YAML (`pool_ab:` block) and has to run `tests/SIT/cases/features/kv_pool/test_pool_ab.py::test_pool_ab` instead of the generic entry. Without a way to select the entry from the case config, those cases would silently run `test_external_dp()` and do nothing useful. This PR only adds that plumbing; it contains no case YAML, no test logic and no runtime change. It adds an optional `tests` field end to end: - `.github/workflows/_e2e_nightly_multi_node.yaml`: new optional `tests` input (default empty), forwarded to the LWS template as `-D tests=...`. - `.github/workflows/schedule_nightly_test_a3.yaml`: pass `matrix.test_config.tests` for the `multi-node-tests` and `double-node-tests` jobs. - `tests/e2e/common/multi_node/lws.yaml.jinja2`: when `tests` is non-empty, export `MULTI_NODE_TEST_PATH` in both the leader and the worker containers, so every pod in the LWS group runs the same pytest entry. The change is fully backward compatible: with the default empty value the template emits no `MULTI_NODE_TEST_PATH`, and `run.sh` keeps its current default (`tests/e2e/common/multi_node/test_multi_node.py`). No existing nightly entry sets `tests`. Reviewer note / merge order: - This plumbing must land before #23069 (or any case PR that sets `tests`). Without it the pod silently falls back to the generic entry, which is a no-op for YAMLs that declare `benchmarks: {}`. - #23069 was branched from the same work and currently carries identical copies of these three files. Once this PR is on `main`, #23069 will rebase and drop them, leaving only the case files. ### Does this PR introduce _any_ user-facing change? No. It only changes how nightly CI pods select the pytest entry; the test content and the runtime path are untouched. ### How was this patch tested? - Static verification of the template guard (`{% if tests | default('') %}`): `MULTI_NODE_TEST_PATH` is emitted only for a non-empty value, in both the leader and worker container specs. - Verified the fallback in `tests/e2e/common/multi_node/run.sh`: `MULTI_NODE_TEST_PATH` defaults to `tests/e2e/common/multi_node/test_multi_node.py` when the variable is unset, so all current multi-node cases keep exactly the old behavior. - Checked the input plumbing across the three files (`inputs.tests` -> `-D tests=` -> pod env) and confirmed the matrix jobs pass the per-case value for both two-node and four-node groups. - No engine or NPU run is required for this change. The companion case PR #23069 exercises the new entry through `/nightly <case-name>` once this PR is on `main`. - vLLM main: vllm-project/vllm@c410543 --------- Signed-off-by: songyang <songyang719@163.com>
|
/nightly dsv41-pd-memcache-128k,dsv41-pd-mooncake-128k
|
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
2 similar comments
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
7fbd5b5 to
9629da2
Compare
9629da2 to
b4ed795
Compare
|
/nightly dsv41-pd-memcache-128k
|
zhenwenqi2024
left a comment
There was a problem hiding this comment.
The description says this is tests-only, but the diff also includes #23195's NPUModelRunner.update_requests() stream synchronization, its unit test, and release_notes/fragments/23195.yaml. Is that temporary stacking for the nightly run? If so, could this PR depend on #23195 explicitly and drop those three hunks from the PR against main after the dependency lands? The nightly result would then be clearly attributable to the combined branch without landing the MRV2 runtime change through the test PR.
Yes, that's temporary stacking for the nightly accuracy validation. We pulled #23195 in only to confirm that the layerwise tail-block fix keeps the A-leg answer correct on the rebased branch. Once #23195 lands, we will rebase this PR, drop those three hunks ( |
b4ed795 to
3372935
Compare
|
/nightly dsv4-mooncake-dp4-colocation
|
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
067df81 to
ebaaeee
Compare
|
/nightly dsv41-pd-memcache-128k,dsv41-pd-mooncake-128k,dsv4-mooncake-dp4-colocation
|
7be3a80 to
efe8247
Compare
|
/nightly dsv41-pd-memcache-128k,dsv41-pd-mooncake-128k,dsv4-mooncake-dp4-colocation
|
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
/e2e tests/e2e/pull_request/four_card/model_runner_v2/test_spec_decode_data_parallel.py::test_deepseek_v4_dspark_spec_decoding_dp4_full_graph |
Signed-off-by: songyang <songyang719@163.com>
98c55ca to
059b7b8
Compare
|
/e2e tests/e2e/pull_request/four_card/model_runner_v2/test_spec_decode_data_parallel.py::test_deepseek_v4_dspark_spec_decoding_dp4_full_graph |
What this PR does / why we need it?
Adds a PD-only KV-pool A/B hit-watch file for the two-node A3 PD setup, plus one
deployment YAML per case. Single-node Nightly cases in
test_pool_nightly.pyareleft untouched; this PR is tests only and needs no product-code change.
New cases in
tests/SIT/cases/features/kv_pool/test_pool_nightly_pd.py:test_dsv41_pd_memcache_128k— DSV4.1-Flash-w8a8, Prefill DP4/TP1/PCP4,Decode DP16/TP1/PCP1, single 128K prefix (
8 x 16384 + 4), memcache pool(layerwise producer / block consumer), A/B throughput gate.
test_dsv41_pd_mooncake_128k— same topology on the Mooncake pool backend(
P2PHANDSHAKE/ascend/20GB, non-layerwise), 128K prompt, throughputrecorded only.
test_glm53_flash_pd_mooncake_130k— GLM-5.3-Flash-w8a8, PrefillDP2/TP1/PCP8 and Decode DP8/TP2 following
GLM5.3-Flash.md§5.3 "A3 series",with the §5.4 pool requirements (prefix caching on both roles, hybrid KV cache
manager kept, non-layerwise), MTP3, INT8 KV cache and HCCS device
communication. 130K prompt (
113 x 1152 + 4), Mooncake pool, A/B throughputgate.
How the cases run:
from LWS DNS in CI (or
cluster_hostsfor local non-Kubernetes runs), the nodeindex from
LWS_WORKER_INDEX, and the HCCL/GLOO NIC is derived from the nodeIP. No hard-coded node IP or NIC in the test.
vllm serveargument lives in the per-role YAML template. The B leg isderived at runtime from the A leg: drop the
AscendStoreConnectorand switchprefill to local prefix caching, keeping the B group a bare PD deployment.
ExternalDPServerManagerand the clusterpool service through
create_kv_pool_manager, so the pool service is startedexactly once per leg on the prefill node.
/metricsand summed, andonly the counter value is kept (
_createdsamples are filtered out). The exacthit-token assertion uses the model lcm: 16384 for DSV4.1 and 1152 for
GLM-5.3-Flash.
lookup_rpc_porteach (37000+rank on Prefill,37100+rank on Decode) through a small
ServerCommandBuildersubclass, sinceAscendStoreConnectorrequires a unique lookup port per engine.isolation, then 3 timed perf samples at concurrency 4 with a batch of 8; the B
leg runs cold + one local-hit round + the same perf sampling.
Notes and known limits:
GLM-5.3-Flash case keeps the H3 assertion.
throughput_A >= throughput_B * 0.85.nightly_config.yaml/estimated_times.yamlentries are intentionally notpart of this change; the two-node runner registration will follow separately.
Does this PR introduce any user-facing change?
No. Tests only.
How was this patch tested?
Static validation on the two-node containers:
py_compile, andpytest --collect-onlycollects the three cases. Each YAML was loaded with atemporary
cluster_hostscopy to verify rank expansion, device slicing, portmapping and per-engine lookup ports for both roles.
Two-node E2E on the 133/135 PD setup with the local cluster_hosts YAML:
pytest -s -k <case>on both nodes;[kv_pool]/[kv_pool_ab]lines andpool_ab_report.jsonare attached to the PR.vLLM main: vllm-project/vllm@c410543