Enable log information. Disable NPU in U9
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "ANSODEngine.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
#include "ANSYOLOOD.h"
|
||||
#include "ANSTENSORRTOD.h"
|
||||
#include "ANSTENSORRTCL.h"
|
||||
@@ -333,8 +334,10 @@ namespace ANSCENTER
|
||||
std::vector<std::string> available_devices = core.get_available_devices();
|
||||
bool device_found = false;
|
||||
std::string deviceName = "CPU";
|
||||
// Search for NPU
|
||||
auto it = std::find(available_devices.begin(), available_devices.end(), "NPU");
|
||||
// Search for NPU (gated by OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h)
|
||||
auto it = IsOpenVINONpuEnabled()
|
||||
? std::find(available_devices.begin(), available_devices.end(), "NPU")
|
||||
: available_devices.end();
|
||||
if (it != available_devices.end()) {
|
||||
core.set_property("NPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
|
||||
core.set_property("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
|
||||
@@ -1414,7 +1417,7 @@ namespace ANSCENTER
|
||||
};
|
||||
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs;
|
||||
if (!s_npuProbed || s_npuAvailable) {
|
||||
if (IsOpenVINONpuEnabled() && (!s_npuProbed || s_npuAvailable)) {
|
||||
try_configs.push_back(makeConfig("AUTO:NPU,GPU"));
|
||||
}
|
||||
try_configs.push_back(makeConfig("GPU.0"));
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <json.hpp>
|
||||
#include "ANSODEngine.h"
|
||||
#include "ANSLicense.h" // ANS_DBG macro
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
#include "ANSYOLOOD.h"
|
||||
#include "ANSTENSORRTOD.h"
|
||||
#include "ANSTENSORRTCL.h"
|
||||
@@ -354,8 +355,10 @@ namespace ANSCENTER
|
||||
std::vector<std::string> available_devices = core.get_available_devices();
|
||||
bool device_found = false;
|
||||
std::string deviceName = "CPU";
|
||||
// Search for NPU
|
||||
auto it = std::find(available_devices.begin(), available_devices.end(), "NPU");
|
||||
// Search for NPU (gated by OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h)
|
||||
auto it = IsOpenVINONpuEnabled()
|
||||
? std::find(available_devices.begin(), available_devices.end(), "NPU")
|
||||
: available_devices.end();
|
||||
if (it != available_devices.end()) {
|
||||
core.set_property("NPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
|
||||
core.set_property("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include"ANSONNXCL.h"
|
||||
#include "EPLoader.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
namespace ANSCENTER
|
||||
{
|
||||
|
||||
@@ -143,20 +144,26 @@ namespace ANSCENTER
|
||||
const std::string numberOfThreads = "1";
|
||||
const std::string numberOfStreams = "1";
|
||||
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs = {
|
||||
{ {"device_type","AUTO:NPU,GPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} },
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs;
|
||||
// NPU gated by OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h
|
||||
if (IsOpenVINONpuEnabled()) {
|
||||
try_configs.push_back(
|
||||
{ {"device_type","AUTO:NPU,GPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} });
|
||||
}
|
||||
try_configs.push_back(
|
||||
{ {"device_type","GPU.0"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} },
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} });
|
||||
try_configs.push_back(
|
||||
{ {"device_type","GPU.1"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} },
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} });
|
||||
try_configs.push_back(
|
||||
{ {"device_type","AUTO:GPU,CPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} }
|
||||
};
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","False"} });
|
||||
|
||||
for (const auto& config : try_configs) {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ANSOPENVINOCL.h"
|
||||
#include "Utility.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
namespace ANSCENTER
|
||||
{
|
||||
bool OPENVINOCL::OptimizeModel(bool fp16, std::string& optimizedModelFolder) {
|
||||
@@ -369,8 +370,10 @@ namespace ANSCENTER
|
||||
std::vector<std::string> available_devices = core.get_available_devices();
|
||||
bool device_found = false;
|
||||
|
||||
// Search for NPU
|
||||
auto it = std::find(available_devices.begin(), available_devices.end(), "NPU");
|
||||
// Search for NPU (gated by OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h)
|
||||
auto it = IsOpenVINONpuEnabled()
|
||||
? std::find(available_devices.begin(), available_devices.end(), "NPU")
|
||||
: available_devices.end();
|
||||
if (it != available_devices.end()) {
|
||||
core.set_property("NPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
|
||||
core.set_property("GPU", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ANSOPENVINOOD.h"
|
||||
#include "Utility.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
namespace ANSCENTER
|
||||
{
|
||||
bool OPENVINOOD::OptimizeModel(bool fp16, std::string& optimizedModelFolder) {
|
||||
@@ -437,8 +438,11 @@ namespace ANSCENTER
|
||||
ov::Core core;
|
||||
// Step 2: Get Available Devices and Log
|
||||
std::vector<std::string> available_devices = core.get_available_devices();
|
||||
// Define device priority: NPU > GPU > CPU
|
||||
std::vector<std::string> priority_devices = { "NPU", "GPU" };
|
||||
// Define device priority: NPU > GPU > CPU. NPU gated by
|
||||
// OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h.
|
||||
std::vector<std::string> priority_devices;
|
||||
if (IsOpenVINONpuEnabled()) priority_devices.push_back("NPU");
|
||||
priority_devices.push_back("GPU");
|
||||
bool device_found = false;
|
||||
|
||||
// Iterate over prioritized devices
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ANSOVSEG.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
namespace ANSCENTER {
|
||||
bool ANSOVSEG::OptimizeModel(bool fp16, std::string& optimizedModelFolder) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
@@ -493,8 +494,11 @@ namespace ANSCENTER {
|
||||
ov::Core core;
|
||||
// Step 2: Get Available Devices and Log
|
||||
std::vector<std::string> available_devices = core.get_available_devices();
|
||||
// Define device priority: NPU > GPU > CPU
|
||||
std::vector<std::string> priority_devices = { "NPU", "GPU" };
|
||||
// Define device priority: NPU > GPU > CPU. NPU gated by
|
||||
// OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h.
|
||||
std::vector<std::string> priority_devices;
|
||||
if (IsOpenVINONpuEnabled()) priority_devices.push_back("NPU");
|
||||
priority_devices.push_back("GPU");
|
||||
bool device_found = false;
|
||||
|
||||
// Iterate over prioritized devices
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ANSYOLO12OD.h"
|
||||
#include "EPLoader.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
#ifdef USEONNXOV
|
||||
#endif
|
||||
|
||||
@@ -365,20 +366,26 @@ namespace ANSCENTER {
|
||||
const std::string numberOfThreads = "8";
|
||||
const std::string numberOfStreams = "8";
|
||||
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs = {
|
||||
{ {"device_type","AUTO:NPU,GPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} },
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs;
|
||||
// NPU gated by OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h
|
||||
if (IsOpenVINONpuEnabled()) {
|
||||
try_configs.push_back(
|
||||
{ {"device_type","AUTO:NPU,GPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
}
|
||||
try_configs.push_back(
|
||||
{ {"device_type","GPU.0"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} },
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
try_configs.push_back(
|
||||
{ {"device_type","GPU.1"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} },
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
try_configs.push_back(
|
||||
{ {"device_type","AUTO:GPU,CPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} }
|
||||
};
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
|
||||
for (const auto& config : try_configs) {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "ANSYOLOOD.h"
|
||||
#include "Utility.h"
|
||||
#include "EPLoader.h"
|
||||
#include "OpenVINODeviceConfig.h"
|
||||
#include "ANSGpuFrameRegistry.h"
|
||||
#include "NV12PreprocessHelper.h" // tl_currentGpuFrame()
|
||||
#ifdef USEONNXOV
|
||||
@@ -303,20 +304,26 @@ namespace ANSCENTER
|
||||
const std::string numberOfThreads = "8";
|
||||
const std::string numberOfStreams = "8";
|
||||
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs = {
|
||||
{ {"device_type","AUTO:NPU,GPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} },
|
||||
std::vector<std::unordered_map<std::string, std::string>> try_configs;
|
||||
// NPU gated by OPENVINO_ENABLE_NPU — see OpenVINODeviceConfig.h
|
||||
if (IsOpenVINONpuEnabled()) {
|
||||
try_configs.push_back(
|
||||
{ {"device_type","AUTO:NPU,GPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
}
|
||||
try_configs.push_back(
|
||||
{ {"device_type","GPU.0"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} },
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
try_configs.push_back(
|
||||
{ {"device_type","GPU.1"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} },
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
try_configs.push_back(
|
||||
{ {"device_type","AUTO:GPU,CPU"}, {"precision",precision},
|
||||
{"num_of_threads",numberOfThreads}, {"num_streams",numberOfStreams},
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} }
|
||||
};
|
||||
{"enable_opencl_throttling","False"}, {"enable_qdq_optimizer","True"} });
|
||||
|
||||
for (const auto& config : try_configs) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user