Skip to content

Commit

Permalink
Enable preformance counters for vision model openvinotoolkit#2
Browse files Browse the repository at this point in the history
    W/A target passing problems
    Fix DWSC handling (PWL fusing)
    Unlock asymetric padding
    Fix output number matching
  • Loading branch information
kbruniec committed Feb 22, 2023
1 parent ff1a6c5 commit 6ee719d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/plugins/intel_gna/src/backend/am_intel_dnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,7 @@ void AMIntelDNN::InitGNAStruct(Gna2Model *gnaModel) {
|| (component[i - 1].operation == kDnnRecurrentOp)
|| (component[i - 1].operation == kDnnConvolutional1dOp)
|| (component[i - 1].operation == kDnnConvolutional2dOp)
|| (component[i - 1].operation == kDnnDWSCOp)
|| ((component[i - 1].operation == kDnnMaxPoolOp) &&
(component[i - 2].operation == kDnnConvolutional1dOp
|| component[i - 2].operation == kDnnConvolutional2dOp))) {
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/intel_gna/src/backend/gna_limitations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ bool Validator_35::ValidateInputPadding(const std::string& name,
const IsLessThanLimit padding_h_limit{kernel_h, "convolution input padding height (must be less than kernel height)"};
const IsLessThanLimit padding_w_limit{kernel_w, "convolution input padding width (must be less than kernel width)"};

auto error = padding_h_symetric.GetErrorOrEmpty(pad_h_begin);
error += padding_w_symetric.GetErrorOrEmpty(pad_w_begin);
//auto error = padding_h_symetric.GetErrorOrEmpty(pad_h_begin);
//error += padding_w_symetric.GetErrorOrEmpty(pad_w_begin);

error += padding_h_limit.GetErrorOrEmpty(pad_h_begin);
auto error = padding_h_limit.GetErrorOrEmpty(pad_h_begin);
error += padding_w_limit.GetErrorOrEmpty(pad_w_begin);

return ValidationSuccesful(throwOnError, error, name, "Convolution2D");
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/intel_gna/src/common/gna_target.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ enum DeviceVersion {
DeviceVersionEmbedded3_5 = 0x35e,
DeviceVersionEmbedded3_6 = 0x36e,
DeviceVersionEmbedded4_0 = 0x40e,
DeviceVersionDefault = DeviceVersion3_0
DeviceVersionDefault = DeviceVersionEmbedded4_0
};

class Target {
DeviceVersion get_default_target() const;

public:
DeviceVersion detected_device_version = DeviceVersionSoftwareEmulation;
DeviceVersion user_set_execution_target = DeviceVersionNotSet;
DeviceVersion user_set_compile_target = DeviceVersionNotSet;
DeviceVersion user_set_execution_target = DeviceVersionEmbedded4_0;
DeviceVersion user_set_compile_target = DeviceVersionEmbedded4_0;

DeviceVersion get_effective_execution_target() const;
DeviceVersion get_effective_compile_target(const bool device_helper) const;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gna/src/gna_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ void GNADeviceHelper::open() {
createVirtualDevice(target.user_set_execution_target);
updateGnaDeviceVersion();
if (target.detected_device_version != target.user_set_execution_target) {
THROW_GNA_EXCEPTION << "Wrong virtual GNA device version reported: " << target.detected_device_version
log::error() << "Wrong virtual GNA device version reported: " << target.detected_device_version
<< " instead of: " << target.user_set_execution_target;
}
} else {
Expand Down
25 changes: 21 additions & 4 deletions src/plugins/intel_gna/src/gna_graph_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,21 @@ void GNAGraphCompiler::finalizeConvolution2DPrimitive(InferenceEngine::CNNLayerP

auto& currentComponent = dnnComponents.addComponent(convolution.name, is_dwsc ? "dwsc" : "convolution");

if (convolution._padding_y != convolution._pads_end_y) {
log::error() << convolution.name << ": convolution._padding_y != convolution._pads_end_y using bigger"
<< convolution._padding_y
<< "!=" << convolution._pads_end_y << "\n";
convolution._padding_y = std::max(convolution._padding_y, convolution._pads_end_y);
convolution._pads_end_y = convolution._padding_y;
}

if (convolution._padding_x != convolution._pads_end_x) {
log::error() << convolution.name << ": convolution._padding_x != convolution._pads_end_x using bigger"
<< convolution._padding_x << "!=" << convolution._pads_end_x << "\n";
convolution._padding_x = std::max(convolution._padding_x, convolution._pads_end_x);
convolution._pads_end_x = convolution._padding_x;
}

dnn->InitConvolutional2DComponent(currentComponent,
{{in_batch, in_height, in_width, in_channels}, inputPrec, {}}, // NHWC for GNA
{{out_batch, out_height, out_width, out_channels}, outputPrec, {}},
Expand Down Expand Up @@ -1004,7 +1019,7 @@ void GNAGraphCompiler::PoolingPrimitive(InferenceEngine::CNNLayerPtr layer) {
switch (pooling._type) {
case PoolingLayer::MAX: break;
// we are loosing precision here
case PoolingLayer::AVG:
case PoolingLayer::AVG: break;
default:
// TODO: convert to SUMM pooling
THROW_GNA_EXCEPTION << "Layer :" << layer->name << " not supported";
Expand Down Expand Up @@ -1574,12 +1589,14 @@ void GNAGraphCompiler::AffinePrimitive(InferenceEngine::CNNLayerPtr layer, bool
bool useBiasConnection = false;
if (LayerInfo(prevLayer).has32BOutput()) {
if (weightable._biases) {
THROW_GNA_EXCEPTION << "Layer: "
log::error() << "Layer: "
<< layer->name << ", cannot be connected to its parent: " << prevLayer->name
<< " due to precision mismatch";
} else {
log::debug() << "Connection " << prevLayer->name << " to " << layer->name << " is using BIAS as input"
<< std::endl;
useBiasConnection = true;
}
log::debug() << "Connection " << prevLayer->name << " to " << layer->name << " is using BIAS as input" << std::endl;
useBiasConnection = true;
}

auto& currentComponent = dnnComponents.addComponent(layer->name, (isDiag ? "diagonal" : "affine"));
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_gna/src/gna_plugin_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ void Config::AdjustKeyMapValues() {
}
IE_ASSERT(!device_mode.empty());
keyConfigMap[ov::intel_gna::execution_mode.name()] = device_mode;
keyConfigMap[GNA_CONFIG_KEY(EXEC_TARGET)] = target.user_set_execution_target;
keyConfigMap[GNA_CONFIG_KEY(COMPILE_TARGET)] = target.user_set_compile_target;
//keyConfigMap[GNA_CONFIG_KEY(EXEC_TARGET)] = target.user_set_execution_target;
//keyConfigMap[GNA_CONFIG_KEY(COMPILE_TARGET)] = target.user_set_compile_target;
keyConfigMap[ov::intel_gna::memory_reuse.name()] =
gnaFlags.compact_mode ? PluginConfigParams::YES : PluginConfigParams::NO;
keyConfigMap[CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)] =
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gna/src/log/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <ie_common.h>

#ifdef GNA_DEBUG
#ifdef GNA_DEBUG_NONE

/**
* @brief used for creating graphviz charts, and layers dump
Expand Down

0 comments on commit 6ee719d

Please sign in to comment.