Remove non official code (#9315)
- feature to export for embedded GNA3 which is not in fact supported.
- SW emulation modes like SSE etc, which are not useful and are undocumented.
This commit is contained in:
1 parent
cf15cbd301
commit
6c92ce48c1
8 files changed
+30
-114
No files matched your search
@@ -177,7 +177,6 @@ int main(int argc, char* argv[]) {
|
||||
// Embedded GNA model dumping (for Intel(R) Speech Enabling Developer Kit)
|
||||
if (!FLAGS_we.empty()) {
|
||||
gnaPluginConfig[InferenceEngine::GNAConfigParams::KEY_GNA_FIRMWARE_MODEL_IMAGE] = FLAGS_we;
|
||||
gnaPluginConfig[InferenceEngine::GNAConfigParams::KEY_GNA_FIRMWARE_MODEL_IMAGE_GENERATION] = FLAGS_we_gen;
|
||||
}
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// --------------------------- Step 2. Loading model to the device ------------------------------------------
|
||||
@@ -232,9 +231,6 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
if (!FLAGS_we.empty()) {
|
||||
slog::info << "Exported GNA embedded model to file " << FLAGS_we << slog::endl;
|
||||
if (!FLAGS_we_gen.empty()) {
|
||||
slog::info << "GNA embedded model export done for GNA generation: " << FLAGS_we_gen << slog::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -162,9 +162,6 @@ DEFINE_string(wg, "", write_gna_model_message);
|
||||
/// @brief Write GNA embedded model to file (model.bin)
|
||||
DEFINE_string(we, "", write_embedded_model_message);
|
||||
|
||||
/// @brief Optional GNA embedded device generation (default GNA1 aka Sue Creek) - hide option
|
||||
DEFINE_string(we_gen, "GNA1", write_embedded_model_generation_message);
|
||||
|
||||
/// @brief Input quantization mode (default static)
|
||||
DEFINE_string(q, "static", quantization_message);
|
||||
|
||||
@@ -203,26 +200,28 @@ static void showUsage() {
|
||||
std::cout << "speech_sample [OPTION]" << std::endl;
|
||||
std::cout << "Options:" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << " -h " << help_message << std::endl;
|
||||
std::cout << " -i \"<path>\" " << input_message << std::endl;
|
||||
std::cout << " -m \"<path>\" " << model_message << std::endl;
|
||||
std::cout << " -o \"<path>\" " << output_message << std::endl;
|
||||
std::cout << " -d \"<device>\" " << target_device_message << std::endl;
|
||||
std::cout << " -pc " << performance_counter_message << std::endl;
|
||||
std::cout << " -q \"<mode>\" " << quantization_message << std::endl;
|
||||
std::cout << " -qb \"<integer>\" " << quantization_bits_message << std::endl;
|
||||
std::cout << " -sf \"<double>\" " << scale_factor_message << std::endl;
|
||||
std::cout << " -bs \"<integer>\" " << batch_size_message << std::endl;
|
||||
std::cout << " -r \"<path>\" " << reference_score_message << std::endl;
|
||||
std::cout << " -rg \"<path>\" " << read_gna_model_message << std::endl;
|
||||
std::cout << " -wg \"<path>\" " << write_gna_model_message << std::endl;
|
||||
std::cout << " -we \"<path>\" " << write_embedded_model_message << std::endl;
|
||||
std::cout << " -nthreads \"<integer>\" " << infer_num_threads_message << std::endl;
|
||||
std::cout << " -cw_l \"<integer>\" " << context_window_message_l << std::endl;
|
||||
std::cout << " -cw_r \"<integer>\" " << context_window_message_r << std::endl;
|
||||
std::cout << " -oname \"<string>\" " << output_layer_names_message << std::endl;
|
||||
std::cout << " -iname \"<string>\" " << input_layer_names_message << std::endl;
|
||||
std::cout << " -pwl_me \"<double>\" " << pwl_max_error_percent_message << std::endl;
|
||||
std::cout << " -h " << help_message << std::endl;
|
||||
std::cout << " -i \"<path>\" " << input_message << std::endl;
|
||||
std::cout << " -m \"<path>\" " << model_message << std::endl;
|
||||
std::cout << " -o \"<path>\" " << output_message << std::endl;
|
||||
std::cout << " -d \"<device>\" " << target_device_message << std::endl;
|
||||
std::cout << " -pc " << performance_counter_message << std::endl;
|
||||
std::cout << " -q \"<mode>\" " << quantization_message << std::endl;
|
||||
std::cout << " -qb \"<integer>\" " << quantization_bits_message << std::endl;
|
||||
std::cout << " -sf \"<double>\" " << scale_factor_message << std::endl;
|
||||
std::cout << " -bs \"<integer>\" " << batch_size_message << std::endl;
|
||||
std::cout << " -r \"<path>\" " << reference_score_message << std::endl;
|
||||
std::cout << " -rg \"<path>\" " << read_gna_model_message << std::endl;
|
||||
std::cout << " -wg \"<path>\" " << write_gna_model_message << std::endl;
|
||||
std::cout << " -we \"<path>\" " << write_embedded_model_message << std::endl;
|
||||
std::cout << " -nthreads \"<integer>\" " << infer_num_threads_message << std::endl;
|
||||
std::cout << " -cw_l \"<integer>\" " << context_window_message_l << std::endl;
|
||||
std::cout << " -cw_r \"<integer>\" " << context_window_message_r << std::endl;
|
||||
std::cout << " -oname \"<string>\" " << output_layer_names_message << std::endl;
|
||||
std::cout << " -iname \"<string>\" " << input_layer_names_message << std::endl;
|
||||
std::cout << " -pwl_me \"<double>\" " << pwl_max_error_percent_message << std::endl;
|
||||
std::cout << " -exec_target \"<string>\" " << execution_target_message << std::endl;
|
||||
std::cout << " -compile_target \"<string>\" " << compile_target_message << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,11 +53,6 @@ DECLARE_GNA_CONFIG_KEY(PRECISION);
|
||||
*/
|
||||
DECLARE_GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE);
|
||||
|
||||
/**
|
||||
* @brief information on GNA generation chosen for firmware model dump, can be overridden by GNA3
|
||||
*/
|
||||
DECLARE_GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION);
|
||||
|
||||
/**
|
||||
* @brief GNA proc_type setting that should be one of GNA_AUTO, GNA_HW, GNA_HW_WITH_SW_FBACK, GNA_SW, GNA_SW_EXACT
|
||||
*/
|
||||
@@ -69,14 +64,6 @@ DECLARE_GNA_CONFIG_VALUE(HW_WITH_SW_FBACK);
|
||||
DECLARE_GNA_CONFIG_VALUE(SW);
|
||||
DECLARE_GNA_CONFIG_VALUE(SW_EXACT);
|
||||
DECLARE_GNA_CONFIG_VALUE(SW_FP32);
|
||||
DECLARE_GNA_CONFIG_VALUE(GEN);
|
||||
DECLARE_GNA_CONFIG_VALUE(GEN_EXACT);
|
||||
DECLARE_GNA_CONFIG_VALUE(SSE);
|
||||
DECLARE_GNA_CONFIG_VALUE(SSE_EXACT);
|
||||
DECLARE_GNA_CONFIG_VALUE(AVX1);
|
||||
DECLARE_GNA_CONFIG_VALUE(AVX1_EXACT);
|
||||
DECLARE_GNA_CONFIG_VALUE(AVX2);
|
||||
DECLARE_GNA_CONFIG_VALUE(AVX2_EXACT);
|
||||
|
||||
/**
|
||||
* @brief The option to override the GNA HW execution target. May be one of GNA_TARGET_2_0, GNA_TARGET_3_0.
|
||||
|
||||
@@ -473,28 +473,6 @@ GNADeviceHelper::DumpResult GNADeviceHelper::dumpXnn(const uint32_t modelId) {
|
||||
|
||||
#if GNA_LIB_VER == 2
|
||||
|
||||
void GNADeviceHelper::dumpXnnForDeviceVersion(
|
||||
const uint32_t modelId,
|
||||
std::ostream & outStream,
|
||||
const Gna2DeviceVersion targetDeviceVersion) {
|
||||
|
||||
Gna2ModelSueCreekHeader sueHeader;
|
||||
auto ptr = ExportSueLegacyUsingGnaApi2(modelId, nGnaDeviceIndex, &sueHeader);
|
||||
gnaUserFree(ptr);
|
||||
|
||||
ExportGnaDescriptorPartiallyFilled(sueHeader.NumberOfLayers, outStream);
|
||||
|
||||
ExportLdForDeviceVersion(modelId, outStream, targetDeviceVersion);
|
||||
if (dumpXNNROPtr == nullptr) {
|
||||
THROW_GNA_EXCEPTION << "Bad RO pointer (nullptr)";
|
||||
}
|
||||
outStream.write(static_cast<const char*>(dumpXNNROPtr), dumpXNNROSize);
|
||||
|
||||
// TODO: GNA2: remove
|
||||
outStream.write("Gna2ModelSueCreekHeader", 24);
|
||||
outStream.write(reinterpret_cast<const char*>(&sueHeader), sizeof(sueHeader));
|
||||
}
|
||||
|
||||
void GNADeviceHelper::createVirtualDevice(Gna2DeviceVersion devVersion, std::string purpose) {
|
||||
const auto status = Gna2DeviceCreateForExport(devVersion, &nGnaDeviceIndex);
|
||||
GNADeviceHelper::checkGna2Status(status, "Gna2DeviceCreateForExport(" + std::to_string(devVersion) + ")" + purpose);
|
||||
|
||||
@@ -176,9 +176,6 @@ public:
|
||||
#else
|
||||
|
||||
DumpResult dumpXnn(const uint32_t modelId);
|
||||
void dumpXnnForDeviceVersion(const uint32_t modelId,
|
||||
std::ostream & outStream,
|
||||
Gna2DeviceVersion targetDeviceVersion);
|
||||
#endif
|
||||
void free(void * ptr);
|
||||
|
||||
|
||||
@@ -1164,17 +1164,8 @@ void GNAPlugin::createRequestConfigsForGnaModels() {
|
||||
#endif
|
||||
|
||||
int GNAPlugin::GetDeviceVersionFromString(const std::string deviceString) {
|
||||
constexpr uint32_t embeddedSuffix = 0xE;
|
||||
if (deviceString.empty())
|
||||
return 0x100 + embeddedSuffix;
|
||||
if (deviceString.size() == 4 && deviceString.substr(0, 3) == "GNA") {
|
||||
int version = deviceString[3] - '0';
|
||||
if (version > 0) {
|
||||
version <<= 8;
|
||||
version += embeddedSuffix;
|
||||
return version;
|
||||
}
|
||||
}
|
||||
return static_cast<int>(Gna2DeviceVersionEmbedded1_0);
|
||||
THROW_GNA_EXCEPTION << "Wrong GNA generation for embedded model dump: " << deviceString;
|
||||
}
|
||||
|
||||
@@ -1185,8 +1176,6 @@ void GNAPlugin::DumpXNNToFile() const {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto versionInt = GetDeviceVersionFromString(config.dumpXNNGeneration);
|
||||
|
||||
if (!gnadevice) {
|
||||
THROW_GNA_EXCEPTION << "Cannot generate XNNDump for float network";
|
||||
}
|
||||
@@ -1202,18 +1191,13 @@ void GNAPlugin::DumpXNNToFile() const {
|
||||
dumpStream.write(reinterpret_cast<char*>(dump.model.get()), dump.header.model_size);
|
||||
#else
|
||||
auto const modelId = gnadevice->createModel(std::get<0>(gnaModels.front())->obj);
|
||||
if (versionInt == Gna2DeviceVersionEmbedded1_0) {
|
||||
auto dump = gnadevice->dumpXnn(modelId);
|
||||
dump.header.RwRegionSize = gnamem->getRWBytes();
|
||||
dump.header.InputScalingFactor = inputsDesc->inputScaleFactors.front();
|
||||
dump.header.OutputScalingFactor = outputsDesc.front().scale_factor;
|
||||
dumpStream.write(reinterpret_cast<char*>(&dump.header), sizeof(Gna2ModelSueCreekHeader));
|
||||
dumpStream.write(reinterpret_cast<char*>(dump.model.get()), dump.header.ModelSize);
|
||||
} else {
|
||||
static_assert(sizeof(versionInt) >= sizeof(Gna2DeviceVersion), "");
|
||||
gnadevice->dumpXnnForDeviceVersion(modelId, dumpStream,
|
||||
*reinterpret_cast<const Gna2DeviceVersion*>(&versionInt));
|
||||
}
|
||||
auto dump = gnadevice->dumpXnn(modelId);
|
||||
dump.header.RwRegionSize = gnamem->getRWBytes();
|
||||
dump.header.InputScalingFactor = inputsDesc->inputScaleFactors.front();
|
||||
dump.header.OutputScalingFactor = outputsDesc.front().scale_factor;
|
||||
dumpStream.write(reinterpret_cast<char*>(&dump.header), sizeof(Gna2ModelSueCreekHeader));
|
||||
dumpStream.write(reinterpret_cast<char*>(dump.model.get()), dump.header.ModelSize);
|
||||
|
||||
gnadevice->releaseModel(modelId);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -24,14 +24,6 @@ static const caseless_unordered_map<std::string, uint32_t> supported_values = {
|
||||
};
|
||||
static const std::vector<std::string> supported_values_on_gna2 = {
|
||||
GNAConfigParams::GNA_HW_WITH_SW_FBACK,
|
||||
GNAConfigParams::GNA_GEN,
|
||||
GNAConfigParams::GNA_GEN_EXACT,
|
||||
GNAConfigParams::GNA_SSE,
|
||||
GNAConfigParams::GNA_SSE_EXACT,
|
||||
GNAConfigParams::GNA_AVX1,
|
||||
GNAConfigParams::GNA_AVX1_EXACT,
|
||||
GNAConfigParams::GNA_AVX2,
|
||||
GNAConfigParams::GNA_AVX2_EXACT
|
||||
};
|
||||
#else
|
||||
static const caseless_unordered_map <std::string, std::pair<Gna2AccelerationMode, bool>> supported_values = {
|
||||
@@ -40,14 +32,6 @@ static const caseless_unordered_map <std::string, std::pair<Gna2AccelerationMode
|
||||
{GNAConfigParams::GNA_HW_WITH_SW_FBACK, {Gna2AccelerationModeHardwareWithSoftwareFallback, false}},
|
||||
{GNAConfigParams::GNA_SW, {Gna2AccelerationModeSoftware, false}},
|
||||
{GNAConfigParams::GNA_SW_EXACT, {Gna2AccelerationModeSoftware, true}},
|
||||
{GNAConfigParams::GNA_GEN, {Gna2AccelerationModeGeneric, false}},
|
||||
{GNAConfigParams::GNA_GEN_EXACT, {Gna2AccelerationModeGeneric, true}},
|
||||
{GNAConfigParams::GNA_SSE, {Gna2AccelerationModeSse4x2, false}},
|
||||
{GNAConfigParams::GNA_SSE_EXACT, {Gna2AccelerationModeSse4x2, true}},
|
||||
{GNAConfigParams::GNA_AVX1, {Gna2AccelerationModeAvx1, false}},
|
||||
{GNAConfigParams::GNA_AVX1_EXACT, {Gna2AccelerationModeAvx1, true}},
|
||||
{GNAConfigParams::GNA_AVX2, {Gna2AccelerationModeAvx2, false}},
|
||||
{GNAConfigParams::GNA_AVX2_EXACT, {Gna2AccelerationModeAvx2, true}},
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -100,8 +84,6 @@ 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)) {
|
||||
dumpXNNPath = value;
|
||||
} else if (key == GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION)) {
|
||||
dumpXNNGeneration = value;
|
||||
} else if (key == GNA_CONFIG_KEY(DEVICE_MODE)) {
|
||||
auto procType = supported_values.find(value);
|
||||
if (procType == supported_values.end()) {
|
||||
@@ -267,7 +249,6 @@ void Config::AdjustKeyMapValues() {
|
||||
std::to_string(inputScaleFactors[n]);
|
||||
}
|
||||
keyConfigMap[GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE)] = dumpXNNPath;
|
||||
keyConfigMap[GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION)] = dumpXNNGeneration;
|
||||
|
||||
std::string device_mode;
|
||||
if (gnaFlags.sw_fp32) {
|
||||
|
||||
@@ -15,7 +15,6 @@ const std::map<std::string, std::string> supportedConfigKeysWithDefaults = {
|
||||
{GNA_CONFIG_KEY(SCALE_FACTOR), "1.000000"},
|
||||
{GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_0"), "1.000000"},
|
||||
{GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE), ""},
|
||||
{GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION), ""},
|
||||
{GNA_CONFIG_KEY(EXEC_TARGET), ""},
|
||||
{GNA_CONFIG_KEY(COMPILE_TARGET), ""},
|
||||
{GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW_EXACT},
|
||||
@@ -96,11 +95,6 @@ TEST_F(GNAPluginConfigTest, GnaConfigFirmwareModelImageTest) {
|
||||
EXPECT_EQ(config.dumpXNNPath, "abc");
|
||||
}
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigFirmwareModelImageGeneratorTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION), "def");
|
||||
EXPECT_EQ(config.dumpXNNGeneration, "def");
|
||||
}
|
||||
|
||||
TEST_F(GNAPluginConfigTest, GnaConfigDeviceModeTest) {
|
||||
SetAndCompare(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_HW);
|
||||
#if GNA_LIB_VER == 1
|
||||
|
||||
Reference in new issue
Block a user