Sglang diffusion ako4all kernel

From wenyi-li/awesome-agent-kernel-skills · View interactive version

Sglang diffusion ako4all kernel is an AI agent skill from the GitHub repository wenyi-li/awesome-agent-kernel-skills. Use when optimizing an existing SGLang diffusion kernel with AKO4ALL, including AKO4ALL repo hygiene, custom microbench setup, ncu-guided iteration, and end-to-end denoise validation. Also use when a sibling AKO4ALL repo must be cloned or refreshed before starting kernel tuning work.

How to use this skill

Skill file

SGLang Diffusion AKO4ALL Kernel

Use this skill to run the full AKO4ALL-based optimization loop for an existing SGLang diffusion kernel.

It is the default implementation path once the benchmark/profile skill has already shown that a hotspot is real and not covered by an existing fast path. This workflow bootstraps a custom AKO harness, benchmarks and profiles the kernel, iterates with ncu, ports the best version back to sglang, then validates with targeted tests and model-level denoise runs.

This skill assumes a sibling repo layout like:

<base-dir>/
├── sglang/
└── AKO4ALL/

If AKO4ALL/ is missing under the current base directory, clone it first.

Use This Skill When

Do not start here when the bottleneck has not been proven yet.

First use ../sglang-diffusion-benchmark-profile/SKILL.md to:

Before opening AKO, also read

../sglang-diffusion-benchmark-profile/existing-fast-paths.md.

It records current mainline fusions plus the open PR watchlist for diffusion

kernel, VAE, attention, cache, and scheduling work. If an open PR already covers

the same shape family, use it as prior art or decide whether to rebase/extend it

instead of starting a duplicate kernel.

If a future specialized optimization skill matches the kernel family better than AKO4ALL, hand off there instead. The diagnosis contract stays the same.

Mandatory AKO4ALL Preflight

Before any AKO work:

  1. Run scripts/ensure_ako4all_clean.sh [base-dir].
  2. If <base-dir>/AKO4ALL does not exist, the script clones it.
  3. Do not continue unless AKO4ALL is:
  1. If the script reports local commits, divergence, or a dirty worktree, stop and clean or re-clone the repo before continuing.

The script creates an upstream remote automatically when missing.

By default it uses the existing origin URL, or AKO4ALL_URL if you need to override the clone source.

Workflow

1. Scope the Kernel

if it does, note the PR number in the AKO context and final PR artifacts.

2. Bootstrap the AKO Harness

Inside the clean AKO4ALL repo:

The custom benchmark should:

3. Establish the Baseline

4. Iterate in AKO4ALL

After 3 consecutive no-improvement or regression iterations:

5. Port the Best Version Back to SGLang

6. Validate on Real Models

7. Prepare PR Artifacts

At minimum, keep:

See references/ako-loop.md for the checklist and common stop rules.

Operating Rules

Falling back to diffusers backend, Using diffusers backend, or

Loaded diffusers pipeline; fix backend selection and rerun the

benchmark/profile workflow first.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.