Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion backends/nxp/runtime/NeutronBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -587,4 +595,4 @@ static auto registered = register_backend(backend_id);
} // namespace
} // namespace neutron
} // namespace executor
} // namespace torch
} // namespace torch
Loading