pytorch/test/cpp/rpc
Luca Wehrstedt 36e47af58b Pass reference to parent future in callbacks (#57635)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57635

Note: this PR looks massive, but it's just one simple change, codemodded many times.

In many cases, a callback needs to access the value/error produced by the parent future. In Python this was easy because the callback was invoked with the parent future as argument, and could thus inspect it. In C++ the callbacks didn't take any arguments, thus in many cases we worked around this by capturing the future in its own callback. This is risky (leads to reference cycle and thus memory leak) and must be done carefully (spoiler: sometimes we weren't).
ghstack-source-id: 128296580

Test Plan: CI

Reviewed By: wanchaol

Differential Revision: D28178783

fbshipit-source-id: 6de02c4568be42123372edc008f630d5ddae0081
2021-05-07 03:59:18 -07:00
..
CMakeLists.txt
e2e_test_base.cpp
e2e_test_base.h Pass reference to parent future in callbacks (#57635) 2021-05-07 03:59:18 -07:00
test_e2e_process_group.cpp [distributed] add base processgroup::options (#53662) 2021-03-17 18:40:04 -07:00
test_e2e_tensorpipe.cpp [distributed] add base processgroup::options (#53662) 2021-03-17 18:40:04 -07:00
test_tensorpipe_serialization.cpp Use Devices instead of DeviceIndexes in TensorPipe agent (#57294) 2021-05-01 16:12:55 -07:00
test_wire_serialization.cpp