diff --git a/backends/nxp/runtime/NeutronBackend.cpp b/backends/nxp/runtime/NeutronBackend.cpp index 3ea973b7c5b..f4865a93205 100644 --- a/backends/nxp/runtime/NeutronBackend.cpp +++ b/backends/nxp/runtime/NeutronBackend.cpp @@ -15,6 +15,12 @@ #include "NeutronDriver.h" #include "NeutronErrors.h" +// Hooks to power on/off the NPU for fine-grained control. +extern "C" { +void __attribute__((weak)) neutronPowerOn(void) {} +void __attribute__((weak)) neutronPowerOff(void) {} +} + using namespace std; namespace torch { @@ -515,7 +521,9 @@ class NeutronBackend final : public PyTorchBackendInterface { #endif // Run neutron compute. + neutronPowerOn(); NeutronError neutronRC = neutronRunBlocking(cfg->nmh, &cfg->dcfg); + neutronPowerOff(); if (neutronRC != ENONE) { ET_LOG( Error, @@ -587,4 +595,4 @@ static auto registered = register_backend(backend_id); } // namespace } // namespace neutron } // namespace executor -} // namespace torch \ No newline at end of file +} // namespace torch