# Experiment: Qwen3-235B-A22B on Kunlun P800 (8x XPU), SGLang, TP=8.
# Benchmark: input 2048 / output 2048, concurrency 16, num_prompts 160.
#
# Adapted from the proven qwen3-8b TP=1 launch on this same image
# (attention-backend kunlun, XSGL_* XPU env vars, --dtype float16).
# Only differences vs the 8b run: --tp-size 8, 8 XPU devices, model path,
# and context-length 8192 (8b used 4096 which truncated 2 outputs at 2k+2k).

EXPERIMENT="${EXPERIMENT:-qwen3_235b_p800_sglang_tp8}"
MODEL_NAME="${MODEL_NAME:-Qwen3-235B-A22B}"
MODEL_PATH="${MODEL_PATH:-/data1/models/Qwen3-235B-A22B}"
SERVED_MODEL_NAME="${SERVED_MODEL_NAME:-/data1/models/Qwen3-235B-A22B}"
BACKEND="${BACKEND:-sglang}"
ENGINE="${ENGINE:-sglang-xpu}"
DATASET="${DATASET:-random}"
DATASET_PATH="${DATASET_PATH:-/data1/yy/sharegpt_data/ShareGPT_V3_unfiltered_cleaned_split.json}"

# Serving port + container.
# 30000 is taken by the lingering qwen3_8b_bench_tp1 container (docker-proxy),
# so default to 30010.
PORT="${PORT:-30010}"
CONTAINER_NAME="${CONTAINER_NAME:-qwen3_235b_bench_tp8}"

# Docker image: Kunlun P800 SGLang image (same one the qwen3-8b run used).
DOCKER_IMAGE="${DOCKER_IMAGE:-iregistry.baidu-int.com/xpu/sglang-p800-pd-disagg-0510:20260511_4202}"

# Hardware: 8x Kunlun P800 XPU, TP=8.
TP="${TP:-8}"
XPU_VISIBLE_DEVICES="${XPU_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"
CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6,7}"

# SGLang launch parameters (mirrors the working qwen3-8b config, TP bumped to 8).
CONTEXT_LENGTH="${CONTEXT_LENGTH:-8192}"
MAX_RUNNING_REQUESTS="${MAX_RUNNING_REQUESTS:-16}"
ATTENTION_BACKEND="${ATTENTION_BACKEND:-kunlun}"
MEM_FRACTION_STATIC="${MEM_FRACTION_STATIC:-0.9}"
DTYPE="${DTYPE:-float16}"
PAGE_SIZE="${PAGE_SIZE:-64}"
MAX_PREFILL_TOKENS="${MAX_PREFILL_TOKENS:-32768}"
CUDA_GRAPH_MAX_BS="${CUDA_GRAPH_MAX_BS:-16}"
CUDA_GRAPH_BS="${CUDA_GRAPH_BS:-1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}"

# Bench scenario: "concurrency input_len output_len num_prompts".
SCENARIOS=(
  "16 2048 2048 160"
)

WARMUP="${WARMUP:-16}"
REQUEST_RATE="${REQUEST_RATE:-10000}"
SEED="${SEED:-1}"
RANDOM_RANGE_RATIO="${RANDOM_RANGE_RATIO:-1}"
