cuda-kernels

Optimizes NVIDIA GPU AI inference and training with custom CUDA kernels for HuggingFace libraries.

723|119|Updated Nov 29, 2024
One-click install
npx skills add https://github.com/huggingface/kernels --skill cuda-kernels
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cuda-kernels
Source: https://github.com/huggingface/kernels/tree/main/skills/cuda-kernels
Command: npx skills add https://github.com/huggingface/kernels --skill cuda-kernels

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, kernels, diffusers, transformers, accelerate, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides optimized CUDA kernels and integration guidance to significantly accelerate AI model inference and training on NVIDIA GPUs, reducing latency and improving throughput.

Core Features & Use Cases

  • Optimized CUDA Kernels: High-performance kernels for common operations like RMSNorm, GELU, and attention mechanisms.
  • Benchmarking Tools: Scripts to measure performance gains against baseline implementations.
  • Integration Guides: Detailed instructions for integrating custom kernels with HuggingFace diffusers and transformers libraries.
  • Use Case: Accelerate Stable Diffusion video generation by 6% or LLM inference by replacing standard PyTorch operations with custom, highly optimized CUDA code.

Quick Start

Benchmark the performance of optimized kernels against the baseline implementation for video generation.

Frequently Asked Questions about cuda-kernels

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

FAQPage Schema
How do I optimize CUDA kernels for HuggingFace transformers and diffusers?

To optimize CUDA kernels for HuggingFace models, replace standard PyTorch operations with custom vectorized kernels targeting RMSNorm and GELU. This directly improves GPU compute efficiency and memory bandwidth utilization.

Can I use custom CUDA kernels to accelerate Stable Diffusion video generation?

Yes, you can use custom CUDA kernels to accelerate Stable Diffusion video generation by up to 6%. The integration provides warp-level optimizations and precise memory hierarchy management for faster inference.

Does this GPU optimization approach support older architectures like the T4 alongside H100?

Yes, the GPU optimization approach supports NVIDIA H100, A100, and T4 architectures. It addresses numerical stability and memory bandwidth utilization challenges specific to these different GPU compute environments.

What is the best way to benchmark custom CUDA kernels against baseline PyTorch implementations?

The best way to benchmark custom CUDA kernels against baseline PyTorch implementations is using the provided benchmarking scripts. These tools measure performance gains in latency and throughput for AI model inference and training.

How do warp-level optimizations improve LLM inference latency on NVIDIA GPUs?

Warp-level optimizations improve LLM inference latency by maximizing GPU compute efficiency and managing the memory hierarchy precisely. This reduces bottlenecks in standard operations during transformer model execution.

Do I need PyTorch and the accelerate library to integrate these custom AI kernels?

Yes, you need PyTorch, the accelerate library, and the HuggingFace transformers or diffusers packages. These dependencies provide the necessary framework interfaces to integrate the custom CUDA kernels into your workflows.