[Test] Make EPD correctness tests configurable for XPU (#50110)
Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
liuzhenwei committed
Jul 29, 2026 at 07:47 UTC
e7f6a39db8d1f05ea923b5f976141db838b11c44
2 files changed
+64
-31
tests/v1/ec_connector/integration/run_epd_correctness_test.sh
+55
-30
@@ -21,12 +21,19 @@ GIT_ROOT="${GIT_ROOT:-$(cd -- "${SCRIPT_DIR}/../../../.." && pwd -P)}"
21
22
# Model to test
23
MODEL="${MODEL:-Qwen/Qwen2.5-VL-3B-Instruct}"
24
+MAX_MODEL_LEN="${MAX_MODEL_LEN:-10240}"
25
+GPU_MEMORY_UTILIZATION="${GPU_MEMORY_UTILIZATION:-0.7}"
26
+MAX_NUM_SEQS="${MAX_NUM_SEQS:-128}"
27
28
# Set 1 to use multimodal prompts; else to use text-only
29
USE_MM_PROMPTS="${USE_MM_PROMPTS:-1}"
27
-MM_FLAG=""
28
-if [ "$USE_MM_PROMPTS" = "1" ]; then
29
- MM_FLAG="--use_mm_prompts"
30
+USE_TWO_IMAGE_PROMPT="${USE_TWO_IMAGE_PROMPT:-1}"
31
+TEST_FLAGS=()
32
+if [[ "$USE_MM_PROMPTS" == "1" ]]; then
33
+ TEST_FLAGS+=(--use_mm_prompts)
34
+fi
35
+if [[ "$USE_TWO_IMAGE_PROMPT" != "1" ]]; then
36
+ TEST_FLAGS+=(--skip_two_image_prompt)
37
fi
38
39
# GPU configuration
@@ -36,6 +43,16 @@ GPU_D="${GPU_D:-2}"
43
GPU_SINGLE="${GPU_SINGLE:-$GPU_P}"
44
GPU_PD="${GPU_PD:-$GPU_P}"
45
46
+# Device platform and affinity environment variable
47
+DEVICE_PLATFORM="${DEVICE_PLATFORM:-cuda}"
48
+if [[ -z "${DEVICE_AFFINITY_ENV:-}" ]]; then
49
+ if [[ "${DEVICE_PLATFORM,,}" == "xpu" ]]; then
50
+ DEVICE_AFFINITY_ENV="ZE_AFFINITY_MASK"
51
+ else
52
+ DEVICE_AFFINITY_ENV="CUDA_VISIBLE_DEVICES"
53
+ fi
54
+fi
55
+
56
# Port
57
ENCODE_PORT="${ENCODE_PORT:-19534}"
58
PREFILL_PORT="${PREFILL_PORT:-19535}"
@@ -87,11 +104,12 @@ run_baseline() {
104
105
# Start baseline instance
106
echo "Starting baseline instance on GPU $GPU_SINGLE, port $PORT"
90
- CUDA_VISIBLE_DEVICES="$GPU_SINGLE" vllm serve "$MODEL" \
107
+ env "$DEVICE_AFFINITY_ENV=$GPU_SINGLE" vllm serve "$MODEL" \
108
--port "$PORT" \
109
+ --max-model-len "$MAX_MODEL_LEN" \
110
--enforce-eager \
93
- --gpu-memory-utilization 0.7 \
94
- --max-num-seqs 128 \
111
+ --gpu-memory-utilization 0.9 \
112
+ --max-num-seqs "$MAX_NUM_SEQS" \
113
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
114
> "$LOG_PATH"/baseline.log 2>&1 &
115
@@ -112,7 +130,7 @@ run_baseline() {
130
--model_name "$MODEL" \
131
--mode baseline \
132
--baseline_file "$BASELINE_FILE" \
115
- $MM_FLAG
133
+ "${TEST_FLAGS[@]}"
134
135
# Cleanup baseline
136
echo "Stopping baseline instance..."
@@ -139,14 +157,15 @@ run_epd_1e_1pd() {
157
158
# Start encoder instance
159
echo "Starting encoder instance on GPU $GPU_E, port $ENCODE_PORT"
142
- CUDA_VISIBLE_DEVICES="$GPU_E" vllm serve "$MODEL" \
160
+ env "$DEVICE_AFFINITY_ENV=$GPU_E" vllm serve "$MODEL" \
161
--port "$ENCODE_PORT" \
162
+ --max-model-len "$MAX_MODEL_LEN" \
163
--enforce-eager \
164
--gpu-memory-utilization 0.01 \
165
--enable-request-id-headers \
166
--no-enable-prefix-caching \
167
--max-num-batched-tokens 114688 \
149
- --max-num-seqs 128 \
168
+ --max-num-seqs "$MAX_NUM_SEQS" \
169
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
170
--ec-transfer-config '{
171
"ec_connector": "ECExampleConnector",
@@ -160,12 +179,13 @@ run_epd_1e_1pd() {
179
180
# Start prefill+decode instance
181
echo "Starting PD instance on GPU $GPU_PD, port $PREFILL_DECODE_PORT"
163
- CUDA_VISIBLE_DEVICES="$GPU_PD" vllm serve "$MODEL" \
182
+ env "$DEVICE_AFFINITY_ENV=$GPU_PD" vllm serve "$MODEL" \
183
--port "$PREFILL_DECODE_PORT" \
184
+ --max-model-len "$MAX_MODEL_LEN" \
185
--enforce-eager \
166
- --gpu-memory-utilization 0.7 \
186
+ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \
187
--enable-request-id-headers \
168
- --max-num-seqs 128 \
188
+ --max-num-seqs "$MAX_NUM_SEQS" \
189
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
190
--ec-transfer-config '{
191
"ec_connector": "ECExampleConnector",
@@ -212,7 +232,7 @@ run_epd_1e_1pd() {
232
--model_name "$MODEL" \
233
--mode disagg \
234
--baseline_file "$BASELINE_FILE" \
215
- $MM_FLAG
235
+ "${TEST_FLAGS[@]}"
236
237
# Cleanup
238
echo "✓✓ 1E+1PD Correctness Test finished"
@@ -242,14 +262,15 @@ run_baseline_1p_1d() {
262
263
# Start prefill instance
264
echo "Starting prefill instance on GPU $GPU_P, port $PREFILL_PORT"
245
- CUDA_VISIBLE_DEVICES="$GPU_P" \
265
+ env "$DEVICE_AFFINITY_ENV=$GPU_P" \
266
VLLM_NIXL_SIDE_CHANNEL_PORT=5559 \
267
vllm serve "$MODEL" \
268
--port "$PREFILL_PORT" \
269
+ --max-model-len "$MAX_MODEL_LEN" \
270
--enforce-eager \
250
- --gpu-memory-utilization 0.7 \
271
+ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \
272
--enable-request-id-headers \
252
- --max-num-seqs 128 \
273
+ --max-num-seqs "$MAX_NUM_SEQS" \
274
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
275
--kv-transfer-config '{
276
"kv_connector": "NixlConnector",
@@ -260,14 +281,15 @@ run_baseline_1p_1d() {
281
282
# Start decode instance
283
echo "Starting decode instance on GPU $GPU_D, port $DECODE_PORT"
263
- CUDA_VISIBLE_DEVICES="$GPU_D" \
284
+ env "$DEVICE_AFFINITY_ENV=$GPU_D" \
285
VLLM_NIXL_SIDE_CHANNEL_PORT=6000 \
286
vllm serve "$MODEL" \
287
--port "$DECODE_PORT" \
288
+ --max-model-len "$MAX_MODEL_LEN" \
289
--enforce-eager \
268
- --gpu-memory-utilization 0.7 \
290
+ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \
291
--enable-request-id-headers \
270
- --max-num-seqs 128 \
292
+ --max-num-seqs "$MAX_NUM_SEQS" \
293
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
294
--kv-transfer-config '{
295
"kv_connector": "NixlConnector",
@@ -309,7 +331,7 @@ run_baseline_1p_1d() {
331
--model_name "$MODEL" \
332
--mode baseline_pd \
333
--baseline_file "$BASELINE_PD_FILE" \
312
- $MM_FLAG
334
+ "${TEST_FLAGS[@]}"
335
336
# Cleanup
337
echo "Stopping PD (1P+1D) instances..."
@@ -339,14 +361,15 @@ run_epd_1e_1p_1d() {
361
362
# Start encoder instance
363
echo "Starting encoder instance on GPU $GPU_E, port $ENCODE_PORT"
342
- CUDA_VISIBLE_DEVICES="$GPU_E" vllm serve "$MODEL" \
364
+ env "$DEVICE_AFFINITY_ENV=$GPU_E" vllm serve "$MODEL" \
365
--port "$ENCODE_PORT" \
366
+ --max-model-len "$MAX_MODEL_LEN" \
367
--enforce-eager \
368
--gpu-memory-utilization 0.01 \
369
--enable-request-id-headers \
370
--no-enable-prefix-caching \
371
--max-num-batched-tokens 114688 \
349
- --max-num-seqs 128 \
372
+ --max-num-seqs "$MAX_NUM_SEQS" \
373
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
374
--ec-transfer-config '{
375
"ec_connector": "ECExampleConnector",
@@ -360,14 +383,15 @@ run_epd_1e_1p_1d() {
383
384
# Start prefill instance
385
echo "Starting prefill instance on GPU $GPU_P, port $PREFILL_PORT"
363
- CUDA_VISIBLE_DEVICES="$GPU_P" \
386
+ env "$DEVICE_AFFINITY_ENV=$GPU_P" \
387
VLLM_NIXL_SIDE_CHANNEL_PORT=5559 \
388
vllm serve "$MODEL" \
389
--port "$PREFILL_PORT" \
390
+ --max-model-len "$MAX_MODEL_LEN" \
391
--enforce-eager \
368
- --gpu-memory-utilization 0.7 \
392
+ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \
393
--enable-request-id-headers \
370
- --max-num-seqs 128 \
394
+ --max-num-seqs "$MAX_NUM_SEQS" \
395
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
396
--ec-transfer-config '{
397
"ec_connector": "ECExampleConnector",
@@ -385,14 +409,15 @@ run_epd_1e_1p_1d() {
409
410
# Start decode instance
411
echo "Starting decode instance on GPU $GPU_D, port $DECODE_PORT"
388
- CUDA_VISIBLE_DEVICES="$GPU_D" \
412
+ env "$DEVICE_AFFINITY_ENV=$GPU_D" \
413
VLLM_NIXL_SIDE_CHANNEL_PORT=6000 \
414
vllm serve "$MODEL" \
415
--port "$DECODE_PORT" \
416
+ --max-model-len "$MAX_MODEL_LEN" \
417
--enforce-eager \
393
- --gpu-memory-utilization 0.7 \
418
+ --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \
419
--enable-request-id-headers \
395
- --max-num-seqs 128 \
420
+ --max-num-seqs "$MAX_NUM_SEQS" \
421
--allowed-local-media-path "${GIT_ROOT}"/tests/v1/ec_connector/integration \
422
--kv-transfer-config '{
423
"kv_connector": "NixlConnector",
@@ -438,7 +463,7 @@ run_epd_1e_1p_1d() {
463
--model_name "$MODEL" \
464
--mode disagg \
465
--baseline_file "$BASELINE_PD_FILE" \
441
- $MM_FLAG
466
+ "${TEST_FLAGS[@]}"
467
468
# Cleanup
469
echo "✓✓ 1E+1P+1D Correctness Test finished"
@@ -465,7 +490,7 @@ run_epd_1e_1pd
490
# Step 3: Test baseline 1P + 1D
491
run_baseline_1p_1d
492
468
-# Step 4: Test 1E + 1P + 1D
493
+# # Step 4: Test 1E + 1P + 1D
494
run_epd_1e_1p_1d
495
496
# Cleanup output file
tests/v1/ec_connector/integration/test_epd_correctness.py
+9
-1
@@ -192,6 +192,12 @@ def main():
192
help="Use multimodal prompts (default: use text-only for quick testing)",
193
)
194
195
+ parser.add_argument(
196
+ "--skip_two_image_prompt",
197
+ action="store_true",
198
+ help="Skip the two-image multimodal prompt",
199
+ )
200
+
201
args = parser.parse_args()
202
203
print(f"Service URL: {args.service_url}")
@@ -221,7 +227,9 @@ def main():
227
228
# Select prompts to use
229
if args.use_mm_prompts:
224
- test_prompts = SAMPLE_PROMPTS_MM
230
+ test_prompts = (
231
+ SAMPLE_PROMPTS_MM[:1] if args.skip_two_image_prompt else SAMPLE_PROMPTS_MM
232
+ )
233
print("Using multimodal prompts")
234
else:
235
test_prompts = SAMPLE_PROMPTS_TEXT