diffusion-kernel

Develop and optimize Triton and CUDA JIT kernels for diffusion models.

105|9|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/guqiong96/Lsglang --skill diffusion-kernel-guqiong96
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: diffusion-kernel
Source: https://github.com/guqiong96/Lsglang/tree/main/python/sglang/multimodal_gen/.claude/skills/diffusion-kernel
Command: npx skills add https://github.com/guqiong96/Lsglang --skill diffusion-kernel-guqiong96

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill streamlines the development and optimization of GPU kernels for diffusion models, addressing performance bottlenecks in critical components like normalization, attention, and elementwise operations.

Core Features & Use Cases

  • JIT Kernel Development: Guides for writing and integrating custom Triton and CUDA kernels for diffusion models.
  • Performance Profiling: Provides workflows for benchmarking and deep-diving into kernel performance using torch.profiler, nsys, and ncu.
  • Use Case: A developer needs to optimize the RMSNorm layer in a diffusion model. They can use this Skill to write a highly efficient JIT CUDA kernel, test its correctness against PyTorch, benchmark its speedup, and profile it with ncu to ensure it saturates GPU memory bandwidth.

Quick Start

Use the diffusion-kernel skill to add a new Triton kernel for fused elementwise operations.

Frequently Asked Questions about diffusion-kernel

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

FAQPage Schema
How do I optimize diffusion model GPU kernels using Triton and CUDA JIT compilation?

To optimize diffusion model GPU kernels, you can author custom Triton and CUDA JIT kernels, integrate them into the SGLang runtime, and validate performance using torch.profiler and NVIDIA Nsight tools to ensure bandwidth saturation.

What is the best way to profile performance bottlenecks in diffusion model normalization and attention layers?

Profiling diffusion model bottlenecks in normalization and attention layers is best achieved by using torch.profiler, nsys, and ncu for deep-dive analysis to identify and resolve memory bandwidth and computational constraints.

How do I test correctness and benchmark speedup for custom CUDA kernels against PyTorch?

You can test custom CUDA kernel correctness against native PyTorch operations and benchmark the resulting speedup to verify that your Triton or CUDA JIT implementation provides actual inference performance gains.

Can I integrate custom GPU kernels into the SGLang runtime for enhanced inference speed?

Yes, you can integrate custom GPU kernels into the SGLang runtime, which allows you to replace default PyTorch operations with optimized Triton kernels to achieve enhanced diffusion model inference speed.

When do I need to write custom Triton kernels for elementwise operations in diffusion models?

You need to write custom Triton kernels for elementwise operations when standard PyTorch implementations fail to saturate GPU memory bandwidth, creating performance bottlenecks during diffusion model inference.