diff --git a/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/tokenspeed-nightly-rocm.sh b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/tokenspeed-nightly-rocm.sh new file mode 100755 index 0000000000..1f2a430755 --- /dev/null +++ b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/tokenspeed-nightly-rocm.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -eo pipefail +source /infmax-workspace/benchmarks/check_env.sh +check_env_vars TOKENSPEED_WHEEL_URL TOKENSPEED_KERNEL_WHEEL_URL TOKENSPEED_KERNEL_AMD_WHEEL_URL TOKENSPEED_ENGINE_WHEEL_URL TOKENSPEED_SCHEDULER_VERSION ROUTER_VERSION + +pip_install=(python3 -m pip install) +if python3 -m pip install --help 2>/dev/null | grep -q -- --break-system-packages; then + pip_install+=(--break-system-packages) +fi +# The runner image provides ROCm torch. Upgrading only what the pinned wheels +# need keeps it: PyPI's torch is a CUDA build. +"${pip_install[@]}" --upgrade --upgrade-strategy only-if-needed \ + --index-url https://pypi.org/simple \ + "$TOKENSPEED_WHEEL_URL" "$TOKENSPEED_KERNEL_WHEEL_URL" \ + "$TOKENSPEED_KERNEL_AMD_WHEEL_URL" "$TOKENSPEED_ENGINE_WHEEL_URL" \ + "tokenspeed-scheduler==$TOKENSPEED_SCHEDULER_VERSION" \ + "tokenspeed-smg==$ROUTER_VERSION" +python3 -c 'import torch, sys; sys.exit(0 if torch.version.hip else "torch is not a ROCm build")' +python3 -m pip check diff --git a/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3.1/tokenspeed/mi355x-fp4/README.md b/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3.1/tokenspeed/mi355x-fp4/README.md new file mode 100644 index 0000000000..8b34b84274 --- /dev/null +++ b/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3.1/tokenspeed/mi355x-fp4/README.md @@ -0,0 +1,71 @@ +# Kimi K3.1 Pro MXFP4 on TokenSpeed (MI355X) + +The `agentic.yaml` recipe backs the +`kimik3.1-fp4-mi355x-tokenspeed-agentic-dspark` matrix: one TokenSpeed worker +on eight MI355X GPUs with attention and MoE TP8 and EP1, so every GPU holds all +experts. The released `Inferact/Kimi-K3.1-Pro-DSpark` draft, a five-layer GQA +stack attended through TokenSpeed's MHA drafter backend, proposes five or seven +tokens per step and is served as it ships, in BF16. The KV cache is FP8 +with the MXFP4 DSA indexer key cache, and the KDA recurrent state stays in +TokenSpeed's default FP32, as the K3.1 week-1 precision policy requires. The +context is 1,048,560 tokens and prefill runs in 8K chunks. From concurrency 8, +the Host L2 KV store holds 128 GB per GPU (`kvstore-size: 128`); concurrency 1 +and 4 run without it (`disable-kvstore`), since their GPU KV pool already holds +the sessions' prefixes. `HSA_USERPTR_FOR_PAGED_MEM=0` makes `hipHostMalloc` +take the pinned Host L2 from the amdgpu GTT pool instead of registering pageable +memory page by page, which on a node whose page cache holds the checkpoint can +take longer than the distributed startup timeout. The GTT pool is about half the +node's memory, so the eight GPUs' Host L2 stays well below it. + +Each concurrency has its own override: + +| Concurrency | KVP / DCP | `max-num-seqs` | DSpark drafts | `prefill-decode-interval` | `prefill-decode-min-interval` | Other | +| ----------- | --------- | -------------- | ------------- | ------------------------- | ----------------------------- | ----- | +| 1 | 1 | 1 | 7 | 0 | 0 | no prefill graphs, no Host L2 | +| 4 | 1 | 2 | 7 | 0 | 0 | no prefill graphs, no Host L2 | +| 8 | 8 | 8 | 7 | 64 | 0 | | +| 16 | 8 | 8 | 5 | 80 | 8 | | +| 24 | 8 | 12 | 5 | 64 | 24 | short prefill first | +| 32 | 8 | 16 | 5 | 64 | 24 | short prefill first, mixed batches | +| 48 | 8 | 48 | 5 | 80 | 4 | mixed batches | + +Decode graphs are captured up to `max-num-seqs`, and a cap below the +concurrency queues the extra sessions. From concurrency 8, each GPU stores one +eighth of every request's KV pages (KV parallel 8) and decode attends each +shard where it lives (DCP8). Those points also capture breakable prefill graphs +for chunks up to 3072 tokens. + +With an interval of N, the scheduler runs up to N decode rounds after each +prefill chunk; the minimum interval keeps at least that many decode rounds +after every chunk, also for a prompt that has waited the full interval. Short +prefill first admits prompts with less uncached work first, and mixed batches +let prefill and decode share an iteration. The caps keep decode batches small +and the intervals keep prefill from interrupting decode; both lower TPOT at the +cost of time to first token. + +The recipe installs the November 19 TokenSpeed, kernel, kernel-amd and engine +wheels by release URL and SHA256, `tokenspeed-scheduler` `0.1.58` from PyPI, +and `tokenspeed-smg` `1.16.0.post20261118`, the gateway that TokenSpeed +revision pins. On gfx950 the November 19 kernels run each MoE layer's +post-attention work as one launch in decode steps that hold one request. The +runner image, pinned by digest in the master config, +provides ROCm torch; `tokenspeed-nightly-rocm.sh` installs the pinned packages +without replacing it and checks that torch is still a ROCm build. The worker +pins the checkpoint with `revision` and the draft with +`speculative-draft-model-revision`. + +Workers launch through `python3 -m tokenspeed.cli serve --headless` with SMG's +ZMQ transport. srtctl runs SMG directly, so the recipe passes the gateway +settings `ts serve` applies: passthrough reasoning and tool-call parsers, +round-robin routing, L0 and L1 tokenizer caches, warn logging, and no retries, +circuit breaker or load monitoring. The engine also receives the passthrough +reasoning parser, as under `ts serve`. + +For synthetic throughput, the golden-AL connector derives acceptance from the +committed Kimi K3.1 Pro DSpark curve (probabilistic draft, block verification) +at each override's draft count and selects the greedy sampler, which verifies +by exact match. Because the greedy sampler rejects speculative sampling and the +synthetic length is itself the rejection method, the connector also removes the +speculative-sampling and block-verification settings. Eval runs keep the +recipe's real verification: the triton sampler with speculative sampling and +block verification. diff --git a/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3.1/tokenspeed/mi355x-fp4/agentic.yaml b/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3.1/tokenspeed/mi355x-fp4/agentic.yaml new file mode 100644 index 0000000000..3e92484346 --- /dev/null +++ b/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3.1/tokenspeed/mi355x-fp4/agentic.yaml @@ -0,0 +1,238 @@ +base: + schema: 2 + name: kimik3.1-fp4-mi355x-tokenspeed-agentic-dspark + identity: + model: + revision: d9e99b0792a5e93b78ea9bea62a68167e36ddd9e + container: {} + frameworks: + tokenspeed: 0.1.1.post20261118 + tokenspeed-kernel: 0.1.5.post20261118 + tokenspeed-kernel-amd: 0.1.4.post20261118 + tokenspeed-scheduler: 0.1.58 + tokenspeed-engine: 0.1.1.post20261118 + resources: + gpu_type: mi355x + gpus_per_node: 8 + observability: + enabled: false + tachometer: + enabled: false + # Up to two hours to load the 1.56 TB checkpoint, capture graphs and compile the first kernels. + health_check: + max_attempts: 720 + interval_seconds: 10 + frontend: + type: smg + enable_multiple_frontends: false + # srtctl runs SMG directly: these are the gateway settings `ts serve` applies. + args: + reasoning-parser: passthrough + tool-call-parser: passthrough + policy: round_robin + disable-circuit-breaker: true + disable-retries: true + disable-load-monitoring: true + tokenizer-cache-enable-l0: true + tokenizer-cache-enable-l1: true + log-level: warn + engine: tokenspeed + setup_script: tokenspeed-nightly-rocm.sh + environment: + TOKENSPEED_WHEEL_URL: https://github.com/lightseekorg/whl/releases/download/tokenspeed-nightly-v0.1.1.post20261119/tokenspeed-0.1.1.post20261119-py3-none-any.whl#sha256=a50cc6aca1e6dec22c14a914d9e593b5f6490b44ee26062f75718b6591dc69c4 + TOKENSPEED_KERNEL_WHEEL_URL: https://github.com/lightseekorg/whl/releases/download/tokenspeed-kernel-nightly-v0.1.5.post20261119-rocm72/tokenspeed_kernel-0.1.5.post20261119-cp312-cp312-manylinux_2_28_x86_64.whl#sha256=0d045c1bfeafa1e1118606a511cd7fb2195dbc693d335d93a0273678f5d36523 + TOKENSPEED_KERNEL_AMD_WHEEL_URL: https://github.com/lightseekorg/whl/releases/download/tokenspeed-kernel-amd-nightly-v0.1.4.post20261119/tokenspeed_kernel_amd-0.1.4.post20261119-py3-none-any.whl#sha256=cfb38b114f4a1ccb75e36f2dc0ae407c7be25844d21b4bd66754cb87eea83334 + TOKENSPEED_SCHEDULER_VERSION: 0.1.58 + TOKENSPEED_ENGINE_WHEEL_URL: https://github.com/lightseekorg/whl/releases/download/tokenspeed-engine-v0.1.1.post20261119/tokenspeed_engine-0.1.1.post20261119-cp312-abi3-manylinux_2_28_x86_64.whl#sha256=2034d53a09fd05667d297cf0f960c94383954087da9b2dd3976b2ae2c0d7e401 + roles: + agg: + nodes: 1 + workers: 1 + gpus: 8 + env: + GPU_MAX_HW_QUEUES: '2' + PYTHONNOUSERSITE: '1' + # Pinned Host L2 comes from hipHostMalloc's GTT pool; registering pageable memory + # pins it page by page and can outlast the distributed startup timeout. + HSA_USERPTR_FOR_PAGED_MEM: '0' + args: + served-model-name: moonshotai/Kimi-K3.1-Pro + revision: d9e99b0792a5e93b78ea9bea62a68167e36ddd9e + trust-remote-code: true + # Attention and MoE TP8; EP1 keeps every expert on every GPU. + attn-tp-size: 8 + data-parallel-size: 1 + ep-size: 1 + pipeline-parallel-size: 1 + moe-backend: auto + kv-cache-dtype: fp8 + # The K3.1 precision policy's FP4 DSA indexer key cache. + dsa-index-k-format: mxfp4 + language-model-only: true + max-model-len: 1048560 + chunked-prefill-size: 8192 + max-prefill-tokens: 8192 + gpu-memory-utilization: 0.95 + enable-prefix-caching: true + # Host L2 per GPU; the eight GPUs' Host L2 must fit the node's GTT pool. + kvstore-size: 128 + reasoning-parser: passthrough + drafter-attention-backend: mha + speculative-algorithm: DSPARK + speculative-draft-model-path: Inferact/Kimi-K3.1-Pro-DSpark + speculative-draft-model-revision: e4e6e6261e9f8b6d5f249f9627eb6b109d762d5f + # Drafts per step (overrides change it); the verify window adds the current token. + speculative-num-steps: 5 + speculative-num-draft-tokens: 6 + speculative-eagle-topk: 1 + # Real verification. The connector selects greedy sampling and the golden acceptance + # length for synthetic throughput. + sampling-backend: triton + enable-speculative-sampling: true + speculative-rejection-sample-method: block + enable-metrics: true + metrics-host: 0.0.0.0 + benchmark: + env: + # Warmup can leave bytes unacknowledged past AIPerf's 30 s default. + AIPERF_HTTP_TCP_USER_TIMEOUT: '900000' + AIPERF_REQUIRED_SERVER_METRIC_PREFIX: 'tokenspeed:' + +override_tp8_c1: + roles: + agg: + args: + max-num-seqs: 1 + max-cudagraph-capture-size: 1 + cudagraph-capture-sizes: [1] + disable-prefill-graph: true + speculative-num-steps: 7 + speculative-num-draft-tokens: 8 + # No Host L2: the GPU KV pool already holds the sessions' prefixes. + disable-kvstore: true + kvstore-size: null + benchmark: + env: + CONC: '1' + KV_OFFLOADING: none + +override_tp8_c4: + roles: + agg: + args: + # Running cap below concurrency: the other sessions wait for their first token. + max-num-seqs: 2 + max-cudagraph-capture-size: 2 + cudagraph-capture-sizes: [1, 2] + disable-prefill-graph: true + speculative-num-steps: 7 + speculative-num-draft-tokens: 8 + disable-kvstore: true + kvstore-size: null + benchmark: + env: + CONC: '4' + KV_OFFLOADING: none + +override_tp8_dcp8_c8: + roles: + agg: + args: + max-num-seqs: 8 + max-cudagraph-capture-size: 8 + cudagraph-capture-sizes: [1, 2, 3, 4, 5, 6, 7, 8] + # Each GPU stores one eighth of every request's KV pages and decode attends its own shard. + kv-parallel-size: 8 + decode-context-parallel-size: 8 + prefill-graph-capture-sizes: [256, 512, 1024, 1536, 2048, 3072] + prefill-graph-max-tokens: 3072 + # Up to 64 decode rounds run after each prefill chunk before the next prefill round. + prefill-decode-interval: 64 + speculative-num-steps: 7 + speculative-num-draft-tokens: 8 + benchmark: + env: + CONC: '8' + KV_OFFLOADING: dram + TOTAL_CPU_DRAM_GB: '1025' + +override_tp8_dcp8_c16: + roles: + agg: + args: + max-num-seqs: 8 + max-cudagraph-capture-size: 8 + cudagraph-capture-sizes: [1, 2, 3, 4, 5, 6, 7, 8] + kv-parallel-size: 8 + decode-context-parallel-size: 8 + prefill-graph-capture-sizes: [256, 512, 1024, 1536, 2048, 3072] + prefill-graph-max-tokens: 3072 + prefill-decode-interval: 80 + # At least 8 decode rounds after every prefill chunk, also once a prompt waited the full interval. + prefill-decode-min-interval: 8 + benchmark: + env: + CONC: '16' + KV_OFFLOADING: dram + TOTAL_CPU_DRAM_GB: '1025' + +override_tp8_dcp8_c24: + roles: + agg: + args: + max-num-seqs: 12 + max-cudagraph-capture-size: 12 + cudagraph-capture-sizes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + kv-parallel-size: 8 + decode-context-parallel-size: 8 + prefill-graph-capture-sizes: [256, 512, 1024, 1536, 2048, 3072] + prefill-graph-max-tokens: 3072 + prefill-decode-interval: 64 + prefill-decode-min-interval: 24 + enable-short-prefill-first: true + benchmark: + env: + CONC: '24' + KV_OFFLOADING: dram + TOTAL_CPU_DRAM_GB: '1025' + +override_tp8_dcp8_c32: + roles: + agg: + args: + max-num-seqs: 16 + max-cudagraph-capture-size: 16 + cudagraph-capture-sizes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + kv-parallel-size: 8 + decode-context-parallel-size: 8 + prefill-graph-capture-sizes: [256, 512, 1024, 1536, 2048, 3072] + prefill-graph-max-tokens: 3072 + prefill-decode-interval: 64 + prefill-decode-min-interval: 24 + enable-short-prefill-first: true + enable-mixed-batch: true + benchmark: + env: + CONC: '32' + KV_OFFLOADING: dram + TOTAL_CPU_DRAM_GB: '1025' + +override_tp8_dcp8_c48: + roles: + agg: + args: + max-num-seqs: 48 + max-cudagraph-capture-size: 48 + cudagraph-capture-sizes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48] + kv-parallel-size: 8 + decode-context-parallel-size: 8 + prefill-graph-capture-sizes: [256, 512, 1024, 1536, 2048, 3072] + prefill-graph-max-tokens: 3072 + prefill-decode-interval: 80 + prefill-decode-min-interval: 4 + enable-mixed-batch: true + benchmark: + env: + CONC: '48' + KV_OFFLOADING: dram + TOTAL_CPU_DRAM_GB: '1025' diff --git a/inferencex-e2e/configs/amd-master.yaml b/inferencex-e2e/configs/amd-master.yaml index 1140d73fdb..8dbaba712d 100644 --- a/inferencex-e2e/configs/amd-master.yaml +++ b/inferencex-e2e/configs/amd-master.yaml @@ -1253,6 +1253,29 @@ kimik3.1-fp4-mi355x-sglang-agentic-dflash-disagg: prefill: { num-worker: 1, tp: 8, ep: 1, dp-attn: false, dcp-size: 8 } decode: { num-worker: 1, tp: 8, ep: 1, dp-attn: false, dcp-size: 8 } +kimik3.1-fp4-mi355x-tokenspeed-agentic-dspark: + image: lightseekorg/tokenspeed-runner-amd:rocm7.2.4-pytorch-2.14.0-gfx950@sha256:25949b7a6306e9fbc0165091cc67d9bded9965ed1d664b55f9966e7df0b05e51 + model: moonshotai/Kimi-K3.1-Pro + model-prefix: kimik3.1 + runner: cluster:mi355x-amds + precision: fp4 + framework: tokenspeed + multinode: false + router: { name: smg, version: 1.16.0.post20261118 } + srt-recipe-dir: kimik3.1/tokenspeed/mi355x-fp4 + scenarios: + agentic-coding: + # The recipe's Host L2 (concurrency 8 to 48) pins 8 x 128 GB = 1024 GB; 0.342 resolves to 1025 GB. + - dram-utilization: 0.342 + search-space: + - { tp: 8, ep: 1, dcp-size: 1, spec-decoding: mtp, kv-offloading: none, conc-list: [1], srt-recipe: agentic.yaml:override_tp8_c1 } + - { tp: 8, ep: 1, dcp-size: 1, spec-decoding: mtp, kv-offloading: none, conc-list: [4], srt-recipe: agentic.yaml:override_tp8_c4 } + - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: kvstore }, conc-list: [8], srt-recipe: agentic.yaml:override_tp8_dcp8_c8 } + - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: kvstore }, conc-list: [16], srt-recipe: agentic.yaml:override_tp8_dcp8_c16 } + - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: kvstore }, conc-list: [24], srt-recipe: agentic.yaml:override_tp8_dcp8_c24 } + - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: kvstore }, conc-list: [32], srt-recipe: agentic.yaml:override_tp8_dcp8_c32 } + - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: kvstore }, conc-list: [48], srt-recipe: agentic.yaml:override_tp8_dcp8_c48 } + glm5.3flash-fp8-mi325x-sglang-agentic-mtp: image: lmsysorg/sglang:v0.5.22-rocm10-mi30x@sha256:5658cd0d8de0c68de10d2e349296f55ceff98053182fa87b2a7e942e5e7f3c2a model: zai-org/GLM-5.3-Flash diff --git a/inferencex-e2e/infx/bench/eval/lm_eval.py b/inferencex-e2e/infx/bench/eval/lm_eval.py index 932e1c48ec..89e41aef12 100644 --- a/inferencex-e2e/infx/bench/eval/lm_eval.py +++ b/inferencex-e2e/infx/bench/eval/lm_eval.py @@ -139,7 +139,7 @@ def run(ctx: EvalContext) -> EvalOutcome: "--apply_chat_template", "--tasks", tasks(ctx.env), "--output_path", str(ctx.results_dir), "--log_samples", "--model_args", ",".join(model_args), - "--gen_kwargs", f"max_tokens={max_tokens},temperature=0,top_p=1", + "--gen_kwargs", f"max_tokens={max_tokens},temperature=0", ] # fmt: skip if limit := env.optional("EVAL_LIMIT", env=ctx.env): argv += ["--limit", limit] diff --git a/inferencex-e2e/infx/golden_al_distribution/README.md b/inferencex-e2e/infx/golden_al_distribution/README.md index 52f54212fb..26a4f8b7b6 100644 --- a/inferencex-e2e/infx/golden_al_distribution/README.md +++ b/inferencex-e2e/infx/golden_al_distribution/README.md @@ -33,13 +33,19 @@ SGLang MTP synthetic throughput, the connector rejects a generation role whose `speculative-num-steps + 1`. Manual acceptance-length settings are not needed. Eval-only runs remove synthetic settings and use real verification. -TokenSpeed MTP recipes use the same automatic selection from +TokenSpeed MTP and DSPARK recipes use the same automatic selection from `speculative-num-steps`, with `speculative-num-draft-tokens` equal to the step -count plus one and `speculative-eagle-topk: 1`. The connector sets -`synthetic-acceptance-length` and the required `sampling-backend: greedy` for -AgentX throughput. Eval-only and fixed-sequence runs remove that length and -select `sampling-backend: flashinfer` for real verification. TokenSpeed's -connector accepts explicit MTP flags; other speculative algorithms and the +count plus one and `speculative-eagle-topk: 1`. A DSPARK recipe drafts +`probabilistic` with `enable-speculative-sampling: true` and `greedy` without +it, and its verifier is `speculative-rejection-sample-method` when set. The +connector sets `synthetic-acceptance-length` and the required +`sampling-backend: greedy` for AgentX throughput and removes +`enable-speculative-sampling` and `speculative-rejection-sample-method`: the +greedy sampler rejects sampled verification, and the synthetic length conflicts +with block verification. Eval-only and fixed-sequence runs remove that length +and verify for real: MTP with `sampling-backend: flashinfer`, DSPARK with the +recipe's own, platform-specific verification settings. TokenSpeed's connector +accepts explicit MTP and DSPARK flags; other speculative algorithms and the JSON `speculative-config` shorthand are rejected. vLLM supports this through synthetic rejection sampling. For example, an EAGLE3 run can inject the selected YAML value through `synthetic_acceptance_length`: diff --git a/inferencex-e2e/infx/golden_al_distribution/README_zh.md b/inferencex-e2e/infx/golden_al_distribution/README_zh.md index be7a35006c..4eeec9c4d1 100644 --- a/inferencex-e2e/infx/golden_al_distribution/README_zh.md +++ b/inferencex-e2e/infx/golden_al_distribution/README_zh.md @@ -26,12 +26,16 @@ AL 取决于工作负载:草稿模型的预测在某些领域比其他领域 对于 Qwen3.5 的 srt-slurm 启动,srt 驱动会运行 `infx/srt_slurm/synthetic_acceptance.py` 连接器,在应用调用方覆盖设置后,根据生成角色的 `speculative-num-steps` 和 `THINKING_MODE` 选择已提交的曲线。验证 token 不计为额外的 MTP 步数。对于采用合成接受的 SGLang MTP 吞吐测试,如果生成角色缺少 `speculative-num-draft-tokens`,或者其值不是等于 `speculative-num-steps + 1` 的整数,连接器会拒绝启动。无需手动设置接受长度。仅评测运行会移除合成设置并使用真实验证。 -TokenSpeed MTP 配置同样根据 `speculative-num-steps` 自动选择黄金 AL,要求 +TokenSpeed MTP 和 DSPARK 配置同样根据 `speculative-num-steps` 自动选择黄金 AL,要求 `speculative-num-draft-tokens` 等于步数加一,且 `speculative-eagle-topk: 1`。 +DSPARK 配置设置 `enable-speculative-sampling: true` 时为 `probabilistic` 草稿采样, +未设置时为 `greedy`;设置了 `speculative-rejection-sample-method` 时以其为验证器。 连接器为 AgentX 吞吐测试设置 `synthetic-acceptance-length` 和所需的 -`sampling-backend: greedy`;仅评测和固定序列长度运行会移除该接受长度,并选择 -`sampling-backend: flashinfer` 进行真实验证。TokenSpeed 连接器接受显式 MTP 参数, -拒绝其他投机算法和 JSON `speculative-config` 简写。 +`sampling-backend: greedy`,并移除 `enable-speculative-sampling` 和 +`speculative-rejection-sample-method`:greedy 采样器不接受采样验证,合成接受长度也与块验证冲突。 +仅评测和固定序列长度运行会移除该接受长度并进行真实验证:MTP 使用 +`sampling-backend: flashinfer`,DSPARK 保留配置自身与平台相关的验证设置。 +TokenSpeed 连接器接受显式 MTP 和 DSPARK 参数,拒绝其他投机算法和 JSON `speculative-config` 简写。 vLLM 通过合成拒绝采样支持这一策略。例如,EAGLE3 运行可以通过 `synthetic_acceptance_length` 注入所选 YAML 值: diff --git a/inferencex-e2e/infx/srt_slurm/single_node.py b/inferencex-e2e/infx/srt_slurm/single_node.py index d0ffda89bf..043d9ee553 100644 --- a/inferencex-e2e/infx/srt_slurm/single_node.py +++ b/inferencex-e2e/infx/srt_slurm/single_node.py @@ -38,6 +38,7 @@ "sglang": ("dcp-size", "decode-context-parallel-size"), "vllm": ("decode-context-parallel-size",), "atom": ("decode-context-parallel-size",), + "tokenspeed": ("decode-context-parallel-size",), } diff --git a/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py b/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py index 75c3bf1f2c..991a6accc2 100644 --- a/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py +++ b/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py @@ -57,16 +57,22 @@ def spec_parameters(role: Mapping[str, Any], engine: str) -> dict[str, Any]: if engine == "tokenspeed": if "speculative-config" in args: raise ValueError( - "TokenSpeed AgentX requires explicit MTP flags, not speculative-config" + "TokenSpeed AgentX requires explicit MTP or DSPARK flags, not speculative-config" ) algorithm = str(args.get("speculative-algorithm", "")).lower() if not algorithm: return {} - if algorithm != "mtp": - raise ValueError("TokenSpeed AgentX currently supports only MTP speculation") + if algorithm == "mtp": + return {"method": "mtp", "num_speculative_tokens": args.get("speculative-num-steps")} + if algorithm != "dspark": + raise ValueError("TokenSpeed AgentX supports MTP and DSPARK speculation") return { - "method": "mtp", + "method": "dspark", "num_speculative_tokens": args.get("speculative-num-steps"), + "model": args.get("speculative-draft-model-path", ""), + "draft_sample_method": "probabilistic" + if args.get("enable-speculative-sampling") is True + else "greedy", } if engine == "tilert": if args.get("with-mtp") is not True: @@ -135,8 +141,10 @@ def spec_parameters(role: Mapping[str, Any], engine: str) -> dict[str, Any]: def verifier(role: Mapping[str, Any], engine: str) -> Fact: """How a role verifies drafts. Block, relaxed and adaptive verification are opt-in, so an unset flag means standard; a synthetic sampler becomes block on real runs. ATOM and TileRT - do not expose their verifier.""" + do not expose their verifier, and TokenSpeed's is known only when the role sets it.""" args = role.get("args") or {} + if engine == "tokenspeed" and (method := args.get("speculative-rejection-sample-method")): + return Fact(method, "explicit") if engine == "vllm": method = spec_parameters(role, engine).get("rejection_sample_method") if method == "synthetic": @@ -320,13 +328,20 @@ def build_overrides( ] elif worker_engine == "tokenspeed": key = "synthetic-acceptance-length" + args = role.get("args") or {} if worker_al is not None and worker_spec: overrides += ["--set", f"{prefix}.args.{key}={worker_al:g}"] overrides += ["--set", f'{prefix}.args.sampling-backend="greedy"'] + # Greedy verifies by exact match and rejects sampled verification; a synthetic + # length is itself the rejection method, so it conflicts with block. + for flag in ("enable-speculative-sampling", "speculative-rejection-sample-method"): + if flag in args: + overrides += ["--unset", f"{prefix}.args.{flag}"] else: - if key in (role.get("args") or {}): + if key in args: overrides += ["--unset", f"{prefix}.args.{key}"] - if worker_spec: + # DSPARK keeps the recipe's verification, which depends on the platform. + if worker_spec.get("method") == "mtp": overrides += ["--set", f'{prefix}.args.sampling-backend="flashinfer"'] elif worker_engine == "atom": key = "spec-decode-acceptance-length" diff --git a/inferencex-e2e/infx/srt_slurm/workload.py b/inferencex-e2e/infx/srt_slurm/workload.py index 14c19ef106..c7ff7c3a79 100644 --- a/inferencex-e2e/infx/srt_slurm/workload.py +++ b/inferencex-e2e/infx/srt_slurm/workload.py @@ -100,6 +100,7 @@ FABRIC_REFERENCE = "@fabric." INSTALLERS = { "tokenspeed-nightly.sh": ("router", "smg"), + "tokenspeed-nightly-rocm.sh": ("router", "smg"), "glm5.3-tilert-rocm.sh": ("router", "tilert-pd-router"), "dsv41flash-tilert-nv.sh": ("router", "tilert-pd-router"), "vllm-mooncake.sh": ("kv-offload-backend", "mooncake"), diff --git a/inferencex-e2e/infx/tests/golden_al_distribution/test_spec_identity.py b/inferencex-e2e/infx/tests/golden_al_distribution/test_spec_identity.py index ab6524f3d8..d79b69da91 100644 --- a/inferencex-e2e/infx/tests/golden_al_distribution/test_spec_identity.py +++ b/inferencex-e2e/infx/tests/golden_al_distribution/test_spec_identity.py @@ -178,6 +178,16 @@ def test_tokenspeed_identity_keeps_unread_semantics_unknown( assert run.verify == run.draft_sample == run.adaptive == Fact(None, "unknown") +def test_tokenspeed_dspark_reads_its_draft_and_explicit_verifier() -> None: + run = run_collection("kimik3.1", _role(**{ + "speculative-algorithm": "DSPARK", "speculative-num-steps": 5, + "speculative-draft-model-path": "Inferact/Kimi-K3.1-Pro-DSpark-preview", + "enable-speculative-sampling": True, "speculative-rejection-sample-method": "block", + }), "tokenspeed") + assert run.draft == "Inferact/Kimi-K3.1-Pro-DSpark-preview" + assert run.verify == Fact("block", "explicit") + + def test_adaptive_run_is_reported() -> None: spec = { "method": "dspark", "num_speculative_tokens": 5, "draft_sample_method": "probabilistic", diff --git a/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py b/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py index 729c664b35..b759c6761f 100644 --- a/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py +++ b/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py @@ -95,3 +95,30 @@ def test_tokenspeed_installer_uses_direct_private_wheels_and_one_public_index(tm "--flashinfer-version", "0.7.2.post1"], ["-m", "pip", "check"], ] + + +def test_tokenspeed_rocm_installer_keeps_the_image_torch_and_checks_it(tmp_path): + result, installs = run(tmp_path, "tokenspeed-nightly-rocm.sh", { + "TOKENSPEED_WHEEL_URL": "https://example.test/tokenspeed.whl#sha256=abc", + "TOKENSPEED_KERNEL_WHEEL_URL": "https://example.test/kernel.whl#sha256=def", + "TOKENSPEED_KERNEL_AMD_WHEEL_URL": "https://example.test/kernel_amd.whl#sha256=456", + "TOKENSPEED_ENGINE_WHEEL_URL": "https://example.test/engine.whl#sha256=123", + "TOKENSPEED_SCHEDULER_VERSION": "0.1.52", + "ROUTER_VERSION": "1.13.0.post20261027", + }) + + assert result.returncode == 0, result.stdout + result.stderr + assert installs == [[ + "-m", "pip", "install", "--break-system-packages", "--upgrade", + "--upgrade-strategy", "only-if-needed", + "--index-url", "https://pypi.org/simple", + "https://example.test/tokenspeed.whl#sha256=abc", + "https://example.test/kernel.whl#sha256=def", + "https://example.test/kernel_amd.whl#sha256=456", + "https://example.test/engine.whl#sha256=123", + "tokenspeed-scheduler==0.1.52", + "tokenspeed-smg==1.13.0.post20261027", + ]] + calls = [json.loads(line) for line in (tmp_path / "python3.jsonl").read_text().splitlines()] + assert calls[-2][0] == "-c" and "torch.version.hip" in calls[-2][1] + assert calls[-1] == ["-m", "pip", "check"] diff --git a/inferencex-e2e/infx/tests/srt_slurm/test_srt_single_node.py b/inferencex-e2e/infx/tests/srt_slurm/test_srt_single_node.py index b58d853af0..6b43e27a1e 100644 --- a/inferencex-e2e/infx/tests/srt_slurm/test_srt_single_node.py +++ b/inferencex-e2e/infx/tests/srt_slurm/test_srt_single_node.py @@ -404,6 +404,20 @@ def test_sglang_decode_context_parallel_size_must_match_the_point(point, flag): runtime_arguments(f"{path}:base", env) +def test_tokenspeed_decode_context_parallel_size_must_match_the_point(point): + path, recipe, env = point + recipe["engine"] = "tokenspeed" + recipe["roles"]["agg"]["args"] = { + "attn-tp-size": 4, "data-parallel-size": 1, "ep-size": 1, + "pipeline-parallel-size": 1, "decode-context-parallel-size": 4, + } + path.write_text(yaml.safe_dump({"base": recipe})) + env = {**env, "FRAMEWORK": "tokenspeed"} + runtime_arguments(f"{path}:base", {**env, "DCP_SIZE": "4"}) + with pytest.raises(ValueError, match=r"DCP_SIZE: recipe/matrix '1' != '4'"): + runtime_arguments(f"{path}:base", env) + + @pytest.mark.parametrize("record,expected", [ ({"status": "submitted", "slurm_job_id": "42", "output_dir": "/shared/42"}, ("42", "/shared/42")), ({"status": "error"}, None), diff --git a/inferencex-e2e/infx/tests/srt_slurm/test_synthetic_acceptance.py b/inferencex-e2e/infx/tests/srt_slurm/test_synthetic_acceptance.py index ea700316b6..f9bc8e9147 100644 --- a/inferencex-e2e/infx/tests/srt_slurm/test_synthetic_acceptance.py +++ b/inferencex-e2e/infx/tests/srt_slurm/test_synthetic_acceptance.py @@ -136,6 +136,51 @@ def test_tokenspeed_plan_uses_effective_mtp_depth_and_restores_real_sampling( assert recipe == original +def tokenspeed_dspark(**args: Any) -> dict[str, Any]: + return {"roles": {"agg": {"args": { + "speculative-algorithm": "DSPARK", + "speculative-draft-model-path": "Inferact/Kimi-K3.1-Pro-DSpark-preview", + "speculative-num-steps": 5, "speculative-num-draft-tokens": 6, + "speculative-eagle-topk": 1, **args, + }}}} + + +def test_tokenspeed_dspark_throughput_forces_greedy_and_evals_keep_block_verification( + tmp_path: Path, golden_dir: Path +) -> None: + curve = "kimi-k3.1-pro__dspark__kimi-k3.1-pro-dspark__probabilistic-block.yaml" + (golden_dir / curve).write_text(yaml.safe_dump({"kimi-k3.1-pro": {"thinking_on": {5: 3.41}}})) + verification = { + "sampling-backend": "triton", "enable-speculative-sampling": True, + "speculative-rejection-sample-method": "block", + } + recipe = tokenspeed_dspark(**verification) + environment = {**ENV, "MODEL_PREFIX": "kimik3.1"} + throughput = apply_native( + recipe, build_overrides(recipe, "tokenspeed", environment, golden_dir=golden_dir) + ) + assert throughput["roles"]["agg"]["args"] == { + **tokenspeed_dspark()["roles"]["agg"]["args"], + "synthetic-acceptance-length": 3.41, "sampling-backend": "greedy", + } + stale = tokenspeed_dspark(**verification, **{"synthetic-acceptance-length": 3.41}) + evaluation = apply_native(stale, build_overrides( + stale, "tokenspeed", {**environment, "EVAL_ONLY": "true"}, + golden_dir=tmp_path / "absent", + )) + assert evaluation == recipe + + +def test_tokenspeed_greedy_dspark_has_no_kimi_k31_curve(golden_dir: Path) -> None: + recipe = tokenspeed_dspark(**{"sampling-backend": "greedy"}) + with pytest.raises( + ValueError, match=r"No kimik3\.1 dspark golden curve .* draft sampling 'greedy'" + ): + build_overrides( + recipe, "tokenspeed", {**ENV, "MODEL_PREFIX": "kimik3.1"}, golden_dir=golden_dir + ) + + @pytest.mark.parametrize("environment", [{"IS_AGENTIC": "0"}, {"SPEC_DECODING": "none"}]) def test_tokenspeed_non_synthetic_runs_remove_forced_acceptance( tmp_path: Path, environment: dict[str, str] @@ -156,8 +201,10 @@ def test_tokenspeed_non_synthetic_runs_remove_forced_acceptance( ({"speculative-num-draft-tokens": 3}, "must equal"), ({"speculative-num-draft-tokens": True}, "must equal"), ({"speculative-eagle-topk": 2}, "topk 1"), - ({"speculative-algorithm": "DFLASH"}, "only MTP"), - ({"speculative-config": {"method": "mtp"}}, "explicit MTP flags"), + ({"speculative-algorithm": "DSPARK", "speculative-num-draft-tokens": 3}, "must equal"), + ({"speculative-algorithm": "DSPARK", "speculative-eagle-topk": 2}, "topk 1"), + ({"speculative-algorithm": "DFLASH"}, "MTP and DSPARK"), + ({"speculative-config": {"method": "mtp"}}, "explicit MTP or DSPARK flags"), ]) def test_tokenspeed_rejects_unsupported_speculation(golden_dir: Path, change, message) -> None: recipe = {"roles": {"agg": {"args": { diff --git a/inferencex-e2e/perf-changelog.yaml b/inferencex-e2e/perf-changelog.yaml index 9d46ec81cd..d44440d070 100644 --- a/inferencex-e2e/perf-changelog.yaml +++ b/inferencex-e2e/perf-changelog.yaml @@ -13117,3 +13117,13 @@ - "Add vLLM-Omni v0.32.0, pinned by its linux/amd64 digest, on the H100 H3 workload SGLang runs (h3-v2.yaml release-v1, C1) on 2, 4 and 8 GPUs: DiT TP2 with Ulysses 1, 2 and 4, since H3 does not fit one 80 GB GPU, with text-encoder TP and tiled VAE patch parallelism across all GPUs, and with the prompt-embedding cache and cross-request AdaLN projection reuse disabled." - "The H3 snapshot staged on h100-dsxe lacks Ref2VA/model_index.json, which the vLLM-Omni model view requires, so its launcher downloads the pinned snapshot without the Ref2VA weights into its hub cache before it submits a video job, as on a100-cw; the download keeps its xet cache in a temporary directory, since the runner's HF_HOME is a read-only model store." pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/4969 + +- config-keys: + - kimik3.1-fp4-mi355x-tokenspeed-agentic-dspark + scenario-type: + - agentic-coding + description: + - "Add Kimi K3.1 Pro MXFP4 MI355X AgentX on TokenSpeed at concurrency 1, 4, 8, 16, 24, 32 and 48: attention and MoE TP8 with EP1, the released Inferact/Kimi-K3.1-Pro-DSpark draft on the MHA drafter backend (7 drafts at concurrency 1 to 8, 5 at 16 to 48), FP8 KV cache with the MXFP4 DSA indexer key cache, 1,048,560-token context. From concurrency 8, a 128 GB per GPU Host L2 KV store pinned from the GTT pool (HSA_USERPTR_FOR_PAGED_MEM=0), KV parallel 8 with DCP8 and prefill graphs up to 3072 tokens (concurrency 1 and 4 run without host KV offload); every point has its own running-request cap and prefill/decode intervals, with short-prefill-first at 24 and 32 and mixed batches at 32 and 48." + - "Pin the runner image by digest, tokenspeed-smg 1.16.0.post20261118, the checkpoint and DSpark draft revisions, and the November 19 TokenSpeed 0.1.1.post20261119, kernel 0.1.5.post20261119, kernel-amd 0.1.4.post20261119 and engine 0.1.1.post20261119 wheels by release URL and SHA256, and tokenspeed-scheduler 0.1.58 from PyPI. tokenspeed-nightly-rocm.sh keeps the image's ROCm torch. Bind TokenSpeed's decode-context-parallel-size to the matrix dcp-size." + - "Select golden DSpark acceptance (probabilistic draft, block verification) and the greedy sampler for TokenSpeed DSPARK throughput, removing speculative sampling and block verification; evals verify for real with the triton sampler, speculative sampling and block verification." + pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/5101