Expand description
LayerNorm Triton kernels.
Layout: input x is [M, N] row-major where M = product of batch / outer
dimensions and N = product of the normalized dimensions. Each CTA handles
one row (one sample), reading all N elements in BLOCK_N-wide tiles.
Forward: y[m, n] = (x[m, n] − mean_m) / sqrt(var_m + eps) * γ[n] + β[n]
Training launches a single forward kernel that also writes out the saved
mean and rstd buffers for the backward pass.
Structs§
- Layer
Norm Backward - Backward pass for LayerNorm.
- Layer
Norm Forward - Forward pass that also saves per-row mean and rstd for the backward pass.
- Layer
Norm Forward Inference - Forward pass using pre-computed running statistics (inference only).
- Layer
Norm Forward Inference Runtime Op - RuntimeOp for LayerNorm inference.
Functions§
- layer_
norm_ backward - Backward pass for LayerNorm.
- layer_
norm_ forward - Forward pass that also saves per-row mean and rstd for the backward pass.
- layer_
norm_ forward_ inference - Forward pass using pre-computed running statistics (inference only).