add-sgl-kernel
Step-by-step guide for adding a heavyweight AOT kernel — CUDA path via sgl-kernel (CUTLASS), ROCm/MI355 path via aiter C++/HIP (CK tile, assembly).
Skill by yichiche
Chalk Labs
Need help deploying add-sgl-kernel?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/yichiche-add-sgl-kernel
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Nov 2, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/add-sgl-kernel
What's inside
- Skill name
add-sgl-kernel- Description
- Step-by-step guide for adding a heavyweight AOT kernel — CUDA path via sgl-kernel (CUTLASS), ROCm/MI355 path via aiter C++/HIP (CK tile, assembly). Includes tests and benchmarks. Use when the kernel depends on CUTLASS or needs wheel-build registration. Complements /add-jit-kernel (lightweight) and /implement-kernel (optimization).
- License
- MIT
- Instructions
- 142 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Add a Heavyweight AOT Kernel
Tutorial for **adding a new production kernel** that belongs in the AOT build, not JIT. For lightweight ops, use `/add-jit-kernel`. For optimizing existing dispatch, use `/implement-kernel`.
## Decision tree
| Platform | Dependency | Path |
|----------|-----------|------|
| CUDA (B200/H100) | CUTLASS, large C++ | `$SGLANG_ROOT/python/sglang/kernels/aot/` (sgl-kernel) |
| CUDA | flashinfer-provided CUTLASS | Can stay in `jit_kernel` — see `/add-jit-kernel` |
| ROCm (MI355) | CK tile, HIP, assembly | `/sgl-workspace/aiter/csrc/` + Python wrapper in `aiter/ops/` |
Upstream canonical CUDA AOT tutorial:
https://github.com/sgl-project/sglang/tree/main/.claude/skills/add-sgl-kernel
---
## Step 0: Detect roots
```bash
SGLANG_ROOT=$(python3 -c "import sglang, pathlib; print(pathlib.Path(sglang.__file__).resolve().parents[2])")
AITER_ROOT=/sgl-workspace/aiter # or wherever aiter is installed
echo "SGLang: $SGLANG_ROOT"
echo "aiter: $AITER_ROOT"
```
---
## CUDA path — `sgl-kernel` (AOT)
### Repository map
| Area | Path |
|------|------|
| Implementation | `$SGLANG_ROOT/python/sglang/kernels/aot/csrc/<category>/` |
| Public declarations | `$SGLANG_ROOT/python/sglang/kernels/aot/include/sgl_kernel_ops.h` |
| Torch extension | `$SGLANG_ROOT/python/sglang/kernels/aot/csrc/common_extension.cc` |
| Build | `$SGLANG_ROOT/python/sglang/kernels/aot/CMakeLists.txt` |
| Python API | `$SGLANG_ROOT/python/sglang/kernels/aot/python/sgl_kernel/` |
| Tests | `$SGLANG_ROOT/python/sglang/kernels/aot/tests/test_*.py` |
| Benchmarks | `$SGLANG_ROOT/python/sglang/kernels/aot/benchmark/bench_*.py` |
### Subdirectory guide
- `csrc/elementwise/` — element-wise ops
- `csrc/gemm/` — GEMM kernels
- `csrc/attention/` — attention kernels
- `csrc/moe/` — MoE kernels
### Every new kernel must ship with
1. **pytest** correctness test
2. **Benchmark script** (triton.testing or equivalent)
3. **Torch op registration** in `common_extension.cc`
4. **CMakeLists.txt** entry in `SOURCES`
### Build & test
```bash
cd "$SGLANG_ROOT/python/sglang/kernels/aot"
pip install -e .
python -m pytest tests/test_<kernel>.py -v
```
CI suites: `base-b-kernel-unit-test-*`, `base-b-kernel-benchmark-test-*`
---
## ROCm / MI355 path — aiter C++/HIP (Tier 3)
On MI355, heavyweight kernels live in **aiter**, not sgl-kernel.
### Repository map
| Area | Path |
|------|------|
| CK GEMM | `$AITER_ROOT/csrc/ck_gemm_a8w8_blockscale/`, `csrc/ck_tile_gemm_moe_2stages/` |
| Other HIP kernels | `$AITER_ROOT/csrc/<category>/` |
| Python wrappers | `$AITER_ROOT/aiter/ops/*.py` |
| Triton (lighter) | `$AITER_ROOT/aiter/ops/triton/` |
| Unit tests | `$AITER_ROOT/op_tests/test_*.py` |
| GEMM configs | `$AITER_ROOT/aiter/configs/` |
| Pre-compiled .so | `$AITER_ROOT/aiter/jit/module_*.so` |
### Workflow checklist
1. Implement kernel in `$AITER_ROOT/csrc/`
2. Add Python wrapper in `aiter/ops/<name>.py`
3. Add unit test in `op_tests/test_<name>.py`
4. Wire into SGLang dispatch (guard with `_use_aiter` — see `/implement-kernel`)
5. Rebuild aiter JIT modules if needed:
```bash
cd "$AITER_ROOT" && python setup.py develop
```
6. Validate with `/validate-pr` — kernel time change must show in trace analysis
### SGLang wiring pattern
In the SGLang layer file:
```python
if _use_aiter:
from aiter.ops.gemm_op_a8w8 import gemm_a8w8_blockscale as _aiter_gemm
output = _aiter_gemm(input, weight, ...)
else:
output = _cuda_fallback(input, weight, ...)
```
Never import aiter at module top level. See Backend-Gated Changes in `/implement-kernel`.
### aiter PR + SGLang PR
Tier 3 changes often need **two PRs**:
1. aiter: kernel + wrapper + op_test
2. sglang: dispatch wiring + `_use_aiter` branch
Use `/pr-ab-benchmark` for before/after on the combined stack.
---From yichiche/agent-box, MIT.
More from yichiche/agent-box
- 0.600score
gfx950-asm-development
yichiche
Develop, validate, and tune hand-written AMD gfx950 assembly kernels, with rocprof profiling.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
commit-push
yichiche
Commit (if needed) and push to the user's fork, with repo-aware remote selection and user confirmation before push.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
implement-kernel
yichiche
Implement a kernel optimization for SGLang on MI355/ROCm.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gpu-status
yichiche
Show which AMD GPUs are free and the exact CUDA_VISIBLE_DEVICES to use for SGLang.
SkillAFreshness: A★ 2Claude Code +9 - 0.595score
generate-profile
yichiche
Generate an e2e profiling trace of an SGLang server run.
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
abox-live
yichiche
Monitor Claude agents running inside your containers, from the host or phone — the single entry point (absorbed the old `abox`).
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
pr-conflict-fix
yichiche
Resolve a conflicting GitHub PR inside a throwaway container built from an image you name.
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
commit-push-pr
yichiche
Commit, push, and create a PR in one flow — checks state at each stage, confirms push target, collects accuracy/benchmark data, drafts PR in HackMD format for…
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
compare-kernels
yichiche
Compare kernel categories and timings between two trace analysis Excel files.
SkillAFreshness: A★ 2Claude Code +9 - 0.589score
ci-analysis
yichiche
Analyze GitHub Actions CI failures for a pull request: trace root-cause jobs vs fast-fail cascades (check-pr-test-health), fetch job logs with gh, attribute…
SkillAFreshness: A★ 2Claude Code +9 - 0.585score
pr-ci-watch
yichiche
Watch a list of sgl-project/sglang PRs on two cadences (daily, or high-priority every 2h) and babysit them — re-run red NVIDIA CI only after /ci-analysis…
SkillAFreshness: A★ 2Claude Code +9 - 0.557score
create-new-rc
yichiche
Start a persistent Claude Code Remote Control session on the GPU host (Command Center) for phone/laptop monitoring of container agents.
SkillBFreshness: B★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 21, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/yichiche/agent-box
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from yichiche
- 0.600score
gfx950-asm-development
yichiche
Develop, validate, and tune hand-written AMD gfx950 assembly kernels, with rocprof profiling.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
implement-kernel
yichiche
Implement a kernel optimization for SGLang on MI355/ROCm.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gpu-status
yichiche
Show which AMD GPUs are free and the exact CUDA_VISIBLE_DEVICES to use for SGLang.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
commit-push
yichiche
Commit (if needed) and push to the user's fork, with repo-aware remote selection and user confirmation before push.
SkillAFreshness: A★ 2Claude Code +9 - 0.595score
generate-profile
yichiche
Generate an e2e profiling trace of an SGLang server run.
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
pr-conflict-fix
yichiche
Resolve a conflicting GitHub PR inside a throwaway container built from an image you name.
SkillAFreshness: A★ 2Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get add-sgl-kernel running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
add-sgl-kernel skill. Agent Mart. https://agentmart.dev/skills/yichiche-add-sgl-kernel (last updated 2026-10-24)