-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Unboxed kernels in c10 #23447
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
Unboxed kernels in c10 #23447
Conversation
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/) ghstack-source-id: 87262377 Pull Request resolved: #23447
| } | ||
|
|
||
| template<class Result, class... Args> | ||
| inline Result callOpUnboxed(const c10::OperatorHandle& op, c10::TensorTypeId dispatchKey, Args... args) { |
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 though the whole point of unboxed call was to figure out the dispatch key from arguments. Do you think it's doable with template magic to collect keys of arguemnts (I recall you had this code somewhere). If not - we can codegen it
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.
This is planned but a future PR. There's a mismatch between c10 and aten currently because c10 chooses "the first tensor argument" to dispatch on while aten looks for "the tensor argument named 'self'". The plan is to add this 'self' functionality to c10 and then use it.
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Pull Request resolved: #23447 ghstack-source-id: 87461228 Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Pull Request resolved: #23447 ghstack-source-id: 87539686 Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
dzhulgakov
left a comment
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.
Stamping it as a standalone change. But it'd be nice to see how it'd connect end-to-end (including boxing/unboxing and figuring out the dispatch keys) and what's the plan going forward
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Differential Revision: [D16521939](https://our.internmc.facebook.com/intern/diff/D16521939/)
|
This pull request has been merged in 9dbee5f. |
Summary: The c10 dispatcher now also stores a `void*` pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature. It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch. Pull Request resolved: pytorch/pytorch#23447 ghstack-source-id: 88050435 Differential Revision: D16521939 fbshipit-source-id: 7e570df5a721defc677c3cc91758651dbe06ce1c
This reverts commit 9dbee5f.
Stack from ghstack:
The c10 dispatcher now also stores a
void*pointer to the unboxed kernel function and this kernel function can be called if the call site knows the exact kernel signature.It is not clear if this API will survive in the long term, but in the short term this allows an easier migration from ATen to c10 and is supposed to replace ATenDispatch.
Differential Revision: D16521939