|
7 | 7 | # against the already-ready frontend on the head node. |
8 | 8 |
|
9 | 9 | source "$(dirname "${BASH_SOURCE[0]}")/../benchmark_lib.sh" --validation-only |
10 | | -check_env_vars INFMAX_CONTAINER_WORKSPACE RESULT_DIR EVAL_ONLY AIPERF_DRAIN_TIMEOUT_SECONDS AIPERF_DRAIN_POLL_SECONDS |
| 10 | +check_env_vars INFMAX_CONTAINER_WORKSPACE RESULT_DIR EVAL_ONLY FRAMEWORK AIPERF_DRAIN_TIMEOUT_SECONDS AIPERF_DRAIN_POLL_SECONDS |
11 | 11 | source "$INFMAX_CONTAINER_WORKSPACE/benchmarks/benchmark_lib.sh" |
12 | 12 |
|
13 | 13 | if [[ -n "${SRT_FRONTEND_HOST:-}" ]]; then |
@@ -62,6 +62,61 @@ if [[ "${EVAL_ONLY}" == "true" ]]; then |
62 | 62 | _wait_for_openai_chat_route --port "$PORT" |
63 | 63 | fi |
64 | 64 |
|
| 65 | +# Preserve the legacy DP-attention replay contract. The SGLang router uses this |
| 66 | +# header to keep every request in one AgentX correlation tree on a stable DP |
| 67 | +# route, which is important for both session continuity and prefix-cache reuse. |
| 68 | +if [[ "$FRAMEWORK" == sglang || "$FRAMEWORK" == sglang-disagg ]] && [[ "${PREFILL_DP_ATTN:-false}" == "true" ]]; then |
| 69 | + export AIPERF_HTTP_X_SMG_ROUTING_KEY_FROM_CORRELATION_ID=true |
| 70 | +fi |
| 71 | + |
| 72 | +# Reset every advertised SGLang worker before each concurrency point, matching |
| 73 | +# the retired amd_utils trace replay. /flush_cache covers GPU radix + host |
| 74 | +# HiCache; the storage-backend endpoint is best-effort because L3 is optional. |
| 75 | +clear_agentic_worker_caches() { |
| 76 | + check_env_vars FLUSH_DRAIN_TIMEOUT |
| 77 | + local timeout_seconds="$FLUSH_DRAIN_TIMEOUT" |
| 78 | + local metrics_csv="${AIPERF_SERVER_METRICS_URLS:-}" |
| 79 | + if [[ -z "$metrics_csv" ]]; then |
| 80 | + echo "[clear_caches] WARN: AIPERF_SERVER_METRICS_URLS unset; skipping cache flush" >&2 |
| 81 | + return 0 |
| 82 | + fi |
| 83 | + |
| 84 | + local -a metrics_urls |
| 85 | + IFS=',' read -r -a metrics_urls <<< "$metrics_csv" |
| 86 | + local metrics_url base_url start response code flushed |
| 87 | + for metrics_url in "${metrics_urls[@]}"; do |
| 88 | + [[ -n "$metrics_url" ]] || continue |
| 89 | + base_url="${metrics_url%/metrics}" |
| 90 | + start=$(date +%s) |
| 91 | + flushed=0 |
| 92 | + response="" |
| 93 | + while :; do |
| 94 | + response=$(curl -sf -m 10 -X POST "${base_url}/flush_cache" 2>/dev/null || true) |
| 95 | + if grep -qi "Cache flushed" <<< "$response"; then |
| 96 | + flushed=1 |
| 97 | + break |
| 98 | + fi |
| 99 | + if (( $(date +%s) - start >= timeout_seconds )); then |
| 100 | + break |
| 101 | + fi |
| 102 | + sleep 3 |
| 103 | + done |
| 104 | + if (( flushed )); then |
| 105 | + echo "[clear_caches] ${base_url}: L1+L2 flushed" |
| 106 | + else |
| 107 | + echo "[clear_caches] WARN ${base_url}: L1+L2 flush not confirmed after ${timeout_seconds}s" >&2 |
| 108 | + fi |
| 109 | + |
| 110 | + code=$(curl -s -m 60 -o /dev/null -w '%{http_code}' \ |
| 111 | + -X POST "${base_url}/hicache/storage-backend/clear" 2>/dev/null || true) |
| 112 | + if [[ "$code" == "200" ]]; then |
| 113 | + echo "[clear_caches] ${base_url}: L3 store cleared" |
| 114 | + else |
| 115 | + echo "[clear_caches] ${base_url}: L3 clear http=${code:-000} (optional backend unavailable)" |
| 116 | + fi |
| 117 | + done |
| 118 | +} |
| 119 | + |
65 | 120 | wait_for_agentic_servers_idle() { |
66 | 121 | local timeout_seconds="${AIPERF_DRAIN_TIMEOUT_SECONDS}" |
67 | 122 | local poll_seconds="${AIPERF_DRAIN_POLL_SECONDS}" |
@@ -144,6 +199,9 @@ for index in "${!CONCURRENCIES[@]}"; do |
144 | 199 | mkdir -p "$RESULT_DIR" |
145 | 200 |
|
146 | 201 | echo "Running agentic concurrency $concurrency of: ${CONCURRENCIES[*]}" |
| 202 | + if [[ "${CLEAR_CACHE_BETWEEN_CONC:-}" == "1" ]]; then |
| 203 | + clear_agentic_worker_caches |
| 204 | + fi |
147 | 205 | build_replay_cmd "$RESULT_DIR" |
148 | 206 | run_agentic_replay_and_write_outputs "$RESULT_DIR" |
149 | 207 |
|
|
0 commit comments