diffusion-kernel

Integrate optimized CUDA and Triton kernels for diffusion model inference.

3|Updated Jun 18, 2025
One-click install
npx skills add https://github.com/moirai-internal/sglang --skill diffusion-kernel-moirai-internal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: diffusion-kernel
Source: https://github.com/moirai-internal/sglang/tree/main/python/sglang/multimodal_gen/.claude/skills/diffusion-kernel
Command: npx skills add https://github.com/moirai-internal/sglang --skill diffusion-kernel-moirai-internal

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill accelerates the inference speed of diffusion models by optimizing critical GPU kernels, reducing latency and improving throughput.

Core Features & Use Cases

  • Kernel Optimization: Integrates highly optimized CUDA and Triton kernels for diffusion model components (e.g., RMSNorm, AdaLN, RoPE).
  • Performance Benchmarking: Provides tools to benchmark and profile kernel performance against baselines.
  • Use Case: Reduce the time it takes to generate images or videos from diffusion models by applying these optimized kernels, leading to faster iteration cycles for artists and developers.

Quick Start

Use the diffusion-kernel skill to benchmark the performance of the RMSNorm kernel.

Frequently Asked Questions about diffusion-kernel

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

FAQPage Schema
How do I optimize GPU kernel performance for diffusion models?

Optimize GPU kernel performance for diffusion models by integrating highly efficient CUDA and Triton kernels. This Skill targets bottlenecks in elementwise operations, normalization, attention, and memory access patterns to maximize inference speed and throughput.

What's the best way to speed up inference for diffusion model components like RMSNorm and RoPE?

Speed up inference for diffusion model components by applying optimized CUDA and Triton kernels for operations like RMSNorm, AdaLN, and RoPE. These specialized kernels replace default implementations to reduce latency and improve overall generation throughput.

Can I profile and benchmark custom CUDA kernels with Nsight Compute for NVIDIA GPUs?

Profile and benchmark custom CUDA kernels with Nsight Compute using the provided tools. The Skill includes detailed guides for profiling performance against baselines and writing custom kernels optimized for NVIDIA GPUs like H100, A100, and T4.

How does writing custom Triton kernels improve diffusion model inference acceleration?

Writing custom Triton kernels improves diffusion model inference acceleration by addressing specific memory access pattern bottlenecks. Optimizing these elementwise operations and attention mechanisms directly reduces latency and speeds up image or video generation cycles.

Do I need an NVIDIA H100 or A100 to see performance gains from diffusion kernel optimization?

NVIDIA H100 or A100 GPUs are not strictly required to see performance gains from diffusion kernel optimization. The provided CUDA and Triton kernels also support the T4, allowing inference acceleration and throughput improvements across various NVIDIA GPU architectures.