Simplify process(Script|Python)(Remote)?Call (#57857)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57857

There used to be a whole lot of methods: `processPythonCall`, `processScriptCall`, `processScriptRemoteCall`, `processPythonRemoteCall`, `processScriptCallOp`, `processBaseScriptRemoteCall` and `processScriptRemoteCallOp`. Thanks to the previous simplification, we can now drop all but the first four, which map nicely 1:1 to the four message types we need to handle. Also their signatures become much simpler: they take an RPC command and return a future.
ghstack-source-id: 129567070

Test Plan: CI

Reviewed By: mrshenli

Differential Revision: D28253848

fbshipit-source-id: e0e45345c414a96900f9d70ee555359d28908833
This commit is contained in:
Luca Wehrstedt
2021-05-21 13:10:24 -07:00
committed by Facebook GitHub Bot
parent c96a05d148
commit cd9dbbd93a
4 changed files with 92 additions and 152 deletions

View File

@ -15,24 +15,17 @@ class TORCH_API RequestCallbackImpl : public RequestCallbackNoPython {
std::unique_ptr<RpcCommandBase> rpc,
const MessageType& messageType) const override;
void processPythonCall(
RpcCommandBase& rpc,
const std::function<void(Message)>& markComplete,
const c10::intrusive_ptr<JitFuture>& responseFuture) const override;
c10::intrusive_ptr<JitFuture> processPythonCall(
RpcCommandBase& rpc) const override;
void processScriptCall(
RpcCommandBase& rpc,
const std::function<void(Message)>& markComplete,
const c10::intrusive_ptr<JitFuture>& responseFuture) const override;
c10::intrusive_ptr<JitFuture> processScriptCall(
RpcCommandBase& rpc) const override;
c10::intrusive_ptr<JitFuture> processScriptRemoteCall(
ScriptRemoteCall& scriptRemoteCall,
std::vector<at::IValue>& stack) const override;
RpcCommandBase& rpc) const override;
void processPythonRemoteCall(
c10::intrusive_ptr<JitFuture> processPythonRemoteCall(
RpcCommandBase& rpc,
const std::function<void(Message)>& markComplete,
const c10::intrusive_ptr<JitFuture>& responseFuture,
std::shared_ptr<LazyStreamContext> ctx) const override;
void processPythonRRefFetchCall(