Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .buildkite/test_areas/distributed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,33 @@ steps:
num_devices: 4
source_file_dependencies:
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py
- tests/v1/kv_connector/nixl_integration/
- tests/v1/kv_connector/pd_integration/
commands:
- uv pip install --system -r /vllm-workspace/requirements/kv_connectors.txt
- bash v1/kv_connector/nixl_integration/config_sweep_accuracy_test.sh
- bash v1/kv_connector/pd_integration/config_sweep_accuracy_test.sh

- label: DP EP Distributed NixlConnector PD accuracy tests (4 GPUs)
timeout_in_minutes: 30
working_dir: "/vllm-workspace/tests"
num_devices: 4
source_file_dependencies:
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py
- tests/v1/kv_connector/nixl_integration/
- tests/v1/kv_connector/pd_integration/
commands:
- uv pip install --system -r /vllm-workspace/requirements/kv_connectors.txt
- DP_EP=1 bash v1/kv_connector/nixl_integration/config_sweep_accuracy_test.sh
- DP_EP=1 bash v1/kv_connector/pd_integration/config_sweep_accuracy_test.sh

- label: P2pNccl Connector PD accuracy (2 GPUs)
timeout_in_minutes: 25
working_dir: "/vllm-workspace/tests"
num_devices: 2
optional: true
source_file_dependencies:
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/
- tests/v1/kv_connector/pd_integration/
- benchmarks/disagg_benchmarks/disagg_prefill_proxy_server.py
commands:
- GPU_MEMORY_UTILIZATION=0.4 bash v1/kv_connector/pd_integration/run_p2p_nccl_accuracy_test.sh

- label: Pipeline + Context Parallelism (4 GPUs))
timeout_in_minutes: 60
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project

# P2pNccl Connector accuracy test script
# Uses disagg_prefill_proxy_server.py which encodes KV addresses in request IDs

set -xe

# Required for NCCL on some systems (consistent with other distributed tests)
export NCCL_CUMEM_HOST_ENABLE=0

MODEL_NAME=${MODEL_NAME:-"Qwen/Qwen3-0.6B"}
GPU_MEMORY_UTILIZATION=${GPU_MEMORY_UTILIZATION:-0.3}
GIT_ROOT=$(git rev-parse --show-toplevel)

# Get the host IP that vLLM will use for KV transfer
# This must match what P2pNcclEngine binds to
KV_HOST=$(python3 -c "from vllm.utils.network_utils import get_ip; print(get_ip())")

# Trap the SIGINT signal (triggered by Ctrl+C)
trap 'kill $(jobs -pr) 2>/dev/null' SIGINT SIGTERM EXIT

wait_for_server() {
local port=$1
timeout 600 bash -c "until curl -s localhost:${port}/v1/completions > /dev/null; do sleep 1; done"
}
Comment on lines +24 to +27

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.

high

The current wait_for_server implementation is not robust. It uses curl to check the /v1/completions endpoint. A GET request to this POST-only endpoint will receive a 405 "Method Not Allowed" response, but curl without the -f flag will still exit with code 0. This can cause a race condition where the script proceeds before the server is fully ready.

A better approach is to use the /health endpoint, which is a GET endpoint, and the curl -f flag to ensure curl fails on HTTP errors. This makes the server readiness check much more reliable and prevents flaky tests.

Suggested change
wait_for_server() {
local port=$1
timeout 600 bash -c "until curl -s localhost:${port}/v1/completions > /dev/null; do sleep 1; done"
}
wait_for_server() {
local port=$1
local endpoint=${2:-/health}
timeout 600 bash -c "until curl -fs http://localhost:${port}${endpoint} > /dev/null; do sleep 1; done"
}


# Cleanup any existing instances
pkill -f "vllm serve" || true
sleep 2

# Prefill instance (kv_producer) - port 8100, kv_port 14579
CUDA_VISIBLE_DEVICES=0 vllm serve $MODEL_NAME \
--port 8100 \
--max-model-len 4096 \
--enforce-eager \
--gpu-memory-utilization $GPU_MEMORY_UTILIZATION \
--kv-transfer-config '{"kv_connector":"P2pNcclConnector","kv_role":"kv_producer","kv_port":14579}' &

# Decode instance (kv_consumer) - port 8200, kv_port 14580 (different!)
CUDA_VISIBLE_DEVICES=1 vllm serve $MODEL_NAME \
--port 8200 \
--max-model-len 4096 \
--enforce-eager \
--gpu-memory-utilization $GPU_MEMORY_UTILIZATION \
--kv-transfer-config '{"kv_connector":"P2pNcclConnector","kv_role":"kv_consumer","kv_port":14580}' &

echo "Waiting for prefill instance on port 8100 to start..."
wait_for_server 8100
echo "Waiting for decode instance on port 8200 to start..."
wait_for_server 8200

# Start proxy server with P2pNccl request ID encoding
# This proxy encodes prefill and decode KV addresses in the request ID
# Note: --kv-host must match the IP that vLLM's P2pNcclEngine binds to
python3 ${GIT_ROOT}/benchmarks/disagg_benchmarks/disagg_prefill_proxy_server.py \
--port 8192 \
--prefill-url http://localhost:8100 \
--decode-url http://localhost:8200 \
--kv-host ${KV_HOST} \
--prefill-kv-port 14579 \
--decode-kv-port 14580 &

sleep 5

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.

high

Instead of a fixed sleep 5, it's more reliable to actively wait for the proxy server to be ready. The proxy server exposes a /healthcheck endpoint. Using an improved wait_for_server function to poll this endpoint ensures that the script only proceeds once the proxy is fully initialized, avoiding potential race conditions.

Suggested change
sleep 5
echo "Waiting for proxy instance on port 8192 to start..."
wait_for_server 8192 /healthcheck


# Run accuracy test
TEST_MODEL=$MODEL_NAME python3 -m pytest -s -x ${GIT_ROOT}/tests/v1/kv_connector/pd_integration/test_accuracy.py

pkill -f "vllm serve" || true
echo "P2pNccl accuracy test completed!"
Loading