diff --git a/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/dsv41flash-tilert-chat-template.jinja b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/dsv41flash-tilert-chat-template.jinja new file mode 100644 index 0000000000..06332f53cc --- /dev/null +++ b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/dsv41flash-tilert-chat-template.jinja @@ -0,0 +1,286 @@ +{#- Based on chat_template.jinja of the model repo deepseek-ai/DeepSeek-V4.1-Flash (revision + 314113f8a7dadb388215396ba5fbee2c610a04d6). Changed: the 8 lines after this notice are added; + everything below them is that file, unchanged. Its license: + + MIT License + + Copyright (c) 2023 DeepSeek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +-#} +{#- The model repo's chat_template.jinja with two changes, so that it renders what vLLM's Python + DeepSeek-V4.1 tokenizer mode renders: the generation prompt is always added (vLLM ignores + add_generation_prompt), and `thinking` is read as vLLM reads it (thinking on when `thinking` or + `enable_thinking` is true; when either key is given and neither is true, chat mode). -#} +{%- set add_generation_prompt = true -%} +{%- if thinking_mode is not defined and thinking is defined -%} + {%- set thinking_mode = "thinking" if (thinking or (enable_thinking is defined and enable_thinking)) else "chat" -%} +{%- endif -%} +{#- DeepSeek-V4.1 chat template, ported from encoding/encoding.py in the model repo. + Extra kwargs: thinking_mode ("thinking" | "chat", default "thinking"; enable_thinking=true/false is accepted + as an alias), drop_thinking (default true), reasoning_effort (int in [1, 100] or "low"/"medium"/"high"/"max", + default "high"). Assistant reasoning is read from reasoning_content, or from thinking as an alias. -#} +{%- set IMG = "<|deepseek_image|>" -%} +{%- set DSML = "|DSML|" -%} + +{%- if thinking_mode is not defined -%} + {%- set thinking_mode = "chat" if (enable_thinking is defined and enable_thinking is not none and not enable_thinking) else "thinking" -%} +{%- endif -%} +{%- if thinking_mode not in ["chat", "thinking"] -%} + {{- raise_exception("Invalid thinking_mode `" ~ thinking_mode ~ "`, should be \"chat\" or \"thinking\"") -}} +{%- endif -%} +{%- if drop_thinking is not defined -%}{%- set drop_thinking = true -%}{%- endif -%} +{%- if add_generation_prompt is not defined -%}{%- set add_generation_prompt = false -%}{%- endif -%} +{%- if tools is not defined -%}{%- set tools = none -%}{%- endif -%} + +{%- if reasoning_effort is not defined or reasoning_effort is none -%}{%- set reasoning_effort = "high" -%}{%- endif -%} +{%- set effort_map = {"low": 50, "medium": 62, "high": 75, "max": 100} -%} +{%- if reasoning_effort is string and reasoning_effort in effort_map -%} + {%- set budget = effort_map[reasoning_effort] -%} +{%- elif reasoning_effort is integer and 1 <= reasoning_effort <= 100 -%} + {%- set budget = reasoning_effort -%} +{%- else -%} + {{- raise_exception("Invalid reasoning effort: " ~ reasoning_effort ~ ", should be int within [1,100] or one of \"low\", \"medium\", \"high\", \"max\"") -}} +{%- endif -%} + +{#- Text of text/image blocks joined by blank lines; other block types are dropped. -#} +{%- macro joined_text(blocks) -%} + {%- set jt = namespace(parts=[]) -%} + {%- for b in blocks -%} + {%- if b.type == "text" -%} + {%- if IMG in (b.text or "") -%}{{- raise_exception("Text block contains image placeholder " ~ IMG ~ ". Images should be separate content blocks.") -}}{%- endif -%} + {%- set jt.parts = jt.parts + [b.text or ""] -%} + {%- elif b.type in ["image", "image_url"] -%} + {%- set jt.parts = jt.parts + [IMG] -%} + {%- endif -%} + {%- endfor -%} + {{- jt.parts | join("\n\n") -}} +{%- endmacro -%} + +{#- Splits/validates "ns::name" against an explicit namespace and returns the qualified name. -#} +{%- macro qualified_name(name, ns) -%} + {%- if ns is mapping -%}{%- set ns = ns.name -%}{%- endif -%} + {%- set parts = name.split("::", 1) -%} + {%- if parts | length == 2 -%} + {%- if ns is not none and ns != parts[0] -%}{{- raise_exception("Conflicting tool namespaces: " ~ ns ~ " != " ~ parts[0]) -}}{%- endif -%} + {%- set ns = parts[0] -%} + {%- set name = parts[1] -%} + {%- endif -%} + {%- if "::" in name -%}{{- raise_exception("Tool name must not contain '::': " ~ name) -}}{%- endif -%} + {%- if ns is not none and "::" in ns -%}{{- raise_exception("Tool namespace must not contain '::': " ~ ns) -}}{%- endif -%} + {{- name if ns is none else ns ~ "::" ~ name -}} +{%- endmacro -%} + +{%- macro render_tools(tool_list) -%} + {%- set ts = namespace(schemas=[]) -%} + {%- for tool in tool_list -%} + {%- set fn = tool.function if tool.function is defined else tool -%} + {%- set ns = tool.namespace if tool.namespace is defined and tool.namespace is not none else fn.get("namespace") -%} + {%- set schema = namespace(d={}) -%} + {%- for k, v in fn.items() if k != "namespace" -%}{%- set schema.d = dict(schema.d, **{k: v}) -%}{%- endfor -%} + {%- set schema.d = dict(schema.d, name=qualified_name(fn.name, ns)) -%} + {%- if ns is mapping and ns.description -%} + {%- set schema.d = dict(schema.d, description=ns.description ~ "\n" ~ (fn.description or "")) -%} + {%- endif -%} + {%- set ts.schemas = ts.schemas + [schema.d | tojson] -%} + {%- endfor -%} + {{- "## Tools\n\nYou have access to a set of tools to help answer the user's question. You can invoke tools by writing a \"<|DSML| calls>\" block like the following:\n\n<|DSML| calls>\n<|DSML| invoke name=\"$TOOL_NAME\">\n<|DSML| parameter name=\"$PARAMETER_NAME\" string=\"true|false\">$PARAMETER_VALUE\n...\n\n<|DSML| invoke name=\"$TOOL_NAME2\">\n...\n\n\n\nString parameters should be specified as is and set `string=\"true\"`. For all other types (numbers, booleans, arrays, objects), pass the value in JSON format and set `string=\"false\"`.\n\nIf thinking_mode is enabled (triggered by ), you MUST output your complete reasoning inside ... BEFORE any tool calls or final response.\n\nOtherwise, output directly after with tool calls or final response.\n\n### Available Tool Schemas\n\n" -}} + {{- ts.schemas | join("\n") -}} + {{- "\n\nYou MUST strictly follow the above defined tool name and parameter schemas to invoke tool calls.\n" -}} +{%- endmacro -%} + +{#- 1. Merge tool results (and consecutive user turns) into user messages made of content blocks. -#} +{%- set mns = namespace(list=[]) -%} +{%- for msg in messages -%} + {%- set content = msg.get("content") -%} + {%- set is_blocks = content is iterable and content is not string and content is not mapping -%} + {%- if content is string and IMG in content -%} + {{- raise_exception("Message content contains image special token " ~ IMG ~ ". Images should be provided as image content blocks.") -}} + {%- endif -%} + {%- set rc = msg.reasoning_content if msg.get("reasoning_content") is not none else msg.get("thinking") -%} + {%- if rc is string and IMG in rc -%} + {{- raise_exception("reasoning_content contains image special token " ~ IMG) -}} + {%- endif -%} + {%- set prev = mns.list[-1] if mns.list else none -%} + {%- if msg.role == "tool" -%} + {%- set tblock = {"type": "tool_result", "tool_use_id": msg.get("tool_call_id", ""), "content": joined_text(content) if is_blocks else msg.get("content", "")} -%} + {%- if prev is not none and prev.role == "user" -%} + {%- set mns.list = mns.list[:-1] + [dict(prev, content_blocks=prev.content_blocks + [tblock])] -%} + {%- else -%} + {%- set mns.list = mns.list + [{"role": "user", "content_blocks": [tblock]}] -%} + {%- endif -%} + {%- elif msg.role == "user" -%} + {%- set blocks = content if is_blocks else [{"type": "text", "text": content or ""}] -%} + {%- if prev is not none and prev.role == "user" and prev.get("task") is none -%} + {%- set mns.list = mns.list[:-1] + [dict(prev, content_blocks=prev.content_blocks + blocks)] -%} + {%- else -%} + {%- set mns.list = mns.list + [dict(msg, content_blocks=blocks)] -%} + {%- endif -%} + {%- else -%} + {%- set mns.list = mns.list + [msg] -%} + {%- endif -%} +{%- endfor -%} + +{#- Top-level tools attach to a leading system message, or to a new empty one. -#} +{%- if tools -%} + {%- if mns.list and mns.list[0].role == "system" -%} + {%- if not mns.list[0].get("tools") -%}{%- set mns.list = [dict(mns.list[0], tools=tools)] + mns.list[1:] -%}{%- endif -%} + {%- else -%} + {%- set mns.list = [{"role": "system", "content": "", "tools": tools}] + mns.list -%} + {%- endif -%} +{%- endif -%} + +{#- 2. Reorder tool results to match the tool_calls order of the preceding assistant message. -#} +{%- set sns = namespace(list=[], ids=[]) -%} +{%- for m in mns.list -%} + {%- if m.role == "assistant" and m.get("tool_calls") -%} + {%- set sns.ids = [] -%} + {%- for tc in m.tool_calls -%} + {%- set sns.ids = sns.ids + [tc.get("id") or tc.get("function", {}).get("id", "")] -%} + {%- endfor -%} + {%- set sns.list = sns.list + [m] -%} + {%- elif m.role == "user" and m.content_blocks -%} + {%- set tb = namespace(blocks=[]) -%} + {%- for b in m.content_blocks if b.type == "tool_result" -%} + {%- set order = namespace(idx=0) -%} + {%- for tc_id in sns.ids -%} + {%- if tc_id and tc_id == b.get("tool_use_id", "") -%}{%- set order.idx = loop.index0 -%}{%- endif -%} + {%- endfor -%} + {%- set tb.blocks = tb.blocks + [dict(b, _order=order.idx)] -%} + {%- endfor -%} + {%- if tb.blocks | length > 1 -%} + {%- set sorted_blocks = tb.blocks | sort(attribute="_order") -%} + {%- set rb = namespace(blocks=[], i=0) -%} + {%- for b in m.content_blocks -%} + {%- if b.type == "tool_result" -%} + {%- set rb.blocks = rb.blocks + [sorted_blocks[rb.i]] -%} + {%- set rb.i = rb.i + 1 -%} + {%- else -%} + {%- set rb.blocks = rb.blocks + [b] -%} + {%- endif -%} + {%- endfor -%} + {%- set sns.list = sns.list + [dict(m, content_blocks=rb.blocks)] -%} + {%- else -%} + {%- set sns.list = sns.list + [m] -%} + {%- endif -%} + {%- else -%} + {%- set sns.list = sns.list + [m] -%} + {%- endif -%} +{%- endfor -%} +{%- set msgs = sns.list -%} + +{#- Mid-conversation system messages count as user turns. Tools anywhere disable drop_thinking. -#} +{%- set state = namespace(last_user=-1, has_tools=false) -%} +{%- for m in msgs -%} + {%- if m.role == "user" or (m.role == "system" and loop.index0 > 0) -%}{%- set state.last_user = loop.index0 -%}{%- endif -%} + {%- if m.get("tools") -%}{%- set state.has_tools = true -%}{%- endif -%} +{%- endfor -%} +{%- set effective_drop = drop_thinking and not state.has_tools -%} +{%- set thinking = thinking_mode == "thinking" -%} + +{{- "<|begin▁of▁sentence|>" -}} +{#- 3. Render each message. -#} +{%- for m in msgs -%} + {%- set idx = loop.index0 -%} + {%- set content = m.get("content") -%} + {%- if content is iterable and content is not string and content is not mapping -%}{%- set content = joined_text(content) -%}{%- endif -%} + + {%- if idx == 0 -%} + {%- if thinking or m.role == "system" -%}{{- "<|System|>" -}}{%- endif -%} + {%- if thinking -%}{{- "Reasoning Effort: " ~ budget ~ " (range 1-100, the higher the value, the more thorough the reasoning)\n\n" -}}{%- endif -%} + {%- endif -%} + + {%- if m.role == "system" -%} + {%- if idx > 0 -%}{{- "<|System|>" -}}{%- endif -%} + {{- content or "" -}} + {%- if m.get("tools") -%}{{- "\n\n" ~ render_tools(m.tools) -}}{%- endif -%} + {%- if m.get("response_format") -%} + {{- "\n\n## Response Format:\n\nYou MUST strictly adhere to the following schema to reply:\n" ~ (m.response_format | tojson) -}} + {%- endif -%} + + {%- elif m.role == "user" -%} + {{- "<|User|>" -}} + {%- set up = namespace(parts=[]) -%} + {%- for b in m.content_blocks -%} + {%- if b.type == "text" -%} + {%- if IMG in (b.text or "") -%}{{- raise_exception("Text block contains image placeholder " ~ IMG ~ ". Images should be separate content blocks.") -}}{%- endif -%} + {%- set up.parts = up.parts + [b.text or ""] -%} + {%- elif b.type in ["image", "image_url"] -%} + {%- set up.parts = up.parts + [IMG] -%} + {%- elif b.type == "tool_result" -%} + {%- set tc = b.get("content", "") -%} + {%- if tc is iterable and tc is not string and tc is not mapping -%} + {%- set sub = namespace(parts=[]) -%} + {%- for s in tc -%} + {%- if s.type == "text" -%}{%- set sub.parts = sub.parts + [s.get("text", "")] -%} + {%- elif s.type in ["image", "image_url"] -%}{%- set sub.parts = sub.parts + [IMG] -%} + {%- else -%}{%- set sub.parts = sub.parts + ["[Unsupported " ~ s.type ~ "]"] -%} + {%- endif -%} + {%- endfor -%} + {%- set tc = sub.parts | join("\n\n") -%} + {%- endif -%} + {%- set up.parts = up.parts + ["" ~ tc ~ ""] -%} + {%- else -%} + {%- set up.parts = up.parts + ["[Unsupported " ~ b.type ~ "]"] -%} + {%- endif -%} + {%- endfor -%} + {{- up.parts | join("\n\n") -}} + + {%- elif m.role == "latest_reminder" -%} + {{- "<|latest_reminder|>" ~ content -}} + + {%- elif m.role == "assistant" -%} + {%- set prev_has_task = idx > 0 and msgs[idx - 1].get("task") is not none -%} + {%- if thinking and not prev_has_task and (not effective_drop or idx > state.last_user) -%} + {{- ((m.reasoning_content if m.get("reasoning_content") is not none else m.get("thinking")) or "") ~ "" -}} + {%- endif -%} + {{- content or "" -}} + {%- if m.get("tool_calls") -%} + {%- set tcs = namespace(lines=[]) -%} + {%- for tc in m.tool_calls -%} + {%- set fn = tc.function -%} + {%- set params = namespace(lines=[]) -%} + {%- set args = fn.arguments if fn.arguments is mapping else {"arguments": fn.arguments} -%} + {%- for k, v in args.items() -%} + {%- set params.lines = params.lines + ["<" ~ DSML ~ " parameter name=\"" ~ k ~ "\" string=\"" ~ ("true" if v is string else "false") ~ "\">" ~ (v if v is string else v | tojson) ~ ""] -%} + {%- endfor -%} + {%- set name = qualified_name(fn.name, tc.get("namespace") or fn.get("namespace")) -%} + {%- set tcs.lines = tcs.lines + ["<" ~ DSML ~ " invoke name=\"" ~ name ~ "\">\n" ~ params.lines | join("\n") ~ "\n"] -%} + {%- endfor -%} + {{- "\n\n<" ~ DSML ~ " calls>\n" ~ tcs.lines | join("\n") ~ "\n" -}} + {%- endif -%} + {%- if not m.get("wo_eos", false) -%}{{- "<|end▁of▁sentence|>" -}}{%- endif -%} + + {%- else -%} + {{- raise_exception("Unknown role: " ~ m.role) -}} + {%- endif -%} + + {#- Transition tokens, only when the next message is an assistant/latest_reminder turn or this is the last one. -#} + {%- if loop.last or msgs[idx + 1].role in ["assistant", "latest_reminder"] -%} + {%- set task = m.get("task") -%} + {%- if task is not none -%} + {%- set task_tokens = {"action": "<|action|>", "query": "<|query|>", "authority": "<|authority|>", "domain": "<|domain|>", "title": "<|title|>", "read_url": "<|read_url|>"} -%} + {%- if task not in task_tokens -%}{{- raise_exception("Invalid task: '" ~ task ~ "'") -}}{%- endif -%} + {%- if task == "action" -%}{{- "<|Assistant|>" ~ ("" if thinking else "") -}}{%- endif -%} + {{- task_tokens[task] -}} + {%- elif (m.role == "user" or (m.role == "system" and idx > 0)) and (add_generation_prompt or not loop.last) -%} + {{- "<|Assistant|>" ~ ("" if thinking and (not effective_drop or idx >= state.last_user) else "") -}} + {%- endif -%} + {%- endif -%} +{%- endfor -%} diff --git a/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/dsv41flash/tilert/mi355x-fp4/agentx/disagg-1p1d-tp4-tp8-mtp.yaml b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/dsv41flash/tilert/mi355x-fp4/agentx/disagg-1p1d-tp4-tp8-mtp.yaml new file mode 100644 index 0000000000..a74a423863 --- /dev/null +++ b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/dsv41flash/tilert/mi355x-fp4/agentx/disagg-1p1d-tp4-tp8-mtp.yaml @@ -0,0 +1,124 @@ +schema: 2 +name: dsv41flash-mi355x-tilert-agentx +slurm: + time_limit: "08:00:00" +resources: + gpu_type: mi355x + gpus_per_node: 8 +setup_script: glm5.3-tilert-rocm.sh +environment: + RDMAV_FORK_SAFE: "1" + NCCL_SOCKET_IFNAME: "@fabric.socket-ifname" + GLOO_SOCKET_IFNAME: "@fabric.socket-ifname" + NCCL_IB_HCA: "@fabric.rdma-devices" +roles: + prefill: + engine: + type: vllm + set_visible_devices: true + # The vLLM nightly's PyPI Mooncake sends cross-node writes over HIP IPC and its ionic + # provider lacks kernel ABI 4; this image carries a multi-protocol build and a newer provider. + container: ghcr.io/tile-ai/tilert-rocm-prefill:0.1.7@sha256:8a88e2aa51105facd103217b0dc353258f3fc9368318c3bb62f0400bb8dd1ed5 + nodes: 1 + workers: 1 + gpus: 4 + env: + TILERT_ROLE: prefill + VLLM_ROCM_USE_AITER: "1" + VLLM_ROCM_USE_AITER_MOE: "1" + VLLM_ROCM_QUICK_REDUCE_QUANTIZATION: NONE + AITER_TRITON_LOG_LEVEL: ERROR + VLLM_USE_BREAKABLE_CUDAGRAPH: "1" + OMP_NUM_THREADS: "1" + PYTHONUNBUFFERED: "1" + VLLM_ENGINE_READY_TIMEOUT_S: "3600" + # Register the VRAM staging buffer with the ionic HCAs through dmabuf. + MOONCAKE_DISABLE_HIP_DMABUF: "0" + # vLLM's Rust front end (as the MI355X vLLM DeepSeek-V4.1-Flash recipes run it): parses the + # router's token-id request and returns the first token without the Python front end's + # detokenization of the whole prompt. + VLLM_USE_RUST_FRONTEND: "1" + args: + served-model-name: deepseek-ai/DeepSeek-V4.1-Flash + tensor-parallel-size: 4 + language-model-only: true + tokenizer-mode: deepseek_v41 + # The router reads the first token id from the prefill's logprobs; it asks for token ids per + # request (return_tokens_as_token_ids), which the Rust front end supports. + moe-backend: aiter + gpu-memory-utilization: 0.85 + attention-config: '{"indexer_kv_dtype":"mxfp4","indexer_sparse_logits":true}' + block-size: 128 + # The DSpark draft runs on the prefill too, so the decode receives its window state. + speculative-config: '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"block","enable_adaptive_verification":false}' + max-model-len: 1048576 + max-num-batched-tokens: 32768 + max-num-seqs: 1 + engram-config: '{"cpu_offload":false}' + enable-prefix-caching: true + # CUDA graphs cover the prefill's step sizes too: an AgentX turn computes a few thousand new + # tokens, and in eager mode such a step is bound by launching its ~2.5K kernels. + compilation-config: '{"cudagraph_capture_sizes":[1,2,4,8,16,32,64,128,256,512,768,1024,1536,2048,3072,4096,6144,8192]}' + kv-transfer-config: >- + {"kv_connector":"DsV41TileRTConnector","kv_connector_module_path":"tilert.pd_vllm.dsv41_prefill_connector", + "kv_role":"kv_producer","kv_connector_extra_config":{ + "tilert_model":"dsv41","tilert_max_seq_len":1048576,"tilert_transport":"mooncake"}} + decode: + engine: tilert + container: ghcr.io/tile-ai/tilert-rocm-decode:0.1.6@sha256:48c30d7636a561b4edf781ac3c7712e09fa9a0b2f1292863b72c2d8e4bcb492a + nodes: 1 + workers: 1 + gpus: 8 + env: + TILERT_ROLE: decode + # The dsv41 profile lands the whole prompt KV in one receive buffer. + TILERT_PD_SHARDS: "1" + # Wake the stream on every token instead of the 200 ms default, so a short + # request's tokens are not held until it ends. + TILERT_DECODE_POLL_MS: "2" + args: + model: dsv41 + # TileRT reads the Hugging Face checkpoint directly; no converted weights. The cluster + # stages no DeepSeek-V4.1-Flash checkpoint, so the job is in Hub mode and mounts nothing + # at /model: read the shared Hub cache's snapshot instead (refs/main, the revision the + # prefill's vLLM loads and the chat template is based on). + model-weights-dir: /hf_hub_cache/hub/models--deepseek-ai--DeepSeek-V4.1-Flash/snapshots/314113f8a7dadb388215396ba5fbee2c610a04d6 + max-seq-len: 1048576 + transport: mooncake + with-mtp: true + num-mtp: 5 +frontend: + type: tilert-router + container_image: ghcr.io/tile-ai/tilert-rocm-decode:0.1.6@sha256:48c30d7636a561b4edf781ac3c7712e09fa9a0b2f1292863b72c2d8e4bcb492a + enable_multiple_frontends: false + env: + TILERT_ROLE: router + args: + parser: none + model-path: /hf_hub_cache/hub/models--deepseek-ai--DeepSeek-V4.1-Flash/snapshots/314113f8a7dadb388215396ba5fbee2c610a04d6 + queue-timeout: 1800 + # The router renders the chat template and tokenizes each request itself, so the prefill + # receives token ids. The template renders what vLLM's deepseek_v41 tokenizer mode renders; the + # router checks that against the prefill's /tokenize at startup and stays off otherwise. + chat-template: /configs/dsv41flash-tilert-chat-template.jinja +sbatch_directives: + cpus-per-task: "128" + mem: "0" +srun_options: + mem: "0" + container-writable: "" + container-remap-root: "" +health_check: + max_attempts: 2160 + interval_seconds: 5 +benchmark: + env: + TOKENIZER: /hf_hub_cache/hub/models--deepseek-ai--DeepSeek-V4.1-Flash/snapshots/314113f8a7dadb388215396ba5fbee2c610a04d6 + SERVED_MODEL_NAME: deepseek-ai/DeepSeek-V4.1-Flash + AIPERF_REQUIRED_SERVER_METRIC_PREFIX: "vllm:" + # Thinking on with high effort, the regime of the golden acceptance curve. + AIPERF_EXTRA_INPUTS: '{"chat_template_kwargs":{"reasoning_effort":"high","thinking":true},"temperature":1}' + HF_HOME: /logs/hf_cache + HF_HUB_OFFLINE: "" + TRANSFORMERS_VERBOSITY: error + TOKENIZERS_PARALLELISM: "false" diff --git a/inferencex-e2e/configs/amd-master.yaml b/inferencex-e2e/configs/amd-master.yaml index 04775a3909..60110fa19d 100644 --- a/inferencex-e2e/configs/amd-master.yaml +++ b/inferencex-e2e/configs/amd-master.yaml @@ -1002,6 +1002,37 @@ glm5.3-fp8-mi355x-tilert-agentic: ep: 1 dp-attn: false +dsv41flash-fp4-mi355x-tilert-agentic-dspark: + image: ghcr.io/tile-ai/tilert-rocm-decode:0.1.6@sha256:48c30d7636a561b4edf781ac3c7712e09fa9a0b2f1292863b72c2d8e4bcb492a + model: deepseek-ai/DeepSeek-V4.1-Flash + model-prefix: dsv41flash + runner: cluster:mi355x-amds + precision: fp4 + framework: tilert + router: { name: tilert-pd-router, version: "0.1.7.post2" } + multinode: true + disagg: true + kv-p2p-transfer: mooncake + srt-recipe-dir: dsv41flash/tilert/mi355x-fp4/agentx + scenarios: + agentic-coding: + - search-space: + - spec-decoding: "mtp" + conc-list: [1] + srt-recipe: disagg-1p1d-tp4-tp8-mtp.yaml + prefill: + num-worker: 1 + tp: 4 + ep: 1 + dp-attn: false + additional-settings: + - "PREFILL_IMAGE=ghcr.io/tile-ai/tilert-rocm-prefill:0.1.7@sha256:8a88e2aa51105facd103217b0dc353258f3fc9368318c3bb62f0400bb8dd1ed5" + decode: + num-worker: 1 + tp: 8 + ep: 1 + dp-attn: false + # SGLang ROCm 10 MI35X release image. TP2/EP1 up to c32, TP4/EP1 up to c16, # DP2 attention with TP MoE at c32 and c64 (c32 overlaps TP2). Host Engram on all. dsv41flash-fp4-mi355x-sglang-agentic-dspark: diff --git a/inferencex-e2e/infx/srt_slurm/spec_identity.py b/inferencex-e2e/infx/srt_slurm/spec_identity.py index 4b22d67f13..11090741b5 100644 --- a/inferencex-e2e/infx/srt_slurm/spec_identity.py +++ b/inferencex-e2e/infx/srt_slurm/spec_identity.py @@ -186,7 +186,9 @@ def audit( def spec_arguments(role: Mapping[str, Any]) -> dict[str, Any]: """The speculative arguments of a role, as the snapshot records them.""" - return {k: v for k, v in (role.get("args") or {}).items() if k.startswith(SPEC_ARGUMENTS)} + args = (role.get("args") or {}).items() + # TileRT's draft method follows its model profile. + return {k: v for k, v in args if k.startswith(SPEC_ARGUMENTS) or k == "model"} def snapshot(matrix: list[Mapping[str, Any]], root: Path) -> list[dict[str, Any]]: diff --git a/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py b/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py index 4373b27f42..75c3bf1f2c 100644 --- a/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py +++ b/inferencex-e2e/infx/srt_slurm/synthetic_acceptance.py @@ -71,7 +71,8 @@ def spec_parameters(role: Mapping[str, Any], engine: str) -> dict[str, Any]: if engine == "tilert": if args.get("with-mtp") is not True: return {} - return {"method": "mtp", "num_speculative_tokens": args.get("num-mtp")} + method = "dspark" if args.get("model") == "dsv41" else "mtp" + return {"method": method, "num_speculative_tokens": args.get("num-mtp")} if engine == "atom": method = args.get("method") if not method: 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 67f0c8e767..ab6524f3d8 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 @@ -10,7 +10,7 @@ load_identities, parse_identity, ) -from infx.srt_slurm.spec_identity import audit, run_collection +from infx.srt_slurm.spec_identity import audit, run_collection, spec_arguments DEFAULT = {"value": None, "source": "default"} CHAIN = {"value": "chain", "source": "documented"} @@ -206,3 +206,8 @@ def test_precision_and_kv_cache_dtypes_are_read_per_engine() -> None: config = {"decoding_type": "MTP", "max_draft_len": 3} trt = _role(speculative_config=config, kv_cache_config={"dtype": "fp8"}) assert run_collection("dsv4", trt, "dynamo-trt").kv_cache_dtype == Fact("fp8", "explicit") + + +def test_snapshot_arguments_keep_the_tilert_model_profile() -> None: + role = _role(model="dsv41", **{"with-mtp": True, "num-mtp": 5, "model-weights-dir": "/w"}) + assert spec_arguments(role) == {"model": "dsv41", "with-mtp": True, "num-mtp": 5} 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 4c5fa24ae4..ea700316b6 100644 --- a/inferencex-e2e/infx/tests/srt_slurm/test_synthetic_acceptance.py +++ b/inferencex-e2e/infx/tests/srt_slurm/test_synthetic_acceptance.py @@ -70,6 +70,11 @@ def golden_dir(tmp_path: Path) -> Path: "muse-spark-open", 3.4, ), + ( + "deepseek-v4.1-flash__dspark__native__probabilistic-block.yaml", + "deepseek-v4.1-flash", + 3.3, + ), ]: (directory / filename).write_text( yaml.safe_dump( @@ -573,6 +578,16 @@ def test_tilert_plan_uses_caller_decode_depth_and_keeps_prefill_real( } +def test_tilert_dsv41_profile_selects_the_dspark_curve(tmp_path: Path, golden_dir: Path) -> None: + recipe = tilert_recipe() + recipe["roles"]["decode"]["args"]["model"] = "dsv41" + path = tmp_path / "tilert.yaml" + path.write_text(yaml.safe_dump(recipe)) + env = {**ENV, "MODEL_PREFIX": "dsv41flash"} + commands = plan_commands(str(path), "tilert", [], env, golden_dir=golden_dir) + assert [command.acceptance_length for command in commands] == [3.3] + + @pytest.mark.parametrize( "environment", [{"EVAL_ONLY": "true"}, {"IS_AGENTIC": "0"}, {"SPEC_DECODING": "none"}, {}], diff --git a/inferencex-e2e/perf-changelog.yaml b/inferencex-e2e/perf-changelog.yaml index 81d3260a6c..2cebb4fd10 100644 --- a/inferencex-e2e/perf-changelog.yaml +++ b/inferencex-e2e/perf-changelog.yaml @@ -12224,3 +12224,14 @@ - "GPU-resident KV at concurrency 2-16; HiCache with SGLang's default auto-sized host tier (~119 GiB, 127 GB per rank; ~1,020 GB per node) at concurrency 20, 24, 28 and 32." - "Prefill CUDA graphs are disabled after a CUDA misaligned-address fault during ~336k-token single-request replay at concurrency 1." pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/4719 + +- config-keys: + - dsv41flash-fp4-mi355x-tilert-agentic-dspark + scenario-type: + - agentic-coding + description: + - "Add DeepSeek-V4.1-Flash FP4 AgentX on MI355X with a disaggregated TileRT setup at concurrency 1: one vLLM ROCm prefill (ghcr.io/tile-ai/tilert-rocm-prefill:0.1.7: the validated MI355X DeepSeek-V4.1-Flash vLLM nightly e68efc68 plus the multi-protocol Mooncake build and ionic verbs provider of the TileRT ROCm decode image; TP4, vLLM's Rust front end, CUDA graphs up to 8192-token steps) sends the prompt KV over Mooncake to one TileRT decode (ghcr.io/tile-ai/tilert-rocm-decode:0.1.6 with tilert 0.1.7.post2; TP8, five drafts from the checkpoint's own DSpark head) behind the TileRT PD router, with the full 1M context on both ranks and no context cap on the replay." + - "Throughput runs simulate the DeepSeek-V4.1-Flash DSpark golden AL at five drafts (3.51): a TileRT decode now takes its draft method from its model profile, and the dsv41 profile maps to dspark." + - "The TileRT router renders the chat template and tokenizes each request itself, so the prefill receives token ids: the model's chat template, adapted to render exactly what the prefill's vLLM deepseek_v41 tokenizer mode renders, ships as configs/dsv41flash-tilert-chat-template.jinja. tilert 0.1.7.post1 lets the router do so on the prefill's node; the prefill's flags match the other DeepSeek-V4.1-Flash configs." + - "tilert 0.1.7.post2 cuts the time to first token on long agentic contexts: the router asks the prefill for token ids per request (so the prefill runs vLLM's Rust front end) and reuses the token ids of the conversation prefix it has already rendered; the decode imports only the KV past the prefix it already holds from the previous turn, checked byte for byte against what it received then; the prefill stages the KV for the decode in a few vectorised copies." + pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/XXX