[GPU] Enable new OV2.0 infer request behavior tests (#8358)

This commit is contained in:
Mikhail Letavin 2021-11-16 10:07:39 +03:00 committed by GitHub
parent 90094e8a8a
commit b6bdc4a567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 301 additions and 6 deletions

View File

@ -755,6 +755,21 @@ void CLDNNInferRequest::copy_input_data(std::shared_ptr<cldnn::network> network,
}
}
Blob::Ptr CLDNNInferRequest::host_blob_from_device_blob(Blob::Ptr blobPtr) {
uint8_t* bufferMem = nullptr;
auto clblobPtr = std::dynamic_pointer_cast<InferenceEngine::gpu::ClBlob>(blobPtr);
if (clblobPtr) {
const auto memPtr = getBlobImpl(clblobPtr.get())->getMemory();
if (memPtr->get_allocation_type() == cldnn::allocation_type::usm_host) {
bufferMem = reinterpret_cast<uint8_t*>(memPtr->get_internal_params().mem);
}
}
Blob::Ptr hostBlob = create_host_blob(blobPtr->getTensorDesc(), bufferMem);
hostBlob->allocate();
return hostBlob;
}
void CLDNNInferRequest::allocate_inputs() {
OV_ITT_SCOPED_TASK(itt::domains::CLDNNPlugin, "CLDNNInferRequest::allocate_inputs");
auto inputLayouts = m_graph->GetInputLayouts();
@ -786,9 +801,7 @@ void CLDNNInferRequest::allocate_inputs() {
} else {
auto blobPtr = create_device_blob(desc, litr->second);
_deviceInputs[name] = blobPtr;
Blob::Ptr inputBlob = create_host_blob(desc);
inputBlob->allocate();
_inputs[name] = inputBlob;
_inputs[name] = host_blob_from_device_blob(blobPtr);
}
}
}
@ -834,9 +847,7 @@ void CLDNNInferRequest::allocate_outputs() {
}
auto blobPtr = create_device_blob(desc, output_layout);
_deviceOutputs[no.first] = blobPtr;
Blob::Ptr outputBlob = create_host_blob(desc);
outputBlob->allocate();
_outputs[no.first] = outputBlob;
_outputs[no.first] = host_blob_from_device_blob(blobPtr);
outputsMap[no.first] = outputID;
}
}

View File

@ -92,6 +92,7 @@ private:
const cldnn::layout& inputLayout, const InferenceEngine::Blob &inputBlob,
buf_info* bi = nullptr);
InferenceEngine::Blob::Ptr host_blob_from_device_blob(const InferenceEngine::Blob::Ptr blobPtr);
void allocate_inputs();
void allocate_outputs();
void allocate_inputs_dynamic();

View File

@ -0,0 +1,38 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/ov_infer_request/callback.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
{{InferenceEngine::PluginConfigParams::KEY_GPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::GPU_THROUGHPUT_AUTO}},
};
const std::vector<std::map<std::string, std::string>> multiConfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestCallbackTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
OVInferRequestCallbackTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestCallbackTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(multiConfigs)),
OVInferRequestCallbackTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestCallbackTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(multiConfigs)),
OVInferRequestCallbackTests::getTestCaseName);
} // namespace

View File

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

View File

@ -0,0 +1,83 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/ov_infer_request/io_tensor.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
{{InferenceEngine::PluginConfigParams::KEY_GPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::GPU_THROUGHPUT_AUTO}},
};
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
OVInferRequestIOTensorTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestIOTensorTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
OVInferRequestIOTensorTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestIOTensorTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
OVInferRequestIOTensorTest::getTestCaseName);
std::vector<ov::element::Type> prcs = {
ov::element::boolean,
ov::element::bf16,
ov::element::f16,
ov::element::f32,
ov::element::f64,
ov::element::i4,
ov::element::i8,
ov::element::i16,
ov::element::i32,
ov::element::i64,
ov::element::u1,
ov::element::u4,
ov::element::u8,
ov::element::u16,
ov::element::u32,
ov::element::u64,
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorSetPrecisionTest,
::testing::Combine(
::testing::ValuesIn(prcs),
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestIOTensorSetPrecisionTest,
::testing::Combine(
::testing::ValuesIn(prcs),
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestIOTensorSetPrecisionTest,
::testing::Combine(
::testing::ValuesIn(prcs),
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
OVInferRequestIOTensorSetPrecisionTest::getTestCaseName);
} // namespace

View File

@ -0,0 +1,40 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/ov_infer_request/multithreading.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
{{InferenceEngine::PluginConfigParams::KEY_GPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::GPU_THROUGHPUT_AUTO}},
};
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestMultithreadingTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
OVInferRequestMultithreadingTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestMultithreadingTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
OVInferRequestMultithreadingTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestMultithreadingTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Multiconfigs)),
OVInferRequestMultithreadingTests::getTestCaseName);
} // namespace

View File

@ -0,0 +1,59 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "behavior/ov_infer_request/perf_counters.hpp"
using namespace ov::test::behavior;
namespace {
TEST_P(OVInferRequestPerfCountersTest, CheckOperationInProfilingInfo) {
req = execNet.create_infer_request();
ASSERT_NO_THROW(req.infer());
std::vector<ov::runtime::ProfilingInfo> profiling_info;
ASSERT_NO_THROW(profiling_info = req.get_profiling_info());
for (const auto& op : function->get_ops()) {
auto op_is_in_profiling_info = std::any_of(std::begin(profiling_info), std::end(profiling_info),
[&] (const ov::runtime::ProfilingInfo& info) {
if (info.node_name.find(op->get_friendly_name() + "_") != std::string::npos || info.node_name == op->get_friendly_name()) {
return true;
} else {
return false;
}
});
ASSERT_TRUE(op_is_in_profiling_info) << "For op: " << op;
}
}
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_GPU}}
};
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestPerfCountersTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
OVInferRequestPerfCountersTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestPerfCountersTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
OVInferRequestPerfCountersTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestPerfCountersTest,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
OVInferRequestPerfCountersTest::getTestCaseName);
} // namespace

View File

@ -0,0 +1,44 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "behavior/ov_infer_request/wait.hpp"
using namespace ov::test::behavior;
namespace {
const std::vector<std::map<std::string, std::string>> configs = {
{},
{{InferenceEngine::PluginConfigParams::KEY_GPU_THROUGHPUT_STREAMS, InferenceEngine::PluginConfigParams::GPU_THROUGHPUT_AUTO}},
};
const std::vector<std::map<std::string, std::string>> Multiconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
const std::vector<std::map<std::string, std::string>> Autoconfigs = {
{{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_GPU}}
};
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestWaitTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(configs)),
OVInferRequestWaitTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestWaitTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_MULTI),
::testing::ValuesIn(Multiconfigs)),
OVInferRequestWaitTests::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestWaitTests,
::testing::Combine(
::testing::Values(CommonTestUtils::DEVICE_AUTO),
::testing::ValuesIn(Autoconfigs)),
OVInferRequestWaitTests::getTestCaseName);
} // namespace