[GNA] Fix for GeminiLake detection (#18653)
* [GNA] Fix for GeminiLake detection * Added HWGeneration::GNA_1_0_E enumerator Added DeviceVersion::GNAEmbedded1_0 enumerator, changed the meaning of DeviceVersion::GNA1_0. Updated ConvLowPrecision test with all supported targets * [GNA] Extended a few tests with GNA1.0
This commit is contained in:
parent
c4f8afb741
commit
e1ec17013d
|
|
@ -223,6 +223,7 @@ int main(int argc, char* argv[]) {
|
|||
gnaPluginConfig[ov::hint::inference_precision.name()] = (FLAGS_qb == 8) ? ov::element::i8 : ov::element::i16;
|
||||
const std::unordered_map<std::string, ov::intel_gna::HWGeneration> StringHWGenerationMap{
|
||||
{"GNA_TARGET_1_0", ov::intel_gna::HWGeneration::GNA_1_0},
|
||||
{"GNA_TARGET_1_0_E", ov::intel_gna::HWGeneration::GNA_1_0_E},
|
||||
{"GNA_TARGET_2_0", ov::intel_gna::HWGeneration::GNA_2_0},
|
||||
{"GNA_TARGET_3_0", ov::intel_gna::HWGeneration::GNA_3_0},
|
||||
{"GNA_TARGET_3_1", ov::intel_gna::HWGeneration::GNA_3_1},
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ inline std::istream& operator>>(std::istream& is, ExecutionMode& execution_mode)
|
|||
enum class HWGeneration {
|
||||
UNDEFINED = 0, //!< GNA HW generation is undefined
|
||||
GNA_1_0 = 4, //!< GNA HW generation 1.0
|
||||
GNA_1_0_E = 9, //!< GNA HW generation 1.0 embedded
|
||||
GNA_2_0 = 1, //!< GNA HW generation 2.0
|
||||
GNA_3_0 = 2, //!< GNA HW generation 3.0
|
||||
GNA_3_1 = 5, //!< GNA HW generation 3.1
|
||||
|
|
@ -134,6 +135,8 @@ inline std::ostream& operator<<(std::ostream& os, const HWGeneration& hw_generat
|
|||
return os << "UNDEFINED";
|
||||
case HWGeneration::GNA_1_0:
|
||||
return os << "GNA_1_0";
|
||||
case HWGeneration::GNA_1_0_E:
|
||||
return os << "GNA_1_0_E";
|
||||
case HWGeneration::GNA_2_0:
|
||||
return os << "GNA_2_0";
|
||||
case HWGeneration::GNA_3_0:
|
||||
|
|
@ -160,6 +163,8 @@ inline std::istream& operator>>(std::istream& is, HWGeneration& hw_generation) {
|
|||
hw_generation = HWGeneration::UNDEFINED;
|
||||
} else if (str == "GNA_1_0") {
|
||||
hw_generation = HWGeneration::GNA_1_0;
|
||||
} else if (str == "GNA_1_0_E") {
|
||||
hw_generation = HWGeneration::GNA_1_0_E;
|
||||
} else if (str == "GNA_2_0") {
|
||||
hw_generation = HWGeneration::GNA_2_0;
|
||||
} else if (str == "GNA_3_0") {
|
||||
|
|
|
|||
|
|
@ -680,8 +680,9 @@ constexpr uint32_t Limitations::kMemoryPageSize;
|
|||
thread_local std::shared_ptr<Limitations> Limitations::k_instance{nullptr};
|
||||
|
||||
Limitations::Limitations(const DeviceVersion& target) {
|
||||
m_use_only_16bit_conv_weights = (target == DeviceVersion::GNA1_0 || target == DeviceVersion::GNA2_0 ||
|
||||
target == DeviceVersion::GNA3_0 || target == DeviceVersion::GNA3_1);
|
||||
m_use_only_16bit_conv_weights =
|
||||
(target == DeviceVersion::GNA1_0 || target == DeviceVersion::GNAEmbedded1_0 ||
|
||||
target == DeviceVersion::GNA2_0 || target == DeviceVersion::GNA3_0 || target == DeviceVersion::GNA3_1);
|
||||
|
||||
m_mem_alignment = get_memory_alignment_bytes(target);
|
||||
m_cnn_validator = cnn2d::AbstractValidator::Create(target);
|
||||
|
|
@ -698,6 +699,7 @@ size_t Limitations::get_min_batch_to_fit_in_buffer(InferenceEngine::DataPtr inpu
|
|||
|
||||
size_t Limitations::get_memory_alignment_bytes(const DeviceVersion& target) const {
|
||||
static const std::unordered_map<DeviceVersion, size_t> mem_alignment_map{{DeviceVersion::GNA1_0, 64},
|
||||
{DeviceVersion::GNAEmbedded1_0, 64},
|
||||
{DeviceVersion::GNA2_0, 64},
|
||||
{DeviceVersion::GNA3_0, 64},
|
||||
{DeviceVersion::GNA3_1, 64},
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace target {
|
|||
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* kGnaTarget1_0_e = "GNA_TARGET_1_0_E";
|
||||
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";
|
||||
|
|
@ -28,6 +29,7 @@ static constexpr const char* kGnaTarget4_0 = "GNA_TARGET_4_0";
|
|||
|
||||
static const std::unordered_map<HWGeneration, DeviceVersion> HWGenerationDeviceMap{
|
||||
{HWGeneration::GNA_1_0, DeviceVersion::GNA1_0},
|
||||
{HWGeneration::GNA_1_0_E, DeviceVersion::GNAEmbedded1_0},
|
||||
{HWGeneration::GNA_2_0, DeviceVersion::GNA2_0},
|
||||
{HWGeneration::GNA_3_0, DeviceVersion::GNA3_0},
|
||||
{HWGeneration::GNA_3_1, DeviceVersion::GNA3_1},
|
||||
|
|
@ -38,7 +40,8 @@ static const std::unordered_map<HWGeneration, DeviceVersion> HWGenerationDeviceM
|
|||
{HWGeneration::UNDEFINED, DeviceVersion::NotSet}};
|
||||
|
||||
static const std::unordered_map<Gna2DeviceVersion, DeviceVersion> GnaDeviceMap{
|
||||
{Gna2DeviceVersionEmbedded1_0, DeviceVersion::GNA1_0},
|
||||
{Gna2DeviceVersion1_0, DeviceVersion::GNA1_0},
|
||||
{Gna2DeviceVersionEmbedded1_0, DeviceVersion::GNAEmbedded1_0},
|
||||
{Gna2DeviceVersion2_0, DeviceVersion::GNA2_0},
|
||||
{Gna2DeviceVersion3_0, DeviceVersion::GNA3_0},
|
||||
{Gna2DeviceVersionEmbedded3_1, DeviceVersion::GNA3_1},
|
||||
|
|
@ -50,6 +53,7 @@ static const std::unordered_map<Gna2DeviceVersion, DeviceVersion> GnaDeviceMap{
|
|||
|
||||
static const std::unordered_map<std::string, DeviceVersion> StringDeviceMap{
|
||||
{kGnaTarget1_0, DeviceVersion::GNA1_0},
|
||||
{kGnaTarget1_0_e, DeviceVersion::GNAEmbedded1_0},
|
||||
{kGnaTarget2_0, DeviceVersion::GNA2_0},
|
||||
{kGnaTarget3_0, DeviceVersion::GNA3_0},
|
||||
{kGnaTarget3_1, DeviceVersion::GNA3_1},
|
||||
|
|
@ -60,7 +64,7 @@ static const std::unordered_map<std::string, DeviceVersion> StringDeviceMap{
|
|||
{kGnaTargetSoftwareEmulation, DeviceVersion::SoftwareEmulation},
|
||||
{kGnaTargetUnspecified, DeviceVersion::NotSet}};
|
||||
|
||||
static const std::vector<DeviceVersion> EmbeddedDevices{DeviceVersion::GNA1_0,
|
||||
static const std::vector<DeviceVersion> EmbeddedDevices{DeviceVersion::GNAEmbedded1_0,
|
||||
DeviceVersion::GNA3_1,
|
||||
DeviceVersion::GNAEmbedded3_5,
|
||||
DeviceVersion::GNA3_6,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ namespace target {
|
|||
enum class DeviceVersion {
|
||||
NotSet = -1,
|
||||
SoftwareEmulation = 0,
|
||||
GNA1_0 = 0x10e,
|
||||
GNA1_0 = 0x10,
|
||||
GNAEmbedded1_0 = 0x10e,
|
||||
GNA2_0 = 0x20,
|
||||
GNA3_0 = 0x30,
|
||||
GNA3_1 = 0x31e,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ void ExportTlvModel(uint32_t modelId,
|
|||
const std::vector<GnaEndpoint>& allInputs,
|
||||
const std::vector<GnaEndpoint>& allOutputs,
|
||||
const GnaAllocations& allAllocations) {
|
||||
if (compile_target == target::DeviceVersion::GNA1_0) {
|
||||
if (compile_target == target::DeviceVersion::GNAEmbedded1_0) {
|
||||
THROW_GNA_EXCEPTION << "Unsupported compile target for TLV export: GNA Embedded 1.0" << std::endl;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ void* ExportSueLegacyUsingGnaApi2(uint32_t modelId, uint32_t deviceIndex, Gna2Mo
|
|||
|
||||
status = Gna2ModelExportConfigSetSource(exportConfig, deviceIndex, modelId);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetSource");
|
||||
status = Gna2ModelExportConfigSetTarget(exportConfig, DeviceToGna(target::DeviceVersion::GNA1_0));
|
||||
status = Gna2ModelExportConfigSetTarget(exportConfig, DeviceToGna(target::DeviceVersion::GNAEmbedded1_0));
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2ModelExportConfigSetTarget");
|
||||
|
||||
void* bufferSueCreekHeader = nullptr;
|
||||
|
|
|
|||
|
|
@ -571,6 +571,7 @@ uint32_t GNADeviceHelper::retrieveMaxLayersCount() {
|
|||
|
||||
switch (target->get_effective_execution_target()) {
|
||||
case DeviceVersion::GNA1_0:
|
||||
case DeviceVersion::GNAEmbedded1_0:
|
||||
case DeviceVersion::GNA2_0:
|
||||
return Limitations::kMaxLayersCountGNA2_0;
|
||||
case DeviceVersion::GNA3_0:
|
||||
|
|
|
|||
|
|
@ -172,7 +172,14 @@ private:
|
|||
static void enforceLegacyCnns(Gna2Model& gnaModel);
|
||||
static void enforceLegacyCnnsWhenNeeded(Gna2Model& gnaModel);
|
||||
static bool is_up_to_20_hw(const target::DeviceVersion device_version) {
|
||||
return device_version <= target::DeviceVersion::GNA2_0 && is_hw_target(device_version);
|
||||
switch (device_version) {
|
||||
case target::DeviceVersion::GNA1_0:
|
||||
case target::DeviceVersion::GNAEmbedded1_0:
|
||||
case target::DeviceVersion::GNA2_0:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void createVirtualDevice(const target::DeviceVersion& devVersion);
|
||||
void updateGnaDeviceVersion();
|
||||
|
|
|
|||
|
|
@ -780,7 +780,7 @@ void GNAPlugin::DumpXNNToFile() const {
|
|||
const auto& inputsDesc = inputs_ptr_->Get();
|
||||
const auto& outputsDesc = outputs_.Get();
|
||||
|
||||
if (config.target->get_effective_compile_target() == target::DeviceVersion::GNA1_0) {
|
||||
if (config.target->get_effective_compile_target() == target::DeviceVersion::GNAEmbedded1_0) {
|
||||
auto dump = gnadevice->dumpXnn(modelId);
|
||||
dump.header.RwRegionSize = static_cast<uint32_t>(gnamem->getRegionBytes(REGION_SCRATCH));
|
||||
dump.header.InputScalingFactor = inputsDesc.begin()->scale_factor;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ RequestStatus SubrequestImpl::wait(int64_t timeoutMilliseconds) {
|
|||
try {
|
||||
status_ = waitHandler_(requestID_, timeoutMilliseconds);
|
||||
} catch (const std::exception& e) {
|
||||
ov::intel_gna::log::error() << "Exception when executiong wait: " << e.what() << std::endl;
|
||||
ov::intel_gna::log::error() << "Exception when execution wait: " << e.what() << std::endl;
|
||||
status_ = RequestStatus::kCompletedWithError;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ TEST_P(TransposesConcatTest, CompareWithRefs) {
|
|||
std::vector<std::map<std::string, std::string>> configs = {{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}}};
|
||||
|
||||
std::vector<std::map<std::string, std::string>> target_configs = {{{"GNA_DEVICE_MODE", "GNA_SW_FP32"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_1_0"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}}};
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ const std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::
|
|||
InferenceEngine::Precision::FP16};
|
||||
|
||||
const std::vector<std::map<std::string, std::string>> configs1D = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "1"}, {"GNA_EXEC_TARGET", "GNA_TARGET_1_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "1"}, {"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "1"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_SCALE_FACTOR_0", "1"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}}};
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ TEST_P(PrePostProcessBaseTest, CompareWithRefs) {
|
|||
std::vector<std::map<std::string, std::string>> configs = {{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}}};
|
||||
|
||||
std::vector<std::map<std::string, std::string>> target_configs = {{{"GNA_DEVICE_MODE", "GNA_SW_FP32"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_1_0"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}}};
|
||||
|
|
|
|||
|
|
@ -17,15 +17,16 @@
|
|||
#include "ngraph_functions/builders.hpp"
|
||||
#include "ngraph_functions/pass/convert_prc.hpp"
|
||||
#include "ngraph_functions/utils/ngraph_helpers.hpp"
|
||||
#include "openvino/opsets/opset12.hpp"
|
||||
#include "shared_test_classes/base/layer_test_utils.hpp"
|
||||
|
||||
namespace ConvLowPrecicionTestNs {
|
||||
|
||||
using namespace ngraph;
|
||||
using namespace ov;
|
||||
using namespace ngraph::builder;
|
||||
using namespace ngraph::element;
|
||||
using namespace ngraph::op;
|
||||
using namespace ngraph::opset1;
|
||||
using namespace ov::element;
|
||||
using namespace ov::op;
|
||||
using namespace ov::opset12;
|
||||
using namespace std;
|
||||
|
||||
using ConvLowPrecisionTestParams = tuple<InferenceEngine::Precision, // Network Precision
|
||||
|
|
@ -128,15 +129,21 @@ TEST_P(ConvLowPrecisionTest, CompareWithRefs) {
|
|||
const vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::Precision::FP16,
|
||||
InferenceEngine::Precision::FP32};
|
||||
|
||||
const vector<map<string, string>> configs_3_X = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}}};
|
||||
const vector<map<string, string>> configs_1 = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_1_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_1_0"}},
|
||||
};
|
||||
|
||||
const vector<map<string, string>> configs_2_0 = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
const vector<map<string, string>> configs_2 = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_2_0"}},
|
||||
};
|
||||
|
||||
const vector<map<string, string>> configs_3 = {
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_0"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I8"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}},
|
||||
{{"GNA_DEVICE_MODE", "GNA_AUTO"}, {"GNA_PRECISION", "I16"}, {"GNA_EXEC_TARGET", "GNA_TARGET_3_5"}},
|
||||
};
|
||||
|
||||
const Shape conv1D = {1, 8, 1, 16};
|
||||
|
|
@ -148,11 +155,21 @@ const vector<pair<float, float>> fqMinMax = {{-1.0f, 1.0f}};
|
|||
|
||||
const vector<std::size_t> levels = {numeric_limits<uint8_t>::max(), numeric_limits<uint16_t>::max()};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_LowPrecision10,
|
||||
ConvLowPrecisionTest,
|
||||
::testing::Combine(::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(ov::test::utils::DEVICE_GNA),
|
||||
::testing::ValuesIn(configs_1),
|
||||
::testing::Values(conv1D),
|
||||
::testing::ValuesIn(fqMinMax),
|
||||
::testing::ValuesIn(levels)),
|
||||
ConvLowPrecisionTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_LowPrecision20,
|
||||
ConvLowPrecisionTest,
|
||||
::testing::Combine(::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(ov::test::utils::DEVICE_GNA),
|
||||
::testing::ValuesIn(configs_2_0),
|
||||
::testing::ValuesIn(configs_2),
|
||||
::testing::Values(conv1D),
|
||||
::testing::ValuesIn(fqMinMax),
|
||||
::testing::ValuesIn(levels)),
|
||||
|
|
@ -162,7 +179,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_LowPrecision3X,
|
|||
ConvLowPrecisionTest,
|
||||
::testing::Combine(::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(ov::test::utils::DEVICE_GNA),
|
||||
::testing::ValuesIn(configs_3_X),
|
||||
::testing::ValuesIn(configs_3),
|
||||
::testing::ValuesIn(inputShapes),
|
||||
::testing::ValuesIn(fqMinMax),
|
||||
::testing::ValuesIn(levels)),
|
||||
|
|
|
|||
|
|
@ -184,6 +184,9 @@ IE_SUPPRESS_DEPRECATED_END
|
|||
TEST_F(GNAPluginConfigTest, GnaConfigGnaExecTargetTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_1_0");
|
||||
EXPECT_EQ(config.target->get_user_set_execution_target(), DeviceVersion::GNA1_0);
|
||||
SetAndCompare(GNA_CONFIG_KEY(EXEC_TARGET), "GNA_TARGET_1_0_E");
|
||||
EXPECT_EQ(config.target->get_user_set_execution_target(), DeviceVersion::GNAEmbedded1_0);
|
||||
|
||||
SetAndCompare(GNA_CONFIG_KEY(EXEC_TARGET), "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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue