---
title: "Custom Kernels for All from Codex and Claude"
description: "Writing CUDA kernels that integrate with diffusers and transformers involves GPU-specific optimization, library integration, PyTorch registration, and environment compatibility. It presents a cuda-kernels agent skill that packages architecture guides, integration patterns, kernel templates, troubleshooting material, benchmarks, and Kernel Hub examples for coding agents. Claude and Codex used it to generate RMSNorm, RoPE 3D, GEGLU, and AdaLN kernels for LTX-Video in diffusers, and an RMSNorm kernel for Qwen3-8B in transformers, including CUDA source, PyTorch bindings, build configuration, and benchmark scripts. On H100 80GB HBM3, the LTX-Video RMSNorm tests averaged 1.88x speedup and the optimized pipeline with torch.compile reached 1.43x the listed baseline, while Qwen3-8B RMSNorm averaged 1.94x and reached 2.47x at 8192 tokens. The skill supports packaging kernels for precompiled distribution through the Hub, where get_kernel selects a matching binary across Python, PyTorch, and CUDA variants."
---

# Custom Kernels for All from Codex and Claude

[Hugging Face](https://yomu.fyi/company/hugging-face) · ben burtenshaw, Sayak Paul, Aritra Roy Gosthipaty, shaun smith · Feb 13, 2026

**Type:** Announcement

## Summary

Writing CUDA kernels that integrate with diffusers and transformers involves GPU-specific optimization, library integration, PyTorch registration, and environment compatibility. It presents a cuda-kernels agent skill that packages architecture guides, integration patterns, kernel templates, troubleshooting material, benchmarks, and Kernel Hub examples for coding agents. Claude and Codex used it to generate RMSNorm, RoPE 3D, GEGLU, and AdaLN kernels for LTX-Video in diffusers, and an RMSNorm kernel for Qwen3-8B in transformers, including CUDA source, PyTorch bindings, build configuration, and benchmark scripts. On H100 80GB HBM3, the LTX-Video RMSNorm tests averaged 1.88x speedup and the optimized pipeline with torch.compile reached 1.43x the listed baseline, while Qwen3-8B RMSNorm averaged 1.94x and reached 2.47x at 8192 tokens. The skill supports packaging kernels for precompiled distribution through the Hub, where get\_kernel selects a matching binary across Python, PyTorch, and CUDA variants.

## Context

CUDA kernel development has a large, specialized surface area spanning GPU-generation-specific optimization, diffusers and transformers integration, PyTorch registration, and compatibility across CUDA, PyTorch, and Python versions. The Kernel Hub distributes precompiled kernels, but the post identifies kernel creation as the remaining gap.

## Approach / What changed

The skill packages roughly 550 tokens of structured guidance with architecture-specific optimization guides, integration references, kernel templates, troubleshooting documentation, scripts, and complete examples. Coding agents use it to generate CUDA source, PyTorch bindings, build.toml configuration, and benchmark projects, after which kernels can be built for multiple variants and published to the Kernel Hub for loading with get\_kernel.

## Takeaways

- The generated LTX-Video RMSNorm kernel averaged 1.88x speedup over the PyTorch baseline across the listed H100 BF16 shapes, with 34.7% of H100 theoretical bandwidth.
- For Qwen3-8B, RMSNorm speedup increased from 1.58x at 128 tokens to 2.47x at 8192 tokens; the post reports 1.94x average speedup and 22.3% theoretical bandwidth efficiency.
- In the LTX-Video end-to-end table, optimized kernels with torch.compile reached 18.45 iterations per second and a listed 1.43x speedup, while RMSNorm represented about 5% of total compute.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Developer Experience](https://yomu.fyi/topic/developer-experience), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Open Source](https://yomu.fyi/topic/open-source), [Performance](https://yomu.fyi/topic/performance)

- Source: [Hugging Face](https://huggingface.co/blog/custom-cuda-kernels-agent-skills)
- Source URL: https://huggingface.co/blog/custom-cuda-kernels-agent-skills
- Ingested by Yomu: 2026-08-28T16:00:46.811Z

[Read original post](https://huggingface.co/blog/custom-cuda-kernels-agent-skills)
