pytorch/test/cpp/rpc
Luca Wehrstedt 4d704e607d Always use intrusive_ptr for Message (1 out of 2) (#58422)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58422

Similar to Future (which I tackled recently), Message is an ivalue type (a "custom class" one), and the natural way to represent it is inside an intrusive_ptr. However in the RPC code we had a mix of usages, often passing Message by value. This has undesirable consequences, as it could easily trigger a copy by accident, which I believe is why in many places we accepted _rvalue references_ to Message, in order to force the caller to move. In my experience this is non-idiomatic in C++ (normally a function signature specifies how the function consumes its arguments, and it's up to the caller to then decide whether to copy or move).

By moving to intrusive_ptr everywhere I think we eliminate and simplify many of the problems above.

In this PR I do half of the migration, by updating everything except the `toMessageImpl` methods, which will come in the next PR.
ghstack-source-id: 129567053

Test Plan: CI

Reviewed By: mrshenli

Differential Revision: D28474878

fbshipit-source-id: 5b76d45e05f6fa58c831e369c5c964d126187a6c
2021-05-21 13:15:24 -07:00
..
CMakeLists.txt fix tensorpipe_agent linked even when USE_TENSORPIPE is turned off (#53281) 2021-03-04 13:29:27 -08:00
e2e_test_base.cpp Enroll TensorPipe agent in C++-only E2E test (#42680) 2020-08-13 07:07:30 -07:00
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 Always use intrusive_ptr for Message (1 out of 2) (#58422) 2021-05-21 13:15:24 -07:00
test_wire_serialization.cpp Back out "Revert D21171334: [pytorch][PR] Change StorageImpl to track byte count rather than element count" (#37893) 2020-05-05 22:43:15 -07:00