Only use hacky_wrapper_for_legacy_signatures if an op needs it#45742
Only use hacky_wrapper_for_legacy_signatures if an op needs it#45742smessmer wants to merge 4 commits intogh/smessmer/258/basefrom
Conversation
Add a new flag to native_functions.yaml: `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` and the codegen only wraps kernels in the aforementioned wrapper if that flag is set. Apart from that, `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` is equivalent to `full`, i.e. it has full boxing and unboxing support. This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as `use_c10_dispatcher: full` don't have it anymore. Differential Revision: [D23328718](https://our.internmc.facebook.com/intern/diff/D23328718/) [ghstack-poisoned]
Add a new flag to native_functions.yaml: `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` and the codegen only wraps kernels in the aforementioned wrapper if that flag is set. Apart from that, `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` is equivalent to `full`, i.e. it has full boxing and unboxing support. This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as `use_c10_dispatcher: full` don't have it anymore. Differential Revision: [D23328718](https://our.internmc.facebook.com/intern/diff/D23328718/) ghstack-source-id: 113439725 Pull Request resolved: #45742
Codecov Report
@@ Coverage Diff @@
## gh/smessmer/258/base #45742 +/- ##
=====================================================
Coverage 68.19% 68.19%
=====================================================
Files 410 410
Lines 53399 53399
=====================================================
Hits 36418 36418
Misses 16981 16981 Continue to review full report at Codecov.
|
…s it" Add a new flag to native_functions.yaml: `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` and the codegen only wraps kernels in the aforementioned wrapper if that flag is set. Apart from that, `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` is equivalent to `full`, i.e. it has full boxing and unboxing support. This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as `use_c10_dispatcher: full` don't have it anymore. Differential Revision: [D23328718](https://our.internmc.facebook.com/intern/diff/D23328718/) [ghstack-poisoned]
Pull Request resolved: #45742 Add a new flag to native_functions.yaml: `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` and the codegen only wraps kernels in the aforementioned wrapper if that flag is set. Apart from that, `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` is equivalent to `full`, i.e. it has full boxing and unboxing support. This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as `use_c10_dispatcher: full` don't have it anymore. ghstack-source-id: 113487599 Differential Revision: [D23328718](https://our.internmc.facebook.com/intern/diff/D23328718/)
|
Quick meta comment: when we do |
|
OK, I've read over the PR. I don't like how you had to update all of the Here's what I think: you should have hacky wrapper for legacy signatures controlled by a separate field. Its action on codegen is orthogonal to use_c10_dispatcher. I audited your PR for sites where you didn't either test for If you want to make it illegal to have |
That's why I'm adding assertions into the "else" case everywhere. The type checker won't tell you, but if you miss a case, then the assertion will fail. This is actually how I found these if statements I have to change. I don't anticipate adding further values to the enum in the future, but then I didn't originally anticipate to add the About making
Also note that removing the flag is still simple, a first step will be to remove |
|
If the implementation decisions to use a wrapper or not are orthogonal, then at the very least I would expect a helper function to take UseC10Dispatcher and make the call on each of these orthogonal aspects. |
…s it" Add a new flag to native_functions.yaml: `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` and the codegen only wraps kernels in the aforementioned wrapper if that flag is set. Apart from that, `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` is equivalent to `full`, i.e. it has full boxing and unboxing support. This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as `use_c10_dispatcher: full` don't have it anymore. Differential Revision: [D23328718](https://our.internmc.facebook.com/intern/diff/D23328718/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 3112f3a (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 4 times. |
ezyang
left a comment
There was a problem hiding this comment.
OK, I would greatly appreciate it if you introduced a helper function, but I am not going to die on this hill.
…s it" Add a new flag to native_functions.yaml: `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` and the codegen only wraps kernels in the aforementioned wrapper if that flag is set. Apart from that, `use_c10_dispatcher: hacky_wrapper_for_legacy_signatures` is equivalent to `full`, i.e. it has full boxing and unboxing support. This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as `use_c10_dispatcher: full` don't have it anymore. Differential Revision: [D23328718](https://our.internmc.facebook.com/intern/diff/D23328718/) [ghstack-poisoned]
|
This pull request has been merged in 6ba6ecb. |
1 similar comment
|
This pull request has been merged in 6ba6ecb. |
|
|
||
| def arguments(func: FunctionSchema) -> Sequence[DispatcherArgument]: | ||
| if local.use_c10_dispatcher() is UseC10Dispatcher.full: | ||
| if local.use_c10_dispatcher().dispatcher_uses_new_style(): |
There was a problem hiding this comment.
try to keep an eye out for people merging diffs that use the old style. One way to make sure people notice is by renaming UseC10Dispatcher 🥉
There was a problem hiding this comment.
(need to keep an eye out because old style uses will not merge conflict, and they will "work" except when they don't)
Stack from ghstack:
Add a new flag to native_functions.yaml:
use_c10_dispatcher: hacky_wrapper_for_legacy_signaturesand the codegen only wraps kernels in the aforementioned wrapper if that flag is set.
Apart from that,
use_c10_dispatcher: hacky_wrapper_for_legacy_signaturesis equivalent tofull,i.e. it has full boxing and unboxing support.
This greatly reduces the number of ops we apply the hacky_wrapper to, i.e. all ops marked as
use_c10_dispatcher: fulldon't have it anymore.Differential Revision: D23328718