Skip to content

Commit c90a720

Browse files
ptrendxKshitijLakhani
authored andcommitted
Fix the use-after-free bug in unfused normalization (#2002)
Signed-off-by: Przemek Tredak <[email protected]>
1 parent 5f1142e commit c90a720

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

transformer_engine/pytorch/csrc/extensions/normalization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ std::vector<py::object> layernorm_fwd(py::handle input, py::handle weight, Maybe
108108
}
109109
}
110110
TensorWrapper unquantized_out_cu;
111+
py::object unquantized_out;
111112
if (force_unfused_kernel) {
112113
NoneQuantizer q{none};
113-
py::object unquantized_out;
114114
std::tie(unquantized_out_cu, unquantized_out) = q.create_tensor(size, out_dtype);
115115
}
116116
TensorWrapper &kernel_out_cu = force_unfused_kernel ? unquantized_out_cu : out_cu;
@@ -269,9 +269,9 @@ std::vector<py::object> rmsnorm_fwd(const py::handle &input, const py::handle &w
269269
}
270270
}
271271
TensorWrapper unquantized_out_cu;
272+
py::object unquantized_out;
272273
if (force_unfused_kernel) {
273274
NoneQuantizer q{none};
274-
py::object unquantized_out;
275275
std::tie(unquantized_out_cu, unquantized_out) = q.create_tensor(size, out_dtype);
276276
}
277277
TensorWrapper &kernel_out_cu = force_unfused_kernel ? unquantized_out_cu : out_cu;

0 commit comments

Comments
 (0)