Skip to content

Commit

Permalink
XLA bindings for torch_neuronx.trace and profile bindings (#5502)
Browse files Browse the repository at this point in the history
* Add python bindings to set IR debug settings on and off (in addition to env variables)

* Add python bindings for turning device cache on and off, and special scalar handling

* Lint fixes

* Lint fixes for init_python_bindings.cpp
  • Loading branch information
mrnikwaws authored and wonjoolee95 committed Nov 9, 2023
1 parent 7c918a3 commit 684baa5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions torch_xla/csrc/init_python_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,19 @@ void InitXlaModuleBindings(py::module m) {
MapXlaEnvVarsToLazy();
InitXlaBackend();
});
m.def("_set_ir_debug",
[](bool ir_debug) { FLAGS_torch_lazy_ir_debug = ir_debug; });
m.def("_get_ir_debug", []() { return FLAGS_torch_lazy_ir_debug; });
m.def("_set_xla_handle_special_scalars", [](bool handle_special_scalars) {
FLAGS_torch_lazy_handle_special_scalars = handle_special_scalars;
});
m.def("_get_xla_handle_special_scalars",
[]() { return FLAGS_torch_lazy_handle_special_scalars; });
m.def("_set_xla_enable_device_data_cache", [](bool enable_device_data_cache) {
FLAGS_torch_lazy_enable_device_data_cache = enable_device_data_cache;
});
m.def("_get_xla_enable_device_data_cache",
[]() { return FLAGS_torch_lazy_enable_device_data_cache; });
m.def("_replace_xla_tensor",
[](at::Tensor& self, const at::Tensor& source) -> at::Tensor& {
return XLANativeFunctions::set_(self, source);
Expand Down

0 comments on commit 684baa5

Please sign in to comment.