Files
pytorch/torch/csrc/jit/mobile/interpreter.h
Zhengxu Chen 12ede84dbb [jit][edge] Enable lite interpreter to correctly handle INTERFACE_CALL instruction. (#65972)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65972

ghstack-source-id: 141842336

Test Plan: buck test mode/dev //caffe2/test:mobile -- --exact 'caffe2/test:mobile - test_stacktrace_interface_call (mobile.test_lite_script_module.TestLiteScriptModule)'

Reviewed By: qihqi

Differential Revision: D31326147

fbshipit-source-id: 338ff4ce8ddc9502ffe0add49057b33b52a24955
2021-10-29 13:13:32 -07:00

31 lines
688 B
C++

#pragma once
#include <vector>
#include <torch/csrc/jit/mobile/code.h>
#include <torch/csrc/jit/mobile/frame.h>
namespace torch {
namespace jit {
namespace mobile {
struct InterpreterState {
TORCH_API explicit InterpreterState(const Code& code);
TORCH_API bool run(Stack& stack);
private:
void enterFrame(const Code&);
void leaveFrame();
void saveExceptionDebugHandles();
void callFunction(torch::jit::Function& f, Stack& stack);
c10::IValue& reg(size_t reg);
std::vector<c10::IValue> registers_;
std::vector<Frame> frames_;
};
const std::vector<DebugHandle>& getInterpretersExceptionDebugHandles();
} // namespace mobile
} // namespace jit
} // namespace torch