pub fn rms_norm_residual(
gpu: &dyn GpuBackend,
kernel: KernelHandle,
input: DevicePtr,
weight: &DenseWeight,
output: DevicePtr,
residual: DevicePtr,
num_tokens: u32,
hidden_size: u32,
eps: f32,
stream: u64,
) -> Result<()>Expand description
Fused RMS norm + residual save: normed = rms_norm(input), residual = input.
Eliminates a separate D2D copy by writing the raw input to the residual buffer in the same pass as the normalized output write.
Kernel: rms_norm_residual(input, weight, output, residual, hidden_size, eps)
Grid: (num_tokens, 1, 1) Block: (min(hidden_size, 1024), 1, 1)