Evidence-first autonomous GPU-kernel optimization campaigns for SGLang.
KDA-Pilot turns real serving-framework kernels into reproducible optimization tasks: frozen production shapes, copied upstream baselines, symmetric benchmarks, correctness gates, Nsight Compute evidence, KernelWiki references, and RLCR-style agent iteration in one place.
Most AI kernel demos optimize a snippet. KDA-Pilot optimizes the parts that actually show up in SGLang diffusion and LLM serving workflows, then keeps the evidence needed to tell whether the agent really improved the production path.
If you care about autonomous CUDA/Triton/CuTe-DSL optimization that can be replayed, reviewed, and compared against real framework baselines, this is the repo to watch.
cuda.synchronize() overhead, not just isolated
device time.KernelWiki and
ncu-report-skill, so prior Blackwell/Hopper kernel work and NCU bottleneck
evidence become part of the optimization loop.These are B200 task outcomes against the corresponding SGLang/Triton/CuTe-DSL
baselines where the task has a stable production-relative baseline. The
measurements include dispatch and synchronization overheads, so they are closer
to what a user sees from the public kernel path. Rows marked review are kept
visible because they turned into SGLang-facing fast paths, but their original
task headline changed after the baseline moved.
| Kernel task | B200 evidence | Representative wins |
|---|---|---|
qknorm_rope | 1.1341x | large rows 1.145-1.279x |
norm_infer | 1.3523x | RMS small 1.634-1.641x |
rotary_embedding | 1.4912x | HunyuanVideo 2.087x; LTX2 1.133-1.622x |
cutedsl_norm_tanh_mul_add | 1.4953x | v1 1.602-1.625x |
cutedsl_norm_scale_shift | 1.3201x | Hunyuan 1.388-1.516x; JoyAI 1.477-1.495x |
fuse_scale_shift | 2.7499x | small broadcast rows 7.365-7.891x |
group_norm_silu | 2.3118x | small/mid C rows 1.369-4.982x; NC rows up to 3.648x |
attention_concat_copy | 1.30x | head-sliced copy 1.39-2.61x; 24 workloads bit-exact |
causal_conv3d_cat_pad | 2.06x | production rows 1.60-2.45x; bitwise-exact B200 gate |
residual_gate_add | review | old eager geomean 2.19x is superseded; SGLang Triton-row follow-up is about 1.11x |
| Kernel | KernelWiki / reference | Key techniques |
|---|---|---|
qknorm_rope | TensorRT-LLM PR-13052/11869 DiT QKNorm+RoPE; SGLang PR-15141/19059/21440/21654 fused QKNorm/RoPE; memory-bound pattern | Shared RoPE staging, Q/K reuse, staged path only for large rows |
norm_infer | KernelWiki memory-bound/vectorized-loads/register-budgeting; vLLM PR-31828 SM100 RMSNorm opt-in path | Warp-row RMS, tiled persistent RMS, 8B/16B vector paths |
rotary_embedding | SGLang PR-24411 LTX2 split RoPE; vLLM PR-21126/30729 FlashInfer RoPE routing; vectorized-loads | 128-bit vector I/O, cos/sin hoisting, LTX2 block matching |
cutedsl_norm_tanh_mul_add | KernelWiki memory-bound/vectorized-loads/register-budgeting; NCU long-scoreboard and launch-bounds evidence | Hoisted row-invariant math, launch-bounds tuning, exact tanhf |
cutedsl_norm_scale_shift | SGLang PR-14717 CuTe-DSL norm/scale/shift fusion; vectorized-loads; register-budgeting | Operand-class dispatch, 16B/32B vectors, two-pass variance |
fuse_scale_shift | SGLang PR-14717 fused norm/scale/shift family; vectorized-loads; cache-policy; memory-bound pattern | Rowgrid/flatvec/exact-C paths, cache hints, one-pass reduction |
group_norm_silu | SGLang PR-22814/23148/23938 GroupNorm+SiLU; memory-bound pattern; vectorized-loads | Split-group stats, generation counters, channels-last transpose |
attention_concat_copy | SGLang USP attention concat/copy path; memory-bound head-sliced copy; A/A harness validation | Single-launch region copy, pitched 16B block gather, strict layout/device rejection |
causal_conv3d_cat_pad | SGLang causal Conv3D cat/pad Triton baseline; instruction-bound B200 NCU evidence | Flat chunking, 16B vectorized stores, stride-aware fallback, bitwise-exact gate |
residual_gate_add | SGLang residual/gate/add serving row; baseline migration to Triton fuse_scale_shift_kernel; PR #29361 follow-up | One-pass CUDA fusion, pinned-GPU correctness, explicit re-benchmark note after baseline swap |
The companion write-up records the benchmark interpretation, kernel-specific optimization paths, KernelWiki/reference links, and AKO4X comparison: KDA-Pilot optimizing SGLang Diffusion Kernel.
diffusion/ SGLang diffusion-operator kernel tasks.
Each task owns a copied baseline, optimized solution, benchmark,
correctness contract, run logs, and result ledger.
llm/ SGLang autoregressive-model kernel-workflow campaign.
Serve priority models on B200/H200, benchmark low/mid/high
concurrency, profile forward passes, and turn >=1% kernel
interfaces into flat task directories with per-task launchers.
external/ Optional shared knowledge submodules.
KernelWiki/ Blackwell/Hopper kernel design references
ncu-report-skill/ Nsight Compute profiling/report helper
Start with:
diffusion/README.md for standalone diffusion kernel
tasks and benchmark rules.llm/README.md for the LLM kernel-workflow campaign.diffusion/docs/standalone_diffusion_benchmark.md
for the baseline/candidate benchmark contract.diffusion/docs/diffusion_kernel_rules.md
for correctness, fallback, and promotion guardrails.Every diffusion kernel task follows the same shape:
prompt.md task card for the agent
config.toml benchmark/build defaults
baseline/ copied upstream SGLang baseline source
solution/ optimized candidate source
bench/ standalone benchmark and correctness harness
docs/ run logs, profile notes, source notes, decision ledger
The important rule is symmetry: the agent must compare the copied baseline and candidate through matching local interfaces, fixed workload rows, preallocated outputs, CUDA-event timing, interleaved A/B sampling, strict correctness checks, and full provenance.
Clone submodules when you want the optional knowledge references:
git submodule update --init --recursive
Launch a task from the repo root:
diffusion/scripts/launch_kernels/k03_b200_diffusion_qknorm_rope__multi_shape.sh
Useful environment switches:
KDA_NO_CLAUDE=1 # prepare the worktree without launching an agent
KDA_BASE_BRANCH=<ref> # launch from a specific committed ref
KDA_BASH_BIN=/opt/homebrew/bin/bash
macOS /bin/bash 3.2 is rejected by the launcher because nested Humanize/Codex
hooks rely on modern Bash behavior.
These campaigns are run with coding agents in full-autonomy mode. For reproducibility, here is exactly how I launch them on a prepared task worktree.
Claude Code — the same combo the diffusion launcher uses (Opus 4.8 + max effort + auto/bypass-permission mode, i.e. the "Effort (Max)" + "Auto mode" toggles in the Claude Code UI):
claude --permission-mode bypassPermissions --model opus --effort max
diffusion/scripts/launch_kda_kernel_task.sh invokes exactly this (defaults
CLAUDE_MODEL=opus, CLAUDE_EFFORT=max, --permission-mode bypassPermissions),
so launching a task and running Claude by hand are equivalent. To iterate a
long-running goal across model switches, resume the session:
claude --resume <session-uuid>
Ultracode mode — the maximum-thoroughness setting (the "Effort (Ultracode –
xhigh + workflows)" entry in the Claude Code effort menu, paired with Auto mode).
Ultracode is not a launch-flag effort value: claude --effort ultracode warns
(Unknown --effort value 'ultracode') and falls back to the default — the valid
--effort flag levels are low, medium, high, xhigh, max. Ultracode is a
composite of xhigh effort + dynamic workflows enabled, so the agent reasons
at xhigh and authors multi-agent workflows on substantive tasks. Enable dynamic
workflows once — the Dynamic workflows toggle in /config (settings key
enableWorkflows) — then launch at xhigh:
claude --permission-mode bypassPermissions --model opus --effort xhigh
Or do it in one self-contained command:
claude --permission-mode bypassPermissions --model opus --effort xhigh --settings '{"enableWorkflows": true}'
With workflows enabled, the in-session /effort menu shows "Ultracode" and
selecting it pins xhigh. To opt a single prompt in instead of the whole session,
include the keyword ultracode in that message.
Codex — full-access, no approval prompts:
codex --yolo --sandbox danger-full-access --ask-for-approval never
Both run unsandboxed / auto-approve because each task lives in an isolated prepared worktree with its own benchmark + correctness gates; an agent's wins only count when the correctness contract and run logs agree.
The "KDA" in KDA-Pilot stands for Kernel Design Agents — the agent methodology these
campaigns build on. Credit to the original project from MIT Han Lab:
mit-han-lab/kernel-design-agents.
The SGLang serving-kernel tasks here are driven by a fork,
BBuf/kernel-design-agents (wired into each
task's prompt.md), and the bundled external/KernelWiki knowledge
base likewise credits the original KDA project.
1,722 followers · starred Jun 2026
470 followers · starred May 2026
487 followers · starred May 2026
2,136 followers · starred May 2026
Evidence-first autonomous GPU-kernel optimization campaigns for SGLang.
KDA-Pilot turns real serving-framework kernels into reproducible optimization tasks: frozen production shapes, copied upstream baselines, symmetric benchmarks, correctness gates, Nsight Compute evidence, KernelWiki references, and RLCR-style agent iteration in one place.
Most AI kernel demos optimize a snippet. KDA-Pilot optimizes the parts that actually show up in SGLang diffusion and LLM serving workflows, then keeps the evidence needed to tell whether the agent really improved the production path.
If you care about autonomous CUDA/Triton/CuTe-DSL optimization that can be replayed, reviewed, and compared against real framework baselines, this is the repo to watch.
cuda.synchronize() overhead, not just isolated
device time.KernelWiki and
ncu-report-skill, so prior Blackwell/Hopper kernel work and NCU bottleneck
evidence become part of the optimization loop.These are B200 task outcomes against the corresponding SGLang/Triton/CuTe-DSL
baselines where the task has a stable production-relative baseline. The
measurements include dispatch and synchronization overheads, so they are closer
to what a user sees from the public kernel path. Rows marked review are kept
visible because they turned into SGLang-facing fast paths, but their original
task headline changed after the baseline moved.
| Kernel task | B200 evidence | Representative wins |
|---|---|---|
qknorm_rope | 1.1341x | large rows 1.145-1.279x |
norm_infer | 1.3523x | RMS small 1.634-1.641x |
rotary_embedding | 1.4912x | HunyuanVideo 2.087x; LTX2 1.133-1.622x |
cutedsl_norm_tanh_mul_add | 1.4953x | v1 1.602-1.625x |
cutedsl_norm_scale_shift | 1.3201x | Hunyuan 1.388-1.516x; JoyAI 1.477-1.495x |
fuse_scale_shift | 2.7499x | small broadcast rows 7.365-7.891x |
group_norm_silu | 2.3118x | small/mid C rows 1.369-4.982x; NC rows up to 3.648x |
attention_concat_copy | 1.30x | head-sliced copy 1.39-2.61x; 24 workloads bit-exact |
causal_conv3d_cat_pad | 2.06x | production rows 1.60-2.45x; bitwise-exact B200 gate |
residual_gate_add | review | old eager geomean 2.19x is superseded; SGLang Triton-row follow-up is about 1.11x |
| Kernel | KernelWiki / reference | Key techniques |
|---|---|---|
qknorm_rope | TensorRT-LLM PR-13052/11869 DiT QKNorm+RoPE; SGLang PR-15141/19059/21440/21654 fused QKNorm/RoPE; memory-bound pattern | Shared RoPE staging, Q/K reuse, staged path only for large rows |
norm_infer | KernelWiki memory-bound/vectorized-loads/register-budgeting; vLLM PR-31828 SM100 RMSNorm opt-in path | Warp-row RMS, tiled persistent RMS, 8B/16B vector paths |
rotary_embedding | SGLang PR-24411 LTX2 split RoPE; vLLM PR-21126/30729 FlashInfer RoPE routing; vectorized-loads | 128-bit vector I/O, cos/sin hoisting, LTX2 block matching |
cutedsl_norm_tanh_mul_add | KernelWiki memory-bound/vectorized-loads/register-budgeting; NCU long-scoreboard and launch-bounds evidence | Hoisted row-invariant math, launch-bounds tuning, exact tanhf |
cutedsl_norm_scale_shift | SGLang PR-14717 CuTe-DSL norm/scale/shift fusion; vectorized-loads; register-budgeting | Operand-class dispatch, 16B/32B vectors, two-pass variance |
fuse_scale_shift | SGLang PR-14717 fused norm/scale/shift family; vectorized-loads; cache-policy; memory-bound pattern | Rowgrid/flatvec/exact-C paths, cache hints, one-pass reduction |
group_norm_silu | SGLang PR-22814/23148/23938 GroupNorm+SiLU; memory-bound pattern; vectorized-loads | Split-group stats, generation counters, channels-last transpose |
attention_concat_copy | SGLang USP attention concat/copy path; memory-bound head-sliced copy; A/A harness validation | Single-launch region copy, pitched 16B block gather, strict layout/device rejection |
causal_conv3d_cat_pad | SGLang causal Conv3D cat/pad Triton baseline; instruction-bound B200 NCU evidence | Flat chunking, 16B vectorized stores, stride-aware fallback, bitwise-exact gate |
residual_gate_add | SGLang residual/gate/add serving row; baseline migration to Triton fuse_scale_shift_kernel; PR #29361 follow-up | One-pass CUDA fusion, pinned-GPU correctness, explicit re-benchmark note after baseline swap |
The companion write-up records the benchmark interpretation, kernel-specific optimization paths, KernelWiki/reference links, and AKO4X comparison: KDA-Pilot optimizing SGLang Diffusion Kernel.
diffusion/ SGLang diffusion-operator kernel tasks.
Each task owns a copied baseline, optimized solution, benchmark,
correctness contract, run logs, and result ledger.
llm/ SGLang autoregressive-model kernel-workflow campaign.
Serve priority models on B200/H200, benchmark low/mid/high
concurrency, profile forward passes, and turn >=1% kernel
interfaces into flat task directories with per-task launchers.
external/ Optional shared knowledge submodules.
KernelWiki/ Blackwell/Hopper kernel design references
ncu-report-skill/ Nsight Compute profiling/report helper
Start with:
diffusion/README.md for standalone diffusion kernel
tasks and benchmark rules.llm/README.md for the LLM kernel-workflow campaign.diffusion/docs/standalone_diffusion_benchmark.md
for the baseline/candidate benchmark contract.diffusion/docs/diffusion_kernel_rules.md
for correctness, fallback, and promotion guardrails.Every diffusion kernel task follows the same shape:
prompt.md task card for the agent
config.toml benchmark/build defaults
baseline/ copied upstream SGLang baseline source
solution/ optimized candidate source
bench/ standalone benchmark and correctness harness
docs/ run logs, profile notes, source notes, decision ledger
The important rule is symmetry: the agent must compare the copied baseline and candidate through matching local interfaces, fixed workload rows, preallocated outputs, CUDA-event timing, interleaved A/B sampling, strict correctness checks, and full provenance.
Clone submodules when you want the optional knowledge references:
git submodule update --init --recursive
Launch a task from the repo root:
diffusion/scripts/launch_kernels/k03_b200_diffusion_qknorm_rope__multi_shape.sh
Useful environment switches:
KDA_NO_CLAUDE=1 # prepare the worktree without launching an agent
KDA_BASE_BRANCH=<ref> # launch from a specific committed ref
KDA_BASH_BIN=/opt/homebrew/bin/bash
macOS /bin/bash 3.2 is rejected by the launcher because nested Humanize/Codex
hooks rely on modern Bash behavior.
These campaigns are run with coding agents in full-autonomy mode. For reproducibility, here is exactly how I launch them on a prepared task worktree.
Claude Code — the same combo the diffusion launcher uses (Opus 4.8 + max effort + auto/bypass-permission mode, i.e. the "Effort (Max)" + "Auto mode" toggles in the Claude Code UI):
claude --permission-mode bypassPermissions --model opus --effort max
diffusion/scripts/launch_kda_kernel_task.sh invokes exactly this (defaults
CLAUDE_MODEL=opus, CLAUDE_EFFORT=max, --permission-mode bypassPermissions),
so launching a task and running Claude by hand are equivalent. To iterate a
long-running goal across model switches, resume the session:
claude --resume <session-uuid>
Ultracode mode — the maximum-thoroughness setting (the "Effort (Ultracode –
xhigh + workflows)" entry in the Claude Code effort menu, paired with Auto mode).
Ultracode is not a launch-flag effort value: claude --effort ultracode warns
(Unknown --effort value 'ultracode') and falls back to the default — the valid
--effort flag levels are low, medium, high, xhigh, max. Ultracode is a
composite of xhigh effort + dynamic workflows enabled, so the agent reasons
at xhigh and authors multi-agent workflows on substantive tasks. Enable dynamic
workflows once — the Dynamic workflows toggle in /config (settings key
enableWorkflows) — then launch at xhigh:
claude --permission-mode bypassPermissions --model opus --effort xhigh
Or do it in one self-contained command:
claude --permission-mode bypassPermissions --model opus --effort xhigh --settings '{"enableWorkflows": true}'
With workflows enabled, the in-session /effort menu shows "Ultracode" and
selecting it pins xhigh. To opt a single prompt in instead of the whole session,
include the keyword ultracode in that message.
Codex — full-access, no approval prompts:
codex --yolo --sandbox danger-full-access --ask-for-approval never
Both run unsandboxed / auto-approve because each task lives in an isolated prepared worktree with its own benchmark + correctness gates; an agent's wins only count when the correctness contract and run logs agree.
The "KDA" in KDA-Pilot stands for Kernel Design Agents — the agent methodology these
campaigns build on. Credit to the original project from MIT Han Lab:
mit-han-lab/kernel-design-agents.
The SGLang serving-kernel tasks here are driven by a fork,
BBuf/kernel-design-agents (wired into each
task's prompt.md), and the bundled external/KernelWiki knowledge
base likewise credits the original KDA project.
1,722 followers · starred Jun 2026
470 followers · starred May 2026
487 followers · starred May 2026
2,136 followers · starred May 2026