-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Unify boxed function signature between jit and c10 #37034
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
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 14ea12a (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:
|
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 102624730 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 102643121 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
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
@@ -29,9 +29,15 @@ using Operation = std::function<int(Stack&)>; | |||
static inline IValue& peek(Stack& stack, size_t i, size_t N) { | |||
return *(stack.end() - N + i); | |||
} | |||
static inline IValue& peek(Stack* stack, size_t i, size_t N) { | |||
return peek(*stack, i, N); | |||
} |
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.
Given the switch from Stack&
to Stack*
, why do we still need the old Stack&
overloads? Will probably find out further down the PR, but leaving this here just in case not :P
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.
because otherwise we'd have to change even more code. They probably should die at some point though.
aten/src/ATen/core/stack.h
Outdated
@@ -72,11 +87,14 @@ template <typename... Types> | |||
static inline void pop(Stack& stack, Types&... args) { | |||
size_t i = 0; | |||
constexpr size_t N = sizeof...(args); | |||
int result[N] = { | |||
(void)std::initializer_list<int>{ |
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 change isn't strictly necessary, right?
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.
true, this is something I cleaned up on the way
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.
@bhosmer lol remember the msvc issue where we had to land exactly this to fix it? I should have landed this sooner and we would have had to do a lot less debugging there...
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.
ugh yeah as you were describing the fix I was thinking of this change and wondering where it had gone 😝
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 102855159 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 102896394 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 102934643 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106815351 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/) [ghstack-poisoned]
Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Differential Revision: [D20567950](https://our.internmc.facebook.com/intern/diff/D20567950/)
Summary: Pull Request resolved: #37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Test Plan: unit tests Differential Revision: D20567950 fbshipit-source-id: 1a7aea291023afc52ae706957e9a5ca576fbb53b
Our project has registered custom jit operators (outside of the pytorch tree), and this diff breaks them because the |
The |
Btw, are you certain those projects break? I think TVM will likely break because they need access to the JIT node and that changed, but I think the TRTorch project shouldn't break. The way they're calling still works, just throws a deprecation warning now. |
The reason we chose to directly register jit operator is that our custom op's kernel needs to access the attribute of its associated jit node (similar to the torch_tvm use case linked in my last comment). |
I have not tried actually building them, maybe you are right that TRTorch doesn't break. |
hm yes, in that case you need |
Summary: Pull Request resolved: pytorch/pytorch#37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Differential Revision: D20567950 fbshipit-source-id: 1a7aea291023afc52ae706957e9a5ca576fbb53b
Summary: Pull Request resolved: pytorch/pytorch#37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Differential Revision: D20567950 fbshipit-source-id: 1a7aea291023afc52ae706957e9a5ca576fbb53b
Summary: Pull Request resolved: pytorch/pytorch#37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Test Plan: unit tests Differential Revision: D20567950 fbshipit-source-id: 1a7aea291023afc52ae706957e9a5ca576fbb53b
Summary: Pull Request resolved: pytorch/pytorch#37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Test Plan: unit tests Differential Revision: D20567950 fbshipit-source-id: 1a7aea291023afc52ae706957e9a5ca576fbb53b
Stack from ghstack:
c10 takes a Stack* in boxed functions while JIT took Stack&.
c10 doesn't return anything while JIT returns an int which is always zero.
This changes JIT to follow the c10 behavior.
Differential Revision: D20567950