[GNA] Refactor target configuration (#15407)
This commit is contained in:
1 parent
6c72ea4bea
commit
1c20005b2f
33 files changed
+489
-361
No files matched your search
@@ -1365,7 +1365,7 @@ uint32_t AMIntelDNN::CountLayers() {
|
||||
return n;
|
||||
}
|
||||
|
||||
void AMIntelDNN::InitGNAStruct(Gna2Model* gnaModel, const std::string& gnaCompileTarget) {
|
||||
void AMIntelDNN::InitGNAStruct(Gna2Model* gnaModel) {
|
||||
Gna2Operation* gnaOperation;
|
||||
if (gnaModel == nullptr)
|
||||
THROW_GNA_EXCEPTION << "Invalid input parameter";
|
||||
|
||||
@@ -306,7 +306,7 @@ public:
|
||||
|
||||
void WriteDnnText(const char* filename, intel_dnn_number_type_t logging_precision);
|
||||
|
||||
void InitGNAStruct(Gna2Model* gnaModel, const std::string& gnaCompileTarget = common::kGnaTarget2_0);
|
||||
void InitGNAStruct(Gna2Model* gnaModel);
|
||||
|
||||
void DestroyGNAStruct(Gna2Model* gnaModel);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
using namespace common;
|
||||
namespace limitations {
|
||||
namespace cnn2d {
|
||||
|
||||
@@ -423,13 +424,17 @@ bool Validator_35::ShouldUseOnlyConv2DGnaIface() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractValidator> AbstractValidator::Create(const std::string& target) {
|
||||
if (target == common::kGnaTarget3_0) {
|
||||
std::unique_ptr<AbstractValidator> AbstractValidator::Create(const common::DeviceVersion& target) {
|
||||
switch (target) {
|
||||
case DeviceVersion::GNA3_0:
|
||||
case DeviceVersion::GNAEmbedded3_1:
|
||||
return tools::make_unique<Validator_30>();
|
||||
} else if (target == common::kGnaTarget3_5) {
|
||||
case DeviceVersion::GNA3_5:
|
||||
case DeviceVersion::GNAEmbedded3_5:
|
||||
return tools::make_unique<Validator_35>();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void AbstractValidator::ThrowIfNotEmpty(const std::string& prefix, const std::string& error) {
|
||||
@@ -450,6 +455,11 @@ bool AbstractValidator::ValidationSuccesful(const bool throwOnError,
|
||||
return error.empty();
|
||||
}
|
||||
|
||||
bool UseOnly16BitConvolutionWeights(const DeviceVersion& compile_target) {
|
||||
return (compile_target == common::DeviceVersion::GNA2_0 || compile_target == common::DeviceVersion::GNA3_0) ||
|
||||
compile_target == common::DeviceVersion::GNAEmbedded3_1;
|
||||
}
|
||||
|
||||
} // namespace cnn2d
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <cstdint>
|
||||
#include <ie_algorithm.hpp>
|
||||
|
||||
#include "common/gna_target.hpp"
|
||||
#include "dnn_types.hpp"
|
||||
#include "gna_lib_ver_selector.hpp"
|
||||
|
||||
@@ -199,7 +200,7 @@ public:
|
||||
OvGnaType inPrecision,
|
||||
bool exception = true) const = 0;
|
||||
|
||||
static std::unique_ptr<AbstractValidator> Create(const std::string&);
|
||||
static std::unique_ptr<AbstractValidator> Create(const common::DeviceVersion& target);
|
||||
};
|
||||
|
||||
class Validator_30 : public AbstractValidator {
|
||||
@@ -351,6 +352,8 @@ public:
|
||||
bool exception = true) const override;
|
||||
};
|
||||
|
||||
bool UseOnly16BitConvolutionWeights(const common::DeviceVersion& compile_target);
|
||||
|
||||
} // namespace cnn2d
|
||||
|
||||
bool AreLayersSupported(InferenceEngine::CNNNetwork& network, std::string& errMessage);
|
||||
|
||||
@@ -3,3 +3,128 @@
|
||||
//
|
||||
|
||||
#include "gna_target.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "log/debug.hpp"
|
||||
#include "misc_utils.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
namespace common {
|
||||
|
||||
static constexpr const char* kGnaTargetUnspecified = "";
|
||||
static constexpr const char* kGnaTargetSoftwareEmulation = "GNA_SW_EMULATION";
|
||||
static constexpr const char* kGnaTarget1_0 = "GNA_TARGET_1_0";
|
||||
static constexpr const char* kGnaTarget2_0 = "GNA_TARGET_2_0";
|
||||
static constexpr const char* kGnaTarget3_0 = "GNA_TARGET_3_0";
|
||||
static constexpr const char* kGnaTarget3_1 = "GNA_TARGET_3_1";
|
||||
static constexpr const char* kGnaTarget3_5 = "GNA_TARGET_3_5";
|
||||
static constexpr const char* kGnaTarget3_5_e = "GNA_TARGET_3_5_E";
|
||||
static constexpr const char* kGnaDefaultTarget = kGnaTarget3_0;
|
||||
|
||||
static const std::unordered_map<HWGeneration, DeviceVersion> HWGenerationDeviceMap{
|
||||
{HWGeneration::GNA_2_0, DeviceVersion::GNA2_0},
|
||||
{HWGeneration::GNA_3_0, DeviceVersion::GNA3_0},
|
||||
{HWGeneration::GNA_3_5, DeviceVersion::GNA3_5},
|
||||
{HWGeneration::UNDEFINED, DeviceVersion::NotSet}};
|
||||
|
||||
static const std::unordered_map<Gna2DeviceVersion, DeviceVersion> GnaDeviceMap{
|
||||
{Gna2DeviceVersionEmbedded1_0, DeviceVersion::GNAEmbedded1_0},
|
||||
{Gna2DeviceVersion2_0, DeviceVersion::GNA2_0},
|
||||
{Gna2DeviceVersion3_0, DeviceVersion::GNA3_0},
|
||||
{Gna2DeviceVersionEmbedded3_1, DeviceVersion::GNAEmbedded3_1},
|
||||
{Gna2DeviceVersion3_5, DeviceVersion::GNA3_5},
|
||||
{Gna2DeviceVersionEmbedded3_5, DeviceVersion::GNAEmbedded3_5},
|
||||
{Gna2DeviceVersionSoftwareEmulation, DeviceVersion::SoftwareEmulation}};
|
||||
|
||||
static const std::unordered_map<std::string, DeviceVersion> StringDeviceMap{
|
||||
{kGnaTarget1_0, DeviceVersion::GNAEmbedded1_0},
|
||||
{kGnaTarget2_0, DeviceVersion::GNA2_0},
|
||||
{kGnaTarget3_0, DeviceVersion::GNA3_0},
|
||||
{kGnaTarget3_1, DeviceVersion::GNAEmbedded3_1},
|
||||
{kGnaTarget3_5, DeviceVersion::GNA3_5},
|
||||
{kGnaTarget3_5_e, DeviceVersion::GNAEmbedded3_5},
|
||||
{kGnaTargetSoftwareEmulation, DeviceVersion::SoftwareEmulation},
|
||||
{kGnaTargetUnspecified, DeviceVersion::NotSet}};
|
||||
|
||||
static const std::vector<DeviceVersion> EmbeddedDevices{DeviceVersion::GNAEmbedded1_0,
|
||||
DeviceVersion::GNAEmbedded3_1,
|
||||
DeviceVersion::GNAEmbedded3_5};
|
||||
|
||||
DeviceVersion HwGenerationToDevice(const HWGeneration& target) {
|
||||
return GetValueForKey<HWGeneration, DeviceVersion>(target, HWGenerationDeviceMap);
|
||||
}
|
||||
|
||||
HWGeneration DeviceToHwGeneration(const DeviceVersion& target) {
|
||||
return GetKeyForValue<HWGeneration, DeviceVersion>(target, HWGenerationDeviceMap);
|
||||
}
|
||||
|
||||
DeviceVersion GnaToDevice(const Gna2DeviceVersion& target) {
|
||||
return GetValueForKey<Gna2DeviceVersion, DeviceVersion>(target, GnaDeviceMap);
|
||||
}
|
||||
|
||||
Gna2DeviceVersion DeviceToGna(const DeviceVersion& target) {
|
||||
return GetKeyForValue<Gna2DeviceVersion, DeviceVersion>(target, GnaDeviceMap);
|
||||
}
|
||||
|
||||
DeviceVersion StringToDevice(const std::string& target) {
|
||||
return GetValueForKey<std::string, DeviceVersion>(target, StringDeviceMap);
|
||||
}
|
||||
|
||||
std::string DeviceToString(const DeviceVersion& target) {
|
||||
return GetKeyForValue<std::string, DeviceVersion>(target, StringDeviceMap);
|
||||
}
|
||||
|
||||
bool IsEmbeddedDevice(const DeviceVersion& target) {
|
||||
return std::find(EmbeddedDevices.begin(), EmbeddedDevices.end(), target) != EmbeddedDevices.end();
|
||||
}
|
||||
|
||||
DeviceVersion Target::get_detected_device_version() const {
|
||||
return detected_device_version;
|
||||
}
|
||||
|
||||
DeviceVersion Target::get_user_set_execution_target() const {
|
||||
return user_set_execution_target;
|
||||
}
|
||||
|
||||
DeviceVersion Target::get_user_set_compile_target() const {
|
||||
return user_set_compile_target;
|
||||
}
|
||||
|
||||
void Target::set_detected_device_version(DeviceVersion detected_device) {
|
||||
detected_device_version = detected_device;
|
||||
}
|
||||
|
||||
void Target::set_user_set_execution_target(DeviceVersion execution_target) {
|
||||
user_set_execution_target = execution_target;
|
||||
}
|
||||
|
||||
void Target::set_user_set_compile_target(DeviceVersion compile_target) {
|
||||
user_set_compile_target = compile_target;
|
||||
}
|
||||
|
||||
DeviceVersion Target::get_effective_execution_target() const {
|
||||
if (user_set_execution_target != DeviceVersion::NotSet) {
|
||||
return user_set_execution_target;
|
||||
} else if (detected_device_version == DeviceVersion::SoftwareEmulation) {
|
||||
return DeviceVersion::Default;
|
||||
} else {
|
||||
return detected_device_version;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceVersion Target::get_effective_compile_target() const {
|
||||
if (user_set_compile_target != DeviceVersion::NotSet) {
|
||||
return user_set_compile_target;
|
||||
} else if (detected_device_version == DeviceVersion::SoftwareEmulation) {
|
||||
return DeviceVersion::Default;
|
||||
} else {
|
||||
return get_effective_execution_target();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -4,16 +4,51 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "gna2-common-api.h"
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
namespace common {
|
||||
|
||||
static constexpr const char* kGnaTargetUnspecified = "";
|
||||
static constexpr const char* kGnaTarget2_0 = "GNA_TARGET_2_0";
|
||||
static constexpr const char* kGnaTarget3_0 = "GNA_TARGET_3_0";
|
||||
static constexpr const char* kGnaTarget3_1 = "GNA_TARGET_3_1";
|
||||
static constexpr const char* kGnaTarget3_5 = "GNA_TARGET_3_5";
|
||||
static constexpr const char* kGnaDefaultTarget = kGnaTarget3_0;
|
||||
enum class DeviceVersion {
|
||||
NotSet = -1,
|
||||
SoftwareEmulation = 0,
|
||||
GNAEmbedded1_0 = 0x10e,
|
||||
GNA2_0 = 0x20,
|
||||
GNA3_0 = 0x30,
|
||||
GNAEmbedded3_1 = 0x31e,
|
||||
GNA3_5 = 0x35,
|
||||
GNAEmbedded3_5 = 0x35e,
|
||||
Default = GNA3_0
|
||||
};
|
||||
|
||||
class Target {
|
||||
public:
|
||||
DeviceVersion get_detected_device_version() const;
|
||||
DeviceVersion get_user_set_execution_target() const;
|
||||
DeviceVersion get_user_set_compile_target() const;
|
||||
void set_detected_device_version(DeviceVersion detected_device);
|
||||
void set_user_set_execution_target(DeviceVersion execution_target);
|
||||
void set_user_set_compile_target(DeviceVersion compile_target);
|
||||
DeviceVersion get_effective_execution_target() const;
|
||||
DeviceVersion get_effective_compile_target() const;
|
||||
|
||||
private:
|
||||
DeviceVersion detected_device_version = DeviceVersion::SoftwareEmulation;
|
||||
DeviceVersion user_set_execution_target = DeviceVersion::NotSet;
|
||||
DeviceVersion user_set_compile_target = DeviceVersion::NotSet;
|
||||
};
|
||||
|
||||
DeviceVersion HwGenerationToDevice(const HWGeneration& target);
|
||||
HWGeneration DeviceToHwGeneration(const DeviceVersion& target);
|
||||
DeviceVersion GnaToDevice(const Gna2DeviceVersion& target);
|
||||
Gna2DeviceVersion DeviceToGna(const DeviceVersion& target);
|
||||
DeviceVersion StringToDevice(const std::string& target);
|
||||
std::string DeviceToString(const DeviceVersion& target);
|
||||
bool IsEmbeddedDevice(const DeviceVersion& target);
|
||||
|
||||
} // namespace common
|
||||
} // namespace intel_gna
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "log/debug.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
namespace common {
|
||||
|
||||
template <typename T, typename U>
|
||||
U GetValueForKey(const T& key, const std::unordered_map<T, U>& mapping) {
|
||||
const auto key_iter = mapping.find(key);
|
||||
if (key_iter != mapping.end()) {
|
||||
return key_iter->second;
|
||||
}
|
||||
THROW_GNA_EXCEPTION << "Unsupported map key" << std::endl;
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
T GetKeyForValue(const U& value, const std::unordered_map<T, U>& mapping) {
|
||||
for (const auto& item : mapping) {
|
||||
if (item.second == value) {
|
||||
return item.first;
|
||||
}
|
||||
}
|
||||
THROW_GNA_EXCEPTION << "Unsupported map value" << std::endl;
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -352,7 +352,7 @@ InferenceEngine::Precision GetWeightsPrecision(const LayerInfo& layer_info,
|
||||
const QuantizedLayerParams& quant_layer_params,
|
||||
const Config& gna_config) {
|
||||
if (((layer_info.isConvolution() || layer_info.isConvolutionFilter()) &&
|
||||
gna_config.gnaCompileTarget != common::kGnaTarget3_5) ||
|
||||
limitations::cnn2d::UseOnly16BitConvolutionWeights(gna_config.target->get_effective_compile_target())) ||
|
||||
layer_info.isScaleShift()) {
|
||||
return InferenceEngine::Precision::I16;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
#include "common/gna_target.hpp"
|
||||
#include "common/versioning.hpp"
|
||||
#include "gna/gna_config.hpp"
|
||||
#include "gna2-device-api.h"
|
||||
@@ -19,40 +18,9 @@
|
||||
#include "gna_device.hpp"
|
||||
#include "log/log.hpp"
|
||||
|
||||
using namespace ov::intel_gna;
|
||||
|
||||
void* ExportSueLegacyUsingGnaApi2(uint32_t modelId, uint32_t deviceIndex, Gna2ModelSueCreekHeader* modelHeader) {
|
||||
uint32_t exportConfig;
|
||||
auto status = Gna2ModelExportConfigCreate(gnaUserAllocatorAlignedPage, &exportConfig);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigCreate");
|
||||
|
||||
status = Gna2ModelExportConfigSetSource(exportConfig, deviceIndex, modelId);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetSource");
|
||||
status = Gna2ModelExportConfigSetTarget(exportConfig, Gna2DeviceVersionEmbedded1_0);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetTarget");
|
||||
|
||||
void* bufferSueCreekHeader = nullptr;
|
||||
uint32_t bufferSueCreekHeaderSize;
|
||||
|
||||
status = Gna2ModelExport(exportConfig,
|
||||
Gna2ModelExportComponentLegacySueCreekHeader,
|
||||
&bufferSueCreekHeader,
|
||||
&bufferSueCreekHeaderSize);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExport(LegacySueCreekHeader)");
|
||||
|
||||
(*modelHeader) = *(reinterpret_cast<Gna2ModelSueCreekHeader*>(bufferSueCreekHeader));
|
||||
|
||||
void* bufferDump = nullptr;
|
||||
uint32_t bufferDumpSize;
|
||||
status = Gna2ModelExport(exportConfig, Gna2ModelExportComponentLegacySueCreekDump, &bufferDump, &bufferDumpSize);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExport(LegacySueCreekDump)");
|
||||
|
||||
status = Gna2ModelExportConfigRelease(exportConfig);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigRelease");
|
||||
|
||||
gnaUserFree(bufferSueCreekHeader);
|
||||
return bufferDump;
|
||||
}
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
using namespace common;
|
||||
|
||||
#define Gna2TlvTypeOVInputScaleFactor GNA2_TLV_IMPL_CHAR_TO_TYPE("OVIS")
|
||||
#define Gna2TlvTypeOVOutputScaleFactor GNA2_TLV_IMPL_CHAR_TO_TYPE("OVOS")
|
||||
@@ -62,16 +30,15 @@ void* ExportSueLegacyUsingGnaApi2(uint32_t modelId, uint32_t deviceIndex, Gna2Mo
|
||||
static_assert(std::numeric_limits<float>::is_iec559, "Float is not IEC 559 compatible");
|
||||
typedef std::array<char, sizeof(Gna2TlvRecord) + sizeof(float)> TlvFloatRecord;
|
||||
|
||||
namespace {
|
||||
TlvFloatRecord GetFloatInTLV(Gna2TlvType type, float value) {
|
||||
static TlvFloatRecord GetFloatInTLV(Gna2TlvType type, float value) {
|
||||
TlvFloatRecord r;
|
||||
reinterpret_cast<Gna2TlvRecord*>(r.data())->type = type;
|
||||
reinterpret_cast<Gna2TlvRecord*>(r.data())->length = sizeof(float);
|
||||
*reinterpret_cast<float*>(r.data() + sizeof(Gna2TlvRecord)) = value;
|
||||
return r;
|
||||
} // namespace
|
||||
}
|
||||
|
||||
std::vector<char> GetStringAsTlv(Gna2TlvType type, const std::string& s) {
|
||||
static std::vector<char> GetStringAsTlv(Gna2TlvType type, const std::string& s) {
|
||||
std::vector<char> record(sizeof(Gna2TlvRecord));
|
||||
reinterpret_cast<Gna2TlvRecord*>(record.data())->type = type;
|
||||
|
||||
@@ -81,38 +48,11 @@ std::vector<char> GetStringAsTlv(Gna2TlvType type, const std::string& s) {
|
||||
record.insert(record.end(), vs.begin(), vs.end());
|
||||
return record;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Gna2DeviceVersion getEmbeddedTargetFromCompileTarget(const std::string compileTarget) {
|
||||
static const std::map<std::string, Gna2DeviceVersion> targetMap = {
|
||||
{common::kGnaTarget3_1, Gna2DeviceVersionEmbedded3_1},
|
||||
{common::kGnaTarget3_5, Gna2DeviceVersionEmbedded3_5},
|
||||
};
|
||||
auto found = targetMap.find(compileTarget);
|
||||
if (found == targetMap.end()) {
|
||||
return Gna2DeviceVersionEmbedded1_0;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
namespace {
|
||||
Gna2DeviceVersion getTlvTargetFromCompileTarget(const std::string compileTarget) {
|
||||
const auto target = getEmbeddedTargetFromCompileTarget(compileTarget);
|
||||
static const std::set<Gna2DeviceVersion> supportedTargets = {
|
||||
Gna2DeviceVersionEmbedded3_1,
|
||||
Gna2DeviceVersionEmbedded3_5,
|
||||
};
|
||||
const auto found = supportedTargets.count(target) > 0;
|
||||
if (!found) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported compile target for TLV export: " << compileTarget << "\n";
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
std::string WriteAllEndpoints(std::ostream& outStream,
|
||||
const std::vector<GnaEndpoint>& allEndpoints,
|
||||
const Gna2TlvType sfTlvType,
|
||||
const GnaAllocation* allocation) {
|
||||
static std::string WriteAllEndpoints(std::ostream& outStream,
|
||||
const std::vector<GnaEndpoint>& allEndpoints,
|
||||
const Gna2TlvType sfTlvType,
|
||||
const GnaAllocation* allocation) {
|
||||
const std::string endPointType = sfTlvType == Gna2TlvTypeOVInputScaleFactor ? "Input" : "Output";
|
||||
|
||||
if (allEndpoints.size() >= 1) {
|
||||
@@ -147,21 +87,21 @@ std::string WriteAllEndpoints(std::ostream& outStream,
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
void WriteStringToTlv(std::ostream& outStream, const Gna2TlvType tlvType, const std::string& value) {
|
||||
static void WriteStringToTlv(std::ostream& outStream, const Gna2TlvType tlvType, const std::string& value) {
|
||||
const auto& valueTlv = GetStringAsTlv(tlvType, value);
|
||||
outStream.write(valueTlv.data(), valueTlv.size());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ExportTlvModel(uint32_t modelId,
|
||||
uint32_t deviceIndex,
|
||||
std::ostream& outStream,
|
||||
std::string compileTarget,
|
||||
const DeviceVersion& compile_target,
|
||||
const std::vector<GnaEndpoint>& allInputs,
|
||||
const std::vector<GnaEndpoint>& allOutputs,
|
||||
const GnaAllocations& allAllocations) {
|
||||
const auto deviceVersionToExport = getTlvTargetFromCompileTarget(compileTarget);
|
||||
if (compile_target == DeviceVersion::GNAEmbedded1_0) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported compile target for TLV export: GNA Embedded 1.0" << std::endl;
|
||||
}
|
||||
|
||||
uint32_t exportConfig;
|
||||
auto status = Gna2ModelExportConfigCreate(gnaUserAllocatorAlignedPage, &exportConfig);
|
||||
@@ -169,12 +109,11 @@ void ExportTlvModel(uint32_t modelId,
|
||||
|
||||
status = Gna2ModelExportConfigSetSource(exportConfig, deviceIndex, modelId);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetSource");
|
||||
status = Gna2ModelExportConfigSetTarget(exportConfig, deviceVersionToExport);
|
||||
status = Gna2ModelExportConfigSetTarget(exportConfig, DeviceToGna(compile_target));
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetTarget");
|
||||
|
||||
// first descriptors
|
||||
void* bufferLayerDescriptors = nullptr;
|
||||
;
|
||||
uint32_t sizeOfLayerDescriptors;
|
||||
|
||||
status = Gna2ModelExport(exportConfig,
|
||||
@@ -185,7 +124,6 @@ void ExportTlvModel(uint32_t modelId,
|
||||
|
||||
// RO
|
||||
void* bufferROData = nullptr;
|
||||
;
|
||||
uint32_t sizeOfROData;
|
||||
|
||||
status = Gna2ModelExport(exportConfig, Gna2ModelExportComponentReadOnlyDump, &bufferROData, &sizeOfROData);
|
||||
@@ -193,7 +131,6 @@ void ExportTlvModel(uint32_t modelId,
|
||||
|
||||
// RW - scratch
|
||||
void* bufferScratchRWData = nullptr;
|
||||
;
|
||||
uint32_t sizeOfScratchRWData;
|
||||
|
||||
status =
|
||||
@@ -230,7 +167,7 @@ void ExportTlvModel(uint32_t modelId,
|
||||
|
||||
uint32_t outTlvSize = 0;
|
||||
|
||||
auto tlv_status = Gna2ExportTlv(deviceVersionToExport,
|
||||
auto tlv_status = Gna2ExportTlv(DeviceToGna(compile_target),
|
||||
gnaUserAllocator,
|
||||
&outTlv,
|
||||
&outTlvSize,
|
||||
@@ -258,7 +195,7 @@ void ExportTlvModel(uint32_t modelId,
|
||||
Gna2TlvTypeOVOutputScaleFactor,
|
||||
allAllocations.Get(Gna2MemoryTagOutput));
|
||||
WriteStringToTlv(outStream, Gna2TlvTypeOVString, metadata);
|
||||
const auto& ovVersionString = ov::intel_gna::common::get_openvino_version_string();
|
||||
const auto& ovVersionString = ov::intel_gna::get_openvino_version_string();
|
||||
WriteStringToTlv(outStream, Gna2TlvTypeOVVersion, ovVersionString);
|
||||
}
|
||||
|
||||
@@ -278,3 +215,39 @@ void ExportTlvModel(uint32_t modelId,
|
||||
THROW_GNA_EXCEPTION << "Not succesfull status returned: " << tlv_status << ", from Gna2ExportTlv() function\n";
|
||||
}
|
||||
}
|
||||
|
||||
void* ExportSueLegacyUsingGnaApi2(uint32_t modelId, uint32_t deviceIndex, Gna2ModelSueCreekHeader* modelHeader) {
|
||||
uint32_t exportConfig;
|
||||
auto status = Gna2ModelExportConfigCreate(gnaUserAllocatorAlignedPage, &exportConfig);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigCreate");
|
||||
|
||||
status = Gna2ModelExportConfigSetSource(exportConfig, deviceIndex, modelId);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetSource");
|
||||
status = Gna2ModelExportConfigSetTarget(exportConfig, DeviceToGna(DeviceVersion::GNAEmbedded1_0));
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetTarget");
|
||||
|
||||
void* bufferSueCreekHeader = nullptr;
|
||||
uint32_t bufferSueCreekHeaderSize;
|
||||
|
||||
status = Gna2ModelExport(exportConfig,
|
||||
Gna2ModelExportComponentLegacySueCreekHeader,
|
||||
&bufferSueCreekHeader,
|
||||
&bufferSueCreekHeaderSize);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExport(LegacySueCreekHeader)");
|
||||
|
||||
(*modelHeader) = *(reinterpret_cast<Gna2ModelSueCreekHeader*>(bufferSueCreekHeader));
|
||||
|
||||
void* bufferDump = nullptr;
|
||||
uint32_t bufferDumpSize;
|
||||
status = Gna2ModelExport(exportConfig, Gna2ModelExportComponentLegacySueCreekDump, &bufferDump, &bufferDumpSize);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExport(LegacySueCreekDump)");
|
||||
|
||||
status = Gna2ModelExportConfigRelease(exportConfig);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigRelease");
|
||||
|
||||
gnaUserFree(bufferSueCreekHeader);
|
||||
return bufferDump;
|
||||
}
|
||||
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -13,11 +13,14 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "gna2-common-api.h"
|
||||
#include "common/gna_target.hpp"
|
||||
#include "gna2-model-export-api.h"
|
||||
#include "gna2-model-suecreek-header.h"
|
||||
#include "gna_device_allocation.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
|
||||
struct GnaEndpoint {
|
||||
std::string name;
|
||||
uint32_t byteSize = 0;
|
||||
@@ -67,12 +70,13 @@ std::vector<GnaEndpoint> GnaEndpoint::CreateFromDescriptorContainer(const T& con
|
||||
|
||||
void* ExportSueLegacyUsingGnaApi2(uint32_t modelId, uint32_t deviceIndex, Gna2ModelSueCreekHeader* modelHeader);
|
||||
|
||||
Gna2DeviceVersion getEmbeddedTargetFromCompileTarget(const std::string compileTarget);
|
||||
|
||||
void ExportTlvModel(uint32_t modelId,
|
||||
uint32_t deviceIndex,
|
||||
std::ostream& outStream,
|
||||
std::string compileTarget,
|
||||
const common::DeviceVersion& compileTarget,
|
||||
const std::vector<GnaEndpoint>& inputs,
|
||||
const std::vector<GnaEndpoint>& outputs,
|
||||
const GnaAllocations& allAllocation);
|
||||
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -4,12 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gna2-common-api.h>
|
||||
#include <gna2-model-api.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "backend/dnn_types.hpp"
|
||||
#include "gna2-model-api.h"
|
||||
|
||||
constexpr uint32_t InOpIdx = 0;
|
||||
constexpr uint32_t OutOpIdx = 1;
|
||||
|
||||
@@ -28,18 +28,15 @@
|
||||
#include "log/log.hpp"
|
||||
#include "memory/gna_mem_requests.hpp"
|
||||
|
||||
using namespace ov::intel_gna;
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
using namespace common;
|
||||
|
||||
std::mutex GNADeviceHelper::acrossPluginsSync{};
|
||||
|
||||
GNADeviceHelper::GNADeviceHelper(std::string executionTargetIn,
|
||||
std::string compileTargetIn,
|
||||
bool swExactModeIn,
|
||||
bool isPerformanceMeasuring,
|
||||
bool deviceEmbedded)
|
||||
: nGnaDeviceIndex{selectGnaDevice()},
|
||||
executionTarget(executionTargetIn),
|
||||
compileTarget(compileTargetIn),
|
||||
GNADeviceHelper::GNADeviceHelper(std::shared_ptr<Target> targetIn, bool isPerformanceMeasuring, bool deviceEmbedded)
|
||||
: target(targetIn),
|
||||
nGnaDeviceIndex{selectGnaDevice()},
|
||||
useDeviceEmbeddedExport(deviceEmbedded),
|
||||
isPerformanceMeasuring(isPerformanceMeasuring) {
|
||||
per_request_diagnostics = log::get_log_level() >= ov::log::Level::TRACE;
|
||||
@@ -53,7 +50,7 @@ GNADeviceHelper::GNADeviceHelper(std::string executionTargetIn,
|
||||
maxLayersCount_ = retrieveMaxLayersCount();
|
||||
}
|
||||
|
||||
GNADeviceHelper ::~GNADeviceHelper() {
|
||||
GNADeviceHelper::~GNADeviceHelper() {
|
||||
if (deviceOpened) {
|
||||
close();
|
||||
}
|
||||
@@ -151,7 +148,7 @@ uint32_t GNADeviceHelper::enqueueRequest(const uint32_t requestConfigID, Gna2Acc
|
||||
uint32_t reqId{};
|
||||
if ((gna2AccelerationMode == Gna2AccelerationModeHardware ||
|
||||
gna2AccelerationMode == Gna2AccelerationModeHardwareWithSoftwareFallback) &&
|
||||
detectedGnaDevVersion == Gna2DeviceVersionSoftwareEmulation) {
|
||||
target->get_detected_device_version() == DeviceVersion::SoftwareEmulation) {
|
||||
log::warning() << "GNA Device not detected, consider using other mode of acceleration";
|
||||
}
|
||||
|
||||
@@ -213,7 +210,8 @@ uint32_t GNADeviceHelper::createModel(Gna2Model& gnaModel) const {
|
||||
"./";
|
||||
#endif
|
||||
const std::string mode = useDeviceEmbeddedExport ? "_ee" : "";
|
||||
const auto fileSuffix = mode + "_devVersion_" + toHexString(detectedGnaDevVersion);
|
||||
const auto fileSuffix =
|
||||
mode + "_devVersion_" + toHexString(DeviceToString(target->get_detected_device_version()));
|
||||
dump::DumpGna2Model(gnaModel, path, false, allAllocations, fileSuffix);
|
||||
}
|
||||
|
||||
@@ -230,37 +228,8 @@ void GNADeviceHelper::releaseModel(const uint32_t model_id) {
|
||||
}
|
||||
|
||||
bool GNADeviceHelper::enforceLegacyCnnNeeded() const {
|
||||
const auto execTargetDevice = getTargetDevice(true);
|
||||
return isUpTo20HwGnaDevice(execTargetDevice);
|
||||
}
|
||||
|
||||
Gna2DeviceVersion GNADeviceHelper::parseTarget(const std::string& target) {
|
||||
static const std::map<std::string, Gna2DeviceVersion> targetMap{
|
||||
{common::kGnaTarget2_0, Gna2DeviceVersion2_0},
|
||||
{common::kGnaTarget3_0, Gna2DeviceVersion3_0},
|
||||
{common::kGnaTarget3_5, Gna2DeviceVersion3_5},
|
||||
{common::kGnaTargetUnspecified, Gna2DeviceVersionSoftwareEmulation},
|
||||
};
|
||||
const auto f = targetMap.find(target);
|
||||
if (f != targetMap.end()) {
|
||||
return f->second;
|
||||
}
|
||||
THROW_GNA_EXCEPTION << "Unsupported "
|
||||
<< "GNA target: \"" << target << "\"\n";
|
||||
}
|
||||
|
||||
Gna2DeviceVersion GNADeviceHelper::getDefaultTarget() const {
|
||||
if (detectedGnaDevVersion == Gna2DeviceVersionSoftwareEmulation)
|
||||
return parseTarget(common::kGnaDefaultTarget);
|
||||
return detectedGnaDevVersion;
|
||||
}
|
||||
|
||||
Gna2DeviceVersion GNADeviceHelper::getTargetDevice(const bool execTarget) const {
|
||||
const auto declared = execTarget ? executionTarget : compileTarget;
|
||||
if (declared == common::kGnaTargetUnspecified) {
|
||||
return execTarget ? getDefaultTarget() : getTargetDevice(true);
|
||||
}
|
||||
return parseTarget(declared);
|
||||
const auto execution_target = target->get_effective_execution_target();
|
||||
return is_up_to_20_hw(execution_target);
|
||||
}
|
||||
|
||||
uint32_t GNADeviceHelper::createRequestConfig(const uint32_t modelID) const {
|
||||
@@ -501,42 +470,42 @@ void GNADeviceHelper::dumpTLVForDeviceVersion(const uint32_t modelId,
|
||||
std::ostream& outStream,
|
||||
const std::vector<GnaEndpoint>& inputsContainer,
|
||||
const std::vector<GnaEndpoint>& outputsContainer) {
|
||||
const auto compileTarget = GetCompileTarget();
|
||||
ExportTlvModel(modelId,
|
||||
nGnaDeviceIndex,
|
||||
outStream,
|
||||
compileTarget,
|
||||
target->get_effective_compile_target(),
|
||||
inputsContainer,
|
||||
outputsContainer,
|
||||
allAllocations);
|
||||
}
|
||||
|
||||
void GNADeviceHelper::createVirtualDevice(Gna2DeviceVersion devVersion) {
|
||||
const auto status = Gna2DeviceCreateForExport(devVersion, &nGnaDeviceIndex);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2DeviceCreateForExport(" + std::to_string(devVersion) + ")");
|
||||
void GNADeviceHelper::createVirtualDevice(const DeviceVersion& devVersion) {
|
||||
const auto status = Gna2DeviceCreateForExport(DeviceToGna(devVersion), &nGnaDeviceIndex);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2DeviceCreateForExport(" + DeviceToString(devVersion) + ")");
|
||||
}
|
||||
|
||||
void GNADeviceHelper::updateGnaDeviceVersion() {
|
||||
const auto status = Gna2DeviceGetVersion(nGnaDeviceIndex, &detectedGnaDevVersion);
|
||||
Gna2DeviceVersion device_version = Gna2DeviceVersionSoftwareEmulation;
|
||||
const auto status = Gna2DeviceGetVersion(nGnaDeviceIndex, &device_version);
|
||||
checkGna2Status(status, "Gna2DeviceGetVersion");
|
||||
target->set_detected_device_version(GnaToDevice(device_version));
|
||||
}
|
||||
|
||||
void GNADeviceHelper::open() {
|
||||
std::unique_lock<std::mutex> lockGnaCalls{acrossPluginsSync};
|
||||
updateGnaDeviceVersion();
|
||||
const auto gnaExecTarget = parseTarget(executionTarget);
|
||||
if (useDeviceEmbeddedExport) {
|
||||
const auto gnaCompileTarget = GetCompileTarget();
|
||||
const auto exportGeneration = getEmbeddedTargetFromCompileTarget(gnaCompileTarget);
|
||||
const auto execution_target = target->get_user_set_execution_target();
|
||||
|
||||
createVirtualDevice(exportGeneration);
|
||||
if (useDeviceEmbeddedExport) {
|
||||
createVirtualDevice(target->get_user_set_compile_target());
|
||||
updateGnaDeviceVersion();
|
||||
} else if (!executionTarget.empty() && gnaExecTarget != detectedGnaDevVersion) {
|
||||
createVirtualDevice(gnaExecTarget);
|
||||
} else if (execution_target != DeviceVersion::NotSet && execution_target != target->get_detected_device_version()) {
|
||||
createVirtualDevice(execution_target);
|
||||
updateGnaDeviceVersion();
|
||||
if (detectedGnaDevVersion != gnaExecTarget) {
|
||||
THROW_GNA_EXCEPTION << "Wrong virtual GNA device version reported: " << detectedGnaDevVersion
|
||||
<< " instead of: " << gnaExecTarget;
|
||||
if (target->get_detected_device_version() != execution_target) {
|
||||
THROW_GNA_EXCEPTION << "Wrong virtual GNA device version reported: "
|
||||
<< DeviceToString(target->get_detected_device_version())
|
||||
<< " instead of: " << DeviceToString(execution_target);
|
||||
}
|
||||
} else {
|
||||
const auto status = Gna2DeviceOpen(nGnaDeviceIndex);
|
||||
@@ -593,21 +562,6 @@ void GNADeviceHelper::getGnaPerfCounters(
|
||||
retPerfCounters["1.2 Stall scoring time in HW"] = info;
|
||||
}
|
||||
|
||||
std::string GNADeviceHelper::GetCompileTarget() const {
|
||||
static const std::map<Gna2DeviceVersion, std::string> targetMap = {
|
||||
{Gna2DeviceVersion2_0, common::kGnaTarget2_0},
|
||||
{Gna2DeviceVersion3_0, common::kGnaTarget3_0},
|
||||
{Gna2DeviceVersion3_5, common::kGnaTarget3_5},
|
||||
{Gna2DeviceVersionEmbedded3_5, common::kGnaTarget3_5},
|
||||
};
|
||||
const auto target = getTargetDevice(false);
|
||||
auto found = targetMap.find(target);
|
||||
if (found == targetMap.end()) {
|
||||
THROW_GNA_EXCEPTION << "Unknown target Gna2DeviceVersion == " << target;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
uint32_t GNADeviceHelper::maxLayersCount() const {
|
||||
return maxLayersCount_;
|
||||
}
|
||||
@@ -615,14 +569,15 @@ uint32_t GNADeviceHelper::maxLayersCount() const {
|
||||
uint32_t GNADeviceHelper::retrieveMaxLayersCount() {
|
||||
using namespace limitations;
|
||||
|
||||
switch (getTargetDevice(true)) {
|
||||
case Gna2DeviceVersion1_0:
|
||||
return kMaxLayersCountGNA1_0;
|
||||
case Gna2DeviceVersion2_0:
|
||||
switch (target->get_effective_execution_target()) {
|
||||
case DeviceVersion::GNA2_0:
|
||||
return kMaxLayersCountGNA2_0;
|
||||
case Gna2DeviceVersion3_0:
|
||||
case Gna2DeviceVersion3_5:
|
||||
case DeviceVersion::GNA3_0:
|
||||
case DeviceVersion::GNA3_5:
|
||||
default:
|
||||
return kMaxLayersCountGNA3_X;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include "gna2-common-api.h"
|
||||
#include "common/gna_target.hpp"
|
||||
#include "gna2-inference-api.h"
|
||||
#include "gna2-instrumentation-api.h"
|
||||
#include "gna2-memory-api.h"
|
||||
@@ -28,22 +28,23 @@
|
||||
#include "gna_device_interface.hpp"
|
||||
#include "memory/gna_mem_requests.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
|
||||
/**
|
||||
* holds gna - style handle in RAII way
|
||||
*/
|
||||
class GNADeviceHelper : public ov::intel_gna::GNADevice {
|
||||
class GNADeviceHelper : public GNADevice {
|
||||
using UnwaitedRequestIds = std::set<uint32_t>;
|
||||
static std::mutex acrossPluginsSync;
|
||||
static std::string decoratedGnaLibVersion() {
|
||||
static std::string gnaLibraryVersion{", GNA library version: " + GNADeviceHelper::GetGnaLibraryVersion()};
|
||||
return gnaLibraryVersion;
|
||||
}
|
||||
std::shared_ptr<common::Target> target;
|
||||
std::string modeOfOperation = "default";
|
||||
GnaAllocations allAllocations;
|
||||
uint32_t nGnaDeviceIndex = 0;
|
||||
Gna2DeviceVersion detectedGnaDevVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
std::string executionTarget;
|
||||
std::string compileTarget;
|
||||
bool useDeviceEmbeddedExport = false;
|
||||
uint32_t maxLayersCount_ = 0;
|
||||
|
||||
@@ -68,9 +69,7 @@ class GNADeviceHelper : public ov::intel_gna::GNADevice {
|
||||
static constexpr const char* kDumpDelimiter = ".";
|
||||
|
||||
public:
|
||||
explicit GNADeviceHelper(std::string executionTargetIn = "",
|
||||
std::string compileTargetIn = "",
|
||||
bool swExactModeIn = false,
|
||||
explicit GNADeviceHelper(std::shared_ptr<common::Target> target = std::make_shared<common::Target>(),
|
||||
bool isPerformanceMeasuring = false,
|
||||
bool deviceEmbedded = false);
|
||||
|
||||
@@ -93,14 +92,11 @@ public:
|
||||
void releaseModel(const uint32_t model_id);
|
||||
static uint32_t getNumberOfGnaDevices();
|
||||
static uint32_t selectGnaDevice();
|
||||
static bool isGnaHw(const Gna2DeviceVersion dev) {
|
||||
return Gna2DeviceVersionSoftwareEmulation != dev;
|
||||
static bool is_hw_target(const common::DeviceVersion device_version) {
|
||||
return common::DeviceVersion::SoftwareEmulation != device_version;
|
||||
}
|
||||
bool hasGnaHw() const {
|
||||
return isGnaHw(detectedGnaDevVersion);
|
||||
}
|
||||
static bool isUpTo20HwGnaDevice(const Gna2DeviceVersion dev) {
|
||||
return dev <= Gna2DeviceVersion2_0 && isGnaHw(dev);
|
||||
bool is_hw_detected() const {
|
||||
return is_hw_target(target->get_detected_device_version());
|
||||
}
|
||||
bool enforceLegacyCnnNeeded() const;
|
||||
static std::string checkGna2Status(Gna2Status status, const std::string& from, bool returnInsteadThrow = false);
|
||||
@@ -126,7 +122,6 @@ public:
|
||||
void updateGnaPerfCounters();
|
||||
void getGnaPerfCounters(std::map<std::string, InferenceEngine::InferenceEngineProfileInfo>& retPerfCounters);
|
||||
static std::string GetGnaLibraryVersion();
|
||||
std::string GetCompileTarget() const;
|
||||
|
||||
const GnaAllocations& getAllAllocations() const {
|
||||
return allAllocations;
|
||||
@@ -175,11 +170,10 @@ private:
|
||||
|
||||
static void enforceLegacyCnns(Gna2Model& gnaModel);
|
||||
static void enforceLegacyCnnsWhenNeeded(Gna2Model& gnaModel);
|
||||
static Gna2DeviceVersion parseTarget(const std::string& target);
|
||||
Gna2DeviceVersion getDefaultTarget() const;
|
||||
Gna2DeviceVersion getTargetDevice(bool execTarget) const;
|
||||
|
||||
void createVirtualDevice(Gna2DeviceVersion devVersion);
|
||||
static bool is_up_to_20_hw(const common::DeviceVersion device_version) {
|
||||
return device_version <= common::DeviceVersion::GNA2_0 && is_hw_target(device_version);
|
||||
}
|
||||
void createVirtualDevice(const common::DeviceVersion& devVersion);
|
||||
void updateGnaDeviceVersion();
|
||||
|
||||
void initGnaPerfCounters() {
|
||||
@@ -191,3 +185,6 @@ private:
|
||||
checkGna2Status(status, "Gna2InstrumentationConfigCreate");
|
||||
}
|
||||
}; // NOLINT
|
||||
|
||||
} // namespace intel_gna
|
||||
} // namespace ov
|
||||
@@ -42,13 +42,13 @@
|
||||
#include "runtime/pwl.h"
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace ov::intel_gna::frontend;
|
||||
using namespace ov::intel_gna::common;
|
||||
using namespace ov::intel_gna::memory;
|
||||
using namespace std;
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
using namespace frontend;
|
||||
using namespace common;
|
||||
using namespace memory;
|
||||
|
||||
static bool CheckIFLastComponentIsPrecededByConv2D(const backend::DnnComponents::storage_type& components,
|
||||
bool verify_with_pooling = true) {
|
||||
@@ -221,7 +221,7 @@ void GNAGraphCompiler::fillSplitConnections(InferenceEngine::CNNLayerPtr layer)
|
||||
split_connection.emplace(id, layerInfoItem);
|
||||
}
|
||||
|
||||
void GNAGraphCompiler::SetValidatorTarget(const std::string& target) {
|
||||
void GNAGraphCompiler::SetValidatorTarget(const DeviceVersion& target) {
|
||||
auto temp = limitations::cnn2d::AbstractValidator::Create(target);
|
||||
cnn2dValidator.reset(temp.release());
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
const uint32_t strideH,
|
||||
const uint32_t strideW) const;
|
||||
|
||||
void SetValidatorTarget(const std::string& target);
|
||||
void SetValidatorTarget(const common::DeviceVersion& target);
|
||||
|
||||
/**
|
||||
* Connects either memory output, or generic output to a layer
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "frontend/model_quantizer.hpp"
|
||||
#include "frontend/scale_factor_calc.hpp"
|
||||
#include "frontend/weights_converter.hpp"
|
||||
#include "gna2-model-api.h"
|
||||
#include "gna2_model_export_helper.hpp"
|
||||
#include "gna2_model_helper.hpp"
|
||||
#include "gna_fused_iterator.hpp"
|
||||
@@ -416,11 +417,9 @@ void GNAPlugin::InitGNADevice() {
|
||||
if (gnaFlags->sw_fp32) {
|
||||
gnamem.reset(new gna_memory_float(memory::GNAFloatAllocator{}));
|
||||
} else {
|
||||
gnadevice = std::make_shared<GNADeviceHelper>(config.gnaExecTarget,
|
||||
config.gnaCompileTarget,
|
||||
config.swExactMode,
|
||||
gnadevice = std::make_shared<GNADeviceHelper>(config.target,
|
||||
gnaFlags->performance_counting,
|
||||
!config.dumpXNNPath.empty());
|
||||
!config.embedded_export_path.empty());
|
||||
size_t page_size_bytes = 4096;
|
||||
gnamem = std::make_shared<gna_memory_device>(memory::GNAAllocator(gnadevice), page_size_bytes);
|
||||
}
|
||||
@@ -704,8 +703,8 @@ void GNAPlugin::LoadNetwork(const CNNNetwork& _network) {
|
||||
_network_name = _network.getName();
|
||||
std::shared_ptr<InferenceEngine::details::CNNNetworkImpl> convertedNetwork;
|
||||
|
||||
const auto effectiveGnaCompileTargetValue = effectiveGnaCompileTarget();
|
||||
graphCompiler.SetValidatorTarget(effectiveGnaCompileTargetValue);
|
||||
const auto effectiveCompileTarget = config.target->get_effective_compile_target();
|
||||
graphCompiler.SetValidatorTarget(effectiveCompileTarget);
|
||||
|
||||
bool isNgraphPassesUsed = false;
|
||||
bool fake_quantized = false;
|
||||
@@ -731,12 +730,11 @@ void GNAPlugin::LoadNetwork(const CNNNetwork& _network) {
|
||||
manager.register_pass<ov::pass::LSTMCellDecomposition>();
|
||||
manager.register_pass<ov::intel_gna::pass::ConvertDWSCToScaleShifts>();
|
||||
manager.register_pass<ov::intel_gna::pass::ConvertPaddedToValidConv>();
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBiasAF>(effectiveGnaCompileTargetValue,
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBiasAF>(effectiveCompileTarget,
|
||||
config.gnaPrecision);
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBias>(effectiveGnaCompileTargetValue,
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBias>(effectiveCompileTarget,
|
||||
config.gnaPrecision);
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConv>(effectiveGnaCompileTargetValue,
|
||||
config.gnaPrecision);
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConv>(effectiveCompileTarget, config.gnaPrecision);
|
||||
// TODO enable this transformation for networks with convolutions
|
||||
if (!ov::op::util::has_op_with_type<ngraph::opset7::Convolution>(graph)) {
|
||||
manager.register_pass<ov::intel_gna::pass::ConvertMatmulWithFqToPointWiseConvolution>();
|
||||
@@ -1171,15 +1169,6 @@ bool GNAPlugin::isFP32ModeActive() const {
|
||||
return gnaFlags->sw_fp32 || !gnadevice;
|
||||
}
|
||||
|
||||
std::string GNAPlugin::effectiveGnaCompileTarget() const {
|
||||
if (gnadevice) {
|
||||
return gnadevice->GetCompileTarget();
|
||||
} else if (!config.gnaCompileTarget.empty()) {
|
||||
return config.gnaCompileTarget;
|
||||
}
|
||||
return common::kGnaDefaultTarget;
|
||||
}
|
||||
|
||||
std::shared_ptr<request::Worker> GNAPlugin::createWorkerForLoadNetwork(bool trivial, bool fp32Mode) {
|
||||
// Do not initialize gna model for fp32 mode (create trivial model wraper)
|
||||
return createWorker(createModelWrapperForLoadNetwork(trivial || fp32Mode), trivial, fp32Mode);
|
||||
@@ -1217,10 +1206,9 @@ std::shared_ptr<request::ModelWrapper> GNAPlugin::createModelWrapperForLoadNetwo
|
||||
}
|
||||
|
||||
std::weak_ptr<backend::AMIntelDNN> weakDnn = dnn;
|
||||
auto compileTarget = effectiveGnaCompileTarget();
|
||||
auto initializer = [weakDnn, compileTarget](Gna2Model* model) {
|
||||
auto initializer = [weakDnn](Gna2Model* model) {
|
||||
if (auto dnn = weakDnn.lock()) {
|
||||
dnn->InitGNAStruct(model, compileTarget);
|
||||
dnn->InitGNAStruct(model);
|
||||
return;
|
||||
}
|
||||
THROW_GNA_EXCEPTION << "dnn is nullptr";
|
||||
@@ -1236,7 +1224,7 @@ std::shared_ptr<request::ModelWrapper> GNAPlugin::createModelWrapperForImportNet
|
||||
void GNAPlugin::DumpXNNToFile() const {
|
||||
// TODO: output precision as well as pointer might be incorrect, LSTM for sure
|
||||
// gna looks automatically set layer 0 as output and adjust it's pointer / precision/ size respectively
|
||||
if (config.dumpXNNPath.empty()) {
|
||||
if (config.embedded_export_path.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1248,7 +1236,7 @@ void GNAPlugin::DumpXNNToFile() const {
|
||||
THROW_GNA_EXCEPTION << "Cannot generate XNNDump for not exsisting model";
|
||||
}
|
||||
|
||||
std::ofstream dumpStream(config.dumpXNNPath, std::ios::out | std::ios::binary);
|
||||
std::ofstream dumpStream(config.embedded_export_path, std::ios::out | std::ios::binary);
|
||||
|
||||
auto model = const_cast<Gna2Model*>(requestWorkerPool_->firstWorker().model());
|
||||
|
||||
@@ -1256,7 +1244,7 @@ void GNAPlugin::DumpXNNToFile() const {
|
||||
const auto& inputsDesc = inputs_ptr_->Get();
|
||||
const auto& outputsDesc = outputs_.Get();
|
||||
|
||||
if (common::kGnaTarget2_0 == gnadevice->GetCompileTarget()) {
|
||||
if (config.target->get_effective_compile_target() == common::DeviceVersion::GNAEmbedded1_0) {
|
||||
auto dump = gnadevice->dumpXnn(modelId);
|
||||
dump.header.RwRegionSize = gnamem->getRegionBytes(REGION_SCRATCH);
|
||||
dump.header.InputScalingFactor = inputsDesc.begin()->scale_factor;
|
||||
@@ -1729,6 +1717,8 @@ InferenceEngine::IExecutableNetworkInternal::Ptr GNAPlugin::ImportNetwork(std::i
|
||||
graphCompiler.memory_connection.emplace_back(make_pair(name, memoryLayer));
|
||||
}
|
||||
|
||||
// TODO update documenation to allow exporting tlv with importing cep only for sue creek
|
||||
// TODO tlv + cep import + export
|
||||
DumpXNNToFile();
|
||||
|
||||
#ifdef PLOT
|
||||
|
||||
@@ -240,7 +240,6 @@ protected:
|
||||
void FillInputsAndOutputsTranspositionInfo(const InferenceEngine::CNNNetwork& net);
|
||||
|
||||
bool isFP32ModeActive() const;
|
||||
std::string effectiveGnaCompileTarget() const;
|
||||
std::shared_ptr<request::ModelWrapper> createModelWrapperForLoadNetwork(bool trivial);
|
||||
std::shared_ptr<request::ModelWrapper> createModelWrapperForImportNetwork(uint32_t numberOfOperations);
|
||||
std::shared_ptr<request::Worker> createWorkerForLoadNetwork(bool trivial, bool fp32Mode);
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace InferenceEngine::details;
|
||||
using namespace ov::intel_gna::common;
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
using namespace common;
|
||||
|
||||
const uint8_t Config::max_num_requests;
|
||||
|
||||
@@ -46,11 +46,6 @@ static const caseless_unordered_map<std::string, std::pair<Gna2AccelerationMode,
|
||||
};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
static const std::set<std::string> supportedTargets = {common::kGnaTarget2_0,
|
||||
common::kGnaTarget3_0,
|
||||
common::kGnaTarget3_5,
|
||||
common::kGnaTargetUnspecified};
|
||||
|
||||
void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
for (auto&& item : config) {
|
||||
auto key = item.first;
|
||||
@@ -84,16 +79,13 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
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 << ")";
|
||||
}
|
||||
auto set_target = [&](const DeviceVersion& target_version) {
|
||||
if (key == GNA_CONFIG_KEY(EXEC_TARGET) || key == ov::intel_gna::execution_target) {
|
||||
gnaExecTarget = target;
|
||||
if (gnaCompileTarget == "")
|
||||
gnaCompileTarget = target;
|
||||
target->set_user_set_execution_target(target_version);
|
||||
if (target->get_user_set_compile_target() == DeviceVersion::NotSet)
|
||||
target->set_user_set_compile_target(target_version);
|
||||
} else {
|
||||
gnaCompileTarget = target;
|
||||
target->set_user_set_compile_target(target_version);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -133,7 +125,7 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
}
|
||||
inputScaleFactors[input_index] = InferenceEngine::CNNLayer::ie_parse_float(value);
|
||||
} else if (key == GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE) || key == ov::intel_gna::firmware_model_image_path) {
|
||||
dumpXNNPath = value;
|
||||
embedded_export_path = value;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION)) {
|
||||
dumpXNNGeneration = value;
|
||||
@@ -153,21 +145,17 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == ov::intel_gna::execution_target || key == ov::intel_gna::compile_target) {
|
||||
auto target = ov::util::from_string(value, ov::intel_gna::execution_target);
|
||||
std::string target_str = "";
|
||||
if (ov::intel_gna::HWGeneration::GNA_2_0 == target) {
|
||||
target_str = common::kGnaTarget2_0;
|
||||
} else if (ov::intel_gna::HWGeneration::GNA_3_0 == target) {
|
||||
target_str = common::kGnaTarget3_0;
|
||||
} else if (ov::intel_gna::HWGeneration::GNA_3_5 == target) {
|
||||
target_str = common::kGnaTarget3_5;
|
||||
}
|
||||
set_target(target_str);
|
||||
set_target(HwGenerationToDevice(target));
|
||||
} else if (key == GNA_CONFIG_KEY(EXEC_TARGET)) {
|
||||
check_compatibility(ov::intel_gna::execution_target.name());
|
||||
set_target(value);
|
||||
set_target(StringToDevice(value));
|
||||
} else if (key == GNA_CONFIG_KEY(COMPILE_TARGET)) {
|
||||
const auto target = StringToDevice(value);
|
||||
if (!embedded_export_path.empty() && !IsEmbeddedDevice(target)) {
|
||||
THROW_GNA_EXCEPTION << "Target device for embedded export should be one of embedded devices";
|
||||
}
|
||||
check_compatibility(ov::intel_gna::compile_target.name());
|
||||
set_target(value);
|
||||
set_target(target);
|
||||
} else if (key == GNA_CONFIG_KEY(COMPACT_MODE) || key == ov::intel_gna::memory_reuse) {
|
||||
if (value == PluginConfigParams::YES) {
|
||||
gnaFlags.compact_mode = true;
|
||||
@@ -303,7 +291,7 @@ void Config::AdjustKeyMapValues() {
|
||||
std::to_string(inputScaleFactors[n]);
|
||||
}
|
||||
}
|
||||
keyConfigMap[ov::intel_gna::firmware_model_image_path.name()] = dumpXNNPath;
|
||||
keyConfigMap[ov::intel_gna::firmware_model_image_path.name()] = embedded_export_path;
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
keyConfigMap[GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION)] = dumpXNNGeneration;
|
||||
IE_SUPPRESS_DEPRECATED_END
|
||||
@@ -320,8 +308,8 @@ void Config::AdjustKeyMapValues() {
|
||||
}
|
||||
IE_ASSERT(!device_mode.empty());
|
||||
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(EXEC_TARGET)] = DeviceToString(target->get_user_set_execution_target());
|
||||
keyConfigMap[GNA_CONFIG_KEY(COMPILE_TARGET)] = DeviceToString(target->get_user_set_compile_target());
|
||||
keyConfigMap[ov::intel_gna::memory_reuse.name()] =
|
||||
gnaFlags.compact_mode ? PluginConfigParams::YES : PluginConfigParams::NO;
|
||||
keyConfigMap[CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)] =
|
||||
@@ -358,19 +346,9 @@ Parameter Config::GetParameter(const std::string& name) const {
|
||||
} else if (name == ov::intel_gna::pwl_design_algorithm) {
|
||||
return gnaFlags.pwl_design_algorithm;
|
||||
} else if (name == ov::intel_gna::execution_target) {
|
||||
return ((gnaExecTarget == common::kGnaTarget2_0)
|
||||
? ov::intel_gna::HWGeneration::GNA_2_0
|
||||
: (gnaExecTarget == common::kGnaTarget3_0)
|
||||
? ov::intel_gna::HWGeneration::GNA_3_0
|
||||
: (gnaExecTarget == common::kGnaTarget3_5) ? ov::intel_gna::HWGeneration::GNA_3_5
|
||||
: ov::intel_gna::HWGeneration::UNDEFINED);
|
||||
return DeviceToHwGeneration(target->get_user_set_execution_target());
|
||||
} else if (name == ov::intel_gna::compile_target) {
|
||||
return ((gnaCompileTarget == common::kGnaTarget2_0)
|
||||
? ov::intel_gna::HWGeneration::GNA_2_0
|
||||
: (gnaCompileTarget == common::kGnaTarget3_0)
|
||||
? ov::intel_gna::HWGeneration::GNA_3_0
|
||||
: (gnaCompileTarget == common::kGnaTarget3_5) ? ov::intel_gna::HWGeneration::GNA_3_5
|
||||
: ov::intel_gna::HWGeneration::UNDEFINED);
|
||||
return DeviceToHwGeneration(target->get_user_set_compile_target());
|
||||
} else if (name == ov::hint::performance_mode) {
|
||||
return performance_mode;
|
||||
} else if (name == ov::inference_precision) {
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gna2-common-api.h>
|
||||
#include <gna2-inference-api.h>
|
||||
|
||||
#include <ie_parameter.hpp>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "common/gna_target.hpp"
|
||||
#include "descriptions/gna_flags.hpp"
|
||||
#include "gna2-inference-api.h"
|
||||
#include "ie_parameter.hpp"
|
||||
#include "ie_precision.hpp"
|
||||
#include "openvino/runtime/intel_gna/properties.hpp"
|
||||
|
||||
@@ -36,10 +35,12 @@ struct Config {
|
||||
performance_mode = r.performance_mode;
|
||||
inference_precision = r.inference_precision;
|
||||
gnaPrecision = r.gnaPrecision;
|
||||
dumpXNNPath = r.dumpXNNPath;
|
||||
embedded_export_path = r.embedded_export_path;
|
||||
dumpXNNGeneration = r.dumpXNNGeneration;
|
||||
gnaExecTarget = r.gnaExecTarget;
|
||||
gnaCompileTarget = r.gnaCompileTarget;
|
||||
target = std::make_shared<common::Target>();
|
||||
if (r.target) {
|
||||
*target = *r.target;
|
||||
}
|
||||
pluginGna2AccMode = r.pluginGna2AccMode;
|
||||
swExactMode = r.swExactMode;
|
||||
inputScaleFactorsPerInput = r.inputScaleFactorsPerInput;
|
||||
@@ -62,11 +63,10 @@ struct Config {
|
||||
ov::element::Type inference_precision = ov::element::undefined;
|
||||
InferenceEngine::Precision gnaPrecision = InferenceEngine::Precision::I16;
|
||||
|
||||
std::string dumpXNNPath;
|
||||
std::string embedded_export_path;
|
||||
std::string dumpXNNGeneration;
|
||||
|
||||
std::string gnaExecTarget;
|
||||
std::string gnaCompileTarget;
|
||||
std::shared_ptr<common::Target> target = std::make_shared<common::Target>();
|
||||
|
||||
Gna2AccelerationMode pluginGna2AccMode = Gna2AccelerationModeSoftware;
|
||||
bool swExactMode = true;
|
||||
|
||||
@@ -132,7 +132,7 @@ Parameter GNAPlugin::GetAvailableDevices() const {
|
||||
try {
|
||||
GNADeviceHelper helper;
|
||||
devices.push_back("GNA_SW");
|
||||
if (helper.hasGnaHw()) {
|
||||
if (helper.is_hw_detected()) {
|
||||
devices.push_back("GNA_HW");
|
||||
}
|
||||
} catch (...) {
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
#include "layers/gna_convolution_layer.hpp"
|
||||
#include "utils/transformation_helper.hpp"
|
||||
|
||||
using namespace ov::intel_gna::pass::helper;
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
using namespace common;
|
||||
namespace pass {
|
||||
using namespace helper;
|
||||
|
||||
struct GraphData {
|
||||
std::shared_ptr<ngraph::opset7::Transpose> leading_transpose;
|
||||
@@ -84,11 +84,11 @@ static bool VerifyMaxPool(GraphData& graph_data, std::shared_ptr<ngraph::opset7:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool GNA30SupportedConv(const std::string& gnaCompileTarget,
|
||||
static bool GNA30SupportedConv(const DeviceVersion& compile_target,
|
||||
const InferenceEngine::Precision& gnaPrecision,
|
||||
const GraphData& graph_data,
|
||||
const ConvData& conv_data) {
|
||||
const auto cnn2dValidatorPtr = limitations::cnn2d::AbstractValidator::Create(gnaCompileTarget);
|
||||
const auto cnn2dValidatorPtr = limitations::cnn2d::AbstractValidator::Create(compile_target);
|
||||
if (!cnn2dValidatorPtr) {
|
||||
return false;
|
||||
}
|
||||
@@ -561,7 +561,7 @@ static void Decompose(const GraphData& graph_data, ConvData& conv_data) {
|
||||
conv_result->set_friendly_name(conv_result_name);
|
||||
}
|
||||
|
||||
static bool Convert(const std::string& gnaCompileTarget,
|
||||
static bool Convert(const DeviceVersion& compile_target,
|
||||
const InferenceEngine::Precision& gnaPrecision,
|
||||
std::shared_ptr<ngraph::Node> leading_transpose,
|
||||
std::shared_ptr<ngraph::Node> fq_filters,
|
||||
@@ -598,7 +598,7 @@ static bool Convert(const std::string& gnaCompileTarget,
|
||||
return false;
|
||||
|
||||
// If compile target is GNA 3.0 and the convolution is supported on it, then skip decomposition
|
||||
if (GNA30SupportedConv(gnaCompileTarget, gnaPrecision, graph_data, conv_data))
|
||||
if (GNA30SupportedConv(compile_target, gnaPrecision, graph_data, conv_data))
|
||||
return false;
|
||||
|
||||
// We are looking for Transpose(NHWC->NCHW) => Conv => Transpose(NCHW->NHWC)
|
||||
@@ -618,7 +618,7 @@ static bool Convert(const std::string& gnaCompileTarget,
|
||||
return true;
|
||||
}
|
||||
|
||||
Decompose2DConv::Decompose2DConv(const std::string& gnaCompileTarget, const InferenceEngine::Precision& gnaPrecision) {
|
||||
Decompose2DConv::Decompose2DConv(const DeviceVersion& compile_target, const InferenceEngine::Precision& gnaPrecision) {
|
||||
MATCHER_SCOPE(Decompose2DConv);
|
||||
|
||||
auto const_input = ngraph::pattern::wrap_type<ngraph::opset7::Constant>();
|
||||
@@ -735,7 +735,7 @@ Decompose2DConv::Decompose2DConv(const std::string& gnaCompileTarget, const Infe
|
||||
}
|
||||
}
|
||||
|
||||
return Convert(gnaCompileTarget,
|
||||
return Convert(compile_target,
|
||||
gnaPrecision,
|
||||
pattern_map.at(leading_transpose).get_node_shared_ptr(),
|
||||
fq_filters_node,
|
||||
@@ -755,7 +755,7 @@ Decompose2DConv::Decompose2DConv(const std::string& gnaCompileTarget, const Infe
|
||||
this->register_matcher(m, callback);
|
||||
}
|
||||
|
||||
Decompose2DConvTransposedWithBias::Decompose2DConvTransposedWithBias(const std::string& gnaCompileTarget,
|
||||
Decompose2DConvTransposedWithBias::Decompose2DConvTransposedWithBias(const DeviceVersion& compile_target,
|
||||
const InferenceEngine::Precision& gnaPrecision) {
|
||||
MATCHER_SCOPE(Decompose2DConvTransposedWithBias);
|
||||
|
||||
@@ -781,7 +781,7 @@ Decompose2DConvTransposedWithBias::Decompose2DConvTransposedWithBias(const std::
|
||||
pattern_map.at(bias).get_node_shared_ptr())))
|
||||
return false;
|
||||
|
||||
return Convert(gnaCompileTarget,
|
||||
return Convert(compile_target,
|
||||
gnaPrecision,
|
||||
pattern_map.at(leading_transpose).get_node_shared_ptr(),
|
||||
nullptr,
|
||||
@@ -802,7 +802,7 @@ Decompose2DConvTransposedWithBias::Decompose2DConvTransposedWithBias(const std::
|
||||
}
|
||||
|
||||
Decompose2DConvTransposedWithBiasAF::Decompose2DConvTransposedWithBiasAF(
|
||||
const std::string& gnaCompileTarget,
|
||||
const DeviceVersion& compile_target,
|
||||
const InferenceEngine::Precision& gnaPrecision) {
|
||||
MATCHER_SCOPE(Decompose2DConvTransposedWithBiasAF);
|
||||
|
||||
@@ -836,7 +836,7 @@ Decompose2DConvTransposedWithBiasAF::Decompose2DConvTransposedWithBiasAF(
|
||||
pattern_map.at(bias).get_node_shared_ptr())))
|
||||
return false;
|
||||
|
||||
return Convert(gnaCompileTarget,
|
||||
return Convert(compile_target,
|
||||
gnaPrecision,
|
||||
pattern_map.at(leading_transpose).get_node_shared_ptr(),
|
||||
nullptr,
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <ie_precision.hpp>
|
||||
#include <ngraph/pass/graph_rewrite.hpp>
|
||||
|
||||
#include "common/gna_target.hpp"
|
||||
#include "ngraph/pass/graph_rewrite.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace intel_gna {
|
||||
@@ -33,7 +35,7 @@ namespace pass {
|
||||
class Decompose2DConv : public ngraph::pass::MatcherPass {
|
||||
public:
|
||||
OPENVINO_RTTI("Decompose2DConv", "0");
|
||||
Decompose2DConv(const std::string& gnaCompileTarget, const InferenceEngine::Precision& gnaPrecision);
|
||||
Decompose2DConv(const common::DeviceVersion& compile_target, const InferenceEngine::Precision& gnaPrecision);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -54,7 +56,7 @@ public:
|
||||
class Decompose2DConvTransposedWithBias : public ngraph::pass::MatcherPass {
|
||||
public:
|
||||
OPENVINO_RTTI("Decompose2DConvTransposedWithBias", "0");
|
||||
Decompose2DConvTransposedWithBias(const std::string& gnaCompileTarget,
|
||||
Decompose2DConvTransposedWithBias(const common::DeviceVersion& compile_target,
|
||||
const InferenceEngine::Precision& gnaPrecision);
|
||||
};
|
||||
|
||||
@@ -78,7 +80,7 @@ public:
|
||||
class Decompose2DConvTransposedWithBiasAF : public ngraph::pass::MatcherPass {
|
||||
public:
|
||||
OPENVINO_RTTI("Decompose2DConvTransposedWithBiasAF", "0");
|
||||
Decompose2DConvTransposedWithBiasAF(const std::string& gnaCompileTarget,
|
||||
Decompose2DConvTransposedWithBiasAF(const common::DeviceVersion& compile_target,
|
||||
const InferenceEngine::Precision& gnaPrecision);
|
||||
};
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ GNA2_API enum Gna2Status Gna2DeviceGetVersion(
|
||||
if (current != nullptr) {
|
||||
return current->Gna2DeviceGetVersion(deviceIndex,deviceVersion);
|
||||
}
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ void GNAPropagateMatcher :: match() {
|
||||
|
||||
EXPECT_CALL(mockApi, Gna2DeviceGetVersion(_,_))
|
||||
.WillOnce(Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
|
||||
@@ -491,7 +491,7 @@ void GNAPluginAOTMatcher :: match() {
|
||||
EXPECT_CALL(mockApi, Gna2DeviceGetVersion(_,_)).WillOnce(Invoke([](
|
||||
uint32_t deviceIndex,
|
||||
enum Gna2DeviceVersion * deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
|
||||
@@ -578,7 +578,7 @@ void GNADumpXNNMatcher::match() {
|
||||
EXPECT_CALL(mockApi, Gna2DeviceGetVersion(_,_)).WillOnce(Invoke([](
|
||||
uint32_t deviceIndex,
|
||||
enum Gna2DeviceVersion * deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
|
||||
@@ -693,7 +693,7 @@ void GNAQueryStateMatcher :: match() {
|
||||
EXPECT_CALL(mockApi, Gna2DeviceGetVersion(_,_)).WillOnce(Invoke([](
|
||||
uint32_t deviceIndex,
|
||||
enum Gna2DeviceVersion * deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
#include "common/gna_target.hpp"
|
||||
|
||||
using namespace ov::intel_gna::limitations;
|
||||
using ov::intel_gna::common::kGnaTarget3_0;
|
||||
using ov::intel_gna::common::kGnaTarget3_5;
|
||||
using namespace ov::intel_gna::common;
|
||||
|
||||
struct GNACnn2DValidatorTestParam {
|
||||
std::string target;
|
||||
DeviceVersion target;
|
||||
std::string whatInvalid;
|
||||
std::vector<uint32_t> invalid;
|
||||
};
|
||||
@@ -51,167 +50,167 @@ const std::vector<uint32_t> kInvaliddW_30 = {0, 2, 400};
|
||||
const std::vector<uint32_t> kInvaliddW_35 = {0, 2, 2049};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"inH",
|
||||
kInvalidH_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"inH",
|
||||
kInvalidH_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_inW{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"inW",
|
||||
kInvalidW_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_inW{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"inW",
|
||||
kInvalidW_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_inC{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"inC",
|
||||
kInvalidC_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_inC{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"inC",
|
||||
kInvalidC_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_kH{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"kH",
|
||||
kInvalidkH_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_kH{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"kH",
|
||||
kInvalidkH_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_kW{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"kW",
|
||||
kInvalidkW_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_kW{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"kW",
|
||||
kInvalidkW_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_kN{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"inC",
|
||||
kInvalidkN_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_kN{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"inC",
|
||||
kInvalidkN_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_sH{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"sH",
|
||||
kInvalidsH_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_sH{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"sH",
|
||||
kInvalidsH_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_sW{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"sW",
|
||||
kInvalidsW_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_sW{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"sW",
|
||||
kInvalidsW_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_dH{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"dH",
|
||||
kInvaliddH_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_dH{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"dH",
|
||||
kInvaliddH_35,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_30_dW{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"dW",
|
||||
kInvaliddW_30,
|
||||
};
|
||||
|
||||
const GNACnn2DValidatorTestParam target_35_dW{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"dW",
|
||||
kInvaliddW_35,
|
||||
};
|
||||
|
||||
const std::vector<uint32_t> kInvalidpw_30 = {0, 2, 10};
|
||||
const GNACnn2DValidatorTestParam target_30_pwH{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"windowH",
|
||||
kInvalidpw_30,
|
||||
};
|
||||
const GNACnn2DValidatorTestParam target_30_pwW{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"windowW",
|
||||
kInvalidpw_30,
|
||||
};
|
||||
|
||||
const std::vector<uint32_t> kInvalidps_30 = {0, 4, 10};
|
||||
const GNACnn2DValidatorTestParam target_30_psH{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"strideH",
|
||||
kInvalidps_30,
|
||||
};
|
||||
const GNACnn2DValidatorTestParam target_30_psW{
|
||||
kGnaTarget3_0,
|
||||
DeviceVersion::GNA3_0,
|
||||
"strideW",
|
||||
kInvalidps_30,
|
||||
};
|
||||
|
||||
const std::vector<uint32_t> kInvalidPoolingRange35 = {0, 256};
|
||||
const GNACnn2DValidatorTestParam target_35_pwH{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"windowH",
|
||||
kInvalidPoolingRange35,
|
||||
};
|
||||
const GNACnn2DValidatorTestParam target_35_pwW{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"windowW",
|
||||
kInvalidPoolingRange35,
|
||||
};
|
||||
const GNACnn2DValidatorTestParam target_35_psH{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"strideH",
|
||||
kInvalidPoolingRange35,
|
||||
};
|
||||
const GNACnn2DValidatorTestParam target_35_psW{
|
||||
kGnaTarget3_5,
|
||||
DeviceVersion::GNA3_5,
|
||||
"strideW",
|
||||
kInvalidPoolingRange35,
|
||||
};
|
||||
@@ -292,7 +291,7 @@ protected:
|
||||
class GNAcnn2dValidatorTestPadding : public GNAcnn2dValidatorTest {
|
||||
protected:
|
||||
bool isPaddingSupported() {
|
||||
static const std::set<std::string> supported{kGnaTarget3_5};
|
||||
static const std::set<DeviceVersion> supported{DeviceVersion::GNA3_5};
|
||||
return supported.count(GetParam().target);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ GNA2_API enum Gna2Status Gna2DeviceGetVersion(uint32_t deviceIndex, enum Gna2Dev
|
||||
if (current != nullptr) {
|
||||
return current->Gna2DeviceGetVersion(deviceIndex, deviceVersion);
|
||||
}
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ protected:
|
||||
|
||||
EXPECT_CALL(*mockApi, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ protected:
|
||||
|
||||
EXPECT_CALL(*_mock_api, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersionSoftwareEmulation;
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class GnaMockApiInitializer {
|
||||
GNACppApi _mock_api;
|
||||
std::vector<std::vector<uint8_t>> _mocked_gna_memory;
|
||||
Gna2DeviceVersion _gna_device_version = Gna2DeviceVersionSoftwareEmulation;
|
||||
Gna2DeviceVersion _gna_device_version = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
bool _create_model = true;
|
||||
|
||||
public:
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
using namespace InferenceEngine;
|
||||
using namespace ov::intel_gna;
|
||||
using namespace ov::intel_gna::common;
|
||||
|
||||
IE_SUPPRESS_DEPRECATED_START
|
||||
const std::map<std::string, std::string> supportedConfigKeysWithDefaults = {
|
||||
@@ -96,11 +97,6 @@ TEST_F(GNAPluginConfigTest, GnaConfigScaleFactorTest) {
|
||||
ExpectThrow(GNA_CONFIG_KEY(SCALE_FACTOR), std::string("0"));
|
||||
}
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigFirmwareModelImageTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE), "abc");
|
||||
EXPECT_EQ(config.dumpXNNPath, "abc");
|
||||
}
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigDeviceModeTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_HW);
|
||||
EXPECT_EQ(config.pluginGna2AccMode, Gna2AccelerationModeHardware);
|
||||
@@ -188,14 +184,14 @@ IE_SUPPRESS_DEPRECATED_END
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigGnaExecTargetTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_2_0");
|
||||
EXPECT_EQ(config.gnaExecTarget, "GNA_TARGET_2_0");
|
||||
EXPECT_EQ(config.target->get_user_set_execution_target(), DeviceVersion::GNA2_0);
|
||||
SetAndCompare(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_3_0");
|
||||
EXPECT_EQ(config.gnaExecTarget, "GNA_TARGET_3_0");
|
||||
EXPECT_EQ(config.target->get_user_set_execution_target(), DeviceVersion::GNA3_0);
|
||||
|
||||
ExpectThrow(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_3_7");
|
||||
|
||||
SetAndCompare(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_3_5");
|
||||
EXPECT_EQ(config.gnaExecTarget, "GNA_TARGET_3_5");
|
||||
EXPECT_EQ(config.target->get_user_set_execution_target(), DeviceVersion::GNA3_5);
|
||||
|
||||
ExpectThrow(GNA_CONFIG_KEY(EXEC_TARGET), "0");
|
||||
ExpectThrow(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_1_5");
|
||||
@@ -204,14 +200,14 @@ TEST_F(GNAPluginConfigTest, GnaConfigGnaExecTargetTest) {
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigGnaCompileTargetTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(COMPILE_TARGET), "GNA_TARGET_2_0");
|
||||
EXPECT_EQ(config.gnaCompileTarget, "GNA_TARGET_2_0");
|
||||
EXPECT_EQ(config.target->get_user_set_compile_target(), DeviceVersion::GNA2_0);
|
||||
SetAndCompare(GNA_CONFIG_KEY(COMPILE_TARGET), "GNA_TARGET_3_0");
|
||||
EXPECT_EQ(config.gnaCompileTarget, "GNA_TARGET_3_0");
|
||||
EXPECT_EQ(config.target->get_user_set_compile_target(), DeviceVersion::GNA3_0);
|
||||
|
||||
ExpectThrow(GNA_CONFIG_KEY(COMPILE_TARGET), "GNA_TARGET_3_7");
|
||||
|
||||
SetAndCompare(GNA_CONFIG_KEY(COMPILE_TARGET), "GNA_TARGET_3_5");
|
||||
EXPECT_EQ(config.gnaCompileTarget, "GNA_TARGET_3_5");
|
||||
EXPECT_EQ(config.target->get_user_set_compile_target(), DeviceVersion::GNA3_5);
|
||||
|
||||
ExpectThrow(GNA_CONFIG_KEY(COMPILE_TARGET), "0");
|
||||
ExpectThrow(GNA_CONFIG_KEY(COMPILE_TARGET), "GNA_TARGET_1_5");
|
||||
|
||||
@@ -25,10 +25,10 @@ typedef struct {
|
||||
bool load_succesfull;
|
||||
} ConvModelTestParams;
|
||||
|
||||
std::vector<ConvModelTestParams> all_tests{{models[0], Gna2DeviceVersion3_0, false},
|
||||
{models[1], Gna2DeviceVersion3_0, false},
|
||||
{models[0], Gna2DeviceVersion3_5, true},
|
||||
{models[1], Gna2DeviceVersion3_5, true}};
|
||||
std::vector<ConvModelTestParams> all_tests{{models[0], Gna2DeviceVersion::Gna2DeviceVersion3_0, false},
|
||||
{models[1], Gna2DeviceVersion::Gna2DeviceVersion3_0, false},
|
||||
{models[0], Gna2DeviceVersion::Gna2DeviceVersion3_5, true},
|
||||
{models[1], Gna2DeviceVersion::Gna2DeviceVersion3_5, true}};
|
||||
|
||||
class GNAPluginLoadNetworkTest : public ::testing::Test, public ::testing::WithParamInterface<ConvModelTestParams> {
|
||||
std::shared_ptr<ngraph::Function> function;
|
||||
|
||||
@@ -82,6 +82,11 @@ public:
|
||||
|
||||
TEST_F(GNAWaitTest, ReturnsGna2StatusDriverQoSTimeoutExceeded) {
|
||||
GNACppApi enableMocks;
|
||||
EXPECT_CALL(enableMocks, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(testing::Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
EXPECT_CALL(enableMocks, Gna2RequestWait(_, _)).Times(1).WillOnce(Return(Gna2StatusDriverQoSTimeoutExceeded));
|
||||
auto plugin = std::make_shared<GNAPluginForGNAWaitTest>();
|
||||
GNAInferRequestForGNAWaitTest inferRequest{plugin};
|
||||
@@ -91,6 +96,11 @@ TEST_F(GNAWaitTest, ReturnsGna2StatusDriverQoSTimeoutExceeded) {
|
||||
|
||||
TEST_F(GNAWaitTest, ReturnsGna2StatusWarningDeviceBusy) {
|
||||
GNACppApi enableMocks;
|
||||
EXPECT_CALL(enableMocks, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(testing::Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
EXPECT_CALL(enableMocks, Gna2RequestWait(_, _)).Times(1).WillOnce(Return(Gna2StatusWarningDeviceBusy));
|
||||
auto plugin = std::make_shared<GNAPluginForGNAWaitTest>();
|
||||
GNAInferRequestForGNAWaitTest inferRequest{plugin};
|
||||
@@ -100,6 +110,11 @@ TEST_F(GNAWaitTest, ReturnsGna2StatusWarningDeviceBusy) {
|
||||
|
||||
TEST_F(GNAWaitTest, ReturnsGna2StatusDeviceParameterOutOfRange) {
|
||||
GNACppApi enableMocks;
|
||||
EXPECT_CALL(enableMocks, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(testing::Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
EXPECT_CALL(enableMocks, Gna2RequestWait(_, _)).Times(1).WillOnce(Return(Gna2StatusDeviceParameterOutOfRange));
|
||||
auto plugin = std::make_shared<GNAPluginForGNAWaitTest>();
|
||||
GNAInferRequestForGNAWaitTest inferRequest{plugin};
|
||||
@@ -109,6 +124,11 @@ TEST_F(GNAWaitTest, ReturnsGna2StatusDeviceParameterOutOfRange) {
|
||||
|
||||
TEST_F(GNAWaitTest, ReturnsGna2StatusDeviceParameterOutOfRange_Extra_Sync) {
|
||||
GNACppApi enableMocks;
|
||||
EXPECT_CALL(enableMocks, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(testing::Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
EXPECT_CALL(enableMocks, Gna2RequestWait(_, _)).Times(1).WillOnce(Return(Gna2StatusDeviceParameterOutOfRange));
|
||||
auto plugin = std::make_shared<GNAPluginForGNAWaitTest>();
|
||||
GNAInferRequestForGNAWaitTest inferRequest{plugin};
|
||||
@@ -120,6 +140,11 @@ TEST_F(GNAWaitTest, ReturnsGna2StatusDeviceParameterOutOfRange_Extra_Sync) {
|
||||
|
||||
TEST_F(GNAWaitTest, ReturnsGna2StatusDeviceParameterOutOfRange_Another_Use) {
|
||||
GNACppApi enableMocks;
|
||||
EXPECT_CALL(enableMocks, Gna2DeviceGetVersion(_, _))
|
||||
.WillOnce(testing::Invoke([](uint32_t deviceIndex, enum Gna2DeviceVersion* deviceVersion) {
|
||||
*deviceVersion = Gna2DeviceVersion::Gna2DeviceVersionSoftwareEmulation;
|
||||
return Gna2StatusSuccess;
|
||||
}));
|
||||
EXPECT_CALL(enableMocks, Gna2RequestWait(_, _)).Times(1).WillOnce(Return(Gna2StatusDeviceParameterOutOfRange));
|
||||
auto plugin = std::make_shared<GNAPluginForGNAWaitTest>();
|
||||
GNAInferRequestForGNAWaitTest inferRequest{plugin};
|
||||
|
||||
@@ -884,13 +884,18 @@ void execute_test(modelType model,
|
||||
case modelType::TranspConvBcastAddMaxPoolTransp:
|
||||
case modelType::TranspConvBcastAddActTransp:
|
||||
case modelType::TranspConvBcastAddMaxPoolActTransp:
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConv>("", gnaPrecision);
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConv>(ov::intel_gna::common::DeviceVersion::Default,
|
||||
gnaPrecision);
|
||||
break;
|
||||
case modelType::TranspConvTranspBcastAdd:
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBias>("", gnaPrecision);
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBias>(
|
||||
ov::intel_gna::common::DeviceVersion::Default,
|
||||
gnaPrecision);
|
||||
break;
|
||||
case modelType::TranspConvTranspBcastAddAct:
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBiasAF>("", gnaPrecision);
|
||||
manager.register_pass<ov::intel_gna::pass::Decompose2DConvTransposedWithBiasAF>(
|
||||
ov::intel_gna::common::DeviceVersion::Default,
|
||||
gnaPrecision);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user