[skill] Remove outdated llm-serving-auto-benchmark skill (#29487)
This commit is contained in:
@@ -34,8 +34,8 @@ def build_triage_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="analyze_llm_torch_profile.py",
|
||||
description=(
|
||||
"Compact LLM torch-profiler triage entrypoint for SGLang, vLLM, and "
|
||||
"TensorRT-LLM. "
|
||||
"Compact LLM torch-profiler triage entrypoint for SGLang, vLLM, "
|
||||
"TensorRT-LLM, and TokenSpeed. "
|
||||
"This prints three tables: kernel mapping, overlap opportunities, "
|
||||
"and fuse opportunities. "
|
||||
"Use either a single trace/profile input or a mapping+formal two-trace pair."
|
||||
@@ -45,7 +45,17 @@ def build_triage_parser() -> argparse.ArgumentParser:
|
||||
"--framework",
|
||||
type=str,
|
||||
default="auto",
|
||||
choices=["auto", "sglang", "vllm", "trtllm", "tllm", "tensorrt-llm"],
|
||||
choices=[
|
||||
"auto",
|
||||
"sglang",
|
||||
"vllm",
|
||||
"trtllm",
|
||||
"tllm",
|
||||
"tensorrt-llm",
|
||||
"tokenspeed",
|
||||
"token-speed",
|
||||
"ts",
|
||||
],
|
||||
help=(
|
||||
"Serving framework. Use auto to detect from trace contents, path hints, "
|
||||
"or URL features."
|
||||
@@ -64,7 +74,9 @@ def build_triage_parser() -> argparse.ArgumentParser:
|
||||
help=(
|
||||
"Running server URL for single-trace triage. SGLang supports direct "
|
||||
"capture via sglang.profiler. vLLM and TensorRT-LLM require a server-side "
|
||||
"torch-profiler output path exposed via --output-dir."
|
||||
"torch-profiler output path exposed via --output-dir. TokenSpeed live "
|
||||
"capture uses the server's /start_profile and /stop_profile endpoints "
|
||||
"when they are available."
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -74,7 +86,8 @@ def build_triage_parser() -> argparse.ArgumentParser:
|
||||
help=(
|
||||
"Trace output dir when using --url. For vLLM this should match the "
|
||||
"server's torch_profiler_dir. For TensorRT-LLM it should match the "
|
||||
"directory or file path configured by TLLM_TORCH_PROFILE_TRACE."
|
||||
"directory or file path configured by TLLM_TORCH_PROFILE_TRACE. "
|
||||
"For TokenSpeed this is passed as start_profile.output_dir."
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -83,7 +96,8 @@ def build_triage_parser() -> argparse.ArgumentParser:
|
||||
default="triage-trace",
|
||||
help=(
|
||||
"Profile prefix when generating a trace from --url. SGLang uses it "
|
||||
"directly; vLLM and TensorRT-LLM may ignore it on the HTTP profiler path."
|
||||
"directly; TokenSpeed maps it to profile_id; vLLM and TensorRT-LLM may "
|
||||
"ignore it on the HTTP profiler path."
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Backwards-compatibility shim for the unified LLM torch-profiler entrypoint.
|
||||
|
||||
The real implementation now lives in ``analyze_llm_torch_profile`` because this
|
||||
skill covers SGLang, vLLM, and TensorRT-LLM. Older scripts and runbooks that
|
||||
skill covers SGLang, vLLM, TensorRT-LLM, and TokenSpeed. Older scripts and runbooks that
|
||||
still invoke ``analyze_sglang_torch_profile.py`` keep working by forwarding to
|
||||
that module.
|
||||
"""
|
||||
|
||||
@@ -31,7 +31,7 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument(
|
||||
"--framework",
|
||||
required=True,
|
||||
choices=("sglang", "vllm", "trtllm"),
|
||||
choices=("sglang", "vllm", "trtllm", "tokenspeed"),
|
||||
help="Serving framework.",
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -42,7 +42,7 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument(
|
||||
"--model",
|
||||
default=None,
|
||||
help="OpenAI model id. Auto-discovered for vLLM and TensorRT-LLM when omitted.",
|
||||
help="OpenAI model id. Auto-discovered for vLLM, TensorRT-LLM, and TokenSpeed when omitted.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--requests",
|
||||
@@ -153,7 +153,7 @@ def openai_request(
|
||||
def run_probe(args: argparse.Namespace) -> Dict[str, Any]:
|
||||
prompts = args.prompt or list(DEFAULT_PROMPTS)
|
||||
model = args.model
|
||||
if args.framework in {"vllm", "trtllm"} and not model:
|
||||
if args.framework in {"vllm", "trtllm", "tokenspeed"} and not model:
|
||||
model = discover_openai_model(args.url, timeout=args.timeout)
|
||||
|
||||
latencies: List[float] = []
|
||||
|
||||
@@ -22,6 +22,7 @@ FRAMEWORK_LABELS = {
|
||||
"sglang": "SGLang",
|
||||
"vllm": "vLLM",
|
||||
"trtllm": "TensorRT-LLM",
|
||||
"tokenspeed": "TokenSpeed",
|
||||
}
|
||||
TRACE_FILE_PATTERNS = (
|
||||
"*.trace.json",
|
||||
@@ -89,6 +90,9 @@ def canonicalize_framework(value: object) -> str:
|
||||
"trtllm": "trtllm",
|
||||
"tensorrt-llm": "trtllm",
|
||||
"tensorrtllm": "trtllm",
|
||||
"tokenspeed": "tokenspeed",
|
||||
"token-speed": "tokenspeed",
|
||||
"ts": "tokenspeed",
|
||||
}
|
||||
return aliases.get(lowered, "auto")
|
||||
|
||||
@@ -105,6 +109,8 @@ def _normalize_repo_relative_path_cached(text: str) -> str:
|
||||
("python/sglang/", "python/sglang/"),
|
||||
("sgl_kernel/", "sgl_kernel/"),
|
||||
("vllm/", "vllm/"),
|
||||
("python/tokenspeed/", "python/tokenspeed/"),
|
||||
("tokenspeed/", "tokenspeed/"),
|
||||
("tensorrt_llm/", "tensorrt_llm/"),
|
||||
("tensorrt-llm/", "tensorrt_llm/"),
|
||||
):
|
||||
@@ -312,6 +318,8 @@ def detect_framework_from_text(text: object) -> Optional[str]:
|
||||
lowered = normalize_text(text).lower()
|
||||
if not lowered:
|
||||
return None
|
||||
if any(token in lowered for token in ("tokenspeed", "token-speed", "/ts/")):
|
||||
return "tokenspeed"
|
||||
if any(
|
||||
token in lowered
|
||||
for token in (
|
||||
@@ -333,6 +341,22 @@ def detect_framework_from_server_args(server_args: Optional[dict]) -> Optional[s
|
||||
if not isinstance(server_args, dict) or not server_args:
|
||||
return None
|
||||
lowered_keys = {normalize_text(key).lower() for key in server_args}
|
||||
text = json.dumps(server_args, sort_keys=True)
|
||||
if any(token in text.lower() for token in ("tokenspeed", "token-speed")):
|
||||
return "tokenspeed"
|
||||
if lowered_keys & {
|
||||
"attn_tp_size",
|
||||
"dense_tp_size",
|
||||
"moe_tp_size",
|
||||
"enable_mla_l1_5_cache",
|
||||
"mla_chunk_multiplier",
|
||||
"comm_fusion_max_num_tokens",
|
||||
"enable_allreduce_fusion",
|
||||
}:
|
||||
return "tokenspeed"
|
||||
text_hint = detect_framework_from_text(text)
|
||||
if text_hint:
|
||||
return text_hint
|
||||
if lowered_keys & {
|
||||
"attention_backend",
|
||||
"sampling_backend",
|
||||
@@ -342,7 +366,7 @@ def detect_framework_from_server_args(server_args: Optional[dict]) -> Optional[s
|
||||
"schedule_policy",
|
||||
}:
|
||||
return "sglang"
|
||||
return detect_framework_from_text(json.dumps(server_args, sort_keys=True))
|
||||
return None
|
||||
|
||||
|
||||
def detect_framework_from_trace(trace: object) -> Optional[str]:
|
||||
@@ -402,6 +426,9 @@ def detect_framework_from_url(
|
||||
or "decode" in server_info
|
||||
):
|
||||
return "sglang"
|
||||
readiness = try_get_json(url.rstrip("/") + "/readiness", timeout=5.0)
|
||||
if readiness is not None:
|
||||
return "tokenspeed"
|
||||
models = try_get_json(url.rstrip("/") + "/v1/models")
|
||||
if isinstance(models, dict) and isinstance(models.get("data"), list):
|
||||
return "vllm"
|
||||
@@ -794,9 +821,11 @@ def wait_for_profiler_artifact(path: Path, timeout_s: float = 60.0) -> Path:
|
||||
return path
|
||||
|
||||
|
||||
def start_remote_profiler(url: str, framework: str) -> None:
|
||||
def start_remote_profiler(
|
||||
url: str, framework: str, payload: Optional[dict] = None
|
||||
) -> None:
|
||||
try:
|
||||
post_json(url.rstrip("/") + "/start_profile", timeout=60.0)
|
||||
post_json(url.rstrip("/") + "/start_profile", payload=payload, timeout=60.0)
|
||||
except Exception as exc:
|
||||
if framework == "vllm":
|
||||
raise RuntimeError(
|
||||
@@ -808,11 +837,40 @@ def start_remote_profiler(url: str, framework: str) -> None:
|
||||
raise RuntimeError(
|
||||
"TensorRT-LLM live torch profiling requires "
|
||||
"a server build that exposes POST /start_profile plus the env vars "
|
||||
"TLLM_PROFILE_START_STOP=1 and TLLM_TORCH_PROFILE_TRACE=/shared/path."
|
||||
"TLLM_PROFILE_START_STOP=<start>-<stop> and "
|
||||
"TLLM_TORCH_PROFILE_TRACE=/shared/path."
|
||||
) from exc
|
||||
if framework == "tokenspeed":
|
||||
raise RuntimeError(
|
||||
"TokenSpeed live torch profiling requires a server build that "
|
||||
"exposes POST /start_profile and POST /stop_profile. The helper "
|
||||
"passes output_dir, activities, and profile_id in the start payload."
|
||||
) from exc
|
||||
raise
|
||||
|
||||
|
||||
def build_remote_profiler_start_payload(
|
||||
framework: str,
|
||||
output_path: Path,
|
||||
profile_prefix: Optional[str],
|
||||
stage: Optional[str],
|
||||
) -> Optional[dict]:
|
||||
if framework != "tokenspeed":
|
||||
return None
|
||||
|
||||
profile_id = profile_prefix or "triage-trace"
|
||||
if stage:
|
||||
profile_id = f"{profile_id}-{stage}"
|
||||
|
||||
return {
|
||||
"output_dir": str(output_path),
|
||||
"activities": ["CPU", "GPU"],
|
||||
"with_stack": True,
|
||||
"record_shapes": False,
|
||||
"profile_id": profile_id,
|
||||
}
|
||||
|
||||
|
||||
def stop_remote_profiler(url: str, framework: str) -> None:
|
||||
try:
|
||||
post_json(url.rstrip("/") + "/stop_profile", timeout=300.0)
|
||||
@@ -829,6 +887,7 @@ def run_remote_profiler(
|
||||
framework: str,
|
||||
probe_plan: ProbePlan,
|
||||
probe_delay: float,
|
||||
profile_prefix: Optional[str] = None,
|
||||
stage: Optional[str] = None,
|
||||
) -> Path:
|
||||
framework = canonicalize_framework(framework)
|
||||
@@ -843,7 +902,11 @@ def run_remote_profiler(
|
||||
if output_path.exists()
|
||||
else set()
|
||||
)
|
||||
model = discover_openai_model(url) if framework in {"vllm", "trtllm"} else None
|
||||
model = (
|
||||
discover_openai_model(url)
|
||||
if framework in {"vllm", "trtllm", "tokenspeed"}
|
||||
else None
|
||||
)
|
||||
if probe_plan.warmup_requests > 0:
|
||||
send_probe_requests(
|
||||
url=url,
|
||||
@@ -854,13 +917,18 @@ def run_remote_profiler(
|
||||
model=model,
|
||||
)
|
||||
|
||||
start_remote_profiler(url, framework)
|
||||
start_payload = build_remote_profiler_start_payload(
|
||||
framework=framework,
|
||||
output_path=output_path,
|
||||
profile_prefix=profile_prefix,
|
||||
stage=stage,
|
||||
)
|
||||
start_remote_profiler(url, framework, payload=start_payload)
|
||||
stop_error: Optional[BaseException] = None
|
||||
try:
|
||||
if probe_plan.capture_requests > 0:
|
||||
# `sglang.profiler` performs its own startup work before it reaches
|
||||
# POST /start_profile. A very short delay can send probes too early
|
||||
# and miss the profiling window entirely.
|
||||
# Server-side profilers may do setup work after POST /start_profile.
|
||||
# A very short delay can send probes too early and miss the window.
|
||||
time.sleep(max(5.0, probe_delay))
|
||||
send_probe_requests(
|
||||
url=url,
|
||||
@@ -1064,14 +1132,14 @@ def run_profiler(
|
||||
if profile_by_stage:
|
||||
raise ValueError(
|
||||
"--profile-by-stage is only supported for SGLang live capture. "
|
||||
"Disable it when profiling vLLM or TensorRT-LLM."
|
||||
"Disable it when profiling vLLM, TensorRT-LLM, or TokenSpeed."
|
||||
)
|
||||
if merge_profiles:
|
||||
raise ValueError(
|
||||
"--merge-profiles is only supported for SGLang live capture. "
|
||||
"Disable it when profiling vLLM or TensorRT-LLM."
|
||||
"Disable it when profiling vLLM, TensorRT-LLM, or TokenSpeed."
|
||||
)
|
||||
if profile_prefix:
|
||||
if profile_prefix and resolved_framework in {"vllm", "trtllm"}:
|
||||
print(
|
||||
f"Note: {framework_display_name(resolved_framework)} ignores "
|
||||
"--profile-prefix on the HTTP profiler control path.",
|
||||
@@ -1093,6 +1161,7 @@ def run_profiler(
|
||||
warmup_steps=warmup_steps,
|
||||
),
|
||||
probe_delay=probe_delay,
|
||||
profile_prefix=profile_prefix,
|
||||
)
|
||||
output_root = ensure_remote_profiler_output_path(output_dir, resolved_framework)
|
||||
for stage in stages:
|
||||
@@ -1116,6 +1185,7 @@ def run_profiler(
|
||||
warmup_steps=warmup_steps,
|
||||
),
|
||||
probe_delay=probe_delay,
|
||||
profile_prefix=profile_prefix,
|
||||
stage=stage,
|
||||
)
|
||||
return output_root
|
||||
|
||||
@@ -12,9 +12,10 @@ FRAMEWORK_LABELS = {
|
||||
"sglang": "SGLang",
|
||||
"vllm": "vLLM",
|
||||
"trtllm": "TensorRT-LLM",
|
||||
"tokenspeed": "TokenSpeed",
|
||||
}
|
||||
|
||||
FRAMEWORK_ORDER = {"sglang": 0, "vllm": 1, "trtllm": 2}
|
||||
FRAMEWORK_ORDER = {"sglang": 0, "vllm": 1, "trtllm": 2, "tokenspeed": 3}
|
||||
|
||||
|
||||
def parse_args(argv: Optional[Sequence[str]] = None) -> argparse.Namespace:
|
||||
@@ -75,6 +76,8 @@ def framework_key_from_path(path: Path) -> str:
|
||||
return "vllm"
|
||||
if "trtllm" in lowered or "tensorrt" in lowered:
|
||||
return "trtllm"
|
||||
if "tokenspeed" in lowered or "token-speed" in lowered:
|
||||
return "tokenspeed"
|
||||
return "other"
|
||||
|
||||
|
||||
|
||||
@@ -530,16 +530,16 @@ FUSION_PATTERN_REGISTRY: Tuple[FusionPatternSpec, ...] = (
|
||||
likely_share=0.5,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="DSA fused metadata copy for graph replay",
|
||||
pattern="NSA fused metadata copy for graph replay",
|
||||
candidate_path="python/sglang/jit_kernel/fused_metadata_copy.py",
|
||||
active_keywords=(
|
||||
"fused_metadata_copy",
|
||||
"fused_metadata_copy_multi",
|
||||
"fused_dsa_cache_seqlens",
|
||||
"fused_nsa_cache_seqlens",
|
||||
"fused_flashmla_metadata",
|
||||
),
|
||||
rationale_hint=(
|
||||
"DSA replay metadata copies are already fused into one-kernel" " families."
|
||||
"NSA replay metadata copies are already fused into one-kernel" " families."
|
||||
),
|
||||
min_share=0.02,
|
||||
likely_share=0.2,
|
||||
@@ -744,23 +744,23 @@ FUSION_PATTERN_REGISTRY: Tuple[FusionPatternSpec, ...] = (
|
||||
likely_share=1.5,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="DSA fused top-k transform / page-table build",
|
||||
candidate_path="python/sglang/srt/layers/attention/dsa_backend.py",
|
||||
pattern="NSA fused top-k transform / page-table build",
|
||||
candidate_path="python/sglang/srt/layers/attention/nsa_backend.py",
|
||||
active_keywords=(
|
||||
"fast_topk_transform_fused",
|
||||
"fast_topk_transform_ragged_fused",
|
||||
),
|
||||
rationale_hint=(
|
||||
"DSA top-k metadata preparation already has fused transform kernels."
|
||||
"NSA top-k metadata preparation already has fused transform kernels."
|
||||
),
|
||||
min_share=0.05,
|
||||
likely_share=0.3,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="DSA fused quantize + indexed K-cache store",
|
||||
pattern="NSA fused quantize + indexed K-cache store",
|
||||
candidate_path=(
|
||||
"python/sglang/jit_kernel/fused_store_index_cache.py"
|
||||
"<br>python/sglang/srt/layers/attention/dsa/dsa_indexer.py"
|
||||
"<br>python/sglang/srt/layers/attention/nsa/nsa_indexer.py"
|
||||
),
|
||||
active_keywords=("fused_store_index_k_cache",),
|
||||
split_groups=(
|
||||
@@ -768,7 +768,7 @@ FUSION_PATTERN_REGISTRY: Tuple[FusionPatternSpec, ...] = (
|
||||
("index_k", "cache", "store"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"DSA already has a fused quantize-and-indexed-store kernel family."
|
||||
"NSA already has a fused quantize-and-indexed-store kernel family."
|
||||
),
|
||||
min_share=0.2,
|
||||
likely_share=1.0,
|
||||
@@ -855,6 +855,180 @@ FUSION_PATTERN_REGISTRY: Tuple[FusionPatternSpec, ...] = (
|
||||
likely_share=1.0,
|
||||
priority=90,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="SGLang LTX2 fused Ada values",
|
||||
candidate_path=(
|
||||
"PR #29390"
|
||||
"<br>python/sglang/jit_kernel/diffusion/triton/ltx2_ada_values.py"
|
||||
"<br>python/sglang/multimodal_gen/runtime/models/dits/ltx_2.py"
|
||||
),
|
||||
active_keywords=(
|
||||
"ltx2_ada_values9",
|
||||
"ltx2_ada_values",
|
||||
"LTX2TransformerBlock",
|
||||
),
|
||||
split_groups=(
|
||||
("scale_shift_table", "timestep", "reshape"),
|
||||
("get_ada_values", "ada", "adaln"),
|
||||
("slice", "split", "unbind"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"SGLang mainline fuses LTX-2.3 Ada value materialization for"
|
||||
" video/audio streams; split Ada table add/reshape/slice ladders"
|
||||
" should be checked against this diffusion Triton kernel first."
|
||||
),
|
||||
origin="upstream",
|
||||
model_include=("ltx", "ltx-2", "ltx2"),
|
||||
min_share=0.2,
|
||||
likely_share=1.0,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="SGLang LTX2 residual-gate add CUDA fast path",
|
||||
candidate_path=(
|
||||
"PR #29361"
|
||||
"<br>python/sglang/jit_kernel/diffusion/residual_gate_add.py"
|
||||
"<br>python/sglang/jit_kernel/csrc/diffusion/residual_gate_add.cuh"
|
||||
"<br>python/sglang/multimodal_gen/runtime/models/dits/ltx_2.py"
|
||||
),
|
||||
active_keywords=(
|
||||
"diffusion_residual_gate_add",
|
||||
"residual_gate_add",
|
||||
"_ltx2_residual_gate_add",
|
||||
),
|
||||
split_groups=(
|
||||
("add", "mul", "gate"),
|
||||
("residual", "update", "gate"),
|
||||
("hidden_states", "attn_hidden_states", "gate"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"SGLang mainline fuses LTX2 residual + update * gate sites into"
|
||||
" a CUDA custom op; split add/mul gate ladders should be checked"
|
||||
" against this path before proposing a new diffusion elementwise"
|
||||
" fusion."
|
||||
),
|
||||
origin="upstream",
|
||||
model_include=("ltx", "ltx-2", "ltx2"),
|
||||
min_share=0.2,
|
||||
likely_share=1.0,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="TokenSpeed CuTe DSL MLA prefill / decode",
|
||||
candidate_path=(
|
||||
"python/tokenspeed/runtime/layers/attention/backends/tokenspeed_mla.py"
|
||||
"<br>tokenspeed-mla/python/tokenspeed_mla/mla_decode.py"
|
||||
"<br>tokenspeed-mla/python/tokenspeed_mla/mla_prefill.py"
|
||||
"<br>tokenspeed-kernel/python/tokenspeed_kernel/ops/attention/"
|
||||
"tokenspeed_mla/__init__.py"
|
||||
),
|
||||
active_keywords=(
|
||||
"tokenspeed_mla_decode",
|
||||
"tokenspeed_mla_prefill",
|
||||
"BlackwellMultiHeadLatentAttentionForward",
|
||||
),
|
||||
split_groups=(
|
||||
("mla", "flashmla", "attention", "fmha"),
|
||||
("prefill", "decode", "verify"),
|
||||
("fp8", "kv_cache", "page_table"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"TokenSpeed ships Blackwell CuTe DSL MLA prefill/decode kernels;"
|
||||
" split MLA support kernels should be checked against backend"
|
||||
" selection before being called novel."
|
||||
),
|
||||
origin="upstream",
|
||||
model_include=("deepseek", "kimi", "qwen3.5", "qwen3_5"),
|
||||
min_share=0.4,
|
||||
likely_share=2.0,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="TokenSpeed MLA KV pack + FP8 quantize",
|
||||
candidate_path=(
|
||||
"tokenspeed-mla/python/tokenspeed_mla/mla_kv_pack_quantize_fp8.py"
|
||||
"<br>tokenspeed-kernel/python/tokenspeed_kernel/ops/attention/"
|
||||
"tokenspeed_mla/__init__.py"
|
||||
),
|
||||
active_keywords=(
|
||||
"_mla_kv_pack_quantize_fp8_kernel",
|
||||
"mla_kv_pack_quantize_fp8",
|
||||
),
|
||||
split_groups=(
|
||||
("k_nope", "k_pe", "cat", "concat", "pack"),
|
||||
("quant", "fp8", "float8"),
|
||||
("v", "kv", "cache"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"TokenSpeed fuses MLA K/V pack, concat, and FP8 quantization into"
|
||||
" one Triton kernel for chunked prefill."
|
||||
),
|
||||
origin="upstream",
|
||||
model_include=("deepseek", "kimi", "qwen3.5", "qwen3_5"),
|
||||
min_share=0.2,
|
||||
likely_share=1.0,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="TokenSpeed fused top-k + top-p sampling",
|
||||
candidate_path=(
|
||||
"tokenspeed-kernel/python/tokenspeed_kernel/thirdparty/cuda/" # codespell:ignore thirdparty
|
||||
"fused_topk_topp.py"
|
||||
"<br>tokenspeed-kernel/python/tokenspeed_kernel/thirdparty/cuda/" # codespell:ignore thirdparty
|
||||
"csrc/fused_topk_topp/fused_topk_topp.cu"
|
||||
),
|
||||
active_keywords=("fused_topk_topp", "fused_topk_topp_renorm"),
|
||||
split_groups=(
|
||||
("topk", "top_k"),
|
||||
("topp", "top_p"),
|
||||
("sampling", "renorm", "softmax"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"TokenSpeed has a fused top-k/top-p renormalization path for"
|
||||
" decode sampling."
|
||||
),
|
||||
origin="upstream",
|
||||
min_share=0.1,
|
||||
likely_share=0.8,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="TokenSpeed persistent lm_head GEMM",
|
||||
candidate_path=(
|
||||
"tokenspeed-kernel/python/tokenspeed_kernel/thirdparty/cuda/" # codespell:ignore thirdparty
|
||||
"lm_head_gemm.py"
|
||||
"<br>tokenspeed-kernel/python/tokenspeed_kernel/thirdparty/cuda/" # codespell:ignore thirdparty
|
||||
"csrc/lm_head_gemm.cu"
|
||||
),
|
||||
active_keywords=("lm_head_gemm",),
|
||||
split_groups=(
|
||||
("lm_head", "logits", "vocab"),
|
||||
("gemm", "matmul", "linear"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"TokenSpeed has a shape-gated persistent lm_head GEMM path; visible"
|
||||
" lm_head matmul ladders should be compared against it."
|
||||
),
|
||||
origin="upstream",
|
||||
model_include=("kimi", "qwen"),
|
||||
min_share=0.2,
|
||||
likely_share=1.0,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="TokenSpeed NVFP4 GEMM + SwiGLU + quant",
|
||||
candidate_path=(
|
||||
"tokenspeed-kernel/python/tokenspeed_kernel/thirdparty/cute_dsl/" # codespell:ignore thirdparty
|
||||
"nvfp4_gemm_swiglu_nvfp4_quant.py"
|
||||
),
|
||||
active_keywords=("nvfp4_gemm_swiglu_nvfp4_quant",),
|
||||
split_groups=(
|
||||
("gemm", "nvfp4", "fp4"),
|
||||
("swiglu", "silu", "activation", "mul"),
|
||||
("quant", "scale", "sfc"),
|
||||
),
|
||||
rationale_hint=(
|
||||
"TokenSpeed's CuTe DSL kernel fuses NVFP4 GEMM, SwiGLU, and"
|
||||
" optional output quantization in one expert-style path."
|
||||
),
|
||||
origin="upstream",
|
||||
min_share=0.3,
|
||||
likely_share=1.5,
|
||||
),
|
||||
FusionPatternSpec(
|
||||
pattern="vLLM-origin Attention + Quantization",
|
||||
candidate_path=(
|
||||
@@ -1235,6 +1409,8 @@ def source_location_priority(location: str) -> int:
|
||||
return 290 - penalty
|
||||
if text.startswith("vllm/"):
|
||||
return 285 - penalty
|
||||
if text.startswith("python/tokenspeed/") or text.startswith("tokenspeed/"):
|
||||
return 283 - penalty
|
||||
if text.startswith("tensorrt_llm/"):
|
||||
return 280 - penalty
|
||||
if text.startswith("sgl_kernel/"):
|
||||
@@ -1254,6 +1430,8 @@ def is_preferred_source_location(location: str) -> bool:
|
||||
text.startswith("python/sglang/")
|
||||
or text.startswith("sglang/")
|
||||
or text.startswith("vllm/")
|
||||
or text.startswith("python/tokenspeed/")
|
||||
or text.startswith("tokenspeed/")
|
||||
or text.startswith("tensorrt_llm/")
|
||||
or text.startswith("sgl_kernel/")
|
||||
)
|
||||
@@ -1316,6 +1494,10 @@ def frame_priority(frame_name: str) -> int:
|
||||
return 290 - penalty
|
||||
if normalized_text.startswith("vllm/"):
|
||||
return 285 - penalty
|
||||
if normalized_text.startswith("python/tokenspeed/") or normalized_text.startswith(
|
||||
"tokenspeed/"
|
||||
):
|
||||
return 283 - penalty
|
||||
if normalized_text.startswith("tensorrt_llm/"):
|
||||
return 280 - penalty
|
||||
if normalized_text.startswith("sgl_kernel/"):
|
||||
@@ -1329,6 +1511,8 @@ def frame_priority(frame_name: str) -> int:
|
||||
return 120
|
||||
if "/vllm/" in raw_text:
|
||||
return 118
|
||||
if "/tokenspeed/" in raw_text or "/TokenSpeed/" in raw_text:
|
||||
return 117
|
||||
if "/TensorRT-LLM/" in raw_text or "/tensorrt_llm/" in raw_text:
|
||||
return 116
|
||||
return 100
|
||||
@@ -1336,6 +1520,10 @@ def frame_priority(frame_name: str) -> int:
|
||||
return 110
|
||||
if ".py(" in raw_text and "/vllm/" in raw_text:
|
||||
return 108
|
||||
if ".py(" in raw_text and (
|
||||
"/tokenspeed/" in raw_text or "/TokenSpeed/" in raw_text
|
||||
):
|
||||
return 107
|
||||
if ".py(" in raw_text and (
|
||||
"/TensorRT-LLM/" in raw_text or "/tensorrt_llm/" in raw_text
|
||||
):
|
||||
@@ -2438,6 +2626,8 @@ def fusion_framework_hints(spec: FusionPatternSpec) -> set[str]:
|
||||
hints: set[str] = set()
|
||||
if "vllm/" in text:
|
||||
hints.add("vllm")
|
||||
if any(token in text for token in ("tokenspeed/", "tokenspeed-", "tokenspeed_")):
|
||||
hints.add("tokenspeed")
|
||||
if "tensorrt_llm/" in text:
|
||||
hints.add("trtllm")
|
||||
if any(token in text for token in ("python/sglang/", "sgl-kernel/", "sgl_kernel/")):
|
||||
|
||||
@@ -416,6 +416,10 @@ def is_meaningful_python_scope(name: str) -> bool:
|
||||
return True
|
||||
if normalized.startswith("vllm/"):
|
||||
return True
|
||||
if normalized.startswith("python/tokenspeed/") or normalized.startswith(
|
||||
"tokenspeed/"
|
||||
):
|
||||
return True
|
||||
if normalized.startswith("tensorrt_llm/"):
|
||||
return True
|
||||
if normalized.startswith("sgl_kernel/"):
|
||||
@@ -697,6 +701,8 @@ def choose_best_scope(scope_chain: Sequence[str]) -> Optional[str]:
|
||||
score += 48.0
|
||||
elif scope.startswith("vllm/"):
|
||||
score += 46.0
|
||||
elif scope.startswith("python/tokenspeed/") or scope.startswith("tokenspeed/"):
|
||||
score += 45.0
|
||||
elif scope.startswith("tensorrt_llm/"):
|
||||
score += 44.0
|
||||
elif scope.startswith("sgl_kernel/"):
|
||||
@@ -744,6 +750,10 @@ def source_scope_priority(scope: Optional[str]) -> int:
|
||||
return 290 - penalty
|
||||
if normalized.startswith("vllm/"):
|
||||
return 285 - penalty
|
||||
if normalized.startswith("python/tokenspeed/") or normalized.startswith(
|
||||
"tokenspeed/"
|
||||
):
|
||||
return 283 - penalty
|
||||
if normalized.startswith("tensorrt_llm/"):
|
||||
return 280 - penalty
|
||||
if normalized.startswith("sgl_kernel/"):
|
||||
|
||||
Reference in New Issue
Block a user