-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Interpreter support for CallFunction/CallMethod #21325
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
Summary: Adds CALL instruction, and function_table to interpreter state. Interpreter state now has a list of Frame objects to keep track of active call frames. Nodes: * Re-did how exception wrapping works so that call stacks can be printed by the interpreter. * Change the order of error reporting so that it is more clear what part of a printout is attributable to the interpreter or shape prop adding additional context to an error. * The first-class functions are only enabled under a guard because serialization does not work and more tests need to be added for the funnctionality.
| ActiveFrame af(frames.back()); | ||
| try { | ||
| return runInterpreterLoop(stack); | ||
| while (true) { |
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 just moving the interpreter loop inline here because the exception handling stuff needs to see af.pc. The ops themselves, except for CALL have not meaningfully changed.
Interpreter support for CallFunction/CallMethod Summary: Adds CALL instruction, and function_table to interpreter state. Interpreter state now has a list of Frame objects to keep track of active call frames. Nodes: * Re-did how exception wrapping works so that call stacks can be printed by the interpreter. * Change the order of error reporting so that it is more clear what part of a printout is attributable to the interpreter or shape prop adding additional context to an error. * The first-class functions are only enabled under a guard because serialization does not work and more tests need to be added for the funnctionality. gh-metadata: pytorch pytorch 21325 gh/zdevito/48/head
| const Code& code = | ||
| af.functions[inst.X]->get_executor().getPlanFor(stack).code; | ||
| frames.back().pc = af.pc + 1; | ||
| enterFrame(code); |
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 think enterFrame and leaveFrame should set the active frame. That would require af to be a member of the interpreter state though.
| namespace torch { | ||
| namespace jit { | ||
|
|
||
| struct ExceptionMessage { |
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.
Can you add a comment explaining what purpose this serves? Why cut out the c10 backtarce is not obvious I think.
Interpreter support for CallFunction/CallMethod Summary: Adds CALL instruction, and function_table to interpreter state. Interpreter state now has a list of Frame objects to keep track of active call frames. Nodes: * Re-did how exception wrapping works so that call stacks can be printed by the interpreter. * Change the order of error reporting so that it is more clear what part of a printout is attributable to the interpreter or shape prop adding additional context to an error. * The first-class functions are only enabled under a guard because serialization does not work and more tests need to be added for the funnctionality. gh-metadata: pytorch pytorch 21325 gh/zdevito/48/head
Interpreter support for CallFunction/CallMethod Summary: Adds CALL instruction, and function_table to interpreter state. Interpreter state now has a list of Frame objects to keep track of active call frames. Nodes: * Re-did how exception wrapping works so that call stacks can be printed by the interpreter. * Change the order of error reporting so that it is more clear what part of a printout is attributable to the interpreter or shape prop adding additional context to an error. * The first-class functions are only enabled under a guard because serialization does not work and more tests need to be added for the funnctionality. gh-metadata: pytorch pytorch 21325 gh/zdevito/48/head
Interpreter support for CallFunction/CallMethod Summary: Adds CALL instruction, and function_table to interpreter state. Interpreter state now has a list of Frame objects to keep track of active call frames. Nodes: * Re-did how exception wrapping works so that call stacks can be printed by the interpreter. * Change the order of error reporting so that it is more clear what part of a printout is attributable to the interpreter or shape prop adding additional context to an error. * The first-class functions are only enabled under a guard because serialization does not work and more tests need to be added for the funnctionality. gh-metadata: pytorch pytorch 21325 gh/zdevito/48/head
Interpreter support for CallFunction/CallMethod Summary: Adds CALL instruction, and function_table to interpreter state. Interpreter state now has a list of Frame objects to keep track of active call frames. Nodes: * Re-did how exception wrapping works so that call stacks can be printed by the interpreter. * Change the order of error reporting so that it is more clear what part of a printout is attributable to the interpreter or shape prop adding additional context to an error. * The first-class functions are only enabled under a guard because serialization does not work and more tests need to be added for the funnctionality. gh-metadata: pytorch pytorch 21325 gh/zdevito/48/head
Stack from ghstack:
Summary: Adds CALL instruction, and function_table to interpreter state.
Interpreter state now has a list of Frame objects to keep track of
active call frames.
Nodes:
by the interpreter.
part of a printout is attributable to the interpreter or shape prop
adding additional context to an error.
serialization does not work and more tests need to be added for
the funnctionality.
Differential Revision: D15618275