Expand description
BatchNorm1d Triton kernels.
Layout: input x is [N, C] row-major. Element x[n, c] lives at flat
offset n * C + c.
Parallelism: one CTA per channel. Each CTA iterates over all N batch
elements in BLOCK_N-wide tiles. This avoids cross-CTA synchronisation
entirely — C channels execute concurrently across SMs.
Training requires two sequential kernel launches separated by a host sync:
batch_norm_stats_forward— computes per-channel mean + rstd, updates running stats.batch_norm_normalize_forward— normalises x using the saved stats.
Inference uses a single kernel that reads the frozen running statistics.
Structs§
- Batch
Norm2d Nchw Backward - Computes gradients for NCHW BatchNorm2d inference.
- Batch
Norm2d Nchw Forward Inference - Normalises NCHW input
xusing frozen running statistics. - Batch
Norm2d Nchw Inference Runtime Op - RuntimeOp for NCHW BatchNorm2d inference.
- Batch
Norm Backward - Computes gradients for BatchNorm.
- Batch
Norm Forward Inference - Normalises input
xusing the frozenrunning_mean/running_var. - Batch
Norm Normalize Forward - Normalises x using the mean and rstd produced by
batch_norm_stats_forward. - Batch
Norm Normalize Runtime Op - RuntimeOp for the normalize kernel node in a training BatchNorm graph.
- Batch
Norm Stats Forward - Computes per-channel mean and rstd from the current mini-batch, saves them for the normalisation kernel and the backward pass, and updates the running statistics with exponential moving average.
- Batch
Norm Stats Runtime Op - RuntimeOp for the stats kernel node in a training BatchNorm graph.
Functions§
- batch_
norm_ 2d_ nchw_ backward - Computes gradients for NCHW BatchNorm2d inference.
- batch_
norm_ 2d_ nchw_ forward_ inference - Normalises NCHW input
xusing frozen running statistics. - batch_
norm_ backward - Computes gradients for BatchNorm.
- batch_
norm_ forward_ inference - Normalises input
xusing the frozenrunning_mean/running_var. - batch_
norm_ normalize_ forward - Normalises x using the mean and rstd produced by
batch_norm_stats_forward. - batch_
norm_ stats_ forward - Computes per-channel mean and rstd from the current mini-batch, saves them for the normalisation kernel and the backward pass, and updates the running statistics with exponential moving average.