You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[17/n] Pass monarch tensors to actor endpoints, part 2, actor messages sent in order
When you send a monarch.Tensor to an actor, what actually happens is that you instruct the stream managing the tensor to send the tensor to the actor.
In part 1, that stream directly told the actor what method to call, and where to send the result. The issue with that is ordering: from the perspective of the original caller it is as if we are sending a message to the actor directly. If the stream sends the message it is possible that it arrives out of order with respect to a message that goes directly to the actor (e.g. a message that contains no monarch.Tensors).
This resolves ordering issue: now the client sends a message to the actor 'CallMethodIndirect' that provides the pickled args/kwargs and method to invoke.
The local python values of the torch.Tensors still need to come from Stream actor, so CallMethodIndirect looks them up by messaging the (new) LocalStateBrokerActor which can transfer PyObjects between local actors without serialization.
Ordering is guarenteed for both tensors and actors because a message is sent to both the receiving actor _and_ the stream actor at the same time.
Differential Revision: [D78314012](https://our.internmc.facebook.com/intern/diff/D78314012/)
ghstack-source-id: 296356330
Pull Request resolved: #539
0 commit comments