tuning-in-sglang

Tune fused-MoE and GEMM kernels inside SGLang serving deployments on AMD Instinct GPUs.

178|52|Updated Jul 30, 2025
One-click install
npx skills add https://github.com/AMD-AGI/GEAK --skill tuning-in-sglang-amd-agi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tuning-in-sglang
Source: https://github.com/AMD-AGI/GEAK/tree/main/perf_knowledge/expert_skills/tuning/tuning-in-sglang
Command: npx skills add https://github.com/AMD-AGI/GEAK --skill tuning-in-sglang-amd-agi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? SGLang ships MoE kernel configs keyed by Triton version and device name, and on newer AMD GPUs like the MI355X no matching configs exist at all, so every fused-MoE layer silently runs default configs. This Skill guides you through capturing real shapes, tuning kernels, deploying configs correctly, and verifying from server logs that the tuned config actually engaged rather than falling back. ## Core Features & Use Cases - Version-aware config deployment: Place tuned JSON configs in the correct triton_<version> directory and deploy via SGLANG_MOE_CONFIG_DIR, avoiding the crash and silent-replacement traps of that override. - Log-based engagement verification: Distinguish an exact config hit from a version fallback or a default-config miss by reading SGLang's startup log lines. - Graph-capture-aware benchmarking: Account for HIP graph capture on the decode path, where kernel changes only take effect across server restarts and eager-mode timing is misleading. - Use Case: On an MI355X node serving a MoE model with SGLang, run the shipped tuning_fused_moe_triton.py tuner against captured production shapes, write results into triton_3_6_0, and confirm an exact-hit log line before A/B benchmarking throughput. ## Quick Start Ask the agent to tune the fused-MoE kernels for your SGLang server on an AMD Instinct GPU and verify from the server log that the tuned config loaded as an exact hit.

Frequently Asked Questions about tuning-in-sglang

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I tune fused MoE kernels in SGLang on AMD GPUs?

Run SGLang's shipped tuner at benchmark/kernels/fused_moe_triton/tuning_fused_moe_triton.py with --model and --tune, then write the output JSON into the triton_<installed version> config directory. Deploy by pointing SGLANG_MOE_CONFIG_DIR at the parent of the configs directory.

How do I know if my SGLang MoE config actually loaded?

Check the server startup log for 'Using MoE kernel config from .../triton_<version>/...', which indicates an exact hit. A 'Fallback to triton version' warning means a stale config loaded and should be treated as a miss, while 'Using default MoE kernel config' means nothing matched.

Why does SGLang use default MoE configs on MI355X?

The shipped config tree contains no files named for AMD_Instinct_MI355X in any Triton version directory, so every fused-MoE lookup falls through to defaults. Re-tuning into the installed Triton version directory is required to get any tuned config engaged.

Can I reuse a vLLM tuned MoE config in SGLang?

No, because the device name is embedded in the config filename and the two frameworks report different names for the same GPU, such as 'AMD Instinct MI355X' versus 'AMD Instinct MI355 OAM'. You must tune separately per framework or rename files deliberately.

Why does SGLANG_MOE_CONFIG_DIR crash my SGLang server?

Pointing the variable directly at the triton_<version> directory causes an unhandled FileNotFoundError because SGLang appends configs/triton_<version> beneath the path you provide. Point it at the parent directory containing the configs tree instead.

Why did my MoE tuning stop applying after enabling deterministic inference?

When enable_deterministic_inference is set, SGLang's get_moe_configs returns before reading any config file and logs only a brief warning. All tuned MoE configs are silently ignored while that flag is on.