Write Triton LayerNorm Kernel

Official

Numerically-stable Triton LayerNorm kernel.

Authortensormux
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Implements a numerically stable, fused LayerNorm kernel in Triton with optional RMSNorm support for fast, single-pass normalization across rows, including stable mean/variance computation and optional affine gamma/beta application.

Core Features & Use Cases

  • Fused LayerNorm (mean subtraction + std normalization) across rows with vectorized tile processing.
  • RMSNorm variant (no mean subtraction) with learnable gamma/beta and optional training path.
  • Backward pass readiness: outputs mean and rstd for gradient computation and supports masking for non-divisible hidden dimensions in inputs.

Quick Start

Load the Triton kernel and run it on a (N, H) input with gamma and beta, verifying numeric stability against a reference LayerNorm.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: Write Triton LayerNorm Kernel
Download link: https://github.com/tensormux/kernel-skills/archive/main.zip#write-triton-layernorm-kernel

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 510,000+ vetted skills library on demand.