[Optimization] Implement fused add rmsnorm (#1667)

This commit is contained in:
ljss
2023-11-18 18:18:02 -08:00
committed by GitHub
parent 8d17774f92
commit e1054247ba
9 changed files with 166 additions and 61 deletions
+10
View File
@@ -6,9 +6,19 @@ void rms_norm(
torch::Tensor& weight,
float epsilon);
void fused_add_rms_norm(
torch::Tensor& input,
torch::Tensor& residual,
torch::Tensor& weight,
float epsilon);
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def(
"rms_norm",
&rms_norm,
"Apply Root Mean Square (RMS) Normalization to the input tensor.");
m.def(
"fused_add_rms_norm",
&fused_add_rms_norm,
"In-place fused Add and RMS Normalization");
}