-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Simplify process(Script|Python)(Remote)?Call #57857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 3f9ed81 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
const std::function<void(Message)>& markComplete, | ||
const c10::intrusive_ptr<JitFuture>& responseFuture) const { | ||
c10::intrusive_ptr<JitFuture> RequestCallbackImpl::processPythonCall( | ||
RpcCommandBase& rpc) const { | ||
auto& upc = static_cast<UnpickledPythonCall&>(rpc); | ||
auto future = runPythonFunction(upc.pythonUdf(), upc.isAsyncExecution()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume, later, we will need to pass agent devices to this Future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I'm doing it in #58426.
responseFuture->markCompleted(c10::make_intrusive<Message>( | ||
PythonResp(std::move(serializedPyObj)).toMessage())); | ||
}); | ||
return future->then( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the futures in the chain will introduce another data ptrs extraction for CUDA (when CUDA is enabled here). Do we need to worry about the perf issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been asking myself the same thing. I'm somewhat worried about DataPtr extraction (although not too much, because for the most part here we're inspecting JIT IValues, which should be much cheaper than inspecting Python objects) but I'm also a bit worried about creating/recording/waiting on events each time, getting new streams, ...
I have some ideas on how we can mitigate some of these issues. For example in #58424 I'll allow callbacks to provide pre-extracted DataPtrs, which should allow us to skip extraction in some cases. I also believe we can add some fastpaths in Future so that for example we reuse the same streams from the "parent" when running callbacks.
Honestly, though, I'm also fine for now to take a perf hit if necessary, if that means we can get CUDA support to work correctly and reliably, and then look later into optimizing it.
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
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. Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/) [ghstack-poisoned]
Pull Request resolved: pytorch#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 Differential Revision: [D28253848](https://our.internmc.facebook.com/intern/diff/D28253848/)
This pull request has been merged in cd9dbbd. |
Stack from ghstack:
There used to be a whole lot of methods:
processPythonCall
,processScriptCall
,processScriptRemoteCall
,processPythonRemoteCall
,processScriptCallOp
,processBaseScriptRemoteCall
andprocessScriptRemoteCallOp
. 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.Differential Revision: D28253848