[GNA] Support new configuration API (#9955)
* [GNA] Support new configuration API * Review comments: description fixes * Review comments
This commit is contained in:
@@ -55,4 +55,23 @@ namespace runtime {
|
||||
using ov::SupportedOpsMap;
|
||||
} // namespace runtime
|
||||
|
||||
} // namespace ov
|
||||
} // namespace ov
|
||||
|
||||
namespace std {
|
||||
inline ostream& operator<<(ostream& os, const map<string, float>& m) {
|
||||
for (auto&& it : m) {
|
||||
os << it.first << " " << it.second << " ";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
inline istream& operator>>(istream& is, map<string, float>& m) {
|
||||
m.clear();
|
||||
string key;
|
||||
float value;
|
||||
while (is >> key >> value) {
|
||||
m.emplace(key, value);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
} // namespace std
|
||||
|
||||
223
src/inference/include/openvino/runtime/intel_gna/properties.hpp
Normal file
223
src/inference/include/openvino/runtime/intel_gna/properties.hpp
Normal file
@@ -0,0 +1,223 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
/**
|
||||
* @brief A header for advanced hardware related properties for GNA plugin
|
||||
* To use in set_property() and get_property() methods of plugins
|
||||
*
|
||||
* @file config.hpp
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "openvino/runtime/properties.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
|
||||
/**
|
||||
* @brief Property to get an std::string of GNA Library version, usually in the form
|
||||
* <API_REVISION>.<RELEASE_LINE>.<RELEASE>.<BUILD>
|
||||
*/
|
||||
static constexpr Property<std::string, PropertyMutability::RO> library_full_version{"GNA_LIBRARY_FULL_VERSION"};
|
||||
|
||||
/**
|
||||
* @brief Scale factor provided by the user to use static quantization.
|
||||
* This option should be used with floating point value serialized to string with . (dot) as a decimal separator
|
||||
* @details In the case of multiple inputs, individual scale factors can be provided using the
|
||||
* map where key is layer name and value is scale factor
|
||||
* Example:
|
||||
* \code{.cpp}
|
||||
* ov::Core core;
|
||||
* auto model = core.read_model(model_path);
|
||||
* std::map<std::string, float> scale_factors;
|
||||
* for (auto& input : model->inputs()) {
|
||||
* scale_factors[input.get_any_name()] = 1.0f;
|
||||
* }
|
||||
* core.set_property("GNA", ov::intel_gna::scale_factors_per_input(scale_factors));
|
||||
* \endcode
|
||||
*/
|
||||
static constexpr Property<std::map<std::string, float>> scale_factors_per_input{"GNA_SCALE_FACTOR_PER_INPUT"};
|
||||
|
||||
/**
|
||||
* @brief if turned on, dump GNA firmware model into specified file
|
||||
*/
|
||||
static constexpr Property<std::string> firmware_model_image_path{"GNA_FIRMWARE_MODEL_IMAGE"};
|
||||
|
||||
/**
|
||||
* @brief Enum to define software acceleration mode
|
||||
*/
|
||||
enum class ExecutionMode {
|
||||
AUTO = 0, //!< Uses Intel GNA if available, otherwise uses software execution mode on CPU.
|
||||
HW = 1, //!< Uses Intel GNA if available, otherwise raises an error.
|
||||
HW_WITH_SW_FBACK =
|
||||
2, //!< Uses Intel GNA if available, otherwise raises an error.
|
||||
//!< If the hardware queue is not empty, automatically falls back to CPU in the bit-exact mode.
|
||||
SW_EXACT = 3, //!< Executes the GNA-compiled graph on CPU performing calculations
|
||||
//!< in the same precision as the Intel GNA in the bit-exact mode.
|
||||
SW_FP32 = 4, //!< Executes the GNA-compiled graph on CPU but substitutes parameters and calculations
|
||||
//!< from low precision to floating point
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const ExecutionMode& execution_mode) {
|
||||
switch (execution_mode) {
|
||||
case ExecutionMode::AUTO:
|
||||
return os << "GNA_AUTO";
|
||||
case ExecutionMode::HW:
|
||||
return os << "GNA_HW";
|
||||
case ExecutionMode::HW_WITH_SW_FBACK:
|
||||
return os << "GNA_HW_WITH_SW_FBACK";
|
||||
case ExecutionMode::SW_EXACT:
|
||||
return os << "GNA_SW_EXACT";
|
||||
case ExecutionMode::SW_FP32:
|
||||
return os << "GNA_SW_FP32";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported execution mode!"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, ExecutionMode& execution_mode) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "GNA_AUTO") {
|
||||
execution_mode = ExecutionMode::AUTO;
|
||||
} else if (str == "GNA_HW") {
|
||||
execution_mode = ExecutionMode::HW;
|
||||
} else if (str == "GNA_HW_WITH_SW_FBACK") {
|
||||
execution_mode = ExecutionMode::HW_WITH_SW_FBACK;
|
||||
} else if (str == "GNA_SW_EXACT") {
|
||||
execution_mode = ExecutionMode::SW_EXACT;
|
||||
} else if (str == "GNA_SW_FP32") {
|
||||
execution_mode = ExecutionMode::SW_FP32;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported execution mode: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief Enum to define HW compile and execution targets
|
||||
*/
|
||||
enum class HWGeneration {
|
||||
UNDEFINED = 0, //!< GNA HW generation is undefined
|
||||
GNA_2_0 = 1, //!< GNA HW generation 2.0
|
||||
GNA_3_0 = 2, //!< GNA HW generation 3.0
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const HWGeneration& hw_generation) {
|
||||
switch (hw_generation) {
|
||||
case HWGeneration::UNDEFINED:
|
||||
return os << "UNDEFINED";
|
||||
case HWGeneration::GNA_2_0:
|
||||
return os << "GNA_2_0";
|
||||
case HWGeneration::GNA_3_0:
|
||||
return os << "GNA_3_0";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported HW generation!"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, HWGeneration& hw_generation) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "UNDEFINED") {
|
||||
hw_generation = HWGeneration::UNDEFINED;
|
||||
} else if (str == "GNA_2_0") {
|
||||
hw_generation = HWGeneration::GNA_2_0;
|
||||
} else if (str == "GNA_3_0") {
|
||||
hw_generation = HWGeneration::GNA_3_0;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported HW generation: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief GNA proc_type setting that should be one of AUTO, HW, GNA_HW_WITH_SW_FBACK,
|
||||
* GNA_SW_EXACT or SW_FP32
|
||||
*/
|
||||
static constexpr Property<ExecutionMode> execution_mode{"GNA_DEVICE_MODE"};
|
||||
|
||||
/**
|
||||
* @brief The option to override the GNA HW execution target. May be one of GNA_2_0, GNA_3_0.
|
||||
* By default (in case of no value set) the behavior depends on GNA HW availability:
|
||||
* If GNA HW is present, use the option corresponding to this HW.
|
||||
* If HW is not present, use the option corresponding to the latest fully supported GNA HW generation.
|
||||
* A fully supported GNA HW generation means it must be supported by both the OV GNA Plugin and the core GNA Library.
|
||||
* Currently, the latest supported GNA HW generation corresponds to GNA_3_0.
|
||||
*/
|
||||
static constexpr Property<HWGeneration> execution_target{"GNA_HW_EXECUTION_TARGET"};
|
||||
|
||||
/**
|
||||
* @brief The option to override the GNA HW compile target. May be one of GNA_2_0, GNA_3_0.
|
||||
* By default the same as execution_target.
|
||||
*/
|
||||
static constexpr Property<HWGeneration> compile_target{"GNA_HW_COMPILE_TARGET"};
|
||||
|
||||
/**
|
||||
* @brief if enabled produced minimum memory footprint for compiled model in GNA memory, default value is true
|
||||
*/
|
||||
static constexpr Property<bool> memory_reuse{"GNA_COMPACT_MODE"};
|
||||
|
||||
/**
|
||||
* @brief Enum to define PWL design algorithm
|
||||
*/
|
||||
enum class PWLDesignAlgorithm {
|
||||
UNDEFINED = 0, //!< PWL approximation algorithm is undefined
|
||||
RECURSIVE_DESCENT = 1, //!< Recursive Descent Algorithm
|
||||
UNIFORM_DISTRIBUTION = 2, //!< Uniform distribution algorithm
|
||||
};
|
||||
|
||||
/** @cond INTERNAL */
|
||||
inline std::ostream& operator<<(std::ostream& os, const PWLDesignAlgorithm& pwl_design_algo) {
|
||||
switch (pwl_design_algo) {
|
||||
case PWLDesignAlgorithm::UNDEFINED:
|
||||
return os << "UNDEFINED";
|
||||
case PWLDesignAlgorithm::RECURSIVE_DESCENT:
|
||||
return os << "RECURSIVE_DESCENT";
|
||||
case PWLDesignAlgorithm::UNIFORM_DISTRIBUTION:
|
||||
return os << "UNIFORM_DISTRIBUTION";
|
||||
default:
|
||||
throw ov::Exception{"Unsupported PWL design algorithm!"};
|
||||
}
|
||||
}
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, PWLDesignAlgorithm& pwl_design_algo) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if (str == "UNDEFINED") {
|
||||
pwl_design_algo = PWLDesignAlgorithm::UNDEFINED;
|
||||
} else if (str == "RECURSIVE_DESCENT") {
|
||||
pwl_design_algo = PWLDesignAlgorithm::RECURSIVE_DESCENT;
|
||||
} else if (str == "UNIFORM_DISTRIBUTION") {
|
||||
pwl_design_algo = PWLDesignAlgorithm::UNIFORM_DISTRIBUTION;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported PWL design algorithm: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief The option to set PWL design algorithm.
|
||||
* By default the optimized algorithm called "Recursive Descent Algorithm for Finding
|
||||
* the Optimal Minimax Piecewise Linear Approximation of Convex Functions" is used.
|
||||
* If value is UNIFORM_DISTRIBUTION then simple uniform distribution is used to create
|
||||
* PWL approximation of activation functions.
|
||||
* Uniform distribution usually gives poor approximation with the same number of segments
|
||||
*/
|
||||
static constexpr Property<PWLDesignAlgorithm> pwl_design_algorithm{"GNA_PWL_DESIGN_ALGORITHM"};
|
||||
|
||||
/**
|
||||
* @brief The option to allow to specify the maximum error percent that the optimized algorithm finding
|
||||
* will be used to find PWL functions.
|
||||
* By default (in case of NO value set), 1.0 value is used.
|
||||
*/
|
||||
static constexpr Property<float> pwl_max_error_percent{"GNA_PWL_MAX_ERROR_PERCENT"};
|
||||
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -5,20 +5,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
#include "gna/gna_config.hpp"
|
||||
|
||||
namespace GNAPluginNS {
|
||||
struct GNAFlags {
|
||||
uint8_t gna_lib_async_threads_num = 1;
|
||||
|
||||
uint8_t num_requests = 1;
|
||||
bool compact_mode = true;
|
||||
bool exclusive_async_requests = false;
|
||||
ov::intel_gna::PWLDesignAlgorithm pwl_design_algorithm = ov::intel_gna::PWLDesignAlgorithm::UNDEFINED;
|
||||
bool uniformPwlDesign = false;
|
||||
float pwlMaxErrorPercent = 1.0f;
|
||||
bool gna_openmp_multithreading = false;
|
||||
bool sw_fp32 = false;
|
||||
bool performance_counting = false;
|
||||
bool input_low_precision = false;
|
||||
std::string log_level = InferenceEngine::PluginConfigParams::LOG_NONE;
|
||||
ov::log::Level log_level = ov::log::Level::NO;
|
||||
};
|
||||
} // namespace GNAPluginNS
|
||||
|
||||
@@ -91,8 +91,16 @@ class GNAExecutableNetwork : public InferenceEngine::IExecutableNetworkInternal
|
||||
if (config.empty()) {
|
||||
IE_THROW() << "The list of configuration values is empty";
|
||||
}
|
||||
|
||||
std::vector<ov::PropertyName> supported_properties = Config::GetSupportedProperties(true);
|
||||
for (auto&& item : config) {
|
||||
if (item.first != KEY_GNA_DEVICE_MODE) {
|
||||
auto it = std::find(supported_properties.begin(), supported_properties.end(), item.first);
|
||||
if (it != supported_properties.end()) {
|
||||
if (!it->is_mutable()) {
|
||||
IE_THROW() << "The following config value cannot be changed dynamically "
|
||||
<< "for compiled model in the GNA plugin: " << item.first;
|
||||
}
|
||||
} else if (item.first != KEY_GNA_DEVICE_MODE) {
|
||||
IE_THROW() << "The following config value cannot be changed dynamically for ExecutableNetwork in the GNA plugin: "
|
||||
<< item.first << ". Only " << KEY_GNA_DEVICE_MODE << " is supported.";
|
||||
}
|
||||
@@ -119,7 +127,11 @@ class GNAExecutableNetwork : public InferenceEngine::IExecutableNetworkInternal
|
||||
}
|
||||
|
||||
InferenceEngine::Parameter GetMetric(const std::string& name) const override {
|
||||
return plg->GetMetric(name, {});
|
||||
if (ov::supported_properties == name) {
|
||||
return Config::GetSupportedProperties(true);
|
||||
} else {
|
||||
return plg->GetMetric(name, {});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -983,7 +983,7 @@ void GNAGraphCompiler::ConcatPrimitive(InferenceEngine::CNNLayerPtr layer) {
|
||||
}
|
||||
|
||||
// Concat axis validation
|
||||
if (!GNALimitations::ValidateConvConcatAxis(concatLayer) && gnaFlags->log_level == PluginConfigParams::LOG_WARNING) {
|
||||
if (!GNALimitations::ValidateConvConcatAxis(concatLayer) && gnaFlags->log_level == ov::log::Level::WARNING) {
|
||||
std::ostringstream in_dims_oss;
|
||||
auto in_dims = concatLayer->insData[0].lock()->getDims();
|
||||
std::copy(in_dims.begin(), in_dims.end(), std::ostream_iterator<size_t>(in_dims_oss, ","));
|
||||
|
||||
@@ -399,9 +399,7 @@ void GNAPlugin::UpdateInputScaleFromNetwork(InferenceEngine::CNNNetwork& network
|
||||
size_t levels = std::min(fqLayer.getLevels(), static_cast<size_t>(std::numeric_limits<uint16_t>::max() + 1));
|
||||
auto scaleInput = frontend::CalculateScaleFactorFromStats(levels, inputRange.first[0], inputRange.second[0]);
|
||||
|
||||
IE_ASSERT(config.inputScaleFactors.size() > inputIdx);
|
||||
|
||||
if (!config.inputScaleFactors.empty()) {
|
||||
if (!config.inputScaleFactorsPerInput.empty() || !config.inputScaleFactors.empty()) {
|
||||
gnawarn() << "WARNING: Scale factor calculated during model quantization (" << scaleInput
|
||||
<< ") will be used instead of user input (" << (*inputs_ptr_)[input.first].scale_factor << ").\n";
|
||||
if ((*inputs_ptr_)[input.first].scale_factor < scaleInput) {
|
||||
@@ -410,8 +408,7 @@ void GNAPlugin::UpdateInputScaleFromNetwork(InferenceEngine::CNNNetwork& network
|
||||
<< "Input values will be clamped.\n";
|
||||
}
|
||||
}
|
||||
|
||||
config.inputScaleFactors[inputIdx] = scaleInput;
|
||||
config.inputScaleFactorsPerInput[input.first] = scaleInput;
|
||||
(*inputs_ptr_)[input.first].scale_factor = scaleInput;
|
||||
}
|
||||
|
||||
@@ -431,8 +428,11 @@ void GNAPlugin::UpdateInputsAndOutputsInfoFromNetwork(InferenceEngine::CNNNetwor
|
||||
(*inputs_ptr_)[input.first].Update(input.second);
|
||||
|
||||
// update scale factor from config
|
||||
if (id < config.inputScaleFactors.size()) {
|
||||
(*inputs_ptr_)[input.first].scale_factor = config.inputScaleFactors[id];
|
||||
if (config.inputScaleFactorsPerInput.count(input.first)) {
|
||||
(*inputs_ptr_)[input.first].scale_factor = config.inputScaleFactorsPerInput[input.first];
|
||||
} else if (id < config.inputScaleFactors.size()) {
|
||||
config.inputScaleFactorsPerInput[input.first] = config.inputScaleFactors[id];
|
||||
(*inputs_ptr_)[input.first].scale_factor = config.inputScaleFactorsPerInput[input.first];
|
||||
}
|
||||
|
||||
id++;
|
||||
@@ -492,7 +492,7 @@ bool GNAPlugin::TryToInitOutput(const std::string &portName, InferenceEngine::CN
|
||||
(intel_dnn_orientation_t orientation, size_t numBytesPerElem, size_t numElem, void* outputPtr) {
|
||||
auto quantized = InferenceEngine::getInjectedData<QuantizedLayerParams>(layer);
|
||||
|
||||
outputs_.at(portName).ptrs.resize(gnaFlags->gna_lib_async_threads_num);
|
||||
outputs_.at(portName).ptrs.resize(gnaFlags->num_requests);
|
||||
outputs_.at(portName).orientation = orientation;
|
||||
outputs_.at(portName).num_bytes_per_element = numBytesPerElem;
|
||||
outputs_.at(portName).scale_factor = quantized != nullptr ? quantized->_dst_quant.GetScale() : GNAPluginNS::kScaleFactorDefault;
|
||||
@@ -751,7 +751,7 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
|
||||
|
||||
// Check the network
|
||||
std::string error;
|
||||
if (!GNAPluginNS::GNALimitations::AreLayersSupported(network, error, gnaFlags->log_level == PluginConfigParams::LOG_WARNING)) {
|
||||
if (!GNAPluginNS::GNALimitations::AreLayersSupported(network, error, gnaFlags->log_level == ov::log::Level::WARNING)) {
|
||||
THROW_GNA_EXCEPTION << error.c_str();
|
||||
}
|
||||
|
||||
@@ -896,9 +896,9 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
|
||||
// fill in extra storage with memory layers
|
||||
graphCompiler.fillMemoryConnections(memoryPairs);
|
||||
|
||||
if (!graphCompiler.memory_connection.empty() && gnaFlags->gna_lib_async_threads_num != 1) {
|
||||
if (!graphCompiler.memory_connection.empty() && gnaFlags->num_requests != 1) {
|
||||
// TODO: check if updating the number of threads is needed for sw_fp32
|
||||
gnaFlags->gna_lib_async_threads_num = 1;
|
||||
gnaFlags->num_requests = 1;
|
||||
if (!gnaFlags->sw_fp32)
|
||||
InitGNADevice();
|
||||
}
|
||||
@@ -921,7 +921,7 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
|
||||
}
|
||||
|
||||
for (auto && input : inputs_data_map_) {
|
||||
inputs_ptr_->at(input.first).ptrs.resize(gnaFlags->gna_lib_async_threads_num);
|
||||
inputs_ptr_->at(input.first).ptrs.resize(gnaFlags->num_requests);
|
||||
}
|
||||
|
||||
// Creating Layer primitives
|
||||
@@ -989,8 +989,8 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
|
||||
|
||||
// reserving more bytes for intermediate data in parallel case - TODO: this works incorrectly in compact mode at lest
|
||||
rwSegmentSize = gnamem->getRWBytes();
|
||||
if (gnaFlags->gna_lib_async_threads_num > 1) {
|
||||
gnamem->reserve_ptr(nullptr, &pParallelExecutionData, gnamem->getRWBytes() * (gnaFlags->gna_lib_async_threads_num - 1), 64);
|
||||
if (gnaFlags->num_requests > 1) {
|
||||
gnamem->reserve_ptr(nullptr, &pParallelExecutionData, gnamem->getRWBytes() * (gnaFlags->num_requests - 1), 64);
|
||||
}
|
||||
|
||||
gnamem->commit(gnaFlags->compact_mode);
|
||||
@@ -1017,7 +1017,7 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
|
||||
}
|
||||
|
||||
// creating same gna RW segment for parallel infer requests
|
||||
for (int i = 1; i != gnaFlags->gna_lib_async_threads_num; i++) {
|
||||
for (int i = 1; i != gnaFlags->num_requests; i++) {
|
||||
gnaModels.push_back(std::make_tuple(make_shared<CPPWrapper<Gna2Model>>()));
|
||||
// this can be improved by just copy all structures, but we are too lazy
|
||||
dnn->InitGNAStruct(&std::get<0>(gnaModels.back())->obj, effectiveGnaCompileTarget);
|
||||
@@ -1176,7 +1176,7 @@ uint32_t GNAPlugin::QueueInference(const InferenceEngine::BlobMap &inputs, Infer
|
||||
} else {
|
||||
IE_THROW(RequestBusy)
|
||||
<< "GNA executable network has max of "
|
||||
<< static_cast<uint32_t >(gnaFlags->gna_lib_async_threads_num)
|
||||
<< static_cast<uint32_t >(gnaFlags->num_requests)
|
||||
<< " parallel infer requests, please sync one of already running";
|
||||
}
|
||||
}
|
||||
@@ -1539,9 +1539,16 @@ InferenceEngine::IExecutableNetworkInternal::Ptr GNAPlugin::ImportNetwork(std::i
|
||||
|
||||
// If scale factors are defined in configuration we still need to use them instead of imported values,
|
||||
// for example to change the scale factors for the old models.
|
||||
if (!config.inputScaleFactors.empty()) {
|
||||
IE_ASSERT(config.inputScaleFactors.size() <= inputs_ptr_->size());
|
||||
// TODO: config should use the map of inputs as well
|
||||
if (!config.inputScaleFactorsPerInput.empty()) {
|
||||
IE_ASSERT(config.inputScaleFactorsPerInput.size() <= inputs_ptr_->size());
|
||||
for (auto&& sf : config.inputScaleFactorsPerInput) {
|
||||
if (sf.second != GNAPluginNS::kScaleFactorDefault) {
|
||||
gnalog() << "[Import Network] Using input scale factor defined in configuration for input " << sf.first << std::endl;
|
||||
(*inputs_ptr_)[sf.first].scale_factor = sf.second;
|
||||
}
|
||||
}
|
||||
} else if (!config.inputScaleFactors.empty()) {
|
||||
IE_ASSERT(config.inputScaleFactors.size() <= inputs_ptr_->size());
|
||||
for (size_t id = 0; id < config.inputScaleFactors.size(); ++id) {
|
||||
if (id < inputs_ptr_->size() && config.inputScaleFactors[id] != GNAPluginNS::kScaleFactorDefault) {
|
||||
gnalog() << "[Import Network] Using input scale factor defined in configuration for input " << id << std::endl;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//
|
||||
|
||||
#include <cmath>
|
||||
#include "openvino/runtime/common.hpp"
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
#include <gna/gna_config.hpp>
|
||||
#include "gna_plugin.hpp"
|
||||
#include "gna_plugin_config.hpp"
|
||||
@@ -14,7 +16,7 @@ using namespace InferenceEngine;
|
||||
using namespace InferenceEngine::details;
|
||||
|
||||
namespace GNAPluginNS {
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
static const caseless_unordered_map<std::string, std::pair<Gna2AccelerationMode, bool>> supported_values = {
|
||||
{GNAConfigParams::GNA_AUTO, {Gna2AccelerationModeAuto, false}},
|
||||
{GNAConfigParams::GNA_HW, {Gna2AccelerationModeHardware, false}},
|
||||
@@ -30,7 +32,7 @@ static const caseless_unordered_map<std::string, std::pair<Gna2AccelerationMode,
|
||||
{GNAConfigParams::GNA_AVX2, {Gna2AccelerationModeAvx2, false}},
|
||||
{GNAConfigParams::GNA_AVX2_EXACT, {Gna2AccelerationModeAvx2, true}},
|
||||
};
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
static const std::set<std::string> supportedTargets = {
|
||||
GNAConfigParams::GNA_TARGET_2_0,
|
||||
@@ -38,7 +40,34 @@ static const std::set<std::string> supportedTargets = {
|
||||
""
|
||||
};
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
inline std::istream& operator>>(std::istream& is, ov::element::Type& p) {
|
||||
std::string str;
|
||||
is >> str;
|
||||
if ((str == "i8") || (str == "I8")) {
|
||||
p = ov::element::i8;
|
||||
} else if ((str == "i16") || (str == "I16")) {
|
||||
p = ov::element::i16;
|
||||
} else {
|
||||
throw ov::Exception{"Unsupported precision: " + str};
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T property_from_string(const std::string& string_value) {
|
||||
std::stringstream ss(string_value);
|
||||
T value;
|
||||
ss >> value;
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string property_to_string(const T& property) {
|
||||
std::stringstream ss;
|
||||
ss << property;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
for (auto&& item : config) {
|
||||
auto key = item.first;
|
||||
@@ -48,9 +77,56 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
return (std::abs(p1 - p2) <= 0.00001f * std::min(std::abs(p1), std::abs(p2)));
|
||||
};
|
||||
|
||||
auto check_scale_factor = [&] (float scale_factor) {
|
||||
if (fp32eq(scale_factor, 0.0f) || std::isinf(scale_factor)) {
|
||||
THROW_GNA_EXCEPTION << "input scale factor of 0.0f or +-inf not supported";
|
||||
}
|
||||
};
|
||||
|
||||
auto &log = gnalog();
|
||||
|
||||
if (key.find(GNA_CONFIG_KEY(SCALE_FACTOR)) == 0) {
|
||||
auto check_compatibility = [&](const std::string& recommended_key) {
|
||||
if (config.count(recommended_key)) {
|
||||
if (value != config.at(recommended_key)) {
|
||||
THROW_GNA_EXCEPTION << "Both " << key << " and " << recommended_key
|
||||
<< " properties are specified! Please use " << recommended_key << " only!";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto get_max_num_requests = [&] () -> uint8_t {
|
||||
uint64_t num_requests;
|
||||
try {
|
||||
num_requests = std::stoul(value);
|
||||
if (num_requests == 0 || num_requests > Config::max_num_requests) {
|
||||
throw std::out_of_range("");
|
||||
}
|
||||
} catch (std::invalid_argument&) {
|
||||
THROW_GNA_EXCEPTION << "Invalid value of number of requests/threads";
|
||||
}
|
||||
return static_cast<uint8_t>(num_requests);
|
||||
};
|
||||
|
||||
auto set_target = [&](const std::string& target) {
|
||||
if (supportedTargets.count(target) == 0) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported GNA config value (key, value): (" << key << ", " << value << ")";
|
||||
}
|
||||
if (key == GNA_CONFIG_KEY(EXEC_TARGET) || key == ov::intel_gna::execution_target) {
|
||||
gnaExecTarget = target;
|
||||
if (gnaCompileTarget == "")
|
||||
gnaCompileTarget = target;
|
||||
} else {
|
||||
gnaCompileTarget = target;
|
||||
}
|
||||
};
|
||||
|
||||
if (key == ov::intel_gna::scale_factors_per_input) {
|
||||
inputScaleFactorsPerInput = property_from_string<std::map<std::string, float>>(value);
|
||||
for (auto&& sf : inputScaleFactorsPerInput) {
|
||||
check_scale_factor(sf.second);
|
||||
}
|
||||
} else if (key.find(GNA_CONFIG_KEY(SCALE_FACTOR)) == 0) {
|
||||
check_compatibility(ov::intel_gna::scale_factors_per_input.name());
|
||||
uint64_t input_index;
|
||||
if (key == GNA_CONFIG_KEY(SCALE_FACTOR)) {
|
||||
input_index = 0;
|
||||
@@ -72,21 +148,18 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
}
|
||||
}
|
||||
auto scale_factor = InferenceEngine::CNNLayer::ie_parse_float(value);
|
||||
if (fp32eq(scale_factor, 0.0f) || std::isinf(scale_factor)) {
|
||||
THROW_GNA_EXCEPTION << "input scale factor of 0.0f or +-inf not supported";
|
||||
}
|
||||
check_scale_factor(scale_factor);
|
||||
// missing scale factors are set to be 1.0f
|
||||
if (inputScaleFactors.size() <= input_index) {
|
||||
inputScaleFactors.resize(input_index + 1, GNAPluginNS::kScaleFactorDefault);
|
||||
}
|
||||
inputScaleFactors[input_index] = InferenceEngine::CNNLayer::ie_parse_float(value);
|
||||
} else if (key == GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE)) {
|
||||
} else if (key == GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE) || key == ov::intel_gna::firmware_model_image_path) {
|
||||
dumpXNNPath = value;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION)) {
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
dumpXNNGeneration = value;
|
||||
} else if (key == GNA_CONFIG_KEY(DEVICE_MODE)) {
|
||||
} else if (key == GNA_CONFIG_KEY(DEVICE_MODE) || key == ov::intel_gna::execution_mode) {
|
||||
auto procType = supported_values.find(value);
|
||||
if (procType == supported_values.end()) {
|
||||
if (value == GNA_CONFIG_VALUE(SW_FP32)) {
|
||||
@@ -95,28 +168,34 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
THROW_GNA_EXCEPTION << "GNA device mode unsupported: " << value;
|
||||
}
|
||||
} else {
|
||||
gnaFlags.sw_fp32 = false;
|
||||
pluginGna2AccMode = procType->second.first;
|
||||
swExactMode = procType->second.second;
|
||||
}
|
||||
} else if (key == GNA_CONFIG_KEY(EXEC_TARGET) || key == GNA_CONFIG_KEY(COMPILE_TARGET)) {
|
||||
if (supportedTargets.count(value) == 0) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported GNA config value (key, value): (" << key << ", " << value << ")";
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == ov::intel_gna::execution_target || key == ov::intel_gna::compile_target) {
|
||||
auto target = property_from_string<ov::intel_gna::HWGeneration>(value);
|
||||
std::string target_str = "";
|
||||
if (ov::intel_gna::HWGeneration::GNA_2_0 == target) {
|
||||
target_str = GNAConfigParams::GNA_TARGET_2_0;
|
||||
} else if (ov::intel_gna::HWGeneration::GNA_3_0 == target) {
|
||||
target_str = GNAConfigParams::GNA_TARGET_3_0;
|
||||
}
|
||||
if (key == GNA_CONFIG_KEY(EXEC_TARGET)) {
|
||||
gnaExecTarget = value;
|
||||
if (gnaCompileTarget == "")
|
||||
gnaCompileTarget = value;
|
||||
} else {
|
||||
gnaCompileTarget = value;
|
||||
}
|
||||
} else if (key == GNA_CONFIG_KEY(COMPACT_MODE)) {
|
||||
set_target(target_str);
|
||||
} else if (key == GNA_CONFIG_KEY(EXEC_TARGET)) {
|
||||
check_compatibility(ov::intel_gna::execution_target.name());
|
||||
set_target(value);
|
||||
} else if (key == GNA_CONFIG_KEY(COMPILE_TARGET)) {
|
||||
check_compatibility(ov::intel_gna::compile_target.name());
|
||||
set_target(value);
|
||||
} else if (key == GNA_CONFIG_KEY(COMPACT_MODE) || key == ov::intel_gna::memory_reuse) {
|
||||
if (value == PluginConfigParams::YES) {
|
||||
gnaFlags.compact_mode = true;
|
||||
} else if (value == PluginConfigParams::NO) {
|
||||
gnaFlags.compact_mode = false;
|
||||
} else {
|
||||
log << "GNA compact mode should be YES/NO, but not " << value;
|
||||
THROW_GNA_EXCEPTION << "GNA compact mode should be YES/NO, but not " << value;
|
||||
log << "GNA compact mode should be true/false (YES/NO), but not " << value;
|
||||
THROW_GNA_EXCEPTION << "GNA compact mode should be true/false (YES/NO), but not " << value;
|
||||
}
|
||||
} else if (key == CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)) {
|
||||
if (value == PluginConfigParams::YES) {
|
||||
@@ -127,7 +206,17 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
log << "EXCLUSIVE_ASYNC_REQUESTS should be YES/NO, but not" << value;
|
||||
THROW_GNA_EXCEPTION << "EXCLUSIVE_ASYNC_REQUESTS should be YES/NO, but not" << value;
|
||||
}
|
||||
} else if (key == ov::hint::performance_mode) {
|
||||
performance_mode = property_from_string<ov::hint::PerformanceMode>(value);
|
||||
} else if (key == ov::hint::inference_precision) {
|
||||
inference_precision = property_from_string<ov::element::Type>(value);
|
||||
if ((inference_precision != ov::element::i8) && (inference_precision != ov::element::i16)) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported precision of GNA hardware, should be i16 or i8, but was: "
|
||||
<< value;
|
||||
}
|
||||
gnaPrecision = (inference_precision == ov::element::i8) ? Precision::I8 : Precision::I16;
|
||||
} else if (key == GNA_CONFIG_KEY(PRECISION)) {
|
||||
check_compatibility(ov::hint::inference_precision.name());
|
||||
auto precision = Precision::FromStr(value);
|
||||
if (precision != Precision::I8 && precision != Precision::I16) {
|
||||
log << "Unsupported precision of GNA hardware, should be Int16 or Int8, but was: " << value;
|
||||
@@ -135,8 +224,12 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
<< value;
|
||||
}
|
||||
gnaPrecision = precision;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == ov::intel_gna::pwl_design_algorithm) {
|
||||
gnaFlags.pwl_design_algorithm = property_from_string<ov::intel_gna::PWLDesignAlgorithm>(value);
|
||||
gnaFlags.uniformPwlDesign = (gnaFlags.pwl_design_algorithm == ov::intel_gna::PWLDesignAlgorithm::UNIFORM_DISTRIBUTION) ? true : false;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == GNA_CONFIG_KEY(PWL_UNIFORM_DESIGN)) {
|
||||
check_compatibility(ov::intel_gna::pwl_design_algorithm.name());
|
||||
// This key is deprecated and will be removed in a future release
|
||||
if (value == PluginConfigParams::YES) {
|
||||
gnaFlags.uniformPwlDesign = true;
|
||||
@@ -148,9 +241,7 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
THROW_GNA_EXCEPTION << "GNA pwl uniform algorithm parameter "
|
||||
<< "should be equal to YES/NO, but not" << value;
|
||||
}
|
||||
} else if (key == GNA_CONFIG_KEY(PWL_MAX_ERROR_PERCENT)) {
|
||||
// This key is deprecated and will be removed in a future release
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == GNA_CONFIG_KEY(PWL_MAX_ERROR_PERCENT) || key == ov::intel_gna::pwl_max_error_percent) {
|
||||
float max_error;
|
||||
try {
|
||||
max_error = InferenceEngine::CNNLayer::ie_parse_float(value);
|
||||
@@ -168,7 +259,8 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
<< ", should be greater than 0 and less than 100";
|
||||
}
|
||||
gnaFlags.pwlMaxErrorPercent = max_error;
|
||||
} else if (key == CONFIG_KEY(PERF_COUNT)) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == CONFIG_KEY(PERF_COUNT) || key == ov::enable_profiling) {
|
||||
if (value == PluginConfigParams::YES) {
|
||||
gnaFlags.performance_counting = true;
|
||||
} else if (value == PluginConfigParams::NO) {
|
||||
@@ -179,22 +271,23 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
THROW_GNA_EXCEPTION << "GNA performance counter enabling parameter "
|
||||
<< "should be equal to YES/NO, but not" << value;
|
||||
}
|
||||
} else if (key == GNA_CONFIG_KEY(LIB_N_THREADS)) {
|
||||
uint64_t lib_threads;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == ov::hint::num_requests) {
|
||||
try {
|
||||
lib_threads = std::stoul(value);
|
||||
if (lib_threads == 0 || lib_threads > (std::numeric_limits<uint8_t>::max()+1) / 2 - 1) {
|
||||
throw std::out_of_range("");
|
||||
}
|
||||
} catch (std::invalid_argument&) {
|
||||
THROW_GNA_EXCEPTION << "Invalid value of number of threads";
|
||||
gnaFlags.num_requests = get_max_num_requests();
|
||||
} catch (std::out_of_range&) {
|
||||
gnaFlags.num_requests = (0 == stoul(value)) ? 1 : Config::max_num_requests;
|
||||
}
|
||||
} else if (key == GNA_CONFIG_KEY(LIB_N_THREADS)) {
|
||||
check_compatibility(ov::hint::num_requests.name());
|
||||
try {
|
||||
gnaFlags.num_requests = get_max_num_requests();
|
||||
} catch (std::out_of_range&) {
|
||||
log << "Unsupported accelerator lib number of threads: " << value
|
||||
<< ", should be greater than 0 and less than 127";
|
||||
<< ", should be greater than 0 and less than " << Config::max_num_requests;
|
||||
THROW_GNA_EXCEPTION << "Unsupported accelerator lib number of threads: " << value
|
||||
<< ", should be greater than 0 and less than 127";
|
||||
<< ", should be greater than 0 and less than" << Config::max_num_requests;
|
||||
}
|
||||
gnaFlags.gna_lib_async_threads_num = lib_threads;
|
||||
} else if (key == CONFIG_KEY(SINGLE_THREAD)) {
|
||||
if (value == PluginConfigParams::YES) {
|
||||
gnaFlags.gna_openmp_multithreading = false;
|
||||
@@ -204,9 +297,10 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
log << "SINGLE_THREAD should be YES/NO, but not" << value;
|
||||
THROW_GNA_EXCEPTION << "SINGLE_THREAD should be YES/NO, but not" << value;
|
||||
}
|
||||
} else if (key == CONFIG_KEY(LOG_LEVEL)) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == CONFIG_KEY(LOG_LEVEL) || key == ov::log::level) {
|
||||
if (value == PluginConfigParams::LOG_WARNING || value == PluginConfigParams::LOG_NONE) {
|
||||
gnaFlags.log_level = value;
|
||||
gnaFlags.log_level = property_from_string<ov::log::Level>(value);
|
||||
} else {
|
||||
log << "Currently only LOG_LEVEL = LOG_WARNING and LOG_NONE are supported, not " << value;
|
||||
THROW_GNA_EXCEPTION << "Currently only LOG_LEVEL = LOG_WARNING and LOG_NONE are supported, not " << value;
|
||||
@@ -217,78 +311,132 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
<< "Incorrect GNA Plugin config. Key " << item.first << " not supported";
|
||||
}
|
||||
|
||||
if (gnaFlags.sw_fp32 && gnaFlags.gna_lib_async_threads_num > 1) {
|
||||
if (gnaFlags.sw_fp32 && gnaFlags.num_requests > 1) {
|
||||
THROW_GNA_EXCEPTION << "GNA plugin does not support async mode on GNA_SW_FP32!";
|
||||
}
|
||||
}
|
||||
|
||||
if (inputScaleFactors.empty()) {
|
||||
if (inputScaleFactorsPerInput.empty() && inputScaleFactors.empty()) {
|
||||
inputScaleFactors.push_back(1.0f);
|
||||
}
|
||||
|
||||
AdjustKeyMapValues();
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
void Config::AdjustKeyMapValues() {
|
||||
std::lock_guard<std::mutex> lockGuard{ mtx4keyConfigMap };
|
||||
keyConfigMap.clear();
|
||||
|
||||
if (inputScaleFactors.empty()) {
|
||||
inputScaleFactors.push_back(1.0);
|
||||
if (!inputScaleFactorsPerInput.empty()) {
|
||||
keyConfigMap[ov::intel_gna::scale_factors_per_input.name()] = property_to_string(inputScaleFactorsPerInput);
|
||||
} else {
|
||||
if (inputScaleFactors.empty()) {
|
||||
inputScaleFactors.push_back(1.0);
|
||||
}
|
||||
keyConfigMap[GNA_CONFIG_KEY(SCALE_FACTOR)] = std::to_string(inputScaleFactors[0]);
|
||||
for (int n = 0; n < inputScaleFactors.size(); n++) {
|
||||
keyConfigMap[GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_") + std::to_string(n)] =
|
||||
std::to_string(inputScaleFactors[n]);
|
||||
}
|
||||
}
|
||||
keyConfigMap[GNA_CONFIG_KEY(SCALE_FACTOR)] = std::to_string(inputScaleFactors[0]);
|
||||
for (int n = 0; n < inputScaleFactors.size(); n++) {
|
||||
keyConfigMap[GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_") + std::to_string(n)] =
|
||||
std::to_string(inputScaleFactors[n]);
|
||||
}
|
||||
keyConfigMap[GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE)] = dumpXNNPath;
|
||||
keyConfigMap[ov::intel_gna::firmware_model_image_path.name()] = dumpXNNPath;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
keyConfigMap[GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION)] = dumpXNNGeneration;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
std::string device_mode;
|
||||
if (gnaFlags.sw_fp32) {
|
||||
device_mode = GNA_CONFIG_VALUE(SW_FP32);
|
||||
device_mode = property_to_string(ov::intel_gna::ExecutionMode::SW_FP32);
|
||||
} else {
|
||||
for (auto&& value : supported_values) {
|
||||
if (value.second.first == pluginGna2AccMode &&
|
||||
value.second.second == swExactMode) {
|
||||
device_mode = value.first;
|
||||
device_mode = property_to_string(value.first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
IE_ASSERT(!device_mode.empty());
|
||||
keyConfigMap[GNA_CONFIG_KEY(DEVICE_MODE)] = device_mode;
|
||||
keyConfigMap[ov::intel_gna::execution_mode.name()] = device_mode;
|
||||
keyConfigMap[GNA_CONFIG_KEY(EXEC_TARGET)] = gnaExecTarget;
|
||||
keyConfigMap[GNA_CONFIG_KEY(COMPILE_TARGET)] = gnaCompileTarget;
|
||||
keyConfigMap[GNA_CONFIG_KEY(COMPACT_MODE)] =
|
||||
gnaFlags.compact_mode ? PluginConfigParams::YES: PluginConfigParams::NO;
|
||||
keyConfigMap[ov::intel_gna::memory_reuse.name()] =
|
||||
gnaFlags.compact_mode ? PluginConfigParams::YES : PluginConfigParams::NO;
|
||||
keyConfigMap[CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)] =
|
||||
gnaFlags.exclusive_async_requests ? PluginConfigParams::YES: PluginConfigParams::NO;
|
||||
keyConfigMap[GNA_CONFIG_KEY(PRECISION)] = gnaPrecision.name();
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
keyConfigMap[GNA_CONFIG_KEY(PWL_UNIFORM_DESIGN)] =
|
||||
gnaFlags.uniformPwlDesign ? PluginConfigParams::YES: PluginConfigParams::NO;
|
||||
keyConfigMap[GNA_CONFIG_KEY(PWL_MAX_ERROR_PERCENT)] = std::to_string(gnaFlags.pwlMaxErrorPercent);
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
keyConfigMap[CONFIG_KEY(PERF_COUNT)] =
|
||||
gnaFlags.performance_counting ? PluginConfigParams::YES: PluginConfigParams::NO;
|
||||
keyConfigMap[ov::hint::performance_mode.name()] = property_to_string(performance_mode);
|
||||
if (inference_precision != ov::element::undefined) {
|
||||
keyConfigMap[ov::hint::inference_precision.name()] = property_to_string(inference_precision);
|
||||
} else {
|
||||
keyConfigMap[GNA_CONFIG_KEY(PRECISION)] = gnaPrecision.name();
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
keyConfigMap[GNA_CONFIG_KEY(LIB_N_THREADS)] = std::to_string(gnaFlags.gna_lib_async_threads_num);
|
||||
if (gnaFlags.pwl_design_algorithm != ov::intel_gna::PWLDesignAlgorithm::UNDEFINED) {
|
||||
keyConfigMap[ov::intel_gna::pwl_design_algorithm.name()] = property_to_string(gnaFlags.pwl_design_algorithm);
|
||||
} else {
|
||||
keyConfigMap[GNA_CONFIG_KEY(PWL_UNIFORM_DESIGN)] =
|
||||
gnaFlags.uniformPwlDesign ? PluginConfigParams::YES: PluginConfigParams::NO;
|
||||
}
|
||||
keyConfigMap[ov::intel_gna::pwl_max_error_percent.name()] = std::to_string(gnaFlags.pwlMaxErrorPercent);
|
||||
keyConfigMap[ov::hint::num_requests.name()] = std::to_string(gnaFlags.num_requests);
|
||||
keyConfigMap[GNA_CONFIG_KEY(LIB_N_THREADS)] = std::to_string(gnaFlags.num_requests);
|
||||
keyConfigMap[CONFIG_KEY(SINGLE_THREAD)] =
|
||||
gnaFlags.gna_openmp_multithreading ? PluginConfigParams::NO: PluginConfigParams::YES;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
keyConfigMap[CONFIG_KEY(LOG_LEVEL)] = gnaFlags.log_level;
|
||||
keyConfigMap[ov::enable_profiling.name()] =
|
||||
gnaFlags.performance_counting ? PluginConfigParams::YES: PluginConfigParams::NO;
|
||||
keyConfigMap[ov::log::level.name()] = property_to_string(gnaFlags.log_level);
|
||||
}
|
||||
|
||||
std::string Config::GetParameter(const std::string& name) const {
|
||||
Parameter Config::GetParameter(const std::string& name) const {
|
||||
std::lock_guard<std::mutex> lockGuard{ mtx4keyConfigMap };
|
||||
auto result = keyConfigMap.find(name);
|
||||
if (result == keyConfigMap.end()) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported config key: " << name;
|
||||
if (name == ov::intel_gna::scale_factors_per_input) {
|
||||
return decltype(ov::intel_gna::scale_factors_per_input)::value_type {inputScaleFactorsPerInput};
|
||||
} else if (name == ov::intel_gna::pwl_design_algorithm) {
|
||||
return gnaFlags.pwl_design_algorithm;
|
||||
} else if (name == ov::intel_gna::execution_target) {
|
||||
return ((gnaExecTarget == GNAConfigParams::GNA_TARGET_2_0) ? ov::intel_gna::HWGeneration::GNA_2_0 :
|
||||
(gnaExecTarget == GNAConfigParams::GNA_TARGET_3_0) ? ov::intel_gna::HWGeneration::GNA_3_0 :
|
||||
ov::intel_gna::HWGeneration::UNDEFINED);
|
||||
} else if (name == ov::intel_gna::compile_target) {
|
||||
return ((gnaCompileTarget == GNAConfigParams::GNA_TARGET_2_0) ? ov::intel_gna::HWGeneration::GNA_2_0 :
|
||||
(gnaCompileTarget == GNAConfigParams::GNA_TARGET_3_0) ? ov::intel_gna::HWGeneration::GNA_3_0 :
|
||||
ov::intel_gna::HWGeneration::UNDEFINED);
|
||||
} else if (name == ov::hint::performance_mode) {
|
||||
return performance_mode;
|
||||
} else if (name == ov::hint::inference_precision) {
|
||||
return inference_precision;
|
||||
} else {
|
||||
auto result = keyConfigMap.find(name);
|
||||
if (result == keyConfigMap.end()) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported config key: " << name;
|
||||
}
|
||||
return result->second;
|
||||
}
|
||||
return result->second;
|
||||
}
|
||||
|
||||
const Parameter Config::GetSupportedProperties(bool compiled) {
|
||||
ov::PropertyMutability model_mutability = compiled ? ov::PropertyMutability::RO : ov::PropertyMutability::RW;
|
||||
const std::vector<ov::PropertyName> supported_properties = {
|
||||
{ ov::supported_properties.name(), ov::PropertyMutability::RO },
|
||||
{ ov::available_devices.name(), ov::PropertyMutability::RO },
|
||||
{ ov::optimal_number_of_infer_requests.name(), ov::PropertyMutability::RO },
|
||||
{ ov::range_for_async_infer_requests.name(), ov::PropertyMutability::RO },
|
||||
{ ov::device::capabilities.name(), ov::PropertyMutability::RO },
|
||||
{ ov::device::full_name.name(), ov::PropertyMutability::RO },
|
||||
{ ov::intel_gna::library_full_version.name(), ov::PropertyMutability::RO },
|
||||
{ ov::intel_gna::scale_factors_per_input.name(), model_mutability },
|
||||
{ ov::intel_gna::firmware_model_image_path.name(), model_mutability },
|
||||
{ ov::intel_gna::execution_mode.name(), ov::PropertyMutability::RW },
|
||||
{ ov::intel_gna::execution_target.name(), model_mutability },
|
||||
{ ov::intel_gna::compile_target.name(), model_mutability },
|
||||
{ ov::intel_gna::pwl_design_algorithm.name(), model_mutability },
|
||||
{ ov::intel_gna::pwl_max_error_percent.name(), model_mutability },
|
||||
{ ov::hint::performance_mode.name(), ov::PropertyMutability::RW },
|
||||
{ ov::hint::inference_precision.name(), model_mutability },
|
||||
{ ov::hint::num_requests.name(), model_mutability },
|
||||
{ ov::log::level.name(), ov::PropertyMutability::RW },
|
||||
};
|
||||
return supported_properties;
|
||||
}
|
||||
|
||||
std::vector<std::string> Config::GetSupportedKeys() const {
|
||||
@@ -299,5 +447,4 @@ std::vector<std::string> Config::GetSupportedKeys() const {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace GNAPluginNS
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
|
||||
#include <gna2-inference-api.h>
|
||||
#include <gna2-common-api.h>
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
#include "ie_precision.hpp"
|
||||
#include <ie_parameter.hpp>
|
||||
#include "descriptions/gna_flags.hpp"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -28,11 +30,16 @@ struct Config {
|
||||
return *this;
|
||||
}
|
||||
void Copy(const Config& r) {
|
||||
performance_mode = r.performance_mode;
|
||||
inference_precision = r.inference_precision;
|
||||
gnaPrecision = r.gnaPrecision;
|
||||
dumpXNNPath = r.dumpXNNPath;
|
||||
dumpXNNGeneration = r.dumpXNNGeneration;
|
||||
gnaExecTarget = r.gnaExecTarget;
|
||||
gnaCompileTarget = r.gnaCompileTarget;
|
||||
pluginGna2AccMode = r.pluginGna2AccMode;
|
||||
swExactMode = r.swExactMode;
|
||||
inputScaleFactorsPerInput = r.inputScaleFactorsPerInput;
|
||||
inputScaleFactors = r.inputScaleFactors;
|
||||
gnaFlags = r.gnaFlags;
|
||||
std::lock_guard<std::mutex> lock(r.mtx4keyConfigMap);
|
||||
@@ -40,10 +47,14 @@ struct Config {
|
||||
}
|
||||
void UpdateFromMap(const std::map<std::string, std::string>& configMap);
|
||||
void AdjustKeyMapValues();
|
||||
std::string GetParameter(const std::string& name) const;
|
||||
InferenceEngine::Parameter GetParameter(const std::string& name) const;
|
||||
std::vector<std::string> GetSupportedKeys() const;
|
||||
static const InferenceEngine::Parameter GetSupportedProperties(bool compiled = false);
|
||||
|
||||
ov::hint::PerformanceMode performance_mode = ov::hint::PerformanceMode::LATENCY;
|
||||
|
||||
// default precision of GNA hardware model (see QuantI16 quantizer struct)
|
||||
ov::element::Type inference_precision = ov::element::undefined;
|
||||
InferenceEngine::Precision gnaPrecision = InferenceEngine::Precision::I16;
|
||||
|
||||
std::string dumpXNNPath;
|
||||
@@ -55,11 +66,14 @@ struct Config {
|
||||
Gna2AccelerationMode pluginGna2AccMode = Gna2AccelerationModeSoftware;
|
||||
bool swExactMode = true;
|
||||
|
||||
std::vector<float> inputScaleFactors;
|
||||
std::map<std::string, float> inputScaleFactorsPerInput;
|
||||
std::vector<float> inputScaleFactors; // Legacy one, should be removed with old confg API
|
||||
GNAFlags gnaFlags;
|
||||
|
||||
mutable std::mutex mtx4keyConfigMap;
|
||||
std::map<std::string, std::string> keyConfigMap;
|
||||
|
||||
static const uint8_t max_num_requests = 127;
|
||||
};
|
||||
|
||||
} // namespace GNAPluginNS
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <ie_parameter.hpp>
|
||||
#include "gna_plugin.hpp"
|
||||
#include "gna/gna_config.hpp"
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -21,48 +22,86 @@ Parameter GNAPlugin::GetConfig(const std::string& name, const std::map<std::stri
|
||||
}
|
||||
|
||||
Parameter GNAPlugin::GetMetric(const std::string& name, const std::map<std::string, InferenceEngine::Parameter> & options) const {
|
||||
const std::unordered_map<std::string, std::function<Parameter()>> queryApiSupported = {
|
||||
{METRIC_KEY(AVAILABLE_DEVICES), [this]() {return GetAvailableDevices();}},
|
||||
{METRIC_KEY(SUPPORTED_CONFIG_KEYS), [this]() {return config.GetSupportedKeys();}},
|
||||
{METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS), [this]() {
|
||||
uint32_t nireq = 1;
|
||||
return nireq;
|
||||
}},
|
||||
{METRIC_KEY(FULL_DEVICE_NAME), [&options, this]() {
|
||||
if (ov::supported_properties == name) {
|
||||
return config.GetSupportedProperties();
|
||||
} else if (ov::available_devices == name) {
|
||||
return GetAvailableDevices().as<std::vector<std::string>>();
|
||||
} else if (ov::optimal_number_of_infer_requests == name) {
|
||||
uint32_t nireq = 1;
|
||||
return nireq;
|
||||
} else if (ov::range_for_async_infer_requests == name) {
|
||||
std::tuple<unsigned int, unsigned int, unsigned int> range{1, 1, 1};
|
||||
return range;
|
||||
} else if (ov::device::capabilities == name) {
|
||||
std::vector<std::string> supported_capabilities = {
|
||||
ov::device::capability::INT16,
|
||||
ov::device::capability::INT8,
|
||||
ov::device::capability::EXPORT_IMPORT,
|
||||
};
|
||||
if (options.count(ov::device::id.name())) {
|
||||
if (options.at(ov::device::id.name()).as<std::string>().compare("GNA_HW") != 0) {
|
||||
supported_capabilities.emplace_back(ov::device::capability::FP32);
|
||||
}
|
||||
}
|
||||
return supported_capabilities;
|
||||
} else if (ov::device::full_name == name) {
|
||||
if (!options.count(ov::device::id.name())) {
|
||||
auto availableDevices = GetAvailableDevices().as<std::vector<std::string>>();
|
||||
|
||||
if (availableDevices.empty()) {
|
||||
THROW_GNA_EXCEPTION << "No devices available.";
|
||||
} else if (availableDevices.size() > 2) {
|
||||
THROW_GNA_EXCEPTION << "ov::device::id not set in request for ov::device::full_name";
|
||||
}
|
||||
return availableDevices.back();
|
||||
} else {
|
||||
return options.at(ov::device::id.name());
|
||||
}
|
||||
} else if (ov::intel_gna::library_full_version == name) {
|
||||
return GNADeviceHelper::GetGnaLibraryVersion();
|
||||
} else {
|
||||
const std::unordered_map<std::string, std::function<Parameter()>> queryApiSupported = {
|
||||
{METRIC_KEY(AVAILABLE_DEVICES), [this]() {return GetAvailableDevices();}},
|
||||
{METRIC_KEY(SUPPORTED_CONFIG_KEYS), [this]() {return config.GetSupportedKeys();}},
|
||||
{METRIC_KEY(OPTIMAL_NUMBER_OF_INFER_REQUESTS), [this]() {
|
||||
uint32_t nireq = 1;
|
||||
return nireq;
|
||||
}},
|
||||
{METRIC_KEY(FULL_DEVICE_NAME), [&options, this]() {
|
||||
auto availableDevices = GetAvailableDevices().as<std::vector<std::string>>();
|
||||
|
||||
if (!options.count(KEY_DEVICE_ID)) {
|
||||
if (availableDevices.size() == 1 || availableDevices.size() == 2) {
|
||||
return availableDevices.back(); // detection order is GNA_SW_EXACT, GNA_HW
|
||||
} else {
|
||||
THROW_GNA_EXCEPTION << "KEY_DEVICE_ID not set in request for FULL_DEVICE_NAME";
|
||||
if (availableDevices.empty()) {
|
||||
THROW_GNA_EXCEPTION << "No devices available.";
|
||||
}
|
||||
}
|
||||
|
||||
auto deviceName = options.at(KEY_DEVICE_ID).as<std::string>();
|
||||
return deviceName;
|
||||
}},
|
||||
{METRIC_KEY(GNA_LIBRARY_FULL_VERSION), [this]() {return GNADeviceHelper::GetGnaLibraryVersion();}},
|
||||
{METRIC_KEY(SUPPORTED_METRICS), [&queryApiSupported, this]() {
|
||||
std::vector<std::string> availablesMetrics;
|
||||
for (auto && supportedAPI : queryApiSupported) {
|
||||
availablesMetrics.push_back(supportedAPI.first);
|
||||
}
|
||||
return availablesMetrics;
|
||||
}},
|
||||
{METRIC_KEY(IMPORT_EXPORT_SUPPORT), []() {return true;}}
|
||||
};
|
||||
if (!options.count(KEY_DEVICE_ID)) {
|
||||
if (availableDevices.size() == 1 || availableDevices.size() == 2) {
|
||||
return availableDevices.back(); // detection order is GNA_SW, GNA_HW
|
||||
} else {
|
||||
THROW_GNA_EXCEPTION << "KEY_DEVICE_ID not set in request for FULL_DEVICE_NAME";
|
||||
}
|
||||
}
|
||||
|
||||
auto it = queryApiSupported.find(name);
|
||||
if (it == queryApiSupported.end()) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported parameters for GetMetric: " << name;
|
||||
auto deviceName = options.at(KEY_DEVICE_ID).as<std::string>();
|
||||
return deviceName;
|
||||
}},
|
||||
{METRIC_KEY(GNA_LIBRARY_FULL_VERSION), [this]() {return GNADeviceHelper::GetGnaLibraryVersion();}},
|
||||
{METRIC_KEY(SUPPORTED_METRICS), [&queryApiSupported, this]() {
|
||||
std::vector<std::string> availablesMetrics;
|
||||
for (auto && supportedAPI : queryApiSupported) {
|
||||
availablesMetrics.push_back(supportedAPI.first);
|
||||
}
|
||||
return availablesMetrics;
|
||||
}},
|
||||
{METRIC_KEY(IMPORT_EXPORT_SUPPORT), []() {return true;}}
|
||||
};
|
||||
|
||||
auto it = queryApiSupported.find(name);
|
||||
if (it == queryApiSupported.end()) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported parameters for GetMetric: " << name;
|
||||
}
|
||||
|
||||
return it->second();
|
||||
}
|
||||
|
||||
return it->second();
|
||||
}
|
||||
|
||||
Parameter GNAPlugin::GetAvailableDevices() const {
|
||||
@@ -70,7 +109,7 @@ Parameter GNAPlugin::GetAvailableDevices() const {
|
||||
|
||||
try {
|
||||
GNADeviceHelper helper;
|
||||
devices.push_back("GNA_SW_EXACT");
|
||||
devices.push_back("GNA_SW");
|
||||
if (helper.hasGnaHw()) {
|
||||
devices.push_back("GNA_HW");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "behavior/ov_executable_network/get_metric.hpp"
|
||||
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
#include <gna/gna_config.hpp>
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
@@ -12,6 +13,51 @@ namespace {
|
||||
//
|
||||
// Executable Network GetMetric
|
||||
//
|
||||
class OVClassNetworkTestGNA : public ::testing::Test {
|
||||
public:
|
||||
std::shared_ptr<ngraph::Function> gnaSimpleNetwork;
|
||||
|
||||
void SetUp() override {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED();
|
||||
|
||||
auto param0 = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::Type_t::f32, ngraph::Shape(1, 1024));
|
||||
auto reshape = std::make_shared<ngraph::opset8::Reshape>(param0,
|
||||
std::make_shared<ngraph::opset8::Constant>(ngraph::element::Type_t::i64, ngraph::Shape{4}, ngraph::Shape{1, 1, 1, 1024}), false);
|
||||
auto conv1 = ngraph::builder::makeConvolution(reshape, ngraph::element::Type_t::f32, {1, 7}, {1, 1}, {0, 0}, {0, 0}, {1, 1},
|
||||
ngraph::op::PadType::EXPLICIT, 4);
|
||||
auto result = std::make_shared<ngraph::opset8::Result>(conv1);
|
||||
gnaSimpleNetwork = std::make_shared<ngraph::Function>(ngraph::ResultVector{result}, ngraph::ParameterVector{param0});
|
||||
gnaSimpleNetwork->set_friendly_name("GnaSingleConv");
|
||||
}
|
||||
};
|
||||
|
||||
class OVClassBaseTestGNAP : public OVClassNetworkTestGNA, public ::testing::WithParamInterface<std::string> {
|
||||
public:
|
||||
std::string deviceName;
|
||||
|
||||
void SetUp() override {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED();
|
||||
OVClassNetworkTestGNA::SetUp();
|
||||
deviceName = GetParam();
|
||||
}
|
||||
};
|
||||
|
||||
class OVClassExecutableNetworkGetMetricTestForSpecificConfigGNA :
|
||||
public OVClassNetworkTestGNA,
|
||||
public ::testing::WithParamInterface<std::tuple<std::string, std::pair<std::string, ov::Any>>> {
|
||||
protected:
|
||||
std::string deviceName;
|
||||
std::string configKey;
|
||||
ov::Any configValue;
|
||||
|
||||
public:
|
||||
void SetUp() override {
|
||||
SKIP_IF_CURRENT_TEST_IS_DISABLED();
|
||||
OVClassNetworkTestGNA::SetUp();
|
||||
deviceName = std::get<0>(GetParam());
|
||||
std::tie(configKey, configValue) = std::get<1>(GetParam());
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Convolution with 3D input is not supported on GNA
|
||||
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetMetricTest,
|
||||
@@ -76,31 +122,64 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::make_pair(CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), CONFIG_VALUE(YES)),
|
||||
std::make_pair(GNA_CONFIG_KEY(COMPACT_MODE), CONFIG_VALUE(NO)))));
|
||||
|
||||
using OVClassExecutableNetworkSetConfigFromFp32Test = OVClassExecutableNetworkGetMetricTestForSpecificConfig;
|
||||
using OVClassExecutableNetworkSetConfigFromFp32Test = OVClassExecutableNetworkGetMetricTestForSpecificConfigGNA;
|
||||
using OVClassExecutableNetworkSetConfigROProperties = OVClassExecutableNetworkGetMetricTestForSpecificConfigGNA;
|
||||
|
||||
TEST_P(OVClassExecutableNetworkSetConfigFromFp32Test, SetConfigFromFp32Throws) {
|
||||
ov::Core ie;
|
||||
|
||||
ov::AnyMap initialConfig;
|
||||
initialConfig[GNA_CONFIG_KEY(DEVICE_MODE)] = InferenceEngine::GNAConfigParams::GNA_SW_FP32;
|
||||
ov::CompiledModel exeNetwork = ie.compile_model(simpleNetwork, deviceName, initialConfig);
|
||||
|
||||
ov::CompiledModel exeNetwork = ie.compile_model(gnaSimpleNetwork, deviceName,
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::SW_FP32));
|
||||
|
||||
ASSERT_THROW(exeNetwork.set_property({{configKey, configValue}}), ov::Exception);
|
||||
}
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
// TODO: Convolution with 3D input is not supported on GNA
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
DISABLED_smoke_OVClassExecutableNetworkSetConfigFromFp32Test,
|
||||
smoke_OVClassExecutableNetworkSetConfigFromFp32Test,
|
||||
OVClassExecutableNetworkSetConfigFromFp32Test,
|
||||
::testing::Combine(
|
||||
::testing::Values("GNA"),
|
||||
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_HW),
|
||||
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW),
|
||||
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_HW_WITH_SW_FBACK),
|
||||
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT),
|
||||
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_FP32),
|
||||
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO))));
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO),
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::HW),
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::HW_WITH_SW_FBACK),
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::SW_EXACT),
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::SW_FP32),
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::AUTO))));
|
||||
|
||||
TEST_P(OVClassExecutableNetworkSetConfigROProperties, SetConfigROPropertiesThrows) {
|
||||
ov::Core ie;
|
||||
std::vector<ov::PropertyName> properties;
|
||||
|
||||
ov::CompiledModel exeNetwork = ie.compile_model(gnaSimpleNetwork, deviceName);
|
||||
|
||||
ASSERT_NO_THROW(properties = exeNetwork.get_property(ov::supported_properties));
|
||||
|
||||
auto it = find(properties.begin(), properties.end(), configKey);
|
||||
ASSERT_TRUE(it != properties.end());
|
||||
ASSERT_FALSE(it->is_mutable());
|
||||
|
||||
ASSERT_THROW(exeNetwork.set_property({{configKey, configValue}}), ov::Exception);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OVClassExecutableNetworkSetConfigROProperties,
|
||||
OVClassExecutableNetworkSetConfigROProperties,
|
||||
::testing::Combine(
|
||||
::testing::Values("GNA"),
|
||||
::testing::Values(ov::intel_gna::scale_factors_per_input(std::map<std::string, float>{{"0", 1.0f}}),
|
||||
ov::hint::inference_precision(ngraph::element::i8),
|
||||
ov::hint::num_requests(2),
|
||||
ov::intel_gna::pwl_design_algorithm(ov::intel_gna::PWLDesignAlgorithm::UNIFORM_DISTRIBUTION),
|
||||
ov::intel_gna::pwl_max_error_percent(0.2),
|
||||
ov::intel_gna::firmware_model_image_path(""),
|
||||
ov::intel_gna::compile_target(ov::intel_gna::HWGeneration::GNA_3_0),
|
||||
ov::intel_gna::execution_target(ov::intel_gna::HWGeneration::GNA_3_0))));
|
||||
|
||||
//
|
||||
// Hetero Executable Network GetMetric
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "behavior/ov_plugin/core_integration.hpp"
|
||||
|
||||
#include <gna/gna_config.hpp>
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
|
||||
using namespace ov::test::behavior;
|
||||
|
||||
@@ -41,13 +42,11 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
|
||||
OVClassGetMetricTest_FULL_DEVICE_NAME,
|
||||
::testing::Values("GNA", "MULTI", "HETERO"));
|
||||
|
||||
// TODO: Issue: 30198
|
||||
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassGetMetricTest,
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_OVClassGetMetricTest,
|
||||
OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
|
||||
::testing::Values("GNA"));
|
||||
|
||||
// TODO: Issue: 30199
|
||||
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassGetMetricTest,
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_OVClassGetMetricTest,
|
||||
OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
|
||||
::testing::Values("GNA"));
|
||||
|
||||
@@ -59,6 +58,7 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest,
|
||||
OVClassGetConfigTest_ThrowUnsupported,
|
||||
::testing::Values("GNA", "MULTI", "HETERO"));
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetAvailableDevices, OVClassGetAvailableDevices, ::testing::Values("GNA"));
|
||||
|
||||
//
|
||||
@@ -67,6 +67,236 @@ INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetAvailableDevices, OVClassGetAvailable
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest, OVClassGetConfigTest, ::testing::Values("GNA"));
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedScaleFactors) {
|
||||
ov::Core core;
|
||||
float sf1, sf2;
|
||||
ASSERT_NO_THROW(core.set_property({{"GNA_SCALE_FACTOR_0", "1634.0"}, {"GNA_SCALE_FACTOR_1", "2000.0"}}));
|
||||
ASSERT_NO_THROW(sf1 = std::stof(core.get_property("GNA", "GNA_SCALE_FACTOR_0").as<std::string>()));
|
||||
ASSERT_NO_THROW(sf2 = std::stof(core.get_property("GNA", "GNA_SCALE_FACTOR_1").as<std::string>()));
|
||||
ASSERT_FLOAT_EQ(1634.0, sf1);
|
||||
ASSERT_FLOAT_EQ(2000.0, sf2);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", { ov::intel_gna::scale_factors_per_input(std::map<std::string, float>{{"input_0", 1634.0f}, {"input_1", 2000.0f}}),
|
||||
{"GNA_SCALE_FACTOR_0", "1634.0"}, {"GNA_SCALE_FACTOR_1", "2000.0"}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedScaleFactorsPerInput) {
|
||||
ov::Core core;
|
||||
std::map<std::string, float> scale_factors_per_input;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA",
|
||||
ov::intel_gna::scale_factors_per_input(std::map<std::string, float>{{"input_0", 1634.0f}, {"input_1", 2000.0f}})));
|
||||
ASSERT_NO_THROW(scale_factors_per_input = core.get_property("GNA", ov::intel_gna::scale_factors_per_input));
|
||||
ASSERT_EQ(2, scale_factors_per_input.size());
|
||||
ASSERT_FLOAT_EQ(1634.0f, scale_factors_per_input["input_0"]);
|
||||
ASSERT_FLOAT_EQ(2000.0f, scale_factors_per_input["input_1"]);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA",
|
||||
ov::intel_gna::scale_factors_per_input(std::map<std::string, float>{{"0", 1.0f}})));
|
||||
ASSERT_NO_THROW(scale_factors_per_input = core.get_property("GNA", ov::intel_gna::scale_factors_per_input));
|
||||
ASSERT_EQ(1, scale_factors_per_input.size());
|
||||
ASSERT_FLOAT_EQ(1.0f, scale_factors_per_input["0"]);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPrecisionHint) {
|
||||
ov::Core core;
|
||||
ov::element::Type precision;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::inference_precision(ov::element::i8)));
|
||||
ASSERT_NO_THROW(precision = core.get_property("GNA", ov::hint::inference_precision));
|
||||
ASSERT_EQ(ov::element::i8, precision);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::inference_precision(ov::element::i16)));
|
||||
ASSERT_NO_THROW(precision = core.get_property("GNA", ov::hint::inference_precision));
|
||||
ASSERT_EQ(ov::element::i16, precision);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", {{ov::hint::inference_precision.name(), "I8"}}));
|
||||
ASSERT_NO_THROW(precision = core.get_property("GNA", ov::hint::inference_precision));
|
||||
ASSERT_EQ(ov::element::i8, precision);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", {{ov::hint::inference_precision.name(), "I16"}}));
|
||||
ASSERT_NO_THROW(precision = core.get_property("GNA", ov::hint::inference_precision));
|
||||
ASSERT_EQ(ov::element::i16, precision);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", { ov::hint::inference_precision(ov::element::i8),
|
||||
{ GNA_CONFIG_KEY(PRECISION), "I16"}}), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", ov::hint::inference_precision(ov::element::i32)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", ov::hint::inference_precision(ov::element::undefined)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::hint::inference_precision.name(), "ABC"}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPerformanceHint) {
|
||||
ov::Core core;
|
||||
ov::hint::PerformanceMode mode;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)));
|
||||
ASSERT_NO_THROW(mode = core.get_property("GNA", ov::hint::performance_mode));
|
||||
ASSERT_EQ(ov::hint::PerformanceMode::LATENCY, mode);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)));
|
||||
ASSERT_NO_THROW(mode = core.get_property("GNA", ov::hint::performance_mode));
|
||||
ASSERT_EQ(ov::hint::PerformanceMode::THROUGHPUT, mode);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::hint::performance_mode.name(), "ABC"}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedNumRequests) {
|
||||
ov::Core core;
|
||||
uint32_t num_requests;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::num_requests(8)));
|
||||
ASSERT_NO_THROW(num_requests = core.get_property("GNA", ov::hint::num_requests));
|
||||
ASSERT_EQ(8, num_requests);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::num_requests(1)));
|
||||
ASSERT_NO_THROW(num_requests = core.get_property("GNA", ov::hint::num_requests));
|
||||
ASSERT_EQ(1, num_requests);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::num_requests(1000)));
|
||||
ASSERT_NO_THROW(num_requests = core.get_property("GNA", ov::hint::num_requests));
|
||||
ASSERT_EQ(127, num_requests); // maximum value
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::hint::num_requests(0)));
|
||||
ASSERT_NO_THROW(num_requests = core.get_property("GNA", ov::hint::num_requests));
|
||||
ASSERT_EQ(1, num_requests); // minimum value
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
ASSERT_NO_THROW(core.set_property("GNA", {ov::hint::num_requests(8), {GNA_CONFIG_KEY(LIB_N_THREADS), "8"}}));
|
||||
ASSERT_THROW(core.set_property("GNA", {ov::hint::num_requests(4), {GNA_CONFIG_KEY(LIB_N_THREADS), "8"}}), ov::Exception);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::hint::num_requests.name(), "ABC"}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedExecutionMode) {
|
||||
ov::Core core;
|
||||
auto execution_mode = ov::intel_gna::ExecutionMode::AUTO;
|
||||
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::SW_EXACT, execution_mode);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::SW_FP32)));
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::SW_FP32, execution_mode);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::SW_EXACT)));
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::SW_EXACT, execution_mode);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::HW_WITH_SW_FBACK)));
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::HW_WITH_SW_FBACK, execution_mode);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::HW)));
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::HW, execution_mode);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::AUTO)));
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::AUTO, execution_mode);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::intel_gna::execution_mode.name(), "ABC"}}), ov::Exception);
|
||||
ASSERT_NO_THROW(execution_mode = core.get_property("GNA", ov::intel_gna::execution_mode));
|
||||
ASSERT_EQ(ov::intel_gna::ExecutionMode::AUTO, execution_mode);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedTargetDevice) {
|
||||
ov::Core core;
|
||||
auto execution_target = ov::intel_gna::HWGeneration::UNDEFINED;
|
||||
auto compile_target = ov::intel_gna::HWGeneration::UNDEFINED;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_target(ov::intel_gna::HWGeneration::GNA_2_0)));
|
||||
ASSERT_NO_THROW(execution_target = core.get_property("GNA", ov::intel_gna::execution_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::GNA_2_0, execution_target);
|
||||
ASSERT_NO_THROW(compile_target = core.get_property("GNA", ov::intel_gna::compile_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::GNA_2_0, compile_target);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_target(ov::intel_gna::HWGeneration::GNA_3_0)));
|
||||
ASSERT_NO_THROW(execution_target = core.get_property("GNA", ov::intel_gna::execution_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::GNA_3_0, execution_target);
|
||||
ASSERT_NO_THROW(compile_target = core.get_property("GNA", ov::intel_gna::compile_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::GNA_2_0, compile_target);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::compile_target(ov::intel_gna::HWGeneration::GNA_3_0)));
|
||||
ASSERT_NO_THROW(execution_target = core.get_property("GNA", ov::intel_gna::execution_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::GNA_3_0, execution_target);
|
||||
ASSERT_NO_THROW(compile_target = core.get_property("GNA", ov::intel_gna::compile_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::GNA_3_0, compile_target);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::execution_target(ov::intel_gna::HWGeneration::UNDEFINED)));
|
||||
ASSERT_NO_THROW(execution_target = core.get_property("GNA", ov::intel_gna::execution_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::UNDEFINED, execution_target);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::compile_target(ov::intel_gna::HWGeneration::UNDEFINED)));
|
||||
ASSERT_NO_THROW(compile_target = core.get_property("GNA", ov::intel_gna::execution_target));
|
||||
ASSERT_EQ(ov::intel_gna::HWGeneration::UNDEFINED, compile_target);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", {ov::intel_gna::execution_target(ov::intel_gna::HWGeneration::GNA_2_0),
|
||||
{ GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_3_0"}}), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", {ov::intel_gna::compile_target(ov::intel_gna::HWGeneration::GNA_2_0),
|
||||
{ GNA_CONFIG_KEY(COMPILE_TARGET), "GNA_TARGET_3_0"}}), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::intel_gna::execution_target.name(), "ABC"}}), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::intel_gna::compile_target.name(), "ABC"}}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedPwlAlgorithm) {
|
||||
ov::Core core;
|
||||
auto pwl_algo = ov::intel_gna::PWLDesignAlgorithm::UNDEFINED;
|
||||
float pwl_max_error = 0.0f;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::pwl_design_algorithm(ov::intel_gna::PWLDesignAlgorithm::RECURSIVE_DESCENT)));
|
||||
ASSERT_NO_THROW(pwl_algo = core.get_property("GNA", ov::intel_gna::pwl_design_algorithm));
|
||||
ASSERT_EQ(ov::intel_gna::PWLDesignAlgorithm::RECURSIVE_DESCENT, pwl_algo);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::pwl_design_algorithm(ov::intel_gna::PWLDesignAlgorithm::UNIFORM_DISTRIBUTION)));
|
||||
ASSERT_NO_THROW(pwl_algo = core.get_property("GNA", ov::intel_gna::pwl_design_algorithm));
|
||||
ASSERT_EQ(ov::intel_gna::PWLDesignAlgorithm::UNIFORM_DISTRIBUTION, pwl_algo);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", {{ov::intel_gna::pwl_design_algorithm.name(), "ABC"}}), ov::Exception);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::pwl_max_error_percent(0.05)));
|
||||
ASSERT_NO_THROW(pwl_max_error = core.get_property("GNA", ov::intel_gna::pwl_max_error_percent));
|
||||
ASSERT_FLOAT_EQ(0.05, pwl_max_error);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::pwl_max_error_percent(100.0f)));
|
||||
ASSERT_NO_THROW(pwl_max_error = core.get_property("GNA", ov::intel_gna::pwl_max_error_percent));
|
||||
ASSERT_FLOAT_EQ(100.0f, pwl_max_error);
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
ASSERT_THROW(core.set_property("GNA", { ov::intel_gna::pwl_design_algorithm(ov::intel_gna::PWLDesignAlgorithm::RECURSIVE_DESCENT),
|
||||
{GNA_CONFIG_KEY(PWL_UNIFORM_DESIGN), InferenceEngine::PluginConfigParams::YES}}), ov::Exception);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
ASSERT_THROW(core.set_property("GNA", ov::intel_gna::pwl_max_error_percent(-1.0f)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", ov::intel_gna::pwl_max_error_percent(146.0f)), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedLogLevel) {
|
||||
ov::Core core;
|
||||
auto level = ov::log::Level::NO;
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::log::level(ov::log::Level::WARNING)));
|
||||
ASSERT_NO_THROW(level = core.get_property("GNA", ov::log::level));
|
||||
ASSERT_EQ(ov::log::Level::WARNING, level);
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::log::level(ov::log::Level::NO)));
|
||||
ASSERT_NO_THROW(level = core.get_property("GNA", ov::log::level));
|
||||
ASSERT_EQ(ov::log::Level::NO, level);
|
||||
|
||||
ASSERT_THROW(core.set_property("GNA", ov::log::level(ov::log::Level::ERR)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", ov::log::level(ov::log::Level::INFO)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", ov::log::level(ov::log::Level::DEBUG)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", ov::log::level(ov::log::Level::TRACE)), ov::Exception);
|
||||
ASSERT_THROW(core.set_property("GNA", {{ ov::log::level.name(), "NO" }}), ov::Exception);
|
||||
}
|
||||
|
||||
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedFwModelPath) {
|
||||
ov::Core core;
|
||||
std::string path = "";
|
||||
|
||||
ASSERT_NO_THROW(core.set_property("GNA", ov::intel_gna::firmware_model_image_path("model.bin")));
|
||||
ASSERT_NO_THROW(path = core.get_property("GNA", ov::intel_gna::firmware_model_image_path));
|
||||
ASSERT_EQ("model.bin", path);
|
||||
}
|
||||
|
||||
// IE Class Query network
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest, ::testing::Values("GNA"));
|
||||
|
||||
@@ -28,7 +28,9 @@ const std::map<std::string, std::string> supportedConfigKeysWithDefaults = {
|
||||
{CONFIG_KEY(PERF_COUNT), CONFIG_VALUE(NO)},
|
||||
{GNA_CONFIG_KEY(LIB_N_THREADS), "1"},
|
||||
{CONFIG_KEY(SINGLE_THREAD), CONFIG_VALUE(YES)},
|
||||
{CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_NONE}
|
||||
{CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_NONE},
|
||||
{CONFIG_KEY(PERFORMANCE_HINT), CONFIG_VALUE(LATENCY)},
|
||||
{CONFIG_KEY(PERFORMANCE_HINT_NUM_REQUESTS), "1"}
|
||||
};
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
@@ -172,9 +174,9 @@ IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigLibNThreadsTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(LIB_N_THREADS), "2");
|
||||
EXPECT_EQ(config.gnaFlags.gna_lib_async_threads_num, 2);
|
||||
EXPECT_EQ(config.gnaFlags.num_requests, 2);
|
||||
SetAndCompare(GNA_CONFIG_KEY(LIB_N_THREADS), "25");
|
||||
EXPECT_EQ(config.gnaFlags.gna_lib_async_threads_num, 25);
|
||||
EXPECT_EQ(config.gnaFlags.num_requests, 25);
|
||||
ExpectThrow(GNA_CONFIG_KEY(LIB_N_THREADS), "");
|
||||
ExpectThrow(GNA_CONFIG_KEY(LIB_N_THREADS), "0");
|
||||
ExpectThrow(GNA_CONFIG_KEY(LIB_N_THREADS), "128");
|
||||
@@ -213,9 +215,9 @@ TEST_F(GNAPluginConfigTest, GnaConfigGnaCompileTargetTest) {
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigLogLevel) {
|
||||
SetAndCompare(CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_WARNING);
|
||||
EXPECT_EQ(config.gnaFlags.log_level, PluginConfigParams::LOG_WARNING);
|
||||
EXPECT_EQ(config.gnaFlags.log_level, ov::log::Level::WARNING);
|
||||
SetAndCompare(CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_NONE);
|
||||
EXPECT_EQ(config.gnaFlags.log_level, PluginConfigParams::LOG_NONE);
|
||||
EXPECT_EQ(config.gnaFlags.log_level, ov::log::Level::NO);
|
||||
ExpectThrow(CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_ERROR);
|
||||
ExpectThrow(CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_INFO);
|
||||
ExpectThrow(CONFIG_KEY(LOG_LEVEL), PluginConfigParams::LOG_DEBUG);
|
||||
|
||||
Reference in New Issue
Block a user