Merge remote-tracking branch 'upstream/master' into layer_test_common

This commit is contained in:
Efode, Irina
2021-10-15 15:52:20 +03:00
307 changed files with 12030 additions and 8333 deletions

View File

@@ -262,6 +262,7 @@ limitations under the License.
<tab type="user" title="Sin-1" url="@ref openvino_docs_ops_arithmetic_Sin_1"/>
<tab type="user" title="Sinh-1" url="@ref openvino_docs_ops_arithmetic_Sinh_1"/>
<tab type="user" title="SoftMax-1" url="@ref openvino_docs_ops_activation_SoftMax_1"/>
<tab type="user" title="SoftMax-8" url="@ref openvino_docs_ops_activation_SoftMax_8"/>
<tab type="user" title="SoftPlus-4" url="@ref openvino_docs_ops_activation_SoftPlus_4"/>
<tab type="user" title="SpaceToBatch-2" url="@ref openvino_docs_ops_movement_SpaceToBatch_2"/>
<tab type="user" title="SpaceToDepth-1" url="@ref openvino_docs_ops_movement_SpaceToDepth_1"/>

View File

@@ -0,0 +1,45 @@
## SoftMax <a name="SoftMax"></a> {#openvino_docs_ops_activation_SoftMax_8}
**Versioned name**: *SoftMax-8*
**Category**: *Activation function*
**Short description**: [Reference](https://github.com/Kulbear/deep-learning-nano-foundation/wiki/ReLU-and-Softmax-Activation-Functions#softmax)
**Detailed description**: [Reference](http://cs231n.github.io/linear-classify/#softmax)
**Attributes**
* *axis*
* **Description**: *axis* represents the axis of which the *SoftMax* is calculated. Negative value means counting
dimensions from the back. *axis* equal 1 is a default value.
* **Range of values**: `[-rank, rank - 1]`
* **Type**: int
* **Default value**: 1
* **Required**: *no*
**Mathematical Formulation**
\f[
y_{c} = \frac{e^{Z_{c}}}{\sum_{d=1}^{C}e^{Z_{d}}}
\f]
where \f$C\f$ is a size of tensor along *axis* dimension.
**Inputs**:
* **1**: Input tensor with enough number of dimension to be compatible with *axis* attribute. **Required.**
**Outputs**:
* **1**: The resulting tensor of the same shape and type as input tensor.
**Example**
```xml
<layer ... type="SoftMax" ... >
<data axis="1" />
<input> ... </input>
<output> ... </output>
</layer>
```

View File

@@ -152,7 +152,7 @@ declared in `namespace opset8`.
* [Sign](arithmetic/Sign_1.md)
* [Sin](arithmetic/Sin_1.md)
* [Sinh](arithmetic/Sinh_1.md)
* [SoftMax](activation/SoftMax_1.md)
* [SoftMax](activation/SoftMax_8.md)
* [SoftPlus](activation/SoftPlus_4.md)
* [SpaceToBatch](movement/SpaceToBatch_2.md)
* [SpaceToDepth](movement/SpaceToDepth_1.md)

View File

@@ -113,8 +113,9 @@ void TemplatePlugin::ExecutableNetwork::CompileNetwork(const std::shared_ptr<con
// Generate backend specific blob mappings. For example Inference Engine uses not ngraph::Result nodes friendly name
// as inference request output names but the name of the layer before.
for (auto&& result : _function->get_results()) {
auto outputName = ngraph::op::util::create_ie_output_name(result->input_value(0));
_outputIndex.emplace(outputName, _function->get_result_index(result));
const auto& input = result->input_value(0);
auto name = ngraph::op::util::get_ie_output_name(input);
_outputIndex.emplace(name, _function->get_result_index(result));
}
for (auto&& parameter : _function->get_parameters()) {
_inputIndex.emplace(parameter->get_friendly_name(), _function->get_parameter_index(parameter));

View File

@@ -10,6 +10,7 @@ addIeTargetTest(
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCIES
templatePlugin
HeteroPlugin
LINK_LIBRARIES
IE::funcSharedTests
INCLUDES

View File

@@ -17,7 +17,7 @@ using namespace ov;
namespace reference_tests {
CommonReferenceTest::CommonReferenceTest(): targetDevice("TEMPLATE") {
core = ov::test::PluginCache::get().core(targetDevice);
core = test::utils::PluginCache::get().core(targetDevice);
}
void CommonReferenceTest::Exec() {

View File

@@ -0,0 +1,316 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <ngraph_functions/builders.hpp>
#include "openvino/op/binary_convolution.hpp"
#include "base_reference_test.hpp"
#include "openvino/opsets/opset8.hpp"
using namespace reference_tests;
using namespace ov;
namespace {
struct BinaryConvolutionParams {
template <class T>
BinaryConvolutionParams(const PartialShape& inputShape,
const Shape& filterShape,
const PartialShape& outputShape,
const element::Type& iType,
const std::vector<T>& iValues,
const std::vector<uint8_t>& filterValues,
const std::vector<T>& oValues,
const Strides& strides,
const CoordinateDiff& padBegin,
const CoordinateDiff& padEnd,
const Strides& dialations,
const float padValue = 0,
const std::string& test_name = "")
: inputShape(inputShape),
filterShape(filterShape),
outputShape(outputShape),
inType(iType),
outType(iType),
inputData(CreateTensor(iType, iValues)),
filterData(filterValues),
refData(CreateTensor(iType, oValues)),
strides(strides),
padBegin(padBegin),
padEnd(padEnd),
dialations(dialations),
padValue(padValue) {}
PartialShape inputShape;
Shape filterShape;
PartialShape outputShape;
ov::element::Type inType;
ov::element::Type outType;
ov::runtime::Tensor inputData;
std::vector<uint8_t> filterData;
ov::runtime::Tensor refData;
ov::Strides strides;
ov::CoordinateDiff padBegin;
ov::CoordinateDiff padEnd;
ov::Strides dialations;
ov::op::v1::BinaryConvolution::BinaryConvolutionMode mode = ov::op::v1::BinaryConvolution::BinaryConvolutionMode::XNOR_POPCOUNT;
float padValue;
std::string testcaseName;
};
class ReferenceBinaryConvolutionLayerTest : public testing::TestWithParam<BinaryConvolutionParams>, public CommonReferenceTest {
public:
void SetUp() override {
auto params = GetParam();
function = CreateFunction(params, params.filterData);
inputData = {params.inputData};
refOutData = {params.refData};
}
static std::string getTestCaseName(const testing::TestParamInfo<BinaryConvolutionParams>& obj) {
auto param = obj.param;
std::ostringstream result;
result << "inputShape=" << param.inputShape << "_";
result << "filterShape=" << param.filterShape << "_";
result << "outputShape=" << param.outputShape << "_";
result << "iType=" << param.inType << "_";
result << "oType=" << param.outType << "_";
result << "strides=" << param.strides << "_";
result << "padBegin=" << param.padBegin << "_";
result << "padEnd=" << param.padEnd << "_";
result << "dialations=" << param.dialations << "_";
if (param.testcaseName != "") {
result << "padValue=" << param.padValue << "_";
result << param.testcaseName;
} else {
result << "padValue=" << param.padValue;
}
return result.str();
}
private:
static std::shared_ptr<Function> CreateFunction(const BinaryConvolutionParams& params, const std::vector<uint8_t>& filterData) {
const op::PadType auto_pad{op::PadType::EXPLICIT};
const auto in = std::make_shared<op::v0::Parameter>(params.inType, params.inputShape);
auto filter = std::make_shared<opset8::Constant>(ov::element::u1, params.filterShape, &filterData[0]);
const auto BinaryConvolution = std::make_shared<op::v1::BinaryConvolution>(in,
filter,
params.strides,
params.padBegin,
params.padEnd,
params.dialations,
params.mode,
params.padValue,
auto_pad);
return std::make_shared<ov::Function>(NodeVector {BinaryConvolution}, ParameterVector {in});
}
};
TEST_P(ReferenceBinaryConvolutionLayerTest, CompareWithRefs) {
Exec();
}
template <element::Type_t IN_ET>
std::vector<BinaryConvolutionParams> generateBinaryConvolutionParams() {
using T = typename element_type_traits<IN_ET>::value_type;
std::vector<BinaryConvolutionParams> binaryConvolutionParams {
// --------------------- 2D BinaryConvolution ------------------------------------------
BinaryConvolutionParams(PartialShape {1, 1, 4, 4},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 2, 2},
IN_ET,
std::vector<T>{1, 0, 0, 1,
1, 1, 0, 0,
0, 0, 0, 1,
1, 0, 1, 1},
std::vector<uint8_t>{0xAA, 0x80}, // 10101010 10000000
std::vector<T>{1, 1,
3, -1},
{1, 1},
{0, 0},
{0, 0},
{1, 1}),
BinaryConvolutionParams(PartialShape {1, 1, 4, 4},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 4, 4},
IN_ET,
std::vector<T>{1, 0, 0, 1,
1, 1, 0, 0,
0, 0, 0, 1,
1, 0, 1, 1},
std::vector<uint8_t>{0xAA, 0x80}, // 10101010 10000000
std::vector<T>{1, -3, -1, 1,
-3, 1, 1, -5,
-3, 3, -1, 1,
1, -5, 1, -3},
{1, 1},
{1, 1},
{1, 1},
{1, 1}),
BinaryConvolutionParams(PartialShape {1, 1, 4, 4},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 4, 4},
IN_ET,
std::vector<T>{1, 0, 0, 1,
1, 1, 0, 0,
0, 0, 0, 1,
1, 0, 1, 1},
std::vector<uint8_t>{0xAA, 0x80}, // 10101010 10000000
std::vector<T>{3, -1, 1, 3,
-1, 1, 1, -3,
-1, 3, -1, 3,
3, -3, 3, -1},
{1, 1},
{1, 1},
{1, 1},
{1, 1},
1.0f),
BinaryConvolutionParams(PartialShape {1, 1, 5, 5},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 2, 2},
IN_ET,
std::vector<T>{0, 1, 1, 0, 1,
1, 1, 0, 1, 0,
0, 0, 1, 0, 1,
1, 1, 0, 1, 0,
0, 0, 1, 1, 1},
std::vector<uint8_t>{0x2E, 0x00}, // 10101010 10000000
std::vector<T>{-1, 3,
1, 1},
{2, 2},
{0, 0},
{0, 0},
{1, 1}),
BinaryConvolutionParams(PartialShape {1, 1, 7, 7},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 3, 3},
IN_ET,
std::vector<T>{1, 1, 0, 0, 0, 1, 0,
0, 0, 1, 0, 1, 0, 0,
1, 1, 1, 1, 0, 1, 1,
0, 0, 0, 1, 1, 1, 0,
0, 1, 0, 0, 1, 1, 1,
1, 0, 1, 1, 0, 0, 0,
1, 1, 1, 0, 1, 0, 0},
std::vector<uint8_t>{0x6B, 0x00}, // 10101010 10000000
std::vector<T>{-5, -3, -5,
5, 1, 3,
-1, -1, 3},
{1, 1},
{0, 0},
{0, 0},
{2, 2}),
BinaryConvolutionParams(PartialShape {1, 1, 7, 7},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 4, 4},
IN_ET,
std::vector<T>{1, 1, 0, 0, 0, 1, 0,
0, 0, 1, 0, 1, 0, 0,
1, 1, 1, 1, 0, 1, 1,
0, 0, 0, 1, 1, 1, 0,
0, 1, 0, 0, 1, 1, 1,
1, 0, 1, 1, 0, 0, 0,
1, 1, 1, 0, 1, 0, 0},
std::vector<uint8_t>{0x6B, 0x00}, // 10101010 10000000
std::vector<T>{1, 1, -1, 1,
1, -5, -5, 5,
3, -1, 3, 3,
-1, -1, 3, -3},
{2, 2},
{2, 2},
{2, 2},
{2, 2}),
BinaryConvolutionParams(PartialShape {1, 1, 7, 7},
Shape {1, 1, 3, 3},
PartialShape {1, 1, 4, 4},
IN_ET,
std::vector<T>{1, 1, 0, 0, 0, 1, 0,
0, 0, 1, 0, 1, 0, 0,
1, 1, 1, 1, 0, 1, 1,
0, 0, 0, 1, 1, 1, 0,
0, 1, 0, 0, 1, 1, 1,
1, 0, 1, 1, 0, 0, 0,
1, 1, 1, 0, 1, 0, 0},
std::vector<uint8_t>{0x6B, 0x00}, // 10101010 10000000
std::vector<T>{3, 3, 1, -1,
-1, -5, -5, 3,
1, -1, 3, 1,
-3, 1, 5, -1},
{2, 2},
{2, 2},
{2, 2},
{2, 2},
1.0f),
BinaryConvolutionParams(PartialShape {1, 2, 4, 4},
Shape {1, 2, 3, 3},
PartialShape {1, 1, 2, 2},
IN_ET,
std::vector<T>{
// channel 1
1, 0, 0, 1,
1, 1, 0, 0,
0, 0, 0, 1,
1, 0, 1, 1,
// channel 2
0, 1, 1, 0,
0, 0, 1, 1,
1, 1, 1, 0,
0, 1, 0, 0},
std::vector<uint8_t>{0xAA, 0xAA, 0x80}, // 10101010 10000000
std::vector<T>{2, 2,
6, -2},
{1, 1},
{0, 0},
{0, 0},
{1, 1}),
BinaryConvolutionParams(PartialShape {2, 1, 4, 4},
Shape {1, 1, 3, 3},
PartialShape {2, 1, 2, 2},
IN_ET,
std::vector<T>{
// batch 1
1, 0, 0, 1,
1, 1, 0, 0,
0, 0, 0, 1,
1, 0, 1, 1,
// batch 2
0, 0, 0, 0,
1, 1, 1, 0,
1, 1, 0, 1,
1, 0, 1, 0},
std::vector<uint8_t>{0xAA, 0x80}, // 10101010 10000000
std::vector<T>{
// batch 1
1, 1,
3, -1,
// batch 2
-3, 3,
5, -7},
{1, 1},
{0, 0},
{0, 0},
{1, 1})
};
return binaryConvolutionParams;
}
std::vector<BinaryConvolutionParams> generateBinaryConvolutionCombinedParams() {
const std::vector<std::vector<BinaryConvolutionParams>> binaryConvolutionTypeParams {
generateBinaryConvolutionParams<element::Type_t::f32>(),
generateBinaryConvolutionParams<element::Type_t::f16>(),
generateBinaryConvolutionParams<element::Type_t::i64>(),
generateBinaryConvolutionParams<element::Type_t::i32>()
};
std::vector<BinaryConvolutionParams> combinedParams;
for (const auto& params : binaryConvolutionTypeParams) {
combinedParams.insert(combinedParams.end(), params.begin(), params.end());
}
return combinedParams;
}
INSTANTIATE_TEST_SUITE_P(smoke_BinaryConvolution_With_Hardcoded_Refs, ReferenceBinaryConvolutionLayerTest,
testing::ValuesIn(generateBinaryConvolutionCombinedParams()), ReferenceBinaryConvolutionLayerTest::getTestCaseName);
} // namespace

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,447 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <limits>
#include "base_reference_test.hpp"
#include "openvino/opsets/opset8.hpp"
using namespace ov;
namespace reference_tests {
namespace {
struct SliceParams {
SliceParams(const Tensor& data,
const Tensor& start,
const Tensor& stop,
const Tensor& step,
const Tensor& axes,
const Tensor& output,
const std::string& test_name = "")
: m_data(data),
m_start(start),
m_stop(stop),
m_step(step),
m_axes(axes),
m_output(output),
m_test_name(test_name),
m_default_axes(false) {}
// Default `axes` input
SliceParams(const Tensor& data,
const Tensor& start,
const Tensor& stop,
const Tensor& step,
const Tensor& output,
const std::string& test_name = "")
: m_data(data),
m_start(start),
m_stop(stop),
m_step(step),
m_output(output),
m_test_name(test_name),
m_default_axes(true) {}
Tensor m_data;
Tensor m_start;
Tensor m_stop;
Tensor m_step;
Tensor m_axes;
Tensor m_output;
std::string m_test_name;
bool m_default_axes = false;
};
class ReferenceSliceLayerTest : public testing::TestWithParam<SliceParams>, public CommonReferenceTest {
public:
void SetUp() override {
auto params = GetParam();
if (params.m_default_axes) {
function = CreateFunction(params.m_data, params.m_start, params.m_stop, params.m_step);
inputData = {params.m_data.data, params.m_start.data, params.m_stop.data, params.m_step.data};
} else {
function = CreateFunction(params.m_data, params.m_start, params.m_stop, params.m_step, params.m_axes);
inputData = {params.m_data.data,
params.m_start.data,
params.m_stop.data,
params.m_step.data,
params.m_axes.data};
}
refOutData = {params.m_output.data};
}
static std::string getTestCaseName(const testing::TestParamInfo<SliceParams>& obj) {
auto param = obj.param;
std::ostringstream result;
result << "test_name=" << param.m_test_name << "__";
result << "data_shape=" << param.m_data.shape << "_";
result << "data_type=" << param.m_data.type << "_";
result << "ind_type=" << param.m_start.type << "_";
if (param.m_default_axes) {
result << "axes_shape="
<< "default"
<< "_";
result << "axes_type="
<< "default"
<< "_";
} else {
result << "axes_shape=" << param.m_axes.shape << "_";
result << "axes_type=" << param.m_axes.type << "_";
}
return result.str();
}
private:
static std::shared_ptr<Function> CreateFunction(const Tensor& data,
const Tensor& start,
const Tensor& stop,
const Tensor& step,
const Tensor& axes) {
const auto data_param = std::make_shared<opset8::Parameter>(data.type, data.shape);
const auto start_param = std::make_shared<opset8::Parameter>(start.type, start.shape);
const auto stop_param = std::make_shared<opset8::Parameter>(stop.type, stop.shape);
const auto step_param = std::make_shared<opset8::Parameter>(step.type, step.shape);
const auto axes_param = std::make_shared<opset8::Parameter>(axes.type, axes.shape);
const auto slice = std::make_shared<opset8::Slice>(data_param, start_param, stop_param, step_param, axes_param);
return std::make_shared<Function>(NodeVector{slice},
ParameterVector{data_param, start_param, stop_param, step_param, axes_param});
}
// Default `axes` input
static std::shared_ptr<Function> CreateFunction(const Tensor& data,
const Tensor& start,
const Tensor& stop,
const Tensor& step) {
const auto data_param = std::make_shared<opset8::Parameter>(data.type, data.shape);
const auto start_param = std::make_shared<opset8::Parameter>(start.type, start.shape);
const auto stop_param = std::make_shared<opset8::Parameter>(stop.type, stop.shape);
const auto step_param = std::make_shared<opset8::Parameter>(step.type, step.shape);
const auto slice = std::make_shared<opset8::Slice>(data_param, start_param, stop_param, step_param);
return std::make_shared<Function>(NodeVector{slice},
ParameterVector{data_param, start_param, stop_param, step_param});
}
};
TEST_P(ReferenceSliceLayerTest, CompareWithHardcodedRefs) {
Exec();
}
} // namespace
template <element::Type_t DATA_ET, element::Type_t IND_ET, element::Type_t AXIS_ET>
std::vector<SliceParams> generateSliceParamsUnsigned() {
using DATA_T = typename element_type_traits<DATA_ET>::value_type;
using IND_T = typename element_type_traits<IND_ET>::value_type;
using AXIS_T = typename element_type_traits<AXIS_ET>::value_type;
std::vector<SliceParams> test_params{
SliceParams(Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{1}, IND_ET, std::vector<IND_T>{0}},
Tensor{{1}, IND_ET, std::vector<IND_T>{5}},
Tensor{{1}, IND_ET, std::vector<IND_T>{1}},
Tensor{{1}, AXIS_ET, std::vector<AXIS_T>{0}},
Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
"1D_full_axes"),
SliceParams(Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{1}, IND_ET, std::vector<IND_T>{0}},
Tensor{{1}, IND_ET, std::vector<IND_T>{5}},
Tensor{{1}, IND_ET, std::vector<IND_T>{1}},
Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
"1D_default_axes"),
SliceParams(Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{1}, IND_ET, std::vector<IND_T>{6}},
Tensor{{1}, IND_ET, std::vector<IND_T>{5}},
Tensor{{1}, IND_ET, std::vector<IND_T>{1}},
Tensor{{1}, AXIS_ET, std::vector<AXIS_T>{0}},
Tensor{{0}, DATA_ET, std::vector<DATA_T>{}},
"1D_empty_output"),
SliceParams(Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{0, 0}},
Tensor{{2}, IND_ET, std::vector<IND_T>{2, 2}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 1}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
"2D_full_axes"),
SliceParams(Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{0, 0}},
Tensor{{2}, IND_ET, std::vector<IND_T>{2, 2}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 1}},
Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
"2D_default_axes"),
SliceParams(Tensor{{2, 4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 0}},
Tensor{{2}, IND_ET, std::vector<IND_T>{2, 3}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 2}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{1, 2}, DATA_ET, std::vector<DATA_T>{5, 7}},
"2D_step_2"),
SliceParams(Tensor{{3, 16}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{2}, IND_ET, std::vector<IND_T>{0, 0}},
Tensor{{2}, IND_ET, std::vector<IND_T>{3, 16}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 15}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{3, 2}, DATA_ET, std::vector<DATA_T>{0, 15, 16, 31, 32, 47}},
"2D_big_step"),
SliceParams(Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{10, 0}},
Tensor{{2}, IND_ET, std::vector<IND_T>{20, 2}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 1}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{0, 2}, DATA_ET, std::vector<DATA_T>{}},
"2D_empty_output"),
SliceParams(Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
Tensor{{3}, IND_ET, std::vector<IND_T>{0, 0, 0}},
Tensor{{3}, IND_ET, std::vector<IND_T>{2, 2, 2}},
Tensor{{3}, IND_ET, std::vector<IND_T>{1, 1, 1}},
Tensor{{3}, AXIS_ET, std::vector<AXIS_T>{0, 1, 2}},
Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
"3D_full_axes"),
SliceParams(Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
Tensor{{3}, IND_ET, std::vector<IND_T>{0, 0, 0}},
Tensor{{3}, IND_ET, std::vector<IND_T>{2, 2, 2}},
Tensor{{3}, IND_ET, std::vector<IND_T>{1, 1, 1}},
Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
"3D_default_axes"),
SliceParams(Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
Tensor{{2}, IND_ET, std::vector<IND_T>{0, 0}},
Tensor{{2}, IND_ET, std::vector<IND_T>{2, 2}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, 1}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
"3D_less_axes"),
SliceParams(Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
Tensor{{3}, IND_ET, std::vector<IND_T>{0, 2, 0}},
Tensor{{3}, IND_ET, std::vector<IND_T>{2, 2, 2}},
Tensor{{3}, IND_ET, std::vector<IND_T>{1, 1, 1}},
Tensor{{3}, AXIS_ET, std::vector<AXIS_T>{0, 1, 2}},
Tensor{{2, 0, 2}, DATA_ET, std::vector<DATA_T>{}},
"3D_empty_output"),
SliceParams(Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{4}, IND_ET, std::vector<IND_T>{0, 0, 0, 0}},
Tensor{{4}, IND_ET, std::vector<IND_T>{4, 2, 3, 2}},
Tensor{{4}, IND_ET, std::vector<IND_T>{1, 1, 1, 1}},
Tensor{{4}, AXIS_ET, std::vector<AXIS_T>{0, 1, 2, 3}},
Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
"4D_full_axes"),
SliceParams(Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{4}, IND_ET, std::vector<IND_T>{0, 0, 0, 0}},
Tensor{{4}, IND_ET, std::vector<IND_T>{4, 2, 3, 2}},
Tensor{{4}, IND_ET, std::vector<IND_T>{1, 1, 1, 1}},
Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
"4D_default_axes"),
SliceParams(Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{1}, IND_ET, std::vector<IND_T>{0}},
Tensor{{1}, IND_ET, std::vector<IND_T>{2}},
Tensor{{1}, IND_ET, std::vector<IND_T>{1}},
Tensor{{1}, AXIS_ET, std::vector<AXIS_T>{0}},
Tensor{{2, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}},
"4D_half_dim"),
SliceParams(Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{1}, IND_ET, std::vector<IND_T>{0}},
Tensor{{1}, IND_ET, std::vector<IND_T>{4}},
Tensor{{1}, IND_ET, std::vector<IND_T>{2}},
Tensor{{1}, AXIS_ET, std::vector<AXIS_T>{0}},
Tensor{{2, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35}},
"4D_half_dim_step"),
SliceParams(
Tensor{{2, 4, 2, 2, 3},
DATA_ET,
std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95}},
Tensor{{5}, IND_ET, std::vector<IND_T>{0, 0, 0, 0, 0}},
Tensor{{5}, IND_ET, std::vector<IND_T>{2, 4, 2, 2, 3}},
Tensor{{5}, IND_ET, std::vector<IND_T>{1, 1, 1, 1, 1}},
Tensor{{5}, AXIS_ET, std::vector<AXIS_T>{0, 1, 2, 3, 4}},
Tensor{{2, 2, 2, 1, 2},
DATA_ET,
std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95}},
"5D_full_axes"),
};
return test_params;
}
template <element::Type_t DATA_ET, element::Type_t IND_ET, element::Type_t AXIS_ET>
std::vector<SliceParams> generateSliceParams() {
using DATA_T = typename element_type_traits<DATA_ET>::value_type;
using IND_T = typename element_type_traits<IND_ET>::value_type;
using AXIS_T = typename element_type_traits<AXIS_ET>::value_type;
std::vector<SliceParams> test_params{
SliceParams(Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{1}, IND_ET, std::vector<IND_T>{5}},
Tensor{{1}, IND_ET, std::vector<IND_T>{-6}},
Tensor{{1}, IND_ET, std::vector<IND_T>{-1}},
Tensor{{4}, DATA_ET, std::vector<DATA_T>{4, 3, 2, 1}},
"1D_negative_step"),
SliceParams(Tensor{{4}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{1}, IND_ET, std::vector<IND_T>{0}},
Tensor{{1}, IND_ET, std::vector<IND_T>{5}},
Tensor{{1}, IND_ET, std::vector<IND_T>{-1}},
Tensor{{1}, AXIS_ET, std::vector<AXIS_T>{0}},
Tensor{{0}, DATA_ET, std::vector<DATA_T>{}},
"1D_empty_output_negative_step"),
SliceParams(Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{0, 3}},
Tensor{{2}, IND_ET, std::vector<IND_T>{2, -4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{1, -1}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{2, 1, 4, 3}},
"2D_negative_step_mix"),
SliceParams(Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-1, 3}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-4, -4}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-1, -1}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{2, 2}, DATA_ET, std::vector<DATA_T>{4, 3, 2, 1}},
"2D_negative_step_only"),
SliceParams(Tensor{{3, 16}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{2}, IND_ET, std::vector<IND_T>{2, 15}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-4, -17}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-1, -15}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{0, 1}},
Tensor{{3, 2}, DATA_ET, std::vector<DATA_T>{47, 32, 31, 16, 15, 0}},
"2D_negative_big_step"),
SliceParams(Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
Tensor{{3}, IND_ET, std::vector<IND_T>{0, 0, 0}},
Tensor{{3}, IND_ET, std::vector<IND_T>{2, 2, 2}},
Tensor{{3}, IND_ET, std::vector<IND_T>{1, 1, 1}},
Tensor{{3}, AXIS_ET, std::vector<AXIS_T>{-3, -2, -1}},
Tensor{{2, 2, 2}, DATA_ET, std::vector<DATA_T>{1, 2, 3, 4, 5, 6, 7, 8}},
"3D_negative_axes"),
SliceParams(Tensor{{2, 4, 3}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}},
Tensor{{3}, IND_ET, std::vector<IND_T>{0, 0, 4}},
Tensor{{3}, IND_ET, std::vector<IND_T>{2, 4, -5}},
Tensor{{3}, IND_ET, std::vector<IND_T>{3, 2, -2}},
Tensor{{3}, AXIS_ET, std::vector<AXIS_T>{0, 1, 2}},
Tensor{{1, 2, 2}, DATA_ET, std::vector<DATA_T>{2, 0, 8, 6}},
"3D_mixed_step"),
SliceParams(Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{4},
IND_ET,
std::vector<IND_T>{std::numeric_limits<IND_T>::min(),
std::numeric_limits<IND_T>::max(),
std::numeric_limits<IND_T>::max(),
std::numeric_limits<IND_T>::min()}},
Tensor{{4},
IND_ET,
std::vector<IND_T>{std::numeric_limits<IND_T>::max(),
std::numeric_limits<IND_T>::min(),
std::numeric_limits<IND_T>::min(),
std::numeric_limits<IND_T>::max()}},
Tensor{{4}, IND_ET, std::vector<IND_T>{1, -1, -1, 1}},
Tensor{{4}, AXIS_ET, std::vector<AXIS_T>{0, 1, 2, 3}},
Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1,
22, 23, 20, 21, 18, 19, 16, 17, 14, 15, 12, 13,
34, 35, 32, 33, 30, 31, 28, 29, 26, 27, 24, 25,
46, 47, 44, 45, 42, 43, 40, 41, 38, 39, 36, 37}},
"4D_INT_MIN_MAX_index"),
SliceParams(Tensor{{4, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}},
Tensor{{2}, IND_ET, std::vector<IND_T>{100, -100}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-100, 100}},
Tensor{{2}, IND_ET, std::vector<IND_T>{-1, 2}},
Tensor{{2}, AXIS_ET, std::vector<AXIS_T>{2, 0}},
Tensor{{2, 2, 3, 2}, DATA_ET, std::vector<DATA_T>{4, 5, 2, 3, 0, 1, 10, 11, 8, 9, 6, 7,
28, 29, 26, 27, 24, 25, 34, 35, 32, 33, 30, 31}},
"4D_mixed"),
SliceParams(
Tensor{{2, 4, 2, 2, 3},
DATA_ET,
std::vector<DATA_T>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95}},
Tensor{{5}, IND_ET, std::vector<IND_T>{0, 1, -5, 100, 1}},
Tensor{{5}, IND_ET, std::vector<IND_T>{2, 6, 3, -100, 2}},
Tensor{{5}, IND_ET, std::vector<IND_T>{1, 2, 2, -1, 1}},
Tensor{{5}, AXIS_ET, std::vector<AXIS_T>{-5, 1, 4, 2, 3}},
Tensor{{2, 2, 2, 1, 2},
DATA_ET,
std::vector<DATA_T>{21, 23, 15, 17, 45, 47, 39, 41, 69, 71, 63, 65, 93, 95, 87, 89}},
"5D_mixed"),
};
const auto& unsigned_test_params = generateSliceParamsUnsigned<DATA_ET, IND_ET, AXIS_ET>();
test_params.insert(test_params.end(), unsigned_test_params.begin(), unsigned_test_params.end());
return test_params;
}
std::vector<SliceParams> generateSliceCombinedParams() {
const std::vector<std::vector<SliceParams>> opTypeParams{
// Mixed types
generateSliceParams<element::Type_t::f16, element::Type_t::i32, element::Type_t::i8>(),
generateSliceParams<element::Type_t::bf16, element::Type_t::i32, element::Type_t::i16>(),
generateSliceParams<element::Type_t::f32, element::Type_t::i64, element::Type_t::i32>(),
generateSliceParams<element::Type_t::i8, element::Type_t::i16, element::Type_t::i8>(),
generateSliceParams<element::Type_t::i16, element::Type_t::i8, element::Type_t::i16>(),
generateSliceParams<element::Type_t::i32, element::Type_t::i64, element::Type_t::i32>(),
generateSliceParams<element::Type_t::i64, element::Type_t::i32, element::Type_t::i64>(),
generateSliceParams<element::Type_t::u32, element::Type_t::i32, element::Type_t::i16>(),
// Unsigned types
generateSliceParamsUnsigned<element::Type_t::u8, element::Type_t::u8, element::Type_t::u8>(),
generateSliceParamsUnsigned<element::Type_t::u16, element::Type_t::u16, element::Type_t::u16>(),
generateSliceParamsUnsigned<element::Type_t::u32, element::Type_t::u32, element::Type_t::u32>(),
generateSliceParamsUnsigned<element::Type_t::u64, element::Type_t::u64, element::Type_t::u64>(),
generateSliceParamsUnsigned<element::Type_t::u16, element::Type_t::u8, element::Type_t::u32>(),
generateSliceParamsUnsigned<element::Type_t::u32, element::Type_t::u16, element::Type_t::u8>(),
};
std::vector<SliceParams> combinedParams;
std::for_each(opTypeParams.begin(), opTypeParams.end(), [&](std::vector<SliceParams> params) {
combinedParams.insert(combinedParams.end(), params.begin(), params.end());
});
return combinedParams;
}
INSTANTIATE_TEST_SUITE_P(smoke_Slice_With_Hardcoded_Refs,
ReferenceSliceLayerTest,
::testing::ValuesIn(generateSliceCombinedParams()),
ReferenceSliceLayerTest::getTestCaseName);
} // namespace reference_tests

View File

@@ -1,29 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/exec_graph_info.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
ExecGraphTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/executable_network/exec_network_base.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
ExecutableNetworkBaseTest::getTestCaseName);
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecNetSetPrecision,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
ExecNetSetPrecision::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,72 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <utility>
#include <string>
#include <vector>
#include "behavior/executable_network/get_metric.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported, IEClassExecutableNetworkGetMetricTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetConfigTest, IEClassExecutableNetworkGetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkSetConfigTest, IEClassExecutableNetworkSetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
//
// Hetero Executable Network GetMetric
//
#ifdef ENABLE_MKL_DNN
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
#endif // ENABLE_MKL_DNN
} // namespace

View File

@@ -14,6 +14,9 @@ const std::vector<std::map<std::string, std::string>> configs = {
{}
};
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestDynamicTests,
::testing::Combine(
::testing::Values(ngraph::builder::subgraph::makeSplitConvConcat()),
@@ -23,4 +26,13 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestDynamicTests,
::testing::ValuesIn(configs)),
InferRequestDynamicTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, InferRequestDynamicTests,
::testing::Combine(
::testing::Values(ngraph::builder::subgraph::makeSplitConvConcat()),
::testing::Values(std::vector<std::pair<std::vector<size_t>, std::vector<size_t>>>{{{1, 4, 20, 20}, {1, 10, 18, 18}},
{{2, 4, 20, 20}, {2, 10, 18, 18}}}),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(HeteroConfigs)),
InferRequestDynamicTests::getTestCaseName);
} // namespace

View File

@@ -5,7 +5,7 @@
#include "behavior/infer_request/inference_chaining.hpp"
#include "common_test_utils/test_constants.hpp"
using namespace ov::test;
using namespace ov::test::behavior;
namespace {
@@ -13,11 +13,19 @@ const std::vector<std::map<std::string, std::string>> configs = {
{}
};
const std::vector<std::map<std::string, std::string>> HeteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferenceChaining,
::testing::Combine(
::testing::Values(ov::element::f32),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
OVInferenceChaining::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferenceChaining,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(HeteroConfigs)),
OVInferenceChaining::getTestCaseName);
} // namespace

View File

@@ -1,62 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_exec_network.hpp"
#include <common_test_utils/test_constants.hpp>
#include "ie_plugin_config.hpp"
using namespace ov::test;
namespace {
const std::vector<ov::element::Type> netPrecisions = {
ov::element::i8,
ov::element::i16,
ov::element::i32,
ov::element::i64,
ov::element::u8,
ov::element::u16,
ov::element::u32,
ov::element::u64,
ov::element::f16,
ov::element::f32,
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_TEMPLATE}}};
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
OVExecNetwork::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
OVExecNetwork::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
OVExecNetwork::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(heteroConfigs)),
OVExecNetwork::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,55 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_executable_network/exec_graph_info.hpp"
#include "ie_plugin_config.hpp"
#include <common_test_utils/test_constants.hpp>
using namespace ov::test::behavior;
namespace {
const std::vector<ov::element::Type_t> netPrecisions = {
ov::element::i8,
ov::element::i16,
ov::element::i32,
ov::element::i64,
ov::element::u8,
ov::element::u16,
ov::element::u32,
ov::element::u64,
ov::element::f16,
ov::element::f32,
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_TEMPLATE}}};
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVExecGraphImportExportTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
OVExecGraphImportExportTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
OVExecGraphImportExportTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
OVExecGraphImportExportTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
OVExecGraphImportExportTest,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(heteroConfigs)),
OVExecGraphImportExportTest::getTestCaseName);
} // namespace

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/config.hpp"
#include "behavior/plugin/configuration_tests.hpp"
#include <template/template_config.hpp>
using namespace BehaviorTestsDefinitions;
@@ -26,31 +26,13 @@ const std::vector<std::map<std::string, std::string>> inconfigs = {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(inconfigs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(inconfigs)),
IncorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
CorrectConfigAPITests::getTestCaseName);
} // namespace

View File

@@ -6,7 +6,7 @@
#include <string>
#include <vector>
#include "behavior/core_integration.hpp"
#include "behavior/plugin/core_integration.hpp"
using namespace BehaviorTestsDefinitions;
@@ -69,12 +69,12 @@ INSTANTIATE_TEST_SUITE_P(
// IE Class SetConfig
//
using IEClassSetConfigTestHETERO = IEClassNetworkTest;
using IEClassSetConfigTestHETERO = BehaviorTestsUtils::IEClassNetworkTest;
TEST_F(IEClassSetConfigTestHETERO, smoke_SetConfigNoThrow) {
{
Core ie = createCoreWithTemplate();
Parameter p;
InferenceEngine::Core ie = BehaviorTestsUtils::createIECoreWithTemplate();
InferenceEngine::Parameter p;
ASSERT_NO_THROW(ie.SetConfig({{HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(YES)}}, "HETERO"));
ASSERT_NO_THROW(p = ie.GetConfig("HETERO", HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)));
@@ -84,8 +84,8 @@ TEST_F(IEClassSetConfigTestHETERO, smoke_SetConfigNoThrow) {
}
{
Core ie = createCoreWithTemplate();
Parameter p;
InferenceEngine::Core ie = BehaviorTestsUtils::createIECoreWithTemplate();
InferenceEngine::Parameter p;
ASSERT_NO_THROW(ie.SetConfig({{HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(NO)}}, "HETERO"));
ASSERT_NO_THROW(p = ie.GetConfig("HETERO", HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)));
@@ -95,8 +95,8 @@ TEST_F(IEClassSetConfigTestHETERO, smoke_SetConfigNoThrow) {
}
{
Core ie = createCoreWithTemplate();
Parameter p;
InferenceEngine::Core ie = BehaviorTestsUtils::createIECoreWithTemplate();
InferenceEngine::Parameter p;
ASSERT_NO_THROW(ie.GetMetric("HETERO", METRIC_KEY(SUPPORTED_CONFIG_KEYS)));
ASSERT_NO_THROW(ie.SetConfig({{HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(YES)}}, "HETERO"));
@@ -115,11 +115,11 @@ INSTANTIATE_TEST_SUITE_P(
smoke_IEClassGetConfigTest, IEClassGetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
using IEClassGetConfigTestTEMPLATE = IEClassNetworkTest;
using IEClassGetConfigTestTEMPLATE = BehaviorTestsUtils::IEClassNetworkTest;
TEST_F(IEClassGetConfigTestTEMPLATE, smoke_GetConfigNoThrow) {
Core ie = createCoreWithTemplate();
Parameter p;
InferenceEngine::Core ie = BehaviorTestsUtils::createIECoreWithTemplate();
InferenceEngine::Parameter p;
std::string deviceName = CommonTestUtils::DEVICE_TEMPLATE;
ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS)));
@@ -139,41 +139,6 @@ TEST_F(IEClassGetConfigTestTEMPLATE, smoke_GetConfigNoThrow) {
}
}
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported, IEClassExecutableNetworkGetMetricTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "MULTI:TEMPLATE", "HETERO:TEMPLATE"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetConfigTest, IEClassExecutableNetworkGetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkSetConfigTest, IEClassExecutableNetworkSetConfigTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(
@@ -185,28 +150,4 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassLoadNetworkTest, IEClassLoadNetworkTest,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
//
// Hetero Executable Network GetMetric
//
#ifdef ENABLE_MKL_DNN
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworlGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE));
#endif // ENABLE_MKL_DNN
} // namespace

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/cpp_holders.hpp"
#include "behavior/plugin/life_time.hpp"
using namespace BehaviorTestsDefinitions;

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/version.hpp"
#include "behavior/plugin/version.hpp"
using namespace BehaviorTestsDefinitions;
@@ -13,10 +13,7 @@ const std::vector<std::map<std::string, std::string>> configs = {
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
VersionTest::getTestCaseName);
} // namespace

View File

@@ -1,41 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/test_plugin.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
BehaviorTestInput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE),
::testing::ValuesIn(configs)),
BehaviorTestOutput::getTestCaseName);
} // namespace

View File

@@ -1,21 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "hetero/query_network.hpp"
#include "ngraph_functions/builders.hpp"
#include "ngraph_functions/subgraph_builders.hpp"
namespace {
using namespace HeteroTests;
auto ConvBias = ngraph::builder::subgraph::makeConvBias();
INSTANTIATE_TEST_SUITE_P(smoke_FullySupportedTopologies, QueryNetworkTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_TEMPLATE, "HETERO:TEMPLATE", "MULTI:TEMPLATE"),
::testing::Values(ConvBias)),
QueryNetworkTest::getTestCaseName);
} // namespace

View File

@@ -19,7 +19,16 @@ std::vector<std::string> disabledTestPatterns() {
// CVS-51758
R"(.*InferRequestPreprocessConversionTest.*oLT=(NHWC|NCHW).*)",
R"(.*InferRequestPreprocessDynamicallyInSetBlobTest.*oPRC=0.*oLT=1.*)",
//Not Implemented
R"(.*Behavior.*ExecutableNetworkBaseTest.*(canSetConfigToExecNet|canSetConfigToExecNetAndCheckConfigAndCheck).*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*(CheckExecGraphInfoBeforeExecution|CheckExecGraphInfoAfterExecution|CheckExecGraphInfoSerialization).*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*canExport.*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*(CanCreateTwoExeNetworksAndCheckFunction).*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*(checkGetExecGraphInfoIsNotNullptr).*)",
R"(.*smoke_BehaviorTests.*OVExecNetwork.ieImportExportedFunction.*)",
// TODO: Round with f16 is not supported
R"(.*smoke_Hetero_BehaviorTests.*OVExecNetwork.*readFromV10IR.*)",
// TODO: execution graph is not supported
R"(.*ExecGraph.*)",

View File

@@ -26,7 +26,9 @@ ie_add_plugin(NAME ${TARGET_NAME}
SOURCES ${MAIN_SRC} ${LIBRARY_HEADERS}
VERSION_DEFINES_FOR cldnn_engine.cpp)
target_compile_options(${TARGET_NAME} PRIVATE -Os)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(${TARGET_NAME} PRIVATE -Os)
endif()
target_link_libraries(${TARGET_NAME} PRIVATE clDNN_lib pugixml::static
inference_engine

View File

@@ -14,78 +14,18 @@
#include "ie_metric_helpers.hpp"
#include "ie_plugin_config.hpp"
#include <ngraph/opsets/opset2.hpp>
#include <ngraph/opsets/opset3.hpp>
#include <ngraph/opsets/opset4.hpp>
#include <ngraph/opsets/opset6.hpp>
#include <ngraph/pass/manager.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <ie_ngraph_utils.hpp>
#include <ie_algorithm.hpp>
#include <transformations/opset_conversions/convert_opset3_to_opset2.hpp>
#include <transformations/opset_conversions/convert_opset2_to_opset1.hpp>
#include <transformations/control_flow/unroll_tensor_iterator.hpp>
#include <transformations/common_optimizations/common_optimizations.hpp>
#include <transformations/common_optimizations/lin_op_sequence_fusion.hpp>
#include <transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp>
#include "transformations/common_optimizations/convert_quantize_dequantize.hpp"
#include <transformations/op_conversions/convert_depth_to_space.hpp>
#include <transformations/op_conversions/convert_space_to_depth.hpp>
#include <transformations/op_conversions/convert_gelu.hpp>
#include <transformations/op_conversions/convert_mod.hpp>
#include <transformations/op_conversions/convert_broadcast3.hpp>
#include <transformations/op_conversions/reduce_l1_decomposition.hpp>
#include <transformations/op_conversions/reduce_l2_decomposition.hpp>
#include <transformations/op_conversions/convert_pad_to_group_conv.hpp>
#include <transformations/op_conversions/softplus_decomposition.hpp>
#include <transformations/op_conversions/convert_space_to_batch.hpp>
#include <transformations/op_conversions/convert_batch_to_space.hpp>
#include <transformations/op_conversions/convert_reduce_to_pooling.hpp>
#include <transformations/op_conversions/convert_shuffle_channels3.hpp>
#include <transformations/op_conversions/hswish_decomposition.hpp>
#include <transformations/op_conversions/hsigmoid_decomposition.hpp>
#include <transformations/op_conversions/log_softmax_decomposition.hpp>
#include <transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp>
#include <transformations/op_conversions/convert_subtract.hpp>
#include <transformations/op_conversions/convert_ti_to_sequences.hpp>
#include <transformations/op_conversions/gru_cell_decomposition.hpp>
#include <transformations/op_conversions/lstm_cell_decomposition.hpp>
#include <transformations/op_conversions/rnn_cell_decomposition.hpp>
#include <transformations/op_conversions/mvn6_decomposition.hpp>
#include <transformations/op_conversions/bidirectional_sequences_decomposition.hpp>
#include <transformations/op_conversions/convert_previous_nms_to_nms_5.hpp>
#include <transformations/op_conversions/convert_nms_to_nms_ie_internal.hpp>
#include <transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp>
#include <transformations/op_conversions/convert_gather_downgrade.hpp>
#include <transformations/op_conversions/convert_gather_0d.hpp>
#include <transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp>
#include <transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp>
#include "transformations/op_conversions/softmax_decomposition.hpp"
#include <transformations/convert_precision.hpp>
#include <transformations/init_node_info.hpp>
#include <transformations/rt_info/fused_names_attribute.hpp>
#include <transformations/low_precision/disable_convert_constant_folding_on_const_path.hpp>
#include <low_precision/pull_reshape_through_dequantization.hpp>
#include <low_precision/pull_transpose_through_dequantization.hpp>
#include <low_precision/convolution.hpp>
#include <low_precision/convolution_backprop_data.hpp>
#include <low_precision/group_convolution.hpp>
#include <low_precision/low_precision.hpp>
#include <low_precision/mat_mul.hpp>
#include <low_precision/multiply_to_group_convolution.hpp>
#include <low_precision/strided_slice.hpp>
#include <low_precision/network_helper.hpp>
#include "cldnn_engine.h"
#include "cldnn_executable_network.h"
#include "cldnn_transformations_pipeline.h"
#include "cldnn_custom_layer.h"
#include "cldnn_itt.h"
#include "gpu/gpu_config.hpp"
#include <transformations/rt_info/fused_names_attribute.hpp>
#include "cldnn/runtime/device_query.hpp"
#include "cldnn/runtime/debug_configuration.hpp"
@@ -137,350 +77,15 @@ cldnn::device_info clDNNEngine::GetDeviceInfo(const std::map<std::string, std::s
return device_info;
}
template<typename T>
static bool disableReduceDecomposition(const std::shared_ptr<const ngraph::Node> node) {
if (auto op = std::dynamic_pointer_cast<const T>(node)) {
bool fp16_batch_not_1 = op->get_element_type() == ngraph::element::f16 && op->input(0).get_shape()[0] != 1;
return !fp16_batch_not_1;
}
return false;
}
InferenceEngine::CNNNetwork clDNNEngine::CloneAndTransformNetwork(const InferenceEngine::CNNNetwork& network,
const CLDNNPlugin::Config& config) const {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "clDNNEngine::CloneAndTransformNetwork");
CNNNetwork clonedNetwork = InferenceEngine::details::cloneNetwork(network);
if (clonedNetwork.getFunction()) {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "clDNNEngine::TransformNetwork");
auto nGraphFunc = clonedNetwork.getFunction();
using const_node_ptr = const std::shared_ptr<const ngraph::Node>;
bool enableInt8;
{
ngraph::pass::Manager manager;
enableInt8 = config.enableInt8 && ngraph::pass::low_precision::LowPrecision::isFunctionQuantized(nGraphFunc);
if (enableInt8) {
manager.register_pass<ngraph::pass::DisableConvertConstantFoldingOnConstPath>(
std::vector<ngraph::element::Type>{ ngraph::element::i8, ngraph::element::u8, ngraph::element::i4, ngraph::element::u4 });
}
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::CommonOptimizations>();
if (!config.enable_loop_unrolling) {
manager.register_pass<ngraph::pass::BidirectionalLSTMSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalGRUSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalRNNSequenceDecomposition>();
}
manager.register_pass<ngraph::pass::ConvertRNNSequenceToTensorIterator>();
manager.register_pass<ngraph::pass::ConvertGRUSequenceToTensorIterator>();
manager.register_pass<ngraph::pass::ConvertLSTMSequenceToTensorIterator>();
manager.register_pass<ngraph::pass::ConvertOpSet3ToOpSet2>();
manager.register_pass<ngraph::pass::ConvertOpSet2ToOpSet1>();
manager.register_pass<ngraph::pass::ConvertTensorIteratorToGRUSequence>();
manager.register_pass<ngraph::pass::ConvertTensorIteratorToLSTMSequence>();
manager.register_pass<ngraph::pass::ConvertTensorIteratorToRNNSequence>();
manager.register_pass<ngraph::pass::LSTMCellDecomposition>();
manager.register_pass<ngraph::pass::GRUCellDecomposition>();
manager.register_pass<ngraph::pass::RNNCellDecomposition>();
if (config.enable_loop_unrolling) {
manager.register_pass<ngraph::pass::BidirectionalLSTMSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalGRUSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalRNNSequenceDecomposition>();
}
manager.register_pass<ngraph::pass::ConvertNMS1ToNMS5>();
manager.register_pass<ngraph::pass::ConvertNMS3ToNMS5>();
manager.register_pass<ngraph::pass::ConvertNMS4ToNMS5>();
manager.register_pass<ngraph::pass::ConvertNMSToNMSIEInternal>();
manager.register_pass<ngraph::pass::ConvertGather0D>();
static const precisions_array convert_precision_list {
{ngraph::element::i64, ngraph::element::i32},
{ngraph::element::u64, ngraph::element::i32},
{ngraph::element::u16, ngraph::element::i32},
{ngraph::element::u32, ngraph::element::i32},
{ngraph::element::boolean, ngraph::element::u8},
{ngraph::element::i4, ngraph::element::i8},
{ngraph::element::u4, ngraph::element::u8},
};
manager.register_pass<ngraph::pass::ConvertPrecision>(convert_precision_list);
auto pass_config = manager.get_pass_config();
// SpaceToDepth/DepthToSpace node implementation supports only equal input/output tensors with rank <= 5
pass_config->set_callback<ngraph::pass::ConvertSpaceToDepth,
ngraph::pass::ConvertDepthToSpace>(
[](const_node_ptr &node) -> bool {
return node->input_value(0).get_shape().size() <= 5lu &&
node->input_value(0).get_shape().size() == node->get_output_shape(0).size();
});
pass_config->set_callback<ngraph::pass::ConvertBatchToSpace,
ngraph::pass::ConvertSpaceToBatch>(
[](const_node_ptr &node) -> bool {
const auto & rank = node->input(0).get_partial_shape().rank().get_length();
return rank <= 5lu;
});
pass_config->set_callback<ngraph::pass::ConvertReduceSumToPooling>(
[](const_node_ptr &node) -> bool {
return disableReduceDecomposition<ngraph::opset1::ReduceSum>(node);
});
pass_config->set_callback<ngraph::pass::ConvertReduceMeanToPooling>(
[](const_node_ptr &node) -> bool {
return disableReduceDecomposition<ngraph::opset1::ReduceMean>(node);
});
pass_config->set_callback<ngraph::pass::ConvertReduceMaxToPooling>(
[](const_node_ptr &node) -> bool {
return disableReduceDecomposition<ngraph::opset1::ReduceMax>(node);
});
auto isCellPrimitiveSupported = [](const_node_ptr &node) -> bool {
if (std::dynamic_pointer_cast<const ngraph::opset6::RNNCell>(node)) {
return false;
} else if (std::dynamic_pointer_cast<const ngraph::opset6::GRUCell>(node)) {
return false;
} else if (const auto &lstm_cell = std::dynamic_pointer_cast<const ngraph::opset6::LSTMCell>(node)) {
return lstm_cell->get_clip() == 0.0f && lstm_cell->get_activations() == std::vector<std::string>{"sigmoid", "tanh", "tanh"};
} else if (const auto &lstm_cell_v1 = std::dynamic_pointer_cast<const ngraph::opset1::LSTMCell>(node)) {
return lstm_cell_v1->get_clip() == 0.0f && lstm_cell_v1->get_activations() == std::vector<std::string>{"sigmoid", "tanh", "tanh"};
}
return false;
};
// Sequences supported by the plugin shouldn't be converted to TensorIterator.
// sequence_length input is not supported in all Sequences, so if is_seq_len_provided() == true, we
// should always convert to TensorIterator.
// RNN/GRU Sequences are not supported in GPU plugin
// LSTM Sequence supported with clip == 0, and activations have default values (sigmoid, tanh, tanh)
auto isSequencePrimitiveSupported = [](const_node_ptr &node) -> bool {
const auto& data = node->input(0);
const auto& data_pshape = data.get_partial_shape();
if (data_pshape.rank().is_static() && data_pshape.rank().get_length() > 1 && !data_pshape[1].is_static())
return false;
auto max_seq_len = data.get_shape().at(1);
if (std::dynamic_pointer_cast<const ngraph::opset6::RNNSequence>(node)) {
return false;
} else if (std::dynamic_pointer_cast<const ngraph::opset6::GRUSequence>(node)) {
return false;
} else if (const auto &lstm_seq = std::dynamic_pointer_cast<const ngraph::opset6::LSTMSequence>(node)) {
return lstm_seq->get_clip() == 0.0f &&
lstm_seq->get_activations() == std::vector<std::string>{"sigmoid", "tanh", "tanh"} &&
!ngraph::op::util::is_seq_len_provided(lstm_seq->get_input_node_shared_ptr(3),
max_seq_len);
}
return false;
};
pass_config->set_callback<ngraph::pass::RNNCellDecomposition,
ngraph::pass::GRUCellDecomposition,
ngraph::pass::LSTMCellDecomposition>(
[isCellPrimitiveSupported](const_node_ptr &node) -> bool {
return isCellPrimitiveSupported(node);
});
pass_config->set_callback<ngraph::pass::ConvertRNNSequenceToTensorIterator,
ngraph::pass::ConvertGRUSequenceToTensorIterator,
ngraph::pass::ConvertLSTMSequenceToTensorIterator>(
[isSequencePrimitiveSupported](const_node_ptr &node) -> bool {
return isSequencePrimitiveSupported(node);
});
pass_config->set_callback<ngraph::pass::ConvertTensorIteratorToRNNSequence,
ngraph::pass::ConvertTensorIteratorToLSTMSequence,
ngraph::pass::ConvertTensorIteratorToGRUSequence>(
[isCellPrimitiveSupported](const_node_ptr &node) -> bool {
if (const auto& ti_op = std::dynamic_pointer_cast<const ngraph::op::TensorIterator>(node)) {
size_t count_rnn = 0;
for (const auto &op : ti_op->get_body()->get_ops())
count_rnn += isCellPrimitiveSupported(op);
return count_rnn != 1;
}
return true;
});
pass_config->set_callback<ngraph::pass::MVN6Decomposition>(
[](const_node_ptr &node) -> bool {
const auto mvn = std::dynamic_pointer_cast<const ngraph::op::v6::MVN>(node);
if (mvn != nullptr && node->get_input_size() == 2) {
if (auto axesNode = dynamic_cast<ngraph::op::v0::Constant*>(mvn->get_input_node_ptr(1))) {
auto axesVal = axesNode->cast_vector<int>();
auto& mvnShape = mvn->get_output_shape(0);
for (int32_t& axis : axesVal)
axis = axis < 0 ? axis + mvnShape.size() : axis;
std::sort(axesVal.begin(), axesVal.end());
if (mvnShape.size() == 1)
return false;
if (mvnShape.size() > 5 || (mvnShape.size() != axesVal.size() + 1 && mvnShape.size() != axesVal.size() + 2))
return false;
int value = mvnShape.size() - 1;
for (int i = axesVal.size() - 1; i >= 0; i--, value--) {
if (axesVal[i] != value)
return false;
}
return true;
}
}
return false;
});
pass_config->enable<ngraph::pass::SoftmaxDecomposition>();
pass_config->set_callback<ngraph::pass::SoftmaxDecomposition>(
[](const_node_ptr &node) -> bool {
return node->input_value(0).get_partial_shape().rank().get_length() <= 5;
});
// List of enabled/disabled transformations
pass_config->disable<ngraph::pass::ConvertGELU>();
pass_config->disable<ngraph::pass::ConvertMod>();
pass_config->disable<ngraph::pass::ConvertShuffleChannels3>();
pass_config->disable<ngraph::pass::HSwishDecomposition>();
pass_config->disable<ngraph::pass::HSigmoidDecomposition>();
pass_config->disable<ngraph::pass::ReduceL1Decomposition>();
pass_config->disable<ngraph::pass::ReduceL2Decomposition>();
pass_config->disable<ngraph::pass::SoftPlusDecomposition>();
pass_config->disable<ngraph::pass::LogSoftmaxDecomposition>();
pass_config->disable<ngraph::pass::ConvertBroadcast3>();
pass_config->disable<ngraph::pass::WeightsDequantizeToFakeQuantize>();
pass_config->disable<ngraph::pass::SimplifyCTCGreedyDecoderSeqLen>();
pass_config->enable<ngraph::pass::ConvertGather8ToGather7>();
if (!config.enable_loop_unrolling) {
pass_config->disable<ngraph::pass::ConvertTensorIteratorToRNNSequence>();
pass_config->disable<ngraph::pass::ConvertTensorIteratorToLSTMSequence>();
pass_config->disable<ngraph::pass::ConvertTensorIteratorToGRUSequence>();
}
pass_config->enable<ngraph::pass::ConvertInterpolate1ToInterpolate4>();
if (enableInt8) {
pass_config->set_callback<ngraph::pass::ConvertQuantizeDequantize>([](const_node_ptr &node) -> bool {
return ngraph::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForMultiply(node);
});
pass_config->set_callback<ngraph::pass::ConvertSubtract>([](const_node_ptr &node) -> bool {
return ngraph::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForSubtract(node);
});
}
manager.run_passes(nGraphFunc);
}
if (enableInt8) {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "clDNNEngine::TransformNetwork::LPT");
using namespace ngraph::pass::low_precision;
// Conversion to FP32 might be needed for quantized models that face any fp16 related issues (e.g. overflow) for non-quantized layers
// With this key users can work-around such issues
if (!config.enable_fp16_for_quantized_models) {
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::ConvertPrecision>(precisions_array {{ ngraph::element::f16, ngraph::element::f32 }});
manager.run_passes(nGraphFunc);
}
auto supportedPrecisions = std::vector<OperationPrecisionRestriction>({
OperationPrecisionRestriction::create<ngraph::opset1::Convolution>({
{0, {ngraph::element::u8, ngraph::element::i8}},
{1, {ngraph::element::i8}},
}),
OperationPrecisionRestriction::create<ngraph::opset1::ConvolutionBackpropData>({
{0, {ngraph::element::u8, ngraph::element::i8}},
{1, {ngraph::element::i8}}
}),
OperationPrecisionRestriction::create<ngraph::opset1::GroupConvolution>({
{0, {ngraph::element::u8, ngraph::element::i8}},
{1, {ngraph::element::i8}}
}),
OperationPrecisionRestriction::create<ngraph::opset1::StridedSlice>({})
});
auto perTensorQuantization = std::vector<OperationPerTensorQuantizationRestriction>({
OperationPerTensorQuantizationRestriction::create<ngraph::opset1::Convolution>({0}),
OperationPerTensorQuantizationRestriction::create<ngraph::opset1::ConvolutionBackpropData>({0}),
});
ngraph::pass::Manager lptManager;
auto lptPassConfig = lptManager.get_pass_config();
lptPassConfig->disable<ngraph::pass::low_precision::StridedSliceTransformation>();
lptPassConfig->set_callback<ngraph::pass::low_precision::MarkupPrecisions>([](const_node_ptr& node) -> bool {
if (const auto mulitply = std::dynamic_pointer_cast<const ngraph::opset1::Multiply>(node)) {
return !MultiplyToGroupConvolutionTransformation::canBeTransformedToGroupConvolution(mulitply);
}
return false;
});
lptPassConfig->set_callback<ConvolutionBackpropDataTransformation>([](const_node_ptr& node) -> bool {
auto fillStaticChannel = [](const ngraph::PartialShape& shape, size_t& channel) -> bool {
const auto rank = shape.rank();
if (rank.is_dynamic()) {
return false;
}
if (rank.get_length() < 2ul) {
return false;
}
const auto dimension = shape[1];
if (dimension.is_dynamic()) {
return false;
}
channel = dimension.get_length();
return true;
};
size_t inputChannels;
if (!fillStaticChannel(node->get_input_partial_shape(0), inputChannels)) {
return true;
}
size_t outputChannels;
if (!fillStaticChannel(node->get_output_partial_shape(0), outputChannels)) {
return true;
}
if ((inputChannels % 4 != 0) || (outputChannels % 16 != 0)) {
return true;
}
return LayerTransformation::isAsymmetricQuantization(node) || WeightableLayerTransformation::isAsymmetricOnWeights(node);
});
lptPassConfig->set_callback<MatMulTransformation>([](const_node_ptr& node) -> bool {
return MatMulTransformation::is3DTensorOnActivations(node);
});
lptManager.register_pass<LowPrecision>(supportedPrecisions, perTensorQuantization);
lptManager.run_passes(nGraphFunc);
}
{
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "clDNNEngine::TransformNetwork::RunPasses");
ngraph::pass::Manager manager;
// This ConstantFolding pass is added to fold reshapes added for constant inputs on NMS internal operation which prevents upper-bound calculation
// TODO: check why we have these reshapes
manager.register_pass<ngraph::pass::ConstantFolding>();
manager.register_pass<ngraph::pass::UnrollTensorIterator>();
auto pass_config = manager.get_pass_config();
pass_config->set_callback<ngraph::pass::UnrollTensorIterator>(
[config](const std::shared_ptr<const ngraph::Node> &node) -> bool {
auto sub_graph_op = std::dynamic_pointer_cast<const ngraph::op::util::SubGraphOp>(node);
int64_t num_iter = sub_graph_op->get_num_iterations();
if (num_iter == 1) {
return false;
}
return !config.enable_loop_unrolling;
});
manager.run_passes(nGraphFunc);
}
TransformationsPipeline transformations(config);
transformations.apply(nGraphFunc);
}
GPU_DEBUG_GET_INSTANCE(debug_config);

View File

@@ -203,6 +203,7 @@ CLDNNExecutionContextImpl::CLDNNExecutionContextImpl(const std::shared_ptr<IInfe
lock.clear(std::memory_order_relaxed);
gpu_handle_param _context_id = nullptr;
gpu_handle_param _va_device = nullptr;
int target_tile_id = -1;
if (params.size()) {
// parameter map is non-empty
@@ -216,13 +217,17 @@ CLDNNExecutionContextImpl::CLDNNExecutionContextImpl(const std::shared_ptr<IInfe
} else {
IE_THROW() << "Invalid execution context type" << contextTypeStr;
}
auto tile_id_itr = params.find(GPU_PARAM_KEY(TILE_ID));
if (tile_id_itr != params.end()) {
target_tile_id = tile_id_itr->second.as<int>();
}
}
// TODO: Parameterize this based on plugin config and compilation options
auto engine_type = cldnn::engine_types::ocl;
auto runtime_type = cldnn::runtime_types::ocl;
// Use actual runtime and engine types
cldnn::device_query device_query(engine_type, runtime_type, _context_id, _va_device);
cldnn::device_query device_query(engine_type, runtime_type, _context_id, _va_device, target_tile_id);
auto device_map = device_query.get_available_devices();
auto iter = device_map.find(m_config.device_id);

View File

@@ -0,0 +1,429 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <limits>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>
#include <tuple>
#include <cctype>
#include <memory>
#include "cldnn_transformations_pipeline.h"
#include "ie_metric_helpers.hpp"
#include "ie_plugin_config.hpp"
#include <ngraph/opsets/opset2.hpp>
#include <ngraph/opsets/opset3.hpp>
#include <ngraph/opsets/opset4.hpp>
#include <ngraph/opsets/opset6.hpp>
#include <ngraph/pass/manager.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <ie_ngraph_utils.hpp>
#include <ie_algorithm.hpp>
#include <transformations/opset_conversions/convert_opset3_to_opset2.hpp>
#include <transformations/opset_conversions/convert_opset2_to_opset1.hpp>
#include <transformations/control_flow/unroll_tensor_iterator.hpp>
#include <transformations/common_optimizations/common_optimizations.hpp>
#include <transformations/common_optimizations/lin_op_sequence_fusion.hpp>
#include <transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp>
#include "transformations/common_optimizations/convert_quantize_dequantize.hpp"
#include <transformations/op_conversions/convert_depth_to_space.hpp>
#include <transformations/op_conversions/convert_space_to_depth.hpp>
#include <transformations/op_conversions/convert_gelu.hpp>
#include <transformations/op_conversions/convert_mod.hpp>
#include <transformations/op_conversions/convert_broadcast3.hpp>
#include <transformations/op_conversions/reduce_l1_decomposition.hpp>
#include <transformations/op_conversions/reduce_l2_decomposition.hpp>
#include <transformations/op_conversions/convert_pad_to_group_conv.hpp>
#include <transformations/op_conversions/softplus_decomposition.hpp>
#include <transformations/op_conversions/convert_space_to_batch.hpp>
#include <transformations/op_conversions/convert_batch_to_space.hpp>
#include <transformations/op_conversions/convert_reduce_to_pooling.hpp>
#include <transformations/op_conversions/convert_shuffle_channels3.hpp>
#include <transformations/op_conversions/hswish_decomposition.hpp>
#include <transformations/op_conversions/hsigmoid_decomposition.hpp>
#include <transformations/op_conversions/log_softmax_decomposition.hpp>
#include <transformations/op_conversions/convert_sequences_to_tensor_iterator.hpp>
#include <transformations/op_conversions/convert_subtract.hpp>
#include <transformations/op_conversions/convert_ti_to_sequences.hpp>
#include <transformations/op_conversions/gru_cell_decomposition.hpp>
#include <transformations/op_conversions/lstm_cell_decomposition.hpp>
#include <transformations/op_conversions/rnn_cell_decomposition.hpp>
#include <transformations/op_conversions/mvn6_decomposition.hpp>
#include <transformations/op_conversions/bidirectional_sequences_decomposition.hpp>
#include <transformations/op_conversions/convert_previous_nms_to_nms_5.hpp>
#include <transformations/op_conversions/convert_nms_to_nms_ie_internal.hpp>
#include <transformations/op_conversions/convert_interpolate1_to_interpolate4.hpp>
#include <transformations/op_conversions/convert_gather_downgrade.hpp>
#include <transformations/op_conversions/convert_gather_0d.hpp>
#include <transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp>
#include <transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp>
#include "transformations/op_conversions/softmax_decomposition.hpp"
#include <transformations/convert_precision.hpp>
#include <transformations/init_node_info.hpp>
#include <transformations/rt_info/fused_names_attribute.hpp>
#include <transformations/low_precision/disable_convert_constant_folding_on_const_path.hpp>
#include <low_precision/pull_reshape_through_dequantization.hpp>
#include <low_precision/pull_transpose_through_dequantization.hpp>
#include <low_precision/convolution.hpp>
#include <low_precision/convolution_backprop_data.hpp>
#include <low_precision/group_convolution.hpp>
#include <low_precision/low_precision.hpp>
#include <low_precision/mat_mul.hpp>
#include <low_precision/multiply_to_group_convolution.hpp>
#include <low_precision/strided_slice.hpp>
#include <low_precision/network_helper.hpp>
#include "cldnn_itt.h"
namespace {
template<typename T>
static bool disableReduceDecomposition(const std::shared_ptr<const ngraph::Node> node) {
if (auto op = std::dynamic_pointer_cast<const T>(node)) {
bool fp16_batch_not_1 = op->get_element_type() == ngraph::element::f16 && op->input(0).get_shape()[0] != 1;
return !fp16_batch_not_1;
}
return false;
}
} // namespace
namespace CLDNNPlugin {
void TransformationsPipeline::apply(std::shared_ptr<ov::Function> func) {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "TransformationsPipeline::apply");
using const_node_ptr = const std::shared_ptr<const ngraph::Node>;
bool enableInt8;
{
ngraph::pass::Manager manager;
enableInt8 = config.enableInt8 && ngraph::pass::low_precision::LowPrecision::isFunctionQuantized(func);
if (enableInt8) {
manager.register_pass<ngraph::pass::DisableConvertConstantFoldingOnConstPath>(
std::vector<ngraph::element::Type>{ ngraph::element::i8, ngraph::element::u8, ngraph::element::i4, ngraph::element::u4 });
}
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::CommonOptimizations>();
if (!config.enable_loop_unrolling) {
manager.register_pass<ngraph::pass::BidirectionalLSTMSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalGRUSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalRNNSequenceDecomposition>();
}
manager.register_pass<ngraph::pass::ConvertRNNSequenceToTensorIterator>();
manager.register_pass<ngraph::pass::ConvertGRUSequenceToTensorIterator>();
manager.register_pass<ngraph::pass::ConvertLSTMSequenceToTensorIterator>();
manager.register_pass<ngraph::pass::ConvertOpSet3ToOpSet2>();
manager.register_pass<ngraph::pass::ConvertOpSet2ToOpSet1>();
manager.register_pass<ngraph::pass::ConvertTensorIteratorToGRUSequence>();
manager.register_pass<ngraph::pass::ConvertTensorIteratorToLSTMSequence>();
manager.register_pass<ngraph::pass::ConvertTensorIteratorToRNNSequence>();
manager.register_pass<ngraph::pass::LSTMCellDecomposition>();
manager.register_pass<ngraph::pass::GRUCellDecomposition>();
manager.register_pass<ngraph::pass::RNNCellDecomposition>();
if (config.enable_loop_unrolling) {
manager.register_pass<ngraph::pass::BidirectionalLSTMSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalGRUSequenceDecomposition>();
manager.register_pass<ngraph::pass::BidirectionalRNNSequenceDecomposition>();
}
manager.register_pass<ngraph::pass::ConvertNMS1ToNMS5>();
manager.register_pass<ngraph::pass::ConvertNMS3ToNMS5>();
manager.register_pass<ngraph::pass::ConvertNMS4ToNMS5>();
manager.register_pass<ngraph::pass::ConvertNMSToNMSIEInternal>();
manager.register_pass<ngraph::pass::ConvertGather0D>();
static const precisions_array convert_precision_list {
{ngraph::element::i64, ngraph::element::i32},
{ngraph::element::u64, ngraph::element::i32},
{ngraph::element::u16, ngraph::element::i32},
{ngraph::element::u32, ngraph::element::i32},
{ngraph::element::boolean, ngraph::element::u8},
{ngraph::element::i4, ngraph::element::i8},
{ngraph::element::u4, ngraph::element::u8},
};
manager.register_pass<ngraph::pass::ConvertPrecision>(convert_precision_list);
auto pass_config = manager.get_pass_config();
// SpaceToDepth/DepthToSpace node implementation supports only equal input/output tensors with rank <= 5
pass_config->set_callback<ngraph::pass::ConvertSpaceToDepth,
ngraph::pass::ConvertDepthToSpace>(
[](const_node_ptr &node) -> bool {
return node->input_value(0).get_shape().size() <= 5lu &&
node->input_value(0).get_shape().size() == node->get_output_shape(0).size();
});
pass_config->set_callback<ngraph::pass::ConvertBatchToSpace,
ngraph::pass::ConvertSpaceToBatch>(
[](const_node_ptr &node) -> bool {
const auto & rank = node->input(0).get_partial_shape().rank().get_length();
return rank <= 5lu;
});
pass_config->set_callback<ngraph::pass::ConvertReduceSumToPooling>(
[](const_node_ptr &node) -> bool {
return disableReduceDecomposition<ngraph::opset1::ReduceSum>(node);
});
pass_config->set_callback<ngraph::pass::ConvertReduceMeanToPooling>(
[](const_node_ptr &node) -> bool {
return disableReduceDecomposition<ngraph::opset1::ReduceMean>(node);
});
pass_config->set_callback<ngraph::pass::ConvertReduceMaxToPooling>(
[](const_node_ptr &node) -> bool {
return disableReduceDecomposition<ngraph::opset1::ReduceMax>(node);
});
auto isCellPrimitiveSupported = [](const_node_ptr &node) -> bool {
if (std::dynamic_pointer_cast<const ngraph::opset6::RNNCell>(node)) {
return false;
} else if (std::dynamic_pointer_cast<const ngraph::opset6::GRUCell>(node)) {
return false;
} else if (const auto &lstm_cell = std::dynamic_pointer_cast<const ngraph::opset6::LSTMCell>(node)) {
return lstm_cell->get_clip() == 0.0f && lstm_cell->get_activations() == std::vector<std::string>{"sigmoid", "tanh", "tanh"};
} else if (const auto &lstm_cell_v1 = std::dynamic_pointer_cast<const ngraph::opset1::LSTMCell>(node)) {
return lstm_cell_v1->get_clip() == 0.0f && lstm_cell_v1->get_activations() == std::vector<std::string>{"sigmoid", "tanh", "tanh"};
}
return false;
};
// Sequences supported by the plugin shouldn't be converted to TensorIterator.
// sequence_length input is not supported in all Sequences, so if is_seq_len_provided() == true, we
// should always convert to TensorIterator.
// RNN/GRU Sequences are not supported in GPU plugin
// LSTM Sequence supported with clip == 0, and activations have default values (sigmoid, tanh, tanh)
auto isSequencePrimitiveSupported = [](const_node_ptr &node) -> bool {
const auto& data = node->input(0);
const auto& data_pshape = data.get_partial_shape();
if (data_pshape.rank().is_static() && data_pshape.rank().get_length() > 1 && !data_pshape[1].is_static())
return false;
auto max_seq_len = data.get_shape().at(1);
if (std::dynamic_pointer_cast<const ngraph::opset6::RNNSequence>(node)) {
return false;
} else if (std::dynamic_pointer_cast<const ngraph::opset6::GRUSequence>(node)) {
return false;
} else if (const auto &lstm_seq = std::dynamic_pointer_cast<const ngraph::opset6::LSTMSequence>(node)) {
return lstm_seq->get_clip() == 0.0f &&
lstm_seq->get_activations() == std::vector<std::string>{"sigmoid", "tanh", "tanh"} &&
!ngraph::op::util::is_seq_len_provided(lstm_seq->get_input_node_shared_ptr(3),
max_seq_len);
}
return false;
};
pass_config->set_callback<ngraph::pass::RNNCellDecomposition,
ngraph::pass::GRUCellDecomposition,
ngraph::pass::LSTMCellDecomposition>(
[isCellPrimitiveSupported](const_node_ptr &node) -> bool {
return isCellPrimitiveSupported(node);
});
pass_config->set_callback<ngraph::pass::ConvertRNNSequenceToTensorIterator,
ngraph::pass::ConvertGRUSequenceToTensorIterator,
ngraph::pass::ConvertLSTMSequenceToTensorIterator>(
[isSequencePrimitiveSupported](const_node_ptr &node) -> bool {
return isSequencePrimitiveSupported(node);
});
pass_config->set_callback<ngraph::pass::ConvertTensorIteratorToRNNSequence,
ngraph::pass::ConvertTensorIteratorToLSTMSequence,
ngraph::pass::ConvertTensorIteratorToGRUSequence>(
[isCellPrimitiveSupported](const_node_ptr &node) -> bool {
if (const auto& ti_op = std::dynamic_pointer_cast<const ngraph::op::TensorIterator>(node)) {
size_t count_rnn = 0;
for (const auto &op : ti_op->get_body()->get_ops())
count_rnn += isCellPrimitiveSupported(op);
return count_rnn != 1;
}
return true;
});
pass_config->set_callback<ngraph::pass::MVN6Decomposition>(
[](const_node_ptr &node) -> bool {
const auto mvn = std::dynamic_pointer_cast<const ngraph::op::v6::MVN>(node);
if (mvn != nullptr && node->get_input_size() == 2) {
if (auto axesNode = dynamic_cast<ngraph::op::v0::Constant*>(mvn->get_input_node_ptr(1))) {
auto axesVal = axesNode->cast_vector<int>();
auto& mvnShape = mvn->get_output_shape(0);
for (int32_t& axis : axesVal)
axis = axis < 0 ? axis + mvnShape.size() : axis;
std::sort(axesVal.begin(), axesVal.end());
if (mvnShape.size() == 1)
return false;
if (mvnShape.size() > 5 || (mvnShape.size() != axesVal.size() + 1 && mvnShape.size() != axesVal.size() + 2))
return false;
int value = mvnShape.size() - 1;
for (int i = axesVal.size() - 1; i >= 0; i--, value--) {
if (axesVal[i] != value)
return false;
}
return true;
}
}
return false;
});
pass_config->enable<ngraph::pass::SoftmaxDecomposition>();
pass_config->set_callback<ngraph::pass::SoftmaxDecomposition>(
[](const_node_ptr &node) -> bool {
return node->input_value(0).get_partial_shape().rank().get_length() <= 5;
});
// List of enabled/disabled transformations
pass_config->disable<ngraph::pass::ConvertGELU>();
pass_config->disable<ngraph::pass::ConvertMod>();
pass_config->disable<ngraph::pass::ConvertShuffleChannels3>();
pass_config->disable<ngraph::pass::HSwishDecomposition>();
pass_config->disable<ngraph::pass::HSigmoidDecomposition>();
pass_config->disable<ngraph::pass::ReduceL1Decomposition>();
pass_config->disable<ngraph::pass::ReduceL2Decomposition>();
pass_config->disable<ngraph::pass::SoftPlusDecomposition>();
pass_config->disable<ngraph::pass::LogSoftmaxDecomposition>();
pass_config->disable<ngraph::pass::ConvertBroadcast3>();
pass_config->disable<ngraph::pass::WeightsDequantizeToFakeQuantize>();
pass_config->disable<ngraph::pass::SimplifyCTCGreedyDecoderSeqLen>();
pass_config->enable<ngraph::pass::ConvertGather8ToGather7>();
if (!config.enable_loop_unrolling) {
pass_config->disable<ngraph::pass::ConvertTensorIteratorToRNNSequence>();
pass_config->disable<ngraph::pass::ConvertTensorIteratorToLSTMSequence>();
pass_config->disable<ngraph::pass::ConvertTensorIteratorToGRUSequence>();
}
pass_config->enable<ngraph::pass::ConvertInterpolate1ToInterpolate4>();
if (enableInt8) {
pass_config->set_callback<ngraph::pass::ConvertQuantizeDequantize>([](const_node_ptr &node) -> bool {
return ngraph::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForMultiply(node);
});
pass_config->set_callback<ngraph::pass::ConvertSubtract>([](const_node_ptr &node) -> bool {
return ngraph::pass::low_precision::NetworkHelper::areQuantizeAndDequantizeSupportedForSubtract(node);
});
}
manager.run_passes(func);
}
if (enableInt8) {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "TransformationsPipeline::apply::lpt");
using namespace ngraph::pass::low_precision;
// Conversion to FP32 might be needed for quantized models that face any fp16 related issues (e.g. overflow) for non-quantized layers
// With this key users can work-around such issues
if (!config.enable_fp16_for_quantized_models) {
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::ConvertPrecision>(precisions_array {{ ngraph::element::f16, ngraph::element::f32 }});
manager.run_passes(func);
}
auto supportedPrecisions = std::vector<OperationPrecisionRestriction>({
OperationPrecisionRestriction::create<ngraph::opset1::Convolution>({
{0, {ngraph::element::u8, ngraph::element::i8}},
{1, {ngraph::element::i8}},
}),
OperationPrecisionRestriction::create<ngraph::opset1::ConvolutionBackpropData>({
{0, {ngraph::element::u8, ngraph::element::i8}},
{1, {ngraph::element::i8}}
}),
OperationPrecisionRestriction::create<ngraph::opset1::GroupConvolution>({
{0, {ngraph::element::u8, ngraph::element::i8}},
{1, {ngraph::element::i8}}
}),
OperationPrecisionRestriction::create<ngraph::opset1::StridedSlice>({})
});
auto perTensorQuantization = std::vector<OperationPerTensorQuantizationRestriction>({
OperationPerTensorQuantizationRestriction::create<ngraph::opset1::Convolution>({0}),
OperationPerTensorQuantizationRestriction::create<ngraph::opset1::ConvolutionBackpropData>({0}),
});
ngraph::pass::Manager lptManager;
auto lptPassConfig = lptManager.get_pass_config();
lptPassConfig->disable<ngraph::pass::low_precision::StridedSliceTransformation>();
lptPassConfig->set_callback<ngraph::pass::low_precision::MarkupPrecisions>([](const_node_ptr& node) -> bool {
if (const auto mulitply = std::dynamic_pointer_cast<const ngraph::opset1::Multiply>(node)) {
return !MultiplyToGroupConvolutionTransformation::canBeTransformedToGroupConvolution(mulitply);
}
return false;
});
lptPassConfig->set_callback<ConvolutionBackpropDataTransformation>([](const_node_ptr& node) -> bool {
auto fillStaticChannel = [](const ngraph::PartialShape& shape, size_t& channel) -> bool {
const auto rank = shape.rank();
if (rank.is_dynamic()) {
return false;
}
if (rank.get_length() < 2ul) {
return false;
}
const auto dimension = shape[1];
if (dimension.is_dynamic()) {
return false;
}
channel = dimension.get_length();
return true;
};
size_t inputChannels;
if (!fillStaticChannel(node->get_input_partial_shape(0), inputChannels)) {
return true;
}
size_t outputChannels;
if (!fillStaticChannel(node->get_output_partial_shape(0), outputChannels)) {
return true;
}
if ((inputChannels % 4 != 0) || (outputChannels % 16 != 0)) {
return true;
}
return LayerTransformation::isAsymmetricQuantization(node) || WeightableLayerTransformation::isAsymmetricOnWeights(node);
});
lptPassConfig->set_callback<MatMulTransformation>([](const_node_ptr& node) -> bool {
return MatMulTransformation::is3DTensorOnActivations(node);
});
lptManager.register_pass<LowPrecision>(supportedPrecisions, perTensorQuantization);
lptManager.run_passes(func);
}
{
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "TransformationsPipeline::apply::run_passes");
ngraph::pass::Manager manager;
// This ConstantFolding pass is added to fold reshapes added for constant inputs on NMS internal operation which prevents upper-bound calculation
// TODO: check why we have these reshapes
manager.register_pass<ngraph::pass::ConstantFolding>();
manager.register_pass<ngraph::pass::UnrollTensorIterator>();
auto pass_config = manager.get_pass_config();
pass_config->set_callback<ngraph::pass::UnrollTensorIterator>(
[this](const std::shared_ptr<const ngraph::Node> &node) -> bool {
auto sub_graph_op = std::dynamic_pointer_cast<const ngraph::op::util::SubGraphOp>(node);
int64_t num_iter = sub_graph_op->get_num_iterations();
if (num_iter == 1) {
return false;
}
return !config.enable_loop_unrolling;
});
manager.run_passes(func);
}
}
} // namespace CLDNNPlugin

View File

@@ -0,0 +1,24 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <memory>
#include <ngraph/function.hpp>
#include "cldnn_config.h"
namespace CLDNNPlugin {
class TransformationsPipeline {
public:
explicit TransformationsPipeline(const Config &conf) : config(conf) {}
void apply(std::shared_ptr<ov::Function> func);
private:
Config config;
};
} // namespace CLDNNPlugin

View File

@@ -70,6 +70,7 @@
#include "transformations/convert_dwsc_to_scaleshifts.hpp"
#include "transformations/op_conversions/lstm_cell_decomposition.hpp"
#include "transformations/remove_single_input_concat.hpp"
#include "transformations/broadcast_const.hpp"
#include <ngraph/opsets/opset7.hpp>
@@ -719,6 +720,15 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
manager.register_pass<ngraph::pass::ConvertOpSet2ToOpSet1>();
manager.register_pass<ngraph::pass::ConvertOpSet1ToLegacy>();
manager.register_pass<RemoveExtraReshapes>();
/*
Put BroadcastAddMultiplyConst here after ConvertOpSet..() transformations since there are conficts with them.
ngraph::pass::ConvertOpSet1ToLegacy -> ngraph::pass::BiasFusions ->
ngraph::pass::ConvAddFusion, ngraph::pass::ConvMultiplyFusion
That transormations fuse bias into convolution and recognizes const node as [1, C, 1, 1].
TODO: move that transformation just beyond RemoveSingleInputConcat pass after removing ConvertOpSet1ToLegacy
transormations
*/
manager.register_pass<BroadcastAddMultiplyConst>();
// UnrollTI should be the last transformation in the transformation pipeline
manager.register_pass<ngraph::pass::UnrollTensorIterator>();
const auto& pass_config = manager.get_pass_config();
@@ -770,15 +780,14 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) {
passes->registerPass<RemoveConstPass>();
passes->registerPass<UnrollLSTMCellPass>();
passes->registerPass<RemoveSingleInputConcatPass>();
passes->registerPass<BroadcastConstPass>();
passes->registerPass<SubstituteScaleShiftBroadCastPass>();
}
// fake quantisation aware passes
passes->registerPass<FuseFQIntoWeightsPass>();
passes->registerPass<MoveFakeQuantizeLayerIntoQuantParamsPass>();
passes->registerPass<SubstituteScaleShiftBroadCastPass>();
passes->registerPass<BroadcastConstPass>();
passes->registerPass<TransposeWeightsFromNCHWToNHWCPass>();
passes->registerPass<SubstitutePReluPass>();

View File

@@ -824,6 +824,30 @@ void InsertIdentityLayerPass::run() {
void InsertCopyLayerPass::run() {
OV_ITT_SCOPED_TASK(itt::domains::GNA_LT, "InsertCopyLayerPass");
using FuncChildrenInfo = std::tuple<
CNNLayerPtr, // parent layer
CNNLayerPtr, // child layer
int32_t // input index
>;
// recursively searches for children functional layers skipping non-functional ones
std::function<std::vector<FuncChildrenInfo>(CNNLayerPtr, CNNLayerPtr, int32_t)> find_func_layers =
[&find_func_layers](CNNLayerPtr currentLayer, CNNLayerPtr parentLayer, int32_t input_idx) {
if (!LayerInfo(currentLayer).isNonFunctional() ||
currentLayer->outData.size() == 0 ||
getInputTo(currentLayer->outData[0]).size() == 0) {
return std::vector<FuncChildrenInfo>{std::make_tuple(parentLayer, currentLayer, input_idx)};
}
std::vector<FuncChildrenInfo> results;
for (size_t i = 0; i < getInputTo(currentLayer->outData[0]).size(); ++i) {
auto next_layer = CNNNetGetNextLayerSkipCertain(currentLayer, 0, i,
[](CNNLayerPtr origin) {return false; }).first;
auto result = find_func_layers(next_layer, currentLayer,
CNNLayerFindInsDataIdxes(currentLayer->outData[0], next_layer)[0]);
results.insert(std::end(results), std::begin(result), std::end(result));
}
return results;
};
// Copy layer insertion happens in few cases:
// Crop output goes to concat layer -> copy layer insertion
// Splitted part of input goes to concat layer -> copy layer insertion
@@ -854,37 +878,24 @@ void InsertCopyLayerPass::run() {
// Crop -> Concat, Input -> Split -> Concat and Concat -> Memory cases
if ((LayerInfo(l).isCrop() && !LayerInfo(l).isCropAffined()) || LayerInfo(l).isConcat() || LayerInfo(l).isSplit()) {
std::vector<std::tuple<CNNLayerPtr, CNNLayerPtr, size_t>> copy_insertion_tuples;
std::vector<std::tuple<CNNLayerPtr, CNNLayerPtr, size_t>> delayed_copy_insertion_tuples;
std::vector<FuncChildrenInfo> copy_insertion_tuples;
std::vector<FuncChildrenInfo> delayed_copy_insertion_tuples;
for (auto output : l->outData) {
auto& inputTo = getInputTo(output);
for (auto& childLayer : inputTo) {
auto original_child = childLayer.second;
auto original_parent = l;
auto current_layer = original_child;
std::vector<int> connections = CNNLayerFindInsDataIdxes(output, original_child);
std::vector<int> connections = CNNLayerFindInsDataIdxes(output, childLayer.second);
for (auto input_idx : connections) {
while (LayerInfo(current_layer).isNonFunctional()) {
if (current_layer->outData.size() == 0) break;
if (getInputTo(current_layer->outData[0]).size() == 0) break;
auto next_layer = CNNNetGetNextLayerSkipCertain(current_layer, 0, 0, [](CNNLayerPtr origin) {return false; }).first;
if (current_layer->outData.size() == 1 && getInputTo(current_layer->outData[0]).size() == 1 && original_child == current_layer) {
original_child = next_layer;
original_parent = current_layer;
input_idx = CNNLayerFindInsDataIdxes(original_parent->outData[0], original_child)[0];
auto children_info = find_func_layers(childLayer.second, l, input_idx);
for (const auto &child_info : children_info) {
CNNLayerPtr child = std::get<1>(child_info);
if ((LayerInfo(l).isConcat() || LayerInfo(l).isCrop() || LayerInfo(l).isSplit()) && LayerInfo(child).isMemory()) {
// Concat|Split|Crop -> Memory case
delayed_copy_insertion_tuples.push_back(child_info);
} else if ((LayerInfo(l).isSplit() || LayerInfo(l).isCrop()) && LayerInfo(child).isConcat()) {
// Split|Crop -> Concat case
// concat may be connected to previous layer with multiple connections
copy_insertion_tuples.push_back(child_info);
}
current_layer = next_layer;
}
if ((LayerInfo(l).isConcat() || LayerInfo(l).isCrop() || LayerInfo(l).isSplit()) && LayerInfo(current_layer).isMemory()) {
// Concat|Split|Crop -> Memory case
delayed_copy_insertion_tuples.push_back(std::make_tuple(original_parent, original_child, input_idx));
} else if ((LayerInfo(l).isSplit() || LayerInfo(l).isCrop()) && LayerInfo(current_layer).isConcat()) {
// Split|Crop -> Concat case
// concat may be connected to previous layer with multiple connections
copy_insertion_tuples.push_back(std::make_tuple(original_parent, original_child, input_idx));
}
}
}

View File

@@ -0,0 +1,129 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <openvino/cc/ngraph/itt.hpp>
#include "transformations/broadcast_const.hpp"
#include "transformations/utils/transformation_helper.hpp"
#include <ngraph/opsets/opset8.hpp>
#include <ngraph/pattern/op/wrap_type.hpp>
#include <ngraph/pattern/op/or.hpp>
#include "legacy/ngraph_ops/eltwise.hpp"
#include <transformations/utils/utils.hpp>
#include <vector>
#include <functional>
#include <numeric>
using namespace GNAPluginNS;
NGRAPH_RTTI_DEFINITION(BroadcastAddMultiplyConst, "BroadcastAddMultiplyConst", 0);
using Node = std::shared_ptr<ngraph::Node>;
using Nodes = std::vector<Node>;
using Input = ngraph::Input<ngraph::Node>;
using Inputs = std::vector<Input>;
using AxisSet = std::set<size_t>;
namespace {
bool HasDynamicShape(Node node) {
const auto & shape = node->get_output_partial_shape(0);
return shape.is_dynamic();
}
/*
* really returns only NUMPY and PDPD
* since another types are filtered out in matcher pattern
*/
ov::op::BroadcastModeSpec GetBroadcastType(Node eltwise_node) {
auto node = std::dynamic_pointer_cast<ov::op::util::BinaryElementwiseArithmetic>(eltwise_node);
// check if it's an ngraph::op::Eltwise layer without broadcast type info
if (!node)
return ov::op::BroadcastType::NUMPY;
switch (node->get_autob().m_type) {
case ov::op::AutoBroadcastType::NUMPY:
return ov::op::BroadcastType::NUMPY;
case ov::op::AutoBroadcastType::PDPD:
return ov::op::BroadcastType::PDPD;
default:
return ov::op::BroadcastType::NONE;
}
return ov::op::BroadcastType::NONE;
}
bool DoTransformation(Node const_node, Node eltwise_node) {
if (HasDynamicShape(const_node) || HasDynamicShape(eltwise_node))
return false;
const ngraph::Shape & eltwise_out_shape = eltwise_node->get_output_tensor(0).get_shape();
auto broadcast_const = ngraph::opset8::Constant::create(ngraph::element::Type_t::i64,
ngraph::Shape{eltwise_out_shape.size()}, eltwise_out_shape);
auto new_const_node = ngraph::op::util::make_try_fold<ngraph::opset8::Broadcast>(const_node,
broadcast_const,
GetBroadcastType(eltwise_node));
ngraph::replace_node(const_node, new_const_node);
return true;
}
/*
* Do not transform graph with NONE/EXPLICIT broadcast modes eltwise layer
* since that types are not broadcastable at all
*/
bool IsEltwiseAcceptable(const ngraph::Output<ngraph::Node>& output) {
auto node = std::dynamic_pointer_cast<ov::op::util::BinaryElementwiseArithmetic>(output.get_node_shared_ptr());
if (!node)
return true;
const ov::op::AutoBroadcastType type = node->get_autob().m_type;
return (type == ov::op::AutoBroadcastType::NUMPY || type == ov::op::AutoBroadcastType::PDPD);
}
} // namespace
BroadcastAddMultiplyConst::BroadcastAddMultiplyConst() {
MATCHER_SCOPE(BroadcastAddMultiplyConst);
auto constant = ngraph::pattern::wrap_type<ngraph::opset8::Constant>();
auto fake_quantize = ngraph::pattern::wrap_type<ngraph::opset8::FakeQuantize>({constant,
ngraph::pattern::wrap_type<ngraph::opset8::Constant>(),
ngraph::pattern::wrap_type<ngraph::opset8::Constant>(),
ngraph::pattern::wrap_type<ngraph::opset8::Constant>(),
ngraph::pattern::wrap_type<ngraph::opset8::Constant>()});
auto eltwise_input = std::make_shared<ngraph::pattern::op::Or>(ngraph::OutputVector{constant, fake_quantize});
auto eltwise_left_const = ngraph::pattern::wrap_type<ngraph::opset8::Add,
ngraph::opset8::Subtract,
ngraph::opset8::Multiply,
ngraph::op::Eltwise>({eltwise_input, ngraph::pattern::any_input()}, IsEltwiseAcceptable);
auto eltwise_right_const = ngraph::pattern::wrap_type<ngraph::opset8::Add,
ngraph::opset8::Subtract,
ngraph::opset8::Multiply,
ngraph::op::Eltwise>({ngraph::pattern::any_input(), eltwise_input}, IsEltwiseAcceptable);
auto eltwise = std::make_shared<ngraph::pattern::op::Or>(ngraph::OutputVector{eltwise_left_const, eltwise_right_const});
ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();
auto const_node = pattern_map.at(constant).get_node_shared_ptr();
auto eltwise_node_it = pattern_map.find(eltwise_left_const);
if (eltwise_node_it == pattern_map.end())
eltwise_node_it = pattern_map.find(eltwise_right_const);
if (eltwise_node_it == pattern_map.end())
return false;
return DoTransformation(const_node, eltwise_node_it->second.get_node_shared_ptr());
};
auto m = std::make_shared<ngraph::pattern::Matcher>(eltwise, matcher_name);
this->register_matcher(m, callback);
}

View File

@@ -0,0 +1,53 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <ngraph/pass/graph_rewrite.hpp>
namespace GNAPluginNS {
/**
* @brief Brodcast data in Const layer
* Transformation recognizes the next patterns
*
* Constant Any
* | |
* Eltwise
*
* Constant
* |
* FakeQuantize Any
* | |
* Eltwise
*
* Where Eltwise node is one of the: Multiply, Substract and Add
* There are different types of broadcasting: NONE/EXPLICIT, NUMPY and PDPD
*
* If eltwise node inputs have different shapes and one the inputs is Constant node
* we can update (broadcast) Constant to have the same shape as another input.
* Transformation doesn't modify graph structure, but modifies Constant
* examples:
*
* NUMPY broadcasting
* Eltwise non-constant shape | Constant prev shape/values | Constant new shape/values
* {3,2} {2}/{1,2} {3,2}/{1, 2, 1, 2, 1, 2}
* {2,3} {2,1}/{1,2} {2,3}/{1, 1, 1, 2, 2, 2}
*
* PDPD broadcasting
* Eltwise non-constant shape | Constant prev shape/values | Constant new shape/values
* {3,2} {3, 1}/{1,2,3} {3,2}/{1, 1, 2, 2, 3, 3}
*
* NONE/EXPLICIT broadcasting doesn't support broadcasting at all
*
* For information about broadcasting rules see
* https://github.com/openvinotoolkit/openvino/blob/master/docs/ops/broadcast_rules.md
*/
class BroadcastAddMultiplyConst : public ngraph::pass::MatcherPass {
public:
NGRAPH_RTTI_DECLARATION;
BroadcastAddMultiplyConst();
};
} // namespace GNAPluginNS

View File

@@ -4,6 +4,8 @@
#pragma once
#include <ngraph/opsets/opset7.hpp>
namespace GNAPluginNS {
struct ConvData {
@@ -56,7 +58,7 @@ bool TransposeOrderMatches(std::shared_ptr<ngraph::opset7::Transpose> transpose,
/**
* @brief performs a crop of a flattened input tensor
* @param input input layer
* @param offset offset to start the crop at*
* @param offset offset to start the crop at*
* @param size size of the crop
* @return pointer to the newly created slice
*/

View File

@@ -43,11 +43,6 @@ HeteroAsyncInferRequest::HeteroAsyncInferRequest(const IInferRequestInternal::Pt
}
}
void HeteroAsyncInferRequest::StartAsync_ThreadUnsafe() {
_heteroInferRequest->updateInOutIfNeeded();
RunFirstStage(_pipeline.begin(), _pipeline.end());
}
StatusCode HeteroAsyncInferRequest::Wait(int64_t millis_timeout) {
auto waitStatus = StatusCode::OK;
try {

View File

@@ -18,7 +18,6 @@ public:
const InferenceEngine::ITaskExecutor::Ptr& taskExecutor,
const InferenceEngine::ITaskExecutor::Ptr& callbackExecutor);
~HeteroAsyncInferRequest();
void StartAsync_ThreadUnsafe() override;
InferenceEngine::StatusCode Wait(int64_t millis_timeout) override;
private:

View File

@@ -68,9 +68,9 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(const InferenceEngine::CNNNetwo
auto clonedFunction = ngraph::clone_function(*function);
auto itDumpDotFile = _config.find(HETERO_CONFIG_KEY(DUMP_GRAPH_DOT));
bool dumpDotFile = itDumpDotFile != _config.end() ? (itDumpDotFile->second == YES) : false;
#ifndef NDEBUG
dumpDotFile = true;
#endif
//#ifndef NDEBUG
// dumpDotFile = true;
//#endif
QueryNetworkResult queryNetworkResult;
auto orderedOps = clonedFunction->get_ordered_ops();

View File

@@ -36,11 +36,14 @@ HeteroInferRequest::HeteroInferRequest(InferenceEngine::InputsDataMap networkInp
bool emplaced = false;
std::tie(itBlob, emplaced) = _blobs.emplace(intermediateBlobName, Blob::Ptr{});
if (emplaced) {
itBlob->second = r->GetBlob(blobName);
if (InferenceEngine::details::contains(networkInputs, blobName)) {
_inputs[blobName] = itBlob->second;
} else if (InferenceEngine::details::contains(networkOutputs, blobName)) {
_outputs[blobName] = itBlob->second;
if (InferenceEngine::details::contains(_networkInputs, blobName)) {
_subRequestFromBlobName.emplace(blobName, r._ptr.get());
_blobs.erase(intermediateBlobName);
} else if (InferenceEngine::details::contains(_networkOutputs, blobName)) {
_subRequestFromBlobName.emplace(blobName, r._ptr.get());
_blobs.erase(intermediateBlobName);
} else {
itBlob->second = r->GetBlob(blobName);
}
} else {
r->SetBlob(blobName, itBlob->second);
@@ -64,25 +67,39 @@ HeteroInferRequest::HeteroInferRequest(InferenceEngine::InputsDataMap networkInp
}
}
void HeteroInferRequest::SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& data) {
InferenceEngine::IInferRequestInternal::SetBlob(name, data);
assert(!_inferRequests.empty());
for (auto &&desc : _inferRequests) {
auto &r = desc._request;
assert(r);
InputInfo::Ptr foundInput;
DataPtr foundOutput;
try {
// if `name` is input blob
if (findInputAndOutputBlobByName(name, foundInput, foundOutput)) {
r->SetBlob(name, data, foundInput->getPreProcess());
}
} catch (const InferenceEngine::NotFound&) {}
void HeteroInferRequest::SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& blob) {
auto itRequest = _subRequestFromBlobName.find(name);
if (itRequest == _subRequestFromBlobName.end()) {
IE_THROW() << "There is no infer requests binded to blob with name: " << name;
}
itRequest->second->SetBlob(name, blob);
}
InferenceEngine::Blob::Ptr HeteroInferRequest::GetBlob(const std::string& name) {
auto itRequest = _subRequestFromBlobName.find(name);
if (itRequest == _subRequestFromBlobName.end()) {
IE_THROW() << "There is no infer requests binded to blob with name: " << name;
}
return itRequest->second->GetBlob(name);
}
void HeteroInferRequest::SetBlob(const std::string& name, const Blob::Ptr& blob, const PreProcessInfo& info) {
auto itRequest = _subRequestFromBlobName.find(name);
if (itRequest == _subRequestFromBlobName.end()) {
IE_THROW() << "There is no infer requests binded to blob with name: " << name;
}
itRequest->second->SetBlob(name, blob, info);
}
const InferenceEngine::PreProcessInfo& HeteroInferRequest::GetPreProcess(const std::string& name) const {
auto itRequest = _subRequestFromBlobName.find(name);
if (itRequest == _subRequestFromBlobName.end()) {
IE_THROW() << "There is no infer requests binded to blob with name: " << name;
}
return itRequest->second->GetPreProcess(name);
}
void HeteroInferRequest::InferImpl() {
updateInOutIfNeeded();
for (auto &&desc : _inferRequests) {
OV_ITT_SCOPED_TASK(itt::domains::HeteroPlugin, desc._profilingTask);
auto &r = desc._request;
@@ -101,40 +118,3 @@ std::map<std::string, InferenceEngineProfileInfo> HeteroInferRequest::GetPerform
}
return perfMap;
}
void HeteroInferRequest::updateInOutIfNeeded() {
OV_ITT_SCOPED_TASK(itt::domains::HeteroPlugin, "updateInOutIfNeeded");
assert(!_inferRequests.empty());
for (auto &&desc : _inferRequests) {
auto &r = desc._request;
assert(r);
for (auto&& inputInfo : desc._network->GetInputsInfo()) {
auto& ioname = inputInfo.first;
auto iti = _inputs.find(ioname);
if (iti != _inputs.end()) {
auto it = _preProcData.find(ioname);
if (it != _preProcData.end()) {
if (it->second->getRoiBlob() != _blobs[ioname]) {
r->SetBlob(ioname.c_str(), it->second->getRoiBlob());
_blobs[ioname] = iti->second;
}
} else {
if (iti->second != _blobs[ioname]) {
r->SetBlob(ioname.c_str(), iti->second);
_blobs[ioname] = iti->second;
}
}
}
}
for (auto&& outputInfo : desc._network->GetOutputsInfo()) {
auto& ioname = outputInfo.first;
auto ito = _outputs.find(ioname);
if (ito != _outputs.end()) {
if (ito->second != _blobs[ioname]) {
r->SetBlob(ioname.c_str(), ito->second);
_blobs[ioname] = ito->second;
}
}
}
}
}

View File

@@ -34,14 +34,21 @@ public:
void InferImpl() override;
void SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& data) override;
void SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& blob) override;
InferenceEngine::Blob::Ptr GetBlob(const std::string& name) override;
void SetBlob(const std::string& name,
const InferenceEngine::Blob::Ptr& blob,
const InferenceEngine::PreProcessInfo& info) override;
const InferenceEngine::PreProcessInfo& GetPreProcess(const std::string& name) const override;
std::map<std::string, InferenceEngine::InferenceEngineProfileInfo> GetPerformanceCounts() const override;
void updateInOutIfNeeded();
SubRequestsList _inferRequests;
std::map<std::string, InferenceEngine::Blob::Ptr> _blobs;
std::map<std::string, InferenceEngine::Blob::Ptr> _blobs;
std::map<std::string, InferenceEngine::IInferRequestInternal*> _subRequestFromBlobName;
};
} // namespace HeteroPlugin

View File

@@ -154,13 +154,19 @@ static inline Blob::Ptr make_shared_blob_nv12(size_t height,
* @param core Inference Engine Core object instance
* @param deviceName A name of to create a remote context for
* @param device A pointer to ID3D11Device to be used to create a remote context
* @param target_tile_id Desired tile id within given context for multi-tile system. Default value (-1) means that root
* device should be used
* @return A shared remote context instance
*/
static inline D3DContext::Ptr make_shared_context(Core& core, std::string deviceName, ID3D11Device* device) {
static inline D3DContext::Ptr make_shared_context(Core& core,
std::string deviceName,
ID3D11Device* device,
int target_tile_id = -1) {
// clang-format off
ParamMap contextParams = {
{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(VA_SHARED)},
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)}
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)},
{GPU_PARAM_KEY(TILE_ID), target_tile_id}
};
// clang-format on
return std::dynamic_pointer_cast<D3DContext>(core.CreateContext(deviceName, contextParams));

View File

@@ -218,11 +218,17 @@ static inline Blob::Ptr make_shared_blob_nv12(RemoteContext::Ptr ctx,
* @param core A reference to Inference Engine Core object
* @param deviceName A name of device to create a remote context for
* @param ctx A OpenCL context to be used to create shared remote context
* @param target_tile_id Desired tile id within given context for multi-tile system. Default value (-1) means that root
* device should be used
* @return A shared remote context instance
*/
static inline RemoteContext::Ptr make_shared_context(Core& core, std::string deviceName, cl_context ctx) {
static inline RemoteContext::Ptr make_shared_context(Core& core,
std::string deviceName,
cl_context ctx,
int target_tile_id = -1) {
ParamMap contextParams = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(OCL)},
{GPU_PARAM_KEY(OCL_CONTEXT), static_cast<gpu_handle_param>(ctx)}};
{GPU_PARAM_KEY(OCL_CONTEXT), static_cast<gpu_handle_param>(ctx)},
{GPU_PARAM_KEY(TILE_ID), target_tile_id}};
return core.CreateContext(deviceName, contextParams);
}

View File

@@ -123,11 +123,17 @@ static inline Blob::Ptr make_shared_blob_nv12(size_t height,
* @param core Inference Engine Core object
* @param deviceName A device name to create a remote context for
* @param device A `VADisplay` to create remote context from
* @param target_tile_id Desired tile id within given context for multi-tile system. Default value (-1) means that root
* device should be used
* @return A remote context wrapping `VADisplay`
*/
static inline VAContext::Ptr make_shared_context(Core& core, std::string deviceName, VADisplay device) {
static inline VAContext::Ptr make_shared_context(Core& core,
std::string deviceName,
VADisplay device,
int target_tile_id = -1) {
ParamMap contextParams = {{GPU_PARAM_KEY(CONTEXT_TYPE), GPU_PARAM_VALUE(VA_SHARED)},
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)}};
{GPU_PARAM_KEY(VA_DEVICE), static_cast<gpu_handle_param>(device)},
{GPU_PARAM_KEY(TILE_ID), target_tile_id}};
return std::dynamic_pointer_cast<VAContext>(core.CreateContext(deviceName, contextParams));
}

View File

@@ -62,6 +62,12 @@ DECLARE_GPU_PARAM_VALUE(VA_SHARED);
*/
DECLARE_GPU_PARAM_KEY(OCL_CONTEXT, gpu_handle_param);
/**
* @brief In case of multi-tile system,
* this key identifies tile within given context
*/
DECLARE_GPU_PARAM_KEY(TILE_ID, int);
/**
* @brief This key identifies video acceleration device/display handle
* in a shared context or shared memory blob parameter map

View File

@@ -2037,12 +2037,9 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
cnnLayer->outData.clear();
continue;
}
NGRAPH_SUPPRESS_DEPRECATED_START
auto outName = layer->output(i).get_tensor().get_name();
NGRAPH_SUPPRESS_DEPRECATED_END
if (outName.empty()) {
outName = ngraph::op::util::create_ie_output_name(layer->output(i));
}
auto outName = ngraph::op::util::get_ie_output_name(layer->output(i));
DataPtr &ptr = cnnNetworkImpl->getData(outName.c_str());
IE_ASSERT(layer->get_output_partial_shape(i).is_static()) << " nGraph "
@@ -2093,13 +2090,7 @@ void convertFunctionToICNNNetwork(const std::shared_ptr<const ::ngraph::Function
if (std::dynamic_pointer_cast<::ngraph::op::Result>(layer)) {
IE_ASSERT(layer->get_input_size() == 1);
const auto &input = layer->input_value(0);
NGRAPH_SUPPRESS_DEPRECATED_START
auto name = input.get_tensor().get_name();
NGRAPH_SUPPRESS_DEPRECATED_END
if (!name.empty())
cnnNetworkImpl->addOutput(name);
else
cnnNetworkImpl->addOutput(ngraph::op::util::create_ie_output_name(input));
cnnNetworkImpl->addOutput(ngraph::op::util::get_ie_output_name(input));
continue;
}

View File

@@ -19,7 +19,7 @@
#include "mkldnn_graph_optimizer.h"
#include "mkldnn_extension_utils.h"
#include "mkldnn_extension_mngr.h"
#include "mkldnn_memory_solver.hpp"
#include "memory_solver.hpp"
#include "mkldnn_itt.h"
#include "mkldnn_infer_request.h"
#include <nodes/mkldnn_input_node.h>
@@ -228,12 +228,7 @@ void MKLDNNGraph::Replicate(const CNNNetwork &network, const MKLDNNExtensionMana
if (op->get_type_info() == ngraph::op::v0::Result::type_info) {
const auto &input = op->input_value(0);
NGRAPH_SUPPRESS_DEPRECATED_START
auto name = input.get_tensor().get_name();
NGRAPH_SUPPRESS_DEPRECATED_END
if (name.empty()) {
name = ngraph::op::util::create_ie_output_name(input);
}
auto name = ngraph::op::util::get_ie_output_name(input);
if (outputsInfo.count(name) != 0) {
outputNodesMap[name] = node;

View File

@@ -1,142 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <ie_common.h>
#include "mkldnn_memory_solver.hpp"
#include <algorithm>
#include <vector>
#include <map>
namespace MKLDNNPlugin {
MemorySolver::MemorySolver(const std::vector<Box>& boxes) : _boxes(boxes) {
int max_ts = 0;
// TODO: add validation of data correctness:
// 1. Box.start >= 0 and Box.finish >= -1
// 2. Box.finish >= Box.start (except Box.finish == -1)
// 3. Box.size > 0 (or == 0 ?)
// 4. Box.id == any unique value
for (const Box &box : _boxes) max_ts = std::max(std::max(max_ts, box.start), box.finish);
for (Box &box : _boxes) if (box.finish == -1) box.finish = max_ts;
// sort by start and finish ts
std::sort(_boxes.begin(), _boxes.end(), [](const Box& l, const Box& r) -> bool
{ return l.start < r.start || (l.start == r.start && l.finish < r.finish); });
// remove unused timestamps (not a begin of some box)
// each ts should start a box
std::vector<bool> ts_exist(max_ts+1);
for (const Box &b : _boxes) ts_exist[b.start] = true;
int rm_ts_s = 0, rm_ts_f = 0;
int ts_s = 0, ts_f = 0;
for (Box &b : _boxes) {
while (ts_s < b.start) if (!ts_exist[ts_s++]) rm_ts_s++;
if (ts_f > b.finish + 1) { ts_f = ts_s; rm_ts_f = rm_ts_s; }
while (ts_f <= b.finish) if (!ts_exist[ts_f++]) rm_ts_f++;
b.start -= rm_ts_s;
b.finish -= rm_ts_f;
}
_time_duration = ts_f - rm_ts_f;
}
inline bool popupTogetherWith(MemorySolver::Box &box_new, const MemorySolver::Box &box_old) {
if (box_new.id+box_new.size > box_old.id &&
box_old.id+box_old.size > box_new.id) {
// Move the new one up. There is an intersection
box_new.id = box_old.id + box_old.size;
return true;
} else {
return false;
}
}
int64_t MemorySolver::solve() {
maxTopDepth(); // at first make sure that we no need more for boxes sorted by box.start
std::vector<std::vector<const Box*>> time_slots(_time_duration);
for (auto & slot : time_slots) slot.reserve(_top_depth); // 2D array [_time_duration][_top_depth]
// Sort be box size. First is biggest
// Comment this line to check other order of box putting
std::sort(_boxes.begin(), _boxes.end(), [](const Box& l, const Box& r)
{ return l.size > r.size; });
int64_t _min_required = 0;
for (Box& box : _boxes) {
// start from bottom and will lift it up if intersect with other present
int64_t id = box.id;
box.id = 0; // id will be used as a temp offset storage
bool popped_up;
do {
popped_up = false;
for (int i_slot = box.start; i_slot <= box.finish; i_slot++) {
for (auto *box_in_slot : time_slots[i_slot]) {
// intersect with already stored boxes for all covered time slots
// and move up the new one if needed
popped_up |= popupTogetherWith(box, *box_in_slot);
}
}
} while (popped_up);
// add current box to covered time slot
for (int i_slot = box.start; i_slot <= box.finish; i_slot++)
time_slots[i_slot].push_back(&box);
// store the max top bound for each box
_min_required = std::max(_min_required, box.id + box.size);
_offsets[id] = box.id; // TODO: move to constructor (use .insert instead of [])
}
return _min_required;
}
int64_t MemorySolver::maxDepth() {
if (_depth == -1) calcDepth();
return _depth;
}
int64_t MemorySolver::maxTopDepth() {
if (_top_depth == -1) calcDepth();
return _top_depth;
}
int64_t MemorySolver::getOffset(int id) const {
auto res = _offsets.find(id);
if (res == _offsets.end()) IE_THROW() << "There are no box for provided ID";
return res->second;
}
//======== Private =============//
void MemorySolver::calcDepth() {
int64_t top_depth = 0;
int64_t depth = 0;
std::map<int64_t, std::vector<const Box*>> release_at;
for (const Box& box : _boxes) {
int64_t time = box.start;
depth += box.size;
top_depth++;
release_at[box.finish+1].push_back(&box);
for (const Box *b : release_at[time]) {
depth -= b->size;
top_depth--;
}
release_at.erase(time);
IE_ASSERT(top_depth > 0);
_top_depth = std::max(_top_depth, top_depth);
_depth = std::max(_depth, depth);
}
}
} // namespace MKLDNNPlugin

View File

@@ -1,94 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief The header provides a declaration of MemorySolver utility class
* @file
*/
#pragma once
#include "ie_api.h"
#include <stdint.h>
#include <vector>
#include <map>
namespace MKLDNNPlugin {
/**
* @brief Helps to solve issue of optimal memory allocation only for particular
* execution order.
*
* It works with abstract data description where
* - Node is index in execution order
* - Edge is Box object with size and start-finish indexes (live time)
*
* Example:
*
* Mem(offset)
* | |____| Box {4, 5}
* | |_____________| Box {2, 6}
* | |____| Box {3, 4}
* | |____| Box {2, 3}
* | |____| Box {6, 7}
* |_____________________________________
* 1 2 3 4 5 6 7 8 9 ExecOrder
*
* Boxes which has an ExecOrder-axis intersection should have no Mem-axis intersections.
* The goal is to define a minimal required memory blob to store all boxes with such
* constraints and specify all corresponding position on Mem axis(through offset field).
*
* NOTE!
* Exec order is predefined.
*/
class MemorySolver {
public:
/** @brief Representation of edge (size and live time)*/
struct Box {
/** Execution order index of first use. The data will be produced here. */
int start;
/**
* The execution order index of last use. After that data will be released.
* -1 is a reserved value for "till to end". The data will be alive to very
* end of execution.
*/
int finish;
/** Size of data. In abstract unit of measure (byte, simd, cache line, ...) */
int64_t size;
/** Box identifier, unique for each box. Will be used to querying calculated offset. */
int64_t id;
};
explicit MemorySolver(const std::vector<Box>& boxes);
/**
* @brief Solve memory location with maximal reuse.
* @return Size of common memory blob required for storing all
*/
int64_t solve();
/** Provides calculated offset for specified box id */
int64_t getOffset(int id) const;
/** Additional info. Max sum of box sizes required for any time stamp. */
int64_t maxDepth();
/** Additional info. Max num of boxes required for any time stamp. */
int64_t maxTopDepth();
private:
std::vector<Box> _boxes;
std::map<int64_t, int64_t> _offsets;
int64_t _top_depth = -1;
int64_t _depth = -1;
int _time_duration = -1;
void calcDepth();
};
} // namespace MKLDNNPlugin

View File

@@ -0,0 +1,217 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief The header provides a declaration of MemorySolver utility class
* @file
*/
#pragma once
#include <stdint.h>
#include <algorithm>
#include <map>
#include <vector>
/**
* @brief Helps to solve issue of optimal memory allocation only for particular
* execution order.
*
* It works with abstract data description where
* - Node is index in execution order
* - Edge is Box object with size and start-finish indexes (live time)
*
* Example:
*
* Mem(offset)
* | |____| Box {4, 5}
* | |_____________| Box {2, 6}
* | |____| Box {3, 4}
* | |____| Box {2, 3}
* | |____| Box {6, 7}
* |_____________________________________
* 1 2 3 4 5 6 7 8 9 ExecOrder
*
* Boxes which has an ExecOrder-axis intersection should have no Mem-axis intersections.
* The goal is to define a minimal required memory blob to store all boxes with such
* constraints and specify all corresponding position on Mem axis(through offset field).
*
* NOTE!
* Exec order is predefined.
*/
class MemorySolver {
public:
/** @brief Representation of edge (size and live time)*/
struct Box {
/** Execution order index of first use. The data will be produced here. */
int start;
/**
* The execution order index of last use. After that data will be released.
* -1 is a reserved value for "till to end". The data will be alive to very
* end of execution.
*/
int finish;
/** Size of data. In abstract unit of measure (byte, simd, cache line, ...) */
int64_t size;
/** Box identifier, unique for each box. Will be used to querying calculated offset. */
int64_t id;
};
explicit MemorySolver(const std::vector<Box>& boxes) : _boxes(boxes) {
int max_ts = 0;
// TODO: add validation of data correctness:
// 1. Box.start >= 0 and Box.finish >= -1
// 2. Box.finish >= Box.start (except Box.finish == -1)
// 3. Box.size > 0 (or == 0 ?)
// 4. Box.id == any unique value
for (const Box& box : _boxes)
max_ts = std::max(std::max(max_ts, box.start), box.finish);
for (Box& box : _boxes)
if (box.finish == -1)
box.finish = max_ts;
// sort by start and finish ts
std::sort(_boxes.begin(), _boxes.end(), [](const Box& l, const Box& r) -> bool {
return l.start < r.start || (l.start == r.start && l.finish < r.finish);
});
// remove unused timestamps (not a begin of some box)
// each ts should start a box
std::vector<bool> ts_exist(max_ts + 1);
for (const Box& b : _boxes)
ts_exist[b.start] = true;
int rm_ts_s = 0, rm_ts_f = 0;
int ts_s = 0, ts_f = 0;
for (Box& b : _boxes) {
while (ts_s < b.start)
if (!ts_exist[ts_s++])
rm_ts_s++;
if (ts_f > b.finish + 1) {
ts_f = ts_s;
rm_ts_f = rm_ts_s;
}
while (ts_f <= b.finish)
if (!ts_exist[ts_f++])
rm_ts_f++;
b.start -= rm_ts_s;
b.finish -= rm_ts_f;
}
_time_duration = ts_f - rm_ts_f;
}
inline bool popupTogetherWith(MemorySolver::Box& box_new, const MemorySolver::Box& box_old) {
if (box_new.id + box_new.size > box_old.id && box_old.id + box_old.size > box_new.id) {
// Move the new one up. There is an intersection
box_new.id = box_old.id + box_old.size;
return true;
} else {
return false;
}
}
/**
* @brief Solve memory location with maximal reuse.
* @return Size of common memory blob required for storing all
*/
int64_t solve() {
maxTopDepth(); // at first make sure that we no need more for boxes sorted by box.start
std::vector<std::vector<const Box*>> time_slots(_time_duration);
for (auto& slot : time_slots)
slot.reserve(_top_depth); // 2D array [_time_duration][_top_depth]
// Sort be box size. First is biggest
// Comment this line to check other order of box putting
std::sort(_boxes.begin(), _boxes.end(), [](const Box& l, const Box& r) {
return l.size > r.size;
});
int64_t _min_required = 0;
for (Box& box : _boxes) {
// start from bottom and will lift it up if intersect with other present
int64_t id = box.id;
box.id = 0; // id will be used as a temp offset storage
bool popped_up;
do {
popped_up = false;
for (int i_slot = box.start; i_slot <= box.finish; i_slot++) {
for (auto* box_in_slot : time_slots[i_slot]) {
// intersect with already stored boxes for all covered time slots
// and move up the new one if needed
popped_up |= popupTogetherWith(box, *box_in_slot);
}
}
} while (popped_up);
// add current box to covered time slot
for (int i_slot = box.start; i_slot <= box.finish; i_slot++)
time_slots[i_slot].push_back(&box);
// store the max top bound for each box
_min_required = std::max(_min_required, box.id + box.size);
_offsets[id] = box.id; // TODO: move to constructor (use .insert instead of [])
}
return _min_required;
}
/** Provides calculated offset for specified box id */
int64_t getOffset(int id) const {
auto res = _offsets.find(id);
if (res == _offsets.end())
IE_THROW() << "There are no box for provided ID";
return res->second;
}
/** Additional info. Max sum of box sizes required for any time stamp. */
int64_t maxDepth() {
if (_depth == -1)
calcDepth();
return _depth;
}
/** Additional info. Max num of boxes required for any time stamp. */
int64_t maxTopDepth() {
if (_top_depth == -1)
calcDepth();
return _top_depth;
}
private:
std::vector<Box> _boxes;
std::map<int64_t, int64_t> _offsets;
int64_t _top_depth = -1;
int64_t _depth = -1;
int _time_duration = -1;
void calcDepth() {
int64_t top_depth = 0;
int64_t depth = 0;
std::map<int64_t, std::vector<const Box*>> release_at;
for (const Box& box : _boxes) {
int64_t time = box.start;
depth += box.size;
top_depth++;
release_at[box.finish + 1].push_back(&box);
for (const Box* b : release_at[time]) {
depth -= b->size;
top_depth--;
}
release_at.erase(time);
IE_ASSERT(top_depth > 0);
_top_depth = std::max(_top_depth, top_depth);
_depth = std::max(_depth, depth);
}
}
};

View File

@@ -0,0 +1,29 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <ngraph/pass/graph_rewrite.hpp>
#include <transformations_visibility.hpp>
namespace ngraph {
namespace pass {
class TRANSFORMATIONS_API UnrollIf;
} // namespace pass
} // namespace ngraph
/**
* @ingroup ie_transformation_common_api
* @brief The transformation replaces 'If' operations with one of the internal functions (bodies) if the provided condition is constant.
* The condition is true: 'If' op is replaced with then_body
* The condition is false 'If' op is replaced with else_body
*/
class ngraph::pass::UnrollIf : public ngraph::pass::FunctionPass {
public:
NGRAPH_RTTI_DECLARATION;
bool run_on_function(std::shared_ptr<ngraph::Function> f) override;
};

View File

@@ -49,7 +49,6 @@ bool has_op_with_type(const std::shared_ptr<const ngraph::Function> &function) {
}
return false;
}
inline std::string create_ie_output_name(const ngraph::Output<ngraph::Node>& output) {
const auto& prev_layer = output.get_node_shared_ptr();
std::string out_name = prev_layer->get_friendly_name();
@@ -57,6 +56,15 @@ inline std::string create_ie_output_name(const ngraph::Output<ngraph::Node>& out
out_name += "." + std::to_string(output.get_index());
return out_name;
}
inline std::string get_ie_output_name(const ngraph::Output<ngraph::Node>& output) {
NGRAPH_SUPPRESS_DEPRECATED_START
auto name = output.get_tensor().get_name();
NGRAPH_SUPPRESS_DEPRECATED_END
if (name.empty()) {
name = create_ie_output_name(output);
}
return name;
}
template <typename T>
bool has_constant_value(const std::shared_ptr<ngraph::opset4::Constant>& constant,

View File

@@ -82,6 +82,8 @@
#include <ngraph/pass/constant_folding.hpp>
#include <transformations/common_optimizations/weights_dequantize_to_fake_quantize.hpp>
#include <transformations/common_optimizations/simplify_shape_of_sub_graph.hpp>
#include <transformations/control_flow/unroll_if.hpp>
#include <transformations/op_conversions/normalize_l2_decomposition.hpp>
#include <transformations/op_conversions/softmax_decomposition.hpp>
#include <transformations/common_optimizations/moc_transformations.hpp>
@@ -143,6 +145,7 @@ bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptr<ngraph::
// LinOpSequenceFusion must be executed after all decompositions
manager.register_pass<ngraph::pass::LinOpSequenceFusion>();
manager.register_pass<ngraph::pass::UnrollIf>();
auto conv_fusions = manager.register_pass<ngraph::pass::GraphRewrite>();
conv_fusions->add_matcher<ngraph::pass::ConvolutionMultiplyFusion>();

View File

@@ -0,0 +1,61 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/control_flow/unroll_if.hpp"
#include <memory>
#include <ngraph/graph_util.hpp>
#include <ngraph/opsets/opset8.hpp>
#include <ngraph/pattern/op/wrap_type.hpp>
#include <ngraph/rt_info.hpp>
#include <ngraph/validation_util.hpp>
#include "itt.hpp"
#include "transformations/utils/utils.hpp"
NGRAPH_RTTI_DEFINITION(ngraph::pass::UnrollIf, "UnrollIf", 0);
bool ngraph::pass::UnrollIf::run_on_function(std::shared_ptr<ngraph::Function> f) {
RUN_ON_FUNCTION_SCOPE(UnrollIf);
bool is_applicable = false;
for (const auto& op : f->get_ordered_ops()) {
auto if_node = std::dynamic_pointer_cast<opset8::If>(op);
if (!if_node || transformation_callback(if_node)) {
continue;
}
Output<Node> cond = if_node->input_value(0);
const auto cond_is_const = ngraph::get_constant_from_source(cond);
if (!cond_is_const) {
continue;
}
auto cond_value = cond_is_const->cast_vector<bool>();
auto body = (cond_value[0]) ? if_node->get_then_body() : if_node->get_else_body();
auto input_descriptions = if_node->get_input_descriptions(static_cast<int>(!cond_value[0]));
auto output_descriptions = if_node->get_output_descriptions(static_cast<int>(!cond_value[0]));
// connect inputs instead of body parameters
for (const auto& input_descr : input_descriptions) {
auto in_data = if_node->input_value(input_descr->m_input_index);
auto& param = body->get_parameters()[input_descr->m_body_parameter_index];
ngraph::replace_node(param, in_data.get_node_shared_ptr());
}
for (const auto& output_desc : output_descriptions) {
std::shared_ptr<opset8::Result> result = body->get_results()[output_desc->m_body_value_index];
const auto& in_value = result->input_value(0);
// set output name to Tensor to store it for ngraph to cnn conversion
NGRAPH_SUPPRESS_DEPRECATED_START
in_value.get_tensor().set_name(op::util::create_ie_output_name(if_node->output(output_desc->m_output_index)));
NGRAPH_SUPPRESS_DEPRECATED_END
for (const auto& input : if_node->output(output_desc->m_output_index).get_target_inputs()) {
input.replace_source_output(result->get_input_source_output(0));
}
}
is_applicable = true;
f->add_sinks(body->get_sinks());
copy_runtime_info(if_node, body->get_ops());
}
return is_applicable;
}

View File

@@ -0,0 +1,115 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <memory>
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset3.hpp>
#include <ngraph/opsets/opset6.hpp>
#include <ngraph/opsets/opset8.hpp>
#include <ngraph/pass/manager.hpp>
#include <string>
#include <transformations/control_flow/unroll_if.hpp>
#include <transformations/init_node_info.hpp>
#include "common_test_utils/ngraph_test_utils.hpp"
using namespace testing;
TEST(TransformationTests, UnrollIfCondIsTrue) {
std::shared_ptr<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto X = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Y = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto cond = std::make_shared<ngraph::opset1::Constant>(ngraph::element::boolean, ngraph::Shape{ 1 }, true);
auto if_op = std::make_shared<ngraph::opset8::If>(cond);
auto Xt = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Yt = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto add_op = std::make_shared<ngraph::opset1::Add>(Xt, Yt);
auto then_op_result = std::make_shared<ngraph::opset1::Result>(add_op);
auto then_body = std::make_shared<ngraph::Function>(ngraph::OutputVector{ then_op_result }, ngraph::ParameterVector{ Xt, Yt });
auto Xe = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Ye = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto mul_op = std::make_shared<ngraph::opset1::Multiply>(Xe, Ye);
auto else_op_result = std::make_shared<ngraph::opset1::Result>(mul_op);
auto else_body = std::make_shared<ngraph::Function>(ngraph::OutputVector{ else_op_result }, ngraph::ParameterVector{ Xe, Ye });
if_op->set_then_body(then_body);
if_op->set_else_body(else_body);
if_op->set_input(X, Xt, Xe);
if_op->set_input(Y, Yt, Ye);
if_op->set_output(then_op_result, else_op_result);
auto if_result = std::make_shared<ngraph::opset1::Result>(if_op);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ if_result }, ngraph::ParameterVector{ X, Y });
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::UnrollIf>();
manager.run_passes(f);
ASSERT_NO_THROW(check_rt_info(f));
}
{
auto X = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Y = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto add_op = std::make_shared<ngraph::opset1::Add>(X, Y);
auto if_result = std::make_shared<ngraph::opset1::Result>(add_op);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{ if_result }, ngraph::ParameterVector{ X, Y });
}
auto res = compare_functions(f, f_ref);
ASSERT_TRUE(res.first) << res.second;
}
TEST(TransformationTests, UnrollIfCondIsFalse) {
std::shared_ptr<ngraph::Function> f(nullptr), f_ref(nullptr);
{
auto X = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Y = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto cond = std::make_shared<ngraph::opset1::Constant>(ngraph::element::boolean, ngraph::Shape{ 1 }, false);
auto if_op = std::make_shared<ngraph::opset8::If>(cond);
auto Xt = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Yt = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto add_op = std::make_shared<ngraph::opset1::Add>(Xt, Yt);
auto then_op_result = std::make_shared<ngraph::opset1::Result>(add_op);
auto then_body = std::make_shared<ngraph::Function>(ngraph::OutputVector{ then_op_result }, ngraph::ParameterVector{ Xt, Yt });
auto Xe = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Ye = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto mul_op = std::make_shared<ngraph::opset1::Multiply>(Xe, Ye);
auto else_op_result = std::make_shared<ngraph::opset1::Result>(mul_op);
auto else_body = std::make_shared<ngraph::Function>(ngraph::OutputVector{ else_op_result }, ngraph::ParameterVector{ Xe, Ye });
if_op->set_then_body(then_body);
if_op->set_else_body(else_body);
if_op->set_input(X, Xt, Xe);
if_op->set_input(Y, Yt, Ye);
if_op->set_output(then_op_result, else_op_result);
auto if_result = std::make_shared<ngraph::opset1::Result>(if_op);
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{ if_result }, ngraph::ParameterVector{ X, Y });
ngraph::pass::Manager manager;
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::UnrollIf>();
manager.run_passes(f);
ASSERT_NO_THROW(check_rt_info(f));
}
{
auto X = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto Y = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{ 3 });
auto mul_op = std::make_shared<ngraph::opset1::Multiply>(X, Y);
auto if_result = std::make_shared<ngraph::opset1::Result>(mul_op);
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{ if_result }, ngraph::ParameterVector{ X, Y });
}
auto res = compare_functions(f, f_ref);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -1,44 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/exec_graph_info.hpp"
#include "ie_plugin_config.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{ InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
ExecGraphTests::getTestCaseName);
// MULTI device does not support ExecGraph
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_Multi_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
ExecGraphTests::getTestCaseName);
// AUTO device does not support ExecGraph
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_Auto_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
ExecGraphTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,59 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <common_test_utils/test_constants.hpp>
#include <exec_graph_info.hpp>
#include "behavior/executable_network/exec_graph_info.hpp"
namespace {
using namespace ExecutionGraphTests;
INSTANTIATE_TEST_SUITE_P(smoke_serialization, ExecGraphSerializationTest,
::testing::Values(CommonTestUtils::DEVICE_CPU),
ExecGraphSerializationTest::getTestCaseName);
TEST_P(ExecGraphUniqueNodeNames, CheckUniqueNodeNames) {
InferenceEngine::CNNNetwork cnnNet(fnPtr);
auto ie = PluginCache::get().ie();
auto execNet = ie->LoadNetwork(cnnNet, targetDevice);
InferenceEngine::CNNNetwork execGraphInfo = execNet.GetExecGraphInfo();
int numReorders = 0;
int expectedReorders = 2;
std::unordered_set<std::string> names;
auto function = execGraphInfo.getFunction();
ASSERT_NE(function, nullptr);
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
auto it = rtInfo.find(ExecGraphInfoSerialization::LAYER_TYPE);
ASSERT_NE(rtInfo.end(), it);
auto opType = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
ASSERT_NE(nullptr, opType);
if (opType->get() == "Reorder") {
numReorders++;
}
}
ASSERT_EQ(numReorders, expectedReorders) << "Expected reorders: " << expectedReorders << ", actual reorders: " << numReorders;
};
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32
};
INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ExecGraphUniqueNodeNames,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({1, 2, 5, 5})),
::testing::Values(CommonTestUtils::DEVICE_CPU)),
ExecGraphUniqueNodeNames::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,87 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/executable_network/exec_network_base.hpp"
#include "ie_plugin_config.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{ InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
ExecutableNetworkBaseTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, ExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
ExecutableNetworkBaseTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, ExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
ExecutableNetworkBaseTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, ExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(heteroConfigs)),
ExecutableNetworkBaseTest::getTestCaseName);
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I16,
InferenceEngine::Precision::U16
};
const std::vector<std::map<std::string, std::string>> configSetPrc = {
{},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> AutoConfigsSetPrc = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
};
const std::vector<std::map<std::string, std::string>> MultiConfigsSetPrc = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU},
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecNetSetPrecision,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configSetPrc)),
ExecNetSetPrecision::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, ExecNetSetPrecision,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiConfigsSetPrc)),
ExecNetSetPrecision::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, ExecNetSetPrecision,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(AutoConfigsSetPrc)),
ExecNetSetPrecision::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,72 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/executable_network/get_metric.hpp"
using namespace BehaviorTestsDefinitions;
using namespace InferenceEngine::PluginConfigParams;
namespace {
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassImportExportTestP, IEClassImportExportTestP,
::testing::Values("HETERO:CPU"));
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetConfigTest, IEClassExecutableNetworkGetConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkSetConfigTest, IEClassExecutableNetworkSetConfigTest,
::testing::Values("CPU"));
//
// Hetero Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values("CPU"));
} // namespace

View File

@@ -5,7 +5,7 @@
#include "behavior/infer_request/inference_chaining.hpp"
#include "common_test_utils/test_constants.hpp"
using namespace ov::test;
using namespace ov::test::behavior;
namespace {
@@ -15,7 +15,6 @@ const std::vector<std::map<std::string, std::string>> configs = {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferenceChaining,
::testing::Combine(
::testing::Values(ov::element::f32),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
OVInferenceChaining::getTestCaseName);

View File

@@ -1,62 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_exec_network.hpp"
#include "ie_plugin_config.hpp"
#include <common_test_utils/test_constants.hpp>
using namespace ov::test;
namespace {
const std::vector<ov::element::Type> netPrecisions = {
ov::element::i8,
ov::element::i16,
ov::element::i32,
ov::element::i64,
ov::element::u8,
ov::element::u16,
ov::element::u32,
ov::element::u64,
ov::element::f16,
ov::element::f32,
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU}}};
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
OVExecNetwork::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
OVExecNetwork::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
OVExecNetwork::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
OVExecNetwork,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(heteroConfigs)),
OVExecNetwork::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,82 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_executable_network/get_metric.hpp"
#include "openvino/runtime/core.hpp"
using namespace ov::test::behavior;
using namespace InferenceEngine::PluginConfigParams;
namespace {
//
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassImportExportTestP, OVClassImportExportTestP,
::testing::Values("HETERO:CPU"));
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetConfigTest, OVClassExecutableNetworkGetConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkSetConfigTest, OVClassExecutableNetworkSetConfigTest,
::testing::Values("CPU"));
////
//// Hetero Executable Network GetMetric
////
//
//INSTANTIATE_TEST_SUITE_P(
// smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
// ::testing::Values("CPU"));
//
//INSTANTIATE_TEST_SUITE_P(
// smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
// ::testing::Values("CPU"));
//
//INSTANTIATE_TEST_SUITE_P(
// smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
// ::testing::Values("CPU"));
//
//INSTANTIATE_TEST_SUITE_P(
// smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
// ::testing::Values("CPU"));
//////////////////////////////////////////////////////////////////////////////////////////
} // namespace

View File

@@ -0,0 +1,55 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_executable_network/exec_graph_info.hpp"
#include "ie_plugin_config.hpp"
#include <common_test_utils/test_constants.hpp>
using namespace ov::test::behavior;
namespace {
const std::vector<ov::element::Type_t> netPrecisions = {
ov::element::i8,
ov::element::i16,
ov::element::i32,
ov::element::i64,
ov::element::u8,
ov::element::u16,
ov::element::u32,
ov::element::u64,
ov::element::f16,
ov::element::f32,
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_CPU}}};
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
OVExecGraphImportExportTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
OVExecGraphImportExportTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
OVExecGraphImportExportTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
OVExecGraphImportExportTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests,
OVExecGraphImportExportTest,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(heteroConfigs)),
OVExecGraphImportExportTest::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,66 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_executable_network/exec_network_base.hpp"
#include "ie_plugin_config.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{ InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> heteroConfigs = {
{{"TARGET_FALLBACK", CommonTestUtils::DEVICE_CPU}}};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
OVExecutableNetworkBaseTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
OVExecutableNetworkBaseTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
OVExecutableNetworkBaseTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(heteroConfigs)),
OVExecutableNetworkBaseTest::getTestCaseName);
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I16,
InferenceEngine::Precision::U16
};
const std::vector<std::map<std::string, std::string>> configSetPrc = {
{},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> AutoConfigsSetPrc = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
};
const std::vector<std::map<std::string, std::string>> MultiConfigsSetPrc = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU},
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
} // namespace

View File

@@ -2,11 +2,10 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_core_integration.hpp"
#include "behavior/ov_plugin/core_integration.hpp"
#include "openvino/runtime/core.hpp"
using namespace BehaviorTestsDefinitions;
using namespace ov::test::behavior;
using namespace InferenceEngine::PluginConfigParams;
namespace {
@@ -78,62 +77,6 @@ INSTANTIATE_TEST_SUITE_P(
smoke_OVClassGetConfigTest, OVClassGetConfigTest,
::testing::Values("CPU"));
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetMetricTest, OVClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkGetConfigTest, OVClassExecutableNetworkGetConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassExecutableNetworkSetConfigTest, OVClassExecutableNetworkSetConfigTest,
::testing::Values("CPU"));
//
// Hetero Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_OVClassHeteroExecutableNetworkGetMetricTest, OVClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values("CPU"));
//////////////////////////////////////////////////////////////////////////////////////////
TEST(OVClassBasicTest, smoke_SetConfigAfterCreatedThrow) {

View File

@@ -3,10 +3,33 @@
//
#include "ie_plugin_config.hpp"
#include "behavior/config.hpp"
#include "ie_system_conf.h"
#include "behavior/plugin/configuration_tests.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
#if (defined(__APPLE__) || defined(_WIN32))
auto defaultBindThreadParameter = InferenceEngine::Parameter{[] {
auto numaNodes = InferenceEngine::getAvailableNUMANodes();
if (numaNodes.size() > 1) {
return std::string{CONFIG_VALUE(NUMA)};
} else {
return std::string{CONFIG_VALUE(NO)};
}
}()};
#else
auto defaultBindThreadParameter = InferenceEngine::Parameter{std::string{CONFIG_VALUE(YES)}};
#endif
INSTANTIATE_TEST_SUITE_P(
smoke_Basic,
DefaultConfigurationTest,
::testing::Combine(
::testing::Values("CPU"),
::testing::Values(DefaultParameter{CONFIG_KEY(CPU_BIND_THREAD), defaultBindThreadParameter})),
DefaultConfigurationTest::getTestCaseName);
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
@@ -47,23 +70,20 @@ namespace {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(Configs)),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(Configs)),
CorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiConfigs)),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiConfigs)),
CorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, CorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(MultiConfigs)),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(MultiConfigs)),
CorrectConfigTests::getTestCaseName);
const std::vector<std::map<std::string, std::string>> inconfigs = {
@@ -105,67 +125,57 @@ namespace {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(conf)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiconf)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiconf)),
CorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(inconfigs)),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(inconfigs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiinconfigs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiinconfigs)),
IncorrectConfigTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(inconfigs)),
IncorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiinconfigs)),
IncorrectConfigAPITests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiinconfigs)),
IncorrectConfigAPITests::getTestCaseName);
const std::vector<std::map<std::string, std::string>> ConfigsCheck = {
{},
{{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::THROUGHPUT}},
{{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY}},
{{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT, InferenceEngine::PluginConfigParams::LATENCY},
{InferenceEngine::PluginConfigParams::KEY_PERFORMANCE_HINT_NUM_REQUESTS, "1"}},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, "8"}},
{{InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, InferenceEngine::PluginConfigParams::NO}},
{{InferenceEngine::PluginConfigParams::KEY_CPU_BIND_THREAD, InferenceEngine::PluginConfigParams::YES}},
{{InferenceEngine::PluginConfigParams::KEY_DYN_BATCH_LIMIT, "10"}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigCheck,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(ConfigsCheck)),
CorrectConfigCheck::getTestCaseName);
} // namespace

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/core_integration.hpp"
#include "behavior/plugin/core_integration.hpp"
using namespace BehaviorTestsDefinitions;
@@ -21,10 +21,6 @@ INSTANTIATE_TEST_SUITE_P(
smoke_IEClassNetworkTestP, IEClassNetworkTestP,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassImportExportTestP, IEClassImportExportTestP,
::testing::Values("HETERO:CPU"));
//
// IE Class GetMetric
//
@@ -77,66 +73,10 @@ INSTANTIATE_TEST_SUITE_P(
smoke_IEClassGetConfigTest, IEClassGetConfigTest,
::testing::Values("CPU"));
//
// Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetMetricTest, IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
::testing::Values("CPU", "MULTI:CPU", "HETERO:CPU", "AUTO:CPU"));
//
// Executable Network GetConfig / SetConfig
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkGetConfigTest, IEClassExecutableNetworkGetConfigTest,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassExecutableNetworkSetConfigTest, IEClassExecutableNetworkSetConfigTest,
::testing::Values("CPU"));
//
// Hetero Executable Network GetMetric
//
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("CPU"));
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassHeteroExecutableNetworkGetMetricTest, IEClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values("CPU"));
//////////////////////////////////////////////////////////////////////////////////////////
TEST(IEClassBasicTest, smoke_SetConfigAfterCreatedThrow) {
Core ie;
InferenceEngine::Core ie;
std::string value = {};
ASSERT_NO_THROW(ie.SetConfig({{KEY_CPU_THREADS_NUM, "1"}}, "CPU"));

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <behavior/core_threading_tests.hpp>
#include <behavior/plugin/core_threading.hpp>
namespace {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/cpp_holders.hpp"
#include "behavior/plugin/life_time.hpp"
using namespace BehaviorTestsDefinitions;
namespace {

View File

@@ -0,0 +1,26 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/plugin/version.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, VersionTest,
::testing::Values(CommonTestUtils::DEVICE_CPU),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, VersionTest,
::testing::Values(CommonTestUtils::DEVICE_MULTI),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, VersionTest,
::testing::Values(CommonTestUtils::DEVICE_AUTO),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, VersionTest,
::testing::Values(CommonTestUtils::DEVICE_HETERO),
VersionTest::getTestCaseName);
} // namespace

View File

@@ -1,108 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/test_plugin.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I16,
InferenceEngine::Precision::U16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
const std::vector<std::map<std::string, std::string>> MultiConfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> configsInput = {
{},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> MultiConfigsInputOutput = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}},
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU},
{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
const std::vector<std::map<std::string, std::string>> AutoConfigsInputOutput = {
{{InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> configsOutput = {
{},
{{InferenceEngine::PluginConfigParams::KEY_CPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::CPU_THROUGHPUT_AUTO}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configsOutput)),
BehaviorTestOutput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiConfigsInputOutput)),
BehaviorTestOutput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(AutoConfigsInputOutput)),
BehaviorTestOutput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiConfigs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(MultiConfigs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configsInput)),
BehaviorTestInput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(MultiConfigsInputOutput)),
BehaviorTestInput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(AutoConfigsInputOutput)),
BehaviorTestInput::getTestCaseName);
} // namespace

View File

@@ -1,50 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/version.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}}
};
const std::vector<std::map<std::string, std::string>> Heteroconfigs = {
{{ HETERO_CONFIG_KEY(DUMP_GRAPH_DOT) , CommonTestUtils::DEVICE_CPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(configs)),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Multiconfigs)),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(Heteroconfigs)),
VersionTest::getTestCaseName);
} // namespace

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <behavior/infer_request/dynamic_batch.hpp>
#include <blob_tests/dynamic_batch.hpp>
#include "common_test_utils/test_constants.hpp"
namespace ConfigurationTestsDefinitions {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/set_blob.hpp"
#include "blob_tests/set_blob.hpp"
#include "common_test_utils/test_constants.hpp"
using namespace BehaviorTestsDefinitions;

View File

@@ -1,34 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include "configuration_tests/configuration_tests.hpp"
#include "threading/ie_istreams_executor.hpp"
#include "ie_plugin_config.hpp"
#if (defined(__APPLE__) || defined(_WIN32))
#include "ie_system_conf.h"
#endif
namespace {
#if (defined(__APPLE__) || defined(_WIN32))
auto defaultBindThreadParameter = InferenceEngine::Parameter{[] {
auto numaNodes = InferenceEngine::getAvailableNUMANodes();
if (numaNodes.size() > 1) {
return std::string{CONFIG_VALUE(NUMA)};
} else {
return std::string{CONFIG_VALUE(NO)};
}
}()};
#else
auto defaultBindThreadParameter = InferenceEngine::Parameter{std::string{CONFIG_VALUE(YES)}};
#endif
INSTANTIATE_TEST_SUITE_P(
smoke_Basic,
DefaultConfigurationTest,
::testing::Combine(
::testing::Values("CPU"),
::testing::Values(DefaultParameter{CONFIG_KEY(CPU_BIND_THREAD), defaultBindThreadParameter})),
DefaultConfigurationTest::getTestCaseName);
} // namespace

View File

@@ -3,7 +3,7 @@
//
#include <common_test_utils/test_constants.hpp>
#include "behavior/add_output.hpp"
#include "execution_graph_tests/add_output.hpp"
#include "functional_test_utils/plugin_cache.hpp"
#include "ngraph_functions/builders.hpp"

View File

@@ -1,17 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <common_test_utils/test_constants.hpp>
#include "execution_graph_tests/exec_graph_serialization.hpp"
namespace {
using namespace ExecutionGraphTests;
INSTANTIATE_TEST_SUITE_P(smoke_serialization, ExecGraphSerializationTest,
::testing::Values(CommonTestUtils::DEVICE_CPU),
ExecGraphSerializationTest::getTestCaseName);
} // namespace

View File

@@ -1,24 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "execution_graph_tests/unique_node_names.hpp"
#include "common_test_utils/test_constants.hpp"
using namespace ExecutionGraphTests;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32
};
INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ExecGraphUniqueNodeNames,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({1, 2, 5, 5})),
::testing::Values(CommonTestUtils::DEVICE_CPU)),
ExecGraphUniqueNodeNames::getTestCaseName);
} // namespace

View File

@@ -1,21 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "hetero/query_network.hpp"
#include "ngraph_functions/builders.hpp"
#include "ngraph_functions/subgraph_builders.hpp"
namespace {
using namespace HeteroTests;
auto ConvBias = ngraph::builder::subgraph::makeConvBias();
INSTANTIATE_TEST_SUITE_P(smoke_FullySupportedTopologies, QueryNetworkTest,
::testing::Combine(
::testing::Values("CPU", "HETERO:CPU", "MULTI:CPU"),
::testing::Values(ConvBias)),
QueryNetworkTest::getTestCaseName);
} // namespace

View File

@@ -3,7 +3,7 @@
//
#include <vector>
#include "behavior/invalid_cases/proposal.hpp"
#include "single_layer_tests/invalid_cases/proposal.hpp"
using namespace ngraph::helpers;
using namespace LayerTestsDefinitions;

View File

@@ -29,8 +29,6 @@ std::vector<std::string> disabledTestPatterns() {
// TODO: Issue: 43793
R"(.*InferRequestPreprocessDynamicallyInSetBlobTest.*iPRC=0.*_iLT=1.*)",
R"(.*InferRequestPreprocessDynamicallyInSetBlobTest.*oPRC=0.*_oLT=1.*)",
// TODO: Issue: 34348
R"(.*IEClassGetAvailableDevices.*)",
// TODO: Issue: 63469
R"(.*ConversionLayerTest.*ConvertLike.*)",
// TODO: Issue: 34055
@@ -79,27 +77,43 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*Behavior.*InferRequestIOBBlobSetLayoutTest.*CanSetOutBlobWithDifferentLayouts.*layout=CN.*targetDevice=(AUTO|MULTI).*)",
R"(.*Behavior.*InferRequestSetBlobByType.*Batched.*)",
R"(.*Auto_Behavior.*InferRequestIOBBlobTest.*canProcessDeallocatedOutputBlobAfterGetAndSetBlob.*)",
R"(.*Auto.*Behavior.*ExecutableNetworkBaseTest.*canLoadCorrectNetworkToGetExecutableWithIncorrectConfig.*)",
R"(.*(Auto|Multi).*Behavior.*CorrectConfigAPITests.*CanSetExclusiveAsyncRequests.*)",
R"(.*(Auto|Multi).*Behavior.*IncorrectConfigTests.*CanNotLoadNetworkWithIncorrectConfig.*)",
R"(.*OVExecutableNetworkBaseTest.*(CanGetInputsInfoAndCheck|CanSetConfigToExecNet|canLoadCorrectNetworkToGetExecutableWithIncorrectConfig).*)",
R"(.*Behavior.*CorrectConfigCheck.*(canSetConfigAndCheckGetConfig|canSetConfigTwiceAndCheckGetConfig).*CPU_BIND_THREAD=YES.*)",
// azure is failing after #6199
R"(.*/NmsLayerTest.*)",
// TODO: 56520 Accuracy mismatch
R"(.*ReduceOpsLayerTest.*type=Mean_.*netPRC=(I64|I32).*)",
R"(.*ReduceOpsLayerTest.*type=Mean_.*netPRC=U64.*)",
// Not implemented yet:
R"(.*Behavior.*ExecutableNetworkBaseTest.*canSetConfigToExecNet.*)",
R"(.*(Auto|Multi).*Behavior.*ExecutableNetworkBaseTest.*checkGetExecGraphInfo.*)",
R"(.*(Auto|Multi).*Behavior.*ExecutableNetworkBaseTest.*CanCreateTwoExeNetworksAndCheckFunction.*)",
R"(.*(Auto|Multi).*Behavior.*ExecutableNetworkBaseTest.*(CheckExecGraphInfoBeforeExecution|CheckExecGraphInfoAfterExecution).*)",
R"(.*(Auto|Multi).*Behavior.*ExecutableNetworkBaseTest.*CheckExecGraphInfoSerialization.*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*canExport.*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*canSetConfigToExecNetWithIncorrectConfig.*)",
R"(.*OVExecutableNetworkBaseTest.*canLoadCorrectNetworkToGetExecutableWithIncorrectConfig.*)",
R"(.*Hetero.*Behavior.*ExecutableNetworkBaseTest.*ExecGraphInfo.*)",
R"(.*Hetero.*Behavior.*ExecutableNetworkBaseTest.*CanCreateTwoExeNetworksAndCheckFunction.*)",
// CPU plugin does not support some precisions
R"(.*smoke_(Auto|Multi)_BehaviorTests.*OVExecNetwork.*type=(i8|u32).*)",
R"(.*smoke_(Auto|Multi)_BehaviorTests.*OVExecNetwork.*type=(f16).*)",
R"(.*smoke_Hetero_BehaviorTests.*OVExecNetwork.*type=(i8|u32).*)",
R"(.*smoke_Hetero_BehaviorTests.*OVExecNetwork.*type=(f16).*)",
R"(.*smoke_BehaviorTests.*OVExecNetwork.*type=(i8|u32).*)",
R"(.*smoke_BehaviorTests.*OVExecNetwork.*type=(f16).*)",
R"(smoke_CachingSupportCase_CPU/LoadNetworkCacheTestBase.CompareWithRefImpl/ReadConcatSplitAssign_f32_batch1_CPU)",
// Issue 66685
R"(smoke_PrePostProcess.*resize_linear_nhwc.*)",
// CPU plugin does not support some precisions
R"(.*Behavior.*OVExecGraphImportExportTest.*elementType=(i8|u32).*)",
R"(.*Behavior.*OVExecGraphImportExportTest.*elementType=(f16).*)",
R"(.*EltwiseLayerTest.*NetType=f16.*)",
// TODO: CVS-66526 overrides i/o precisions in execution graph
// as WA we used GetInputsInfo() precisions instead of ngraph ones
// R"(.*smoke_BehaviorTests.*OVExecNetwork.*importExportedFunction.*type=(i16|u16).*)",
// R"(.*smoke_BehaviorTests.*OVExecNetwork.*importExportedFunction.*type=(i64|u64).*)",
// R"(.*smoke_BehaviorTests.*OVExecNetwork.*importExportedIENetwork.*type=(i16|u16).*)",
// R"(.*smoke_BehaviorTests.*OVExecNetwork.*importExportedIENetwork.*type=(i64|u64).*)",
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedFunction.*type=(i16|u16).*)",
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedFunction.*type=(i64|u64).*)",
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedIENetwork.*type=(i16|u16).*)",
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedIENetwork.*type=(i64|u64).*)",
// CPU does not support dynamic rank
// Issue: CVS-66778
@@ -112,18 +126,14 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*smoke_BehaviorTests.*InferUpperBoundNetworkWithGetTensor.*)",
R"(.*smoke_BehaviorTests.*InferDynamicNetworkWithGetTensor.*)",
// Issue: 62746
R"(smoke_CachingSupportCase_CPU/LoadNetworkCacheTestBase.CompareWithRefImpl/ReadConcatSplitAssign_f32_batch1_CPU)",
// TODO: Issue CVS-51680
R"(.*BehaviorTests.*canRun3SyncRequestsConsistentlyFromThreads.*CPU_THROUGHPUT.*)",
// Issue 66685
R"(smoke_PrePostProcess.*resize_linear_nhwc.*)",
// Issue 67214
R"(smoke_PrePostProcess.*resize_and_convert_layout_i8.*)",
// Issue 67910
R"(.*smoke_PrePostProcess.*two_inputs_trivial.*)",
// TODO: CVS-67255
R"(smoke_If.*SimpleIf2OutTest.*)"
};
#define FIX_62820 0

View File

@@ -1,25 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/exec_graph_info.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
ExecGraphTests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,37 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/executable_network/exec_network_base.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
ExecutableNetworkBaseTest::getTestCaseName);
const std::vector<InferenceEngine::Precision> setPRC = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I16
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecNetSetPrecision,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
ExecNetSetPrecision::getTestCaseName);
} // namespace

View File

@@ -2,76 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/core_integration.hpp"
#include "behavior/executable_network/get_metric.hpp"
#include <gna/gna_config.hpp>
using namespace BehaviorTestsDefinitions;
namespace {
//
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassBasicTestP, IEClassBasicTestP,
::testing::Values(std::make_pair("GNAPlugin", "GNA")));
// TODO
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassNetworkTestP, IEClassNetworkTestP,
::testing::Values("GNA"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("GNA", "MULTI", "HETERO"));
// TODO: Issue: 30198
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassGetMetricTest, IEClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("GNA"));
// TODO: Issue: 30199
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassGetMetricTest, IEClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetConfigTest, IEClassGetConfigTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetAvailableDevices, IEClassGetAvailableDevices,
::testing::Values("GNA"));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetConfigTest, IEClassGetConfigTest,
::testing::Values("GNA"));
//
// Executable Network GetMetric
//
@@ -119,16 +55,16 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassExecutableNetworkSupportedConfigTest, IEClassExecutableNetworkSupportedConfigTest,
::testing::Combine(::testing::Values("GNA"),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_HW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW_EXACT),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_AUTO))));
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_HW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO))));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassExecutableNetworkUnsupportedConfigTest, IEClassExecutableNetworkUnsupportedConfigTest,
::testing::Combine(::testing::Values("GNA"),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW_FP32),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_FP32),
std::make_pair(GNA_CONFIG_KEY(SCALE_FACTOR), "5"),
std::make_pair(CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), CONFIG_VALUE(YES)),
std::make_pair(GNA_CONFIG_KEY(COMPACT_MODE), CONFIG_VALUE(NO)))));
@@ -136,36 +72,24 @@ INSTANTIATE_TEST_SUITE_P(
using IEClassExecutableNetworkSetConfigFromFp32Test = IEClassExecutableNetworkGetMetricTestForSpecificConfig;
TEST_P(IEClassExecutableNetworkSetConfigFromFp32Test, SetConfigFromFp32Throws) {
Core ie;
InferenceEngine::Core ie;
std::map<std::string, std::string> initialConfig;
initialConfig[GNA_CONFIG_KEY(DEVICE_MODE)] = GNAConfigParams::GNA_SW_FP32;
ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName, initialConfig);
initialConfig[GNA_CONFIG_KEY(DEVICE_MODE)] = InferenceEngine::GNAConfigParams::GNA_SW_FP32;
InferenceEngine::ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleCnnNetwork, deviceName, initialConfig);
ASSERT_THROW(exeNetwork.SetConfig({{configKey, configValue}}), Exception);
ASSERT_THROW(exeNetwork.SetConfig({{configKey, configValue}}), InferenceEngine::Exception);
}
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassExecutableNetworkSetConfigFromFp32Test, IEClassExecutableNetworkSetConfigFromFp32Test,
::testing::Combine(::testing::Values("GNA"),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_HW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW_EXACT),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW_FP32),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_AUTO))));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassQueryNetworkTest, IEClassQueryNetworkTest,
::testing::Values("GNA"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassLoadNetworkTest, IEClassLoadNetworkTest,
::testing::Values("GNA"));
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_HW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_FP32),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO))));
//
// Hetero Executable Network GetMetric

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_executable_network/exec_network_base.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVExecutableNetworkBaseTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
OVExecutableNetworkBaseTest::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,123 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_executable_network/get_metric.hpp"
#include <gna/gna_config.hpp>
using namespace ov::test::behavior;
namespace {
//
// Executable Network GetMetric
//
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetMetricTest,
OVClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GNA" /*, "MULTI:GNA", "HETERO:GNA" */));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetMetricTest,
OVClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GNA" /*, "MULTI:GNA", "HETERO:GNA" */));
// TODO: this metric is not supported by the plugin
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetMetricTest,
OVClassExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("GNA", "MULTI:GNA", "HETERO:GNA"));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetMetricTest,
OVClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS,
::testing::Values("GNA" /*, "MULTI:GNA", "HETERO:GNA" */));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetMetricTest,
OVClassExecutableNetworkGetMetricTest_ThrowsUnsupported,
::testing::Values("GNA", /* "MULTI:GNA", */ "HETERO:GNA"));
//
// Executable Network GetConfig / SetConfig
//
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkGetConfigTest,
OVClassExecutableNetworkGetConfigTest,
::testing::Values("GNA"));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkSetConfigTest,
OVClassExecutableNetworkSetConfigTest,
::testing::Values("GNA"));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_OVClassExecutableNetworkSupportedConfigTest,
OVClassExecutableNetworkSupportedConfigTest,
::testing::Combine(
::testing::Values("GNA"),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_HW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO))));
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_OVClassExecutableNetworkUnsupportedConfigTest,
OVClassExecutableNetworkUnsupportedConfigTest,
::testing::Combine(::testing::Values("GNA"),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE),
InferenceEngine::GNAConfigParams::GNA_SW_FP32),
std::make_pair(GNA_CONFIG_KEY(SCALE_FACTOR), "5"),
std::make_pair(CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), CONFIG_VALUE(YES)),
std::make_pair(GNA_CONFIG_KEY(COMPACT_MODE), CONFIG_VALUE(NO)))));
using OVClassExecutableNetworkSetConfigFromFp32Test = OVClassExecutableNetworkGetMetricTestForSpecificConfig;
TEST_P(OVClassExecutableNetworkSetConfigFromFp32Test, SetConfigFromFp32Throws) {
ov::runtime::Core ie;
std::map<std::string, std::string> initialConfig;
initialConfig[GNA_CONFIG_KEY(DEVICE_MODE)] = InferenceEngine::GNAConfigParams::GNA_SW_FP32;
ov::runtime::ExecutableNetwork exeNetwork = ie.compile_model(simpleNetwork, deviceName, initialConfig);
ASSERT_THROW(exeNetwork.set_config({{configKey, configValue}}), ov::Exception);
}
// TODO: Convolution with 3D input is not supported on GNA
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_OVClassExecutableNetworkSetConfigFromFp32Test,
OVClassExecutableNetworkSetConfigFromFp32Test,
::testing::Combine(
::testing::Values("GNA"),
::testing::Values(std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_HW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_FP32),
std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO))));
//
// Hetero Executable Network GetMetric
//
// TODO: verify hetero interop
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassHeteroExecutableNetworlGetMetricTest,
OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GNA"));
// TODO: verify hetero interop
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassHeteroExecutableNetworlGetMetricTest,
OVClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GNA"));
// TODO: verify hetero interop
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassHeteroExecutableNetworlGetMetricTest,
OVClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(smoke_OVClassHeteroExecutableNetworlGetMetricTest,
OVClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK,
::testing::Values("GNA"));
} // namespace

View File

@@ -0,0 +1,78 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_plugin/core_integration.hpp"
#include <gna/gna_config.hpp>
using namespace ov::test::behavior;
namespace {
//
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassBasicTestP,
OVClassBasicTestP,
::testing::Values(std::make_pair("GNAPlugin", "GNA")));
// TODO
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassNetworkTestP, OVClassNetworkTestP, ::testing::Values("GNA"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("GNA", "MULTI", "HETERO"));
// TODO: Issue: 30198
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassGetMetricTest,
OVClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("GNA"));
// TODO: Issue: 30199
INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassGetMetricTest,
OVClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetMetricTest,
OVClassGetMetricTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest,
OVClassGetConfigTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetAvailableDevices, OVClassGetAvailableDevices, ::testing::Values("GNA"));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(nightly_OVClassGetConfigTest, OVClassGetConfigTest, ::testing::Values("GNA"));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassQueryNetworkTest, OVClassQueryNetworkTest, ::testing::Values("GNA"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(smoke_OVClassLoadNetworkTest, OVClassLoadNetworkTest, ::testing::Values("GNA"));
} // namespace

View File

@@ -3,7 +3,7 @@
//
#include "gna/gna_config.hpp"
#include "behavior/config.hpp"
#include "behavior/plugin/configuration_tests.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
@@ -24,7 +24,6 @@ namespace {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(inconfigs)),
IncorrectConfigTests::getTestCaseName);
@@ -40,22 +39,7 @@ namespace {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(Inconfigs)),
IncorrectConfigAPITests::getTestCaseName);
const std::vector<std::map<std::string, std::string>> conf = {
{}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigAPITests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(conf)),
CorrectConfigAPITests::getTestCaseName);
} // namespace

View File

@@ -0,0 +1,86 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/plugin/core_integration.hpp"
#include <gna/gna_config.hpp>
using namespace BehaviorTestsDefinitions;
namespace {
//
// IE Class Common tests with <pluginName, deviceName params>
//
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassBasicTestP, IEClassBasicTestP,
::testing::Values(std::make_pair("GNAPlugin", "GNA")));
// TODO
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassNetworkTestP, IEClassNetworkTestP,
::testing::Values("GNA"));
//
// IE Class GetMetric
//
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_CONFIG_KEYS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_SUPPORTED_METRICS,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_AVAILABLE_DEVICES,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_FULL_DEVICE_NAME,
::testing::Values("GNA", "MULTI", "HETERO"));
// TODO: Issue: 30198
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassGetMetricTest, IEClassGetMetricTest_OPTIMIZATION_CAPABILITIES,
::testing::Values("GNA"));
// TODO: Issue: 30199
INSTANTIATE_TEST_SUITE_P(
DISABLED_smoke_IEClassGetMetricTest, IEClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS,
::testing::Values("GNA"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetMetricTest, IEClassGetMetricTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetConfigTest, IEClassGetConfigTest_ThrowUnsupported,
::testing::Values("GNA", "MULTI", "HETERO"));
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetAvailableDevices, IEClassGetAvailableDevices,
::testing::Values("GNA"));
//
// IE Class GetConfig
//
INSTANTIATE_TEST_SUITE_P(
nightly_IEClassGetConfigTest, IEClassGetConfigTest,
::testing::Values("GNA"));
// IE Class Query network
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassQueryNetworkTest, IEClassQueryNetworkTest,
::testing::Values("GNA"));
// IE Class Load network
INSTANTIATE_TEST_SUITE_P(
smoke_IEClassLoadNetworkTest, IEClassLoadNetworkTest,
::testing::Values("GNA"));
} // namespace

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <behavior/core_threading_tests.hpp>
#include <behavior/plugin/core_threading.hpp>
namespace {
Params params[] = {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/cpp_holders.hpp"
#include "behavior/plugin/life_time.hpp"
using namespace BehaviorTestsDefinitions;
namespace {

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/plugin/version.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, VersionTest,
::testing::Values(CommonTestUtils::DEVICE_GNA),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, VersionTest,
::testing::Values(CommonTestUtils::DEVICE_HETERO),
VersionTest::getTestCaseName);
} // namespace

View File

@@ -1,40 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/test_plugin.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::U8,
InferenceEngine::Precision::I16
};
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTests,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
BehaviorTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTestInput,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
BehaviorTestInput::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, BehaviorTestOutput,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
BehaviorTestOutput::getTestCaseName);
} // namespace

View File

@@ -1,32 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/version.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{}
};
const std::vector<std::map<std::string, std::string>> Heteroconfigs = {
{{ HETERO_CONFIG_KEY(DUMP_GRAPH_DOT) , CommonTestUtils::DEVICE_GNA}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(configs)),
VersionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, VersionTest,
::testing::Combine(
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(CommonTestUtils::DEVICE_HETERO),
::testing::ValuesIn(Heteroconfigs)),
VersionTest::getTestCaseName);
} // namespace

View File

@@ -3,7 +3,7 @@
//
#include <common_test_utils/test_constants.hpp>
#include "behavior/add_output.hpp"
#include "execution_graph_tests/add_output.hpp"
#include "functional_test_utils/test_model/test_model.hpp"
#include "functional_test_utils/plugin_cache.hpp"

View File

@@ -51,6 +51,19 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*smoke_MemoryTest.*iteration_count=4.*IS=\(1.10\).*)",
R"(.*smoke_MemoryTest.*iteration_count=10.*IS=\(1.10\).*)",
R"(.*smoke_MemoryTest.*LOW_LATENCY.*iteration_count=10.*IS=\(1.2\).*)",
// Not implemented yet
R"(.*Behavior.*ExecutableNetworkBaseTest.*(canSetConfigToExecNet|canSetConfigToExecNetWithIncorrectConfig).*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*(CheckExecGraphInfoBeforeExecution|CheckExecGraphInfoAfterExecution|CheckExecGraphInfoSerialization).*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*canExport.*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*(CanCreateTwoExeNetworksAndCheckFunction).*)",
R"(.*Behavior.*ExecutableNetworkBaseTest.*(checkGetExecGraphInfoIsNotNullptr).*)",
// Not expected behavior
R"(.*Behavior.*ExecNetSetPrecision.*canSetInputPrecisionForNetwork.*FP16.*)",
R"(.*OVExecutableNetworkBaseTest.*canLoadCorrectNetworkToGetExecutableWithIncorrectConfig.*)",
R"(.*OVExecutableNetworkBaseTest.*CanSetConfigToExecNet.*)",
R"(.*OVExecutableNetworkBaseTest.*CanGetInputsInfoAndCheck.*)",
R"(.*OVClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK.*GetMetricNoThrow.*)",
R"(.*Behavior.*OVExecutableNetworkBaseTest.*get(Inputs|Outputs)FromFunctionWithSeveral(Inputs|Outputs).*)",
// TODO: Issue: 29577
R"(.*QueryNetwork.*)",
// TODO: GNA plugin does not support ExecGraph

View File

@@ -13,14 +13,28 @@ namespace {
std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::Precision::FP32,
};
std::map<std::string, std::string> additional_config = {
{"GNA_COMPACT_MODE", "NO"}
std::vector<std::map<std::string, std::string>> additional_config = {
{{"GNA_DEVICE_MODE", "GNA_SW_FP32"}},
{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}}
};
std::vector<size_t> memory_sizes = {
128, 256, 32
};
INSTANTIATE_TEST_SUITE_P(smoke_delayed_copy_layer, DelayedCopyTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::Values(additional_config)),
DelayedCopyTest::getTestCaseName);
::testing::ValuesIn(additional_config),
::testing::ValuesIn(memory_sizes)),
DelayedCopyTestBase::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_delayed_copy_layer, DelayedCopyAfterReshapeWithMultipleConnTest,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GNA),
::testing::ValuesIn(additional_config),
::testing::ValuesIn(memory_sizes)),
DelayedCopyTestBase::getTestCaseName);
} // namespace

View File

@@ -42,3 +42,8 @@ if(LIBVA_FOUND)
target_include_directories(${TARGET_NAME} PRIVATE ${LIBVA_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} PRIVATE ${LIBVA_LINK_LIBRARIES})
endif()
if(WIN32)
target_compile_definitions(${TARGET_NAME} PRIVATE ENABLE_DX11)
target_link_libraries(${TARGET_NAME} PRIVATE d3d11 dxgi)
endif()

View File

@@ -0,0 +1,134 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <string>
#include <utility>
#include <vector>
#include <tuple>
#include <memory>
#include <ie_compound_blob.h>
#include <gpu/gpu_config.hpp>
#include <common_test_utils/test_common.hpp>
#include <common_test_utils/test_constants.hpp>
#ifdef _WIN32
#ifdef ENABLE_DX11
#ifndef D3D11_NO_HELPERS
#define D3D11_NO_HELPERS
#define D3D11_NO_HELPERS_DEFINED_CTX_UT
#endif
#ifndef NOMINMAX
#define NOMINMAX
#define NOMINMAX_DEFINED_CTX_UT
#endif
#include <gpu/gpu_context_api_dx.hpp>
#include <atlbase.h>
#include <d3d11.h>
#include <d3d11_4.h>
#ifdef NOMINMAX_DEFINED_CTX_UT
#undef NOMINMAX
#undef NOMINMAX_DEFINED_CTX_UT
#endif
#ifdef D3D11_NO_HELPERS_DEFINED_CTX_UT
#undef D3D11_NO_HELPERS
#undef D3D11_NO_HELPERS_DEFINED_CTX_UT
#endif
using namespace ::testing;
using namespace InferenceEngine;
using namespace InferenceEngine::gpu;
class DX11RemoteCtx_Test : public CommonTestUtils::TestsCommon {
protected:
CComPtr<IDXGIFactory> factory;
std::vector<CComPtr<IDXGIAdapter>> intel_adapters;
std::vector<CComPtr<IDXGIAdapter>> other_adapters;
void SetUp() override {
IDXGIFactory* out_factory = nullptr;
HRESULT err = CreateDXGIFactory(__uuidof(IDXGIFactory),
reinterpret_cast<void**>(&out_factory));
if (FAILED(err)) {
throw std::runtime_error("Cannot create CreateDXGIFactory, error: " + std::to_string(HRESULT_CODE(err)));
}
factory.Attach(out_factory);
UINT adapter_index = 0;
const unsigned int refIntelVendorID = 0x8086;
IDXGIAdapter* out_adapter = nullptr;
while (factory->EnumAdapters(adapter_index, &out_adapter) != DXGI_ERROR_NOT_FOUND) {
CComPtr<IDXGIAdapter> adapter(out_adapter);
DXGI_ADAPTER_DESC desc{};
adapter->GetDesc(&desc);
if (desc.VendorId == refIntelVendorID) {
intel_adapters.push_back(adapter);
} else {
other_adapters.push_back(adapter);
}
++adapter_index;
}
}
std::tuple<CComPtr<ID3D11Device>, CComPtr<ID3D11DeviceContext>>
create_device_with_ctx(CComPtr<IDXGIAdapter> adapter) {
UINT flags = 0;
D3D_FEATURE_LEVEL feature_levels[] = { D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
D3D_FEATURE_LEVEL featureLevel;
ID3D11Device* ret_device_ptr = nullptr;
ID3D11DeviceContext* ret_ctx_ptr = nullptr;
HRESULT err = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN,
nullptr, flags,
feature_levels,
ARRAYSIZE(feature_levels),
D3D11_SDK_VERSION, &ret_device_ptr,
&featureLevel, &ret_ctx_ptr);
if (FAILED(err)) {
throw std::runtime_error("Cannot create D3D11CreateDevice, error: " +
std::to_string(HRESULT_CODE(err)));
}
return std::make_tuple(ret_device_ptr, ret_ctx_ptr);
}
};
TEST_F(DX11RemoteCtx_Test, smoke_make_shared_context) {
auto ie = InferenceEngine::Core();
for (auto adapter : intel_adapters) {
CComPtr<ID3D11Device> device_ptr;
CComPtr<ID3D11DeviceContext> ctx_ptr;
ASSERT_NO_THROW(std::tie(device_ptr, ctx_ptr) =
create_device_with_ctx(adapter));
auto remote_context = make_shared_context(ie,
CommonTestUtils::DEVICE_GPU,
device_ptr);
ASSERT_TRUE(remote_context);
}
for (auto adapter : other_adapters) {
CComPtr<ID3D11Device> device_ptr;
CComPtr<ID3D11DeviceContext> ctx_ptr;
ASSERT_NO_THROW(std::tie(device_ptr, ctx_ptr) =
create_device_with_ctx(adapter));
ASSERT_THROW(make_shared_context(ie, CommonTestUtils::DEVICE_GPU,
device_ptr),
std::runtime_error);
}
}
#endif // ENABLE_DX11
#endif // WIN32

View File

@@ -1,25 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/exec_graph_info.hpp"
using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
};
const std::vector<std::map<std::string, std::string>> configs = {
{},
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, ExecGraphTests,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
ExecGraphTests::getTestCaseName);
} // namespace

Some files were not shown because too many files have changed in this diff Show More