Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JackCaoG committed Feb 24, 2024
1 parent 2f2ad67 commit 09cc0cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions torch_xla/csrc/init_python_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,14 @@ void InitXlaModuleBindings(py::module m) {
xtensor->MarkDynamicDimension(dim);
});

// This api will set the `should_donate_buffer_` field in the
// ComputationClient::Data. This api is currently only useful if you are
// running with `torch.compile`. Buffer assocaited with data with
// `should_donate_buffer_` set to true will be donated to the output, You
// should only use this api if
// 1. You are using torch.compile
// 2. You will inplace update a tensor in the `torch.compiled` function(so the
// currnet buffer can be donated after compuation)
m.def("_set_buffer_donation",
[](at::Tensor& input, bool should_donate) -> bool {
XLATensorPtr xtensor = bridge::GetXlaTensor(input);
Expand Down

0 comments on commit 09cc0cb

Please sign in to comment.