#include <vpu/vpu_plugin_config.hpp>
#include <vpu/utils/extra.hpp>
#include <vpu/utils/logger.hpp>
+#include <vpu/utils/profiling.hpp>
#include "myriad_executor.h"
#include "myriad_config.h"
static std::mutex device_mutex;
MyriadExecutor::MyriadExecutor(bool forceReset, const LogLevel& vpuLogLevel, const Logger::Ptr& log) : _log(log) {
+ VPU_PROFILE(MyriadExecutor);
_mvnc = std::make_shared<Mvnc>();
int ncResetAll = forceReset;
auto status = ncGlobalSetOption(NC_RW_RESET_ALL, &ncResetAll, sizeof(ncResetAll));
const std::string& configDevName,
const ncDevicePlatform_t &configPlatform,
const ncDeviceProtocol_t &configProtocol,
- int watchdogInterval) {
+ int watchdogInterval,
+ PowerConfig powerConfig) {
+ VPU_PROFILE(bootNextDevice);
// #-17972, #-16790
#if defined(NO_BOOT)
if (!devicePool.empty()) {
device._name = deviceName;
}
+ status = ncDeviceSetOption(device._deviceHandle, NC_RW_DEVICE_POWER_CONFIG, reinterpret_cast<void*>(&powerConfig), sizeof(dataLength));
+
+ if (status != NC_OK) {
+ _log->warning("Failed to set configuration for Power Manager");
+ ncDeviceClose(&device._deviceHandle);
+ return status;
+ }
+
/* TODO: what should we do if we do not know maximum available graphs? What if we got number <= 0? */
device._graphNum = 1;
device._deviceIdx = lastDeviceIdx + 1;
DevicePtr MyriadExecutor::openDevice(std::vector<DevicePtr> &devicePool,
const std::shared_ptr<MyriadConfig> &config) {
+ VPU_PROFILE(openDevice);
std::lock_guard<std::mutex> lock(device_mutex);
auto firstBootedButEmptyDevice = std::find_if(devicePool.begin(), devicePool.end(),
}
ncStatus_t booted = bootNextDevice(devicePool, config->deviceName,
- config->platform, config->protocol, config->watchdogInterval.count());
+ config->platform, config->protocol, config->watchdogInterval.count(), config->powerConfig);
// TODO Is any tests for this case? #-19309
// In case, then there is no another not booted device, use already booted with minimum number of executors
};)
void MyriadExecutor::closeDevices(std::vector<DevicePtr> &devicePool) {
+ VPU_PROFILE(closeDevices);
std::lock_guard<std::mutex> lock(device_mutex);
for (auto &device : devicePool) {
if (device->_deviceHandle != nullptr) {
const std::vector<char> &graphFileContent,
const std::pair<const char*, size_t> &graphHeaderDesc,
size_t numStages, const char* networkName, int executors) {
+ VPU_PROFILE(allocateGraph);
_numStages = numStages;
graphDesc._name = networkName;
if (device->_deviceHandle == nullptr) {
void MyriadExecutor::queueInference(GraphDesc &graphDesc, void *input_data, size_t input_bytes,
void *result_data, size_t result_bytes) {
+ VPU_PROFILE(queueInference);
#ifndef NDEBUG
if (auto dumpFileName = std::getenv("IE_VPU_DUMP_INPUT_FILE_NAME")) {
std::ofstream file(dumpFileName, std::ios_base::binary | std::ios_base::out);
}
void MyriadExecutor::deallocateGraph(DevicePtr &device, GraphDesc &graphDesc) {
+ VPU_PROFILE(deallocateGraph);
std::lock_guard<std::mutex> lock(device_mutex);
if (graphDesc._inputFifoHandle != nullptr) {