[nativert] Add OSS version of ModelRunner (#159268)

Summary: Implement a ModelRunner from scratch with the minimum features for OSS only

Test Plan:
test_export -r NativeRT

Rollback Plan:

Differential Revision: D78979812

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159268
Approved by: https://github.com/dolpm
This commit is contained in:
Zhengxu Chen
2025-07-29 21:08:10 +00:00
committed by PyTorch MergeBot
parent c0c24b61ff
commit 8460131087
16 changed files with 561 additions and 4 deletions

View File

@ -138,6 +138,8 @@
#include <torch/csrc/itt.h>
#endif
#include <torch/nativert/python/Bindings.h>
namespace py = pybind11;
static PyObject* module;
@ -2780,6 +2782,8 @@ Call this whenever a new thread is created in order to propagate values from
#ifdef USE_KINETO
torch::global_kineto_init();
#endif
auto nativert_module = py_module.def_submodule("_nativert");
torch::nativert::initModelRunnerPybind(nativert_module);
return module;
END_HANDLE_TH_ERRORS
}