Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DON"T MERGE] [TEST] cpu plugin api 2.0 precision mismatch fixing #18544

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
8cb9cce
[CPU] CPU plugin migrates to plugin API 2.0
riverlijunjie May 26, 2023
2a9112c
Fix legacy config/metric issue
riverlijunjie May 29, 2023
c092964
Fix some issue of ov_cpu_func_tests
riverlijunjie May 30, 2023
2928e85
Resolve some comments
riverlijunjie Jun 1, 2023
99c02e2
Fix dynamic shape inference issue
riverlijunjie Jun 7, 2023
b00aaa9
Fix build error
riverlijunjie Jun 7, 2023
4f920ce
keep original model info in infer_request
riverlijunjie Jun 8, 2023
3929eca
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 8, 2023
2de65cd
Fix minor error
riverlijunjie Jun 8, 2023
67d1f5d
cache internal tensors for input/output precision change
riverlijunjie Jun 8, 2023
3740fca
Disable import model test cases with precision changes
riverlijunjie Jun 9, 2023
ef13da6
fix precision issue
riverlijunjie Jun 9, 2023
c51ad46
Fix issue for import model
riverlijunjie Jun 12, 2023
e0ea0e0
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 12, 2023
a371a86
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 13, 2023
234f507
Fix InferRequestCancellationTests exception issue
riverlijunjie Jun 13, 2023
6fef581
Skip InferRequestIOBBlobTest.*secondCallGetInputDoNotReAllocateData d…
riverlijunjie Jun 13, 2023
6ba95c8
Fix graph name issue
riverlijunjie Jun 13, 2023
5053b78
Fix ROI issues
riverlijunjie Jun 14, 2023
6a26a4f
Fix Transpose shape issue
riverlijunjie Jun 15, 2023
604934f
Skip vie::Version test due to change to ov::Version
riverlijunjie Jun 15, 2023
3630f2b
Solve input port name changes issue
riverlijunjie Jun 16, 2023
48fd629
Solve preprocess layout issue
riverlijunjie Jun 16, 2023
157b8c4
Fix minor issue
riverlijunjie Jun 17, 2023
ed369f9
tidy up code
riverlijunjie Jun 17, 2023
22961ec
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 17, 2023
75a2e7d
Fix conflict after rebase
riverlijunjie Jun 17, 2023
294907a
Fix Windows build warning
riverlijunjie Jun 17, 2023
9fd7dc4
Add aux tensors for precision change issue
riverlijunjie Jun 18, 2023
4d8d6de
Fix import/export model issue
riverlijunjie Jun 19, 2023
bc8fcdd
WA single layer name changed by preprocess
riverlijunjie Jun 20, 2023
b3dae9d
Revert "WA single layer name changed by preprocess"
riverlijunjie Jun 20, 2023
7c03c55
Skip some legacy tests due to plugin api 2.0 is enabled
riverlijunjie Jun 23, 2023
9ef10dd
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 23, 2023
b71389f
Fix 2 build warnings
riverlijunjie Jun 23, 2023
ca2e07a
Skip some AUTO plugin tests
riverlijunjie Jun 23, 2023
d55a0d8
Fix property issue caused by AUTO plugin
riverlijunjie Jun 23, 2023
f593dc5
Skip PSROIPooling issues
riverlijunjie Jun 23, 2023
bd0aea6
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 23, 2023
50960f9
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 23, 2023
89deaae
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 24, 2023
03a9c94
Follow header files reference policy
riverlijunjie Jun 24, 2023
018331d
Split out transformation fixing for nop_elimination
riverlijunjie Jun 25, 2023
48ff306
Fix AUTO plugin mismatch issue for get_tensor function
riverlijunjie Jun 25, 2023
f2bea40
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 25, 2023
e56f5a2
Fix aux tensor shape issue
riverlijunjie Jun 25, 2023
90a862d
Fix tensor shape issue
riverlijunjie Jun 25, 2023
e16fc9e
WA python sync inference sample's segmentfault issue
riverlijunjie Jun 27, 2023
ef9913d
Fix reshape issue for dynamic inference
riverlijunjie Jun 27, 2023
72e9d15
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jun 28, 2023
8871a29
Fixed incorrect tensor name in e2e test
riverlijunjie Jun 28, 2023
07c7c63
Fix python segmentfault issue of plugin api 2.0
riverlijunjie Jul 2, 2023
91fe9fa
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 2, 2023
6f502e5
Fix python segmentfault issue of plugin api 2.0
riverlijunjie Jul 2, 2023
7ecee1a
Revert "Fix python segmentfault issue of plugin api 2.0"
riverlijunjie Jul 2, 2023
c977a4b
Fix onnx_duplicated_output_name due to empty tensor
riverlijunjie Jul 3, 2023
6b54f79
Remove redundant code
riverlijunjie Jul 3, 2023
80dac48
Merge branch 'river/fix_segmentfault_plugin_api_2.0' into river/cpu_p…
riverlijunjie Jul 3, 2023
7be6ac3
Remove python segment fault WA
riverlijunjie Jul 3, 2023
cefe4a6
Keep rt_info to fix test failure in case of legacy public api
riverlijunjie Jul 4, 2023
de997a6
Fix output port names missing issue
riverlijunjie Jul 4, 2023
7d7d15d
Adress some reviewers' comments
riverlijunjie Jul 4, 2023
1c60930
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 4, 2023
ac5875d
Restore OnnxBackendNodeModelTest::test_maxpool_with_argmax_2d_precomp…
riverlijunjie Jul 4, 2023
6cf6901
Resolve tensor sharing issue when there are same name output port name
riverlijunjie Jul 5, 2023
c30147a
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 5, 2023
fee942a
Resolve tensor sharing issue when there are same name output port name
riverlijunjie Jul 5, 2023
a352444
Better method to find shrared tensor desc
riverlijunjie Jul 5, 2023
4d14a24
Merge branch 'master' into river/same_name_port_name_tensor_shared_issue
riverlijunjie Jul 5, 2023
76881a3
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 5, 2023
ba9eddc
Merge branch 'river/same_name_port_name_tensor_shared_issue' into riv…
riverlijunjie Jul 5, 2023
7081af0
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 6, 2023
c7284f9
rename with snake_case style
riverlijunjie Jul 6, 2023
d8bed0f
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 6, 2023
b1a4a18
Remove ngraph header files
riverlijunjie Jul 6, 2023
6d11157
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 6, 2023
4f3508d
Keep external_ptr naming
riverlijunjie Jul 6, 2023
e900a7b
Add OPENVINO_SUPPRESS_DEPRECATED for some legacy code
riverlijunjie Jul 6, 2023
6b86b81
Use port's tensor_ptr to replace creating new tensor_ptr
riverlijunjie Jul 6, 2023
cb6a835
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 7, 2023
48451a7
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 7, 2023
a90c8af
Resolve some reviewer comments
riverlijunjie Jul 10, 2023
e4da77c
Implement ov::IInferRequestInternalWrapper::GetPreProcess to recover …
riverlijunjie Jul 10, 2023
04eeca1
Remove unnecessary header files reference
riverlijunjie Jul 10, 2023
c902db0
Assert the risk of precision change and reorder at the same time
riverlijunjie Jul 10, 2023
ac1b450
Modify legacy python test to fit plugin api 2.0 behavior
riverlijunjie Jul 10, 2023
68973d0
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 10, 2023
9d45c3c
Recover smoke_Transpose(2|4|5|6)D/TransposeLayerTest.CompareWithRefs …
riverlijunjie Jul 10, 2023
a391f28
Fix typo issue
riverlijunjie Jul 11, 2023
8cb8a20
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 11, 2023
11af7f2
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 11, 2023
ecef81e
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 11, 2023
c7b78cb
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 11, 2023
ccdf1ff
Address reviewer's comments
riverlijunjie Jul 12, 2023
445f073
Merge branch 'master' into river/cpu_plugin_api_2.0
riverlijunjie Jul 12, 2023
fc5af55
Disable precision coversion
riverlijunjie Jul 12, 2023
028d59a
Remove precision mismatch WA
riverlijunjie Jul 14, 2023
b49110f
WA precision issue for query_model
riverlijunjie Jul 14, 2023
af978e8
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 14, 2023
eed5cc5
Solve precision mismatch between compiled model and graph
riverlijunjie Jul 14, 2023
7b2cdcb
Fixe failure of query_model
riverlijunjie Jul 14, 2023
27b757f
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 14, 2023
df8acb7
Rebase to new plugin api update
riverlijunjie Jul 14, 2023
526aa08
Recover the test cases of precision mismatch
riverlijunjie Jul 14, 2023
b2da7f4
Try to fix name changing for graph model
riverlijunjie Jul 15, 2023
60cdef6
Remove tets code
riverlijunjie Jul 15, 2023
a5ba7e5
Remove fp64
riverlijunjie Jul 15, 2023
3c2d9a5
Remove precision change from preprocess to avoid ACL unsupport conver…
riverlijunjie Jul 16, 2023
ef42c30
Revert "Remove precision change from preprocess to avoid ACL unsuppor…
riverlijunjie Jul 17, 2023
be9a5e2
Debug
riverlijunjie Jul 17, 2023
c0bb415
Debug incorrect precision checking issue
riverlijunjie Jul 17, 2023
287c60b
Debug Eltwise FP64 unsupported issue
riverlijunjie Jul 18, 2023
d6ca7e1
Add logs for precision
riverlijunjie Jul 18, 2023
0dc2648
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 18, 2023
fdb7461
debug log
riverlijunjie Jul 21, 2023
b336c17
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 24, 2023
8e63a81
Add debug
riverlijunjie Jul 24, 2023
1b3e8a5
Fix precision unsupport issue
riverlijunjie Jul 25, 2023
23ce148
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 26, 2023
3af2940
U16/I16/U64 precision support
riverlijunjie Jul 26, 2023
39471bf
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 27, 2023
3d49e2e
Resolve the issue of f64 reorder
riverlijunjie Jul 28, 2023
8de23a0
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Jul 28, 2023
88e1284
Fix convert multiple child edge issue
riverlijunjie Jul 28, 2023
c9010c1
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Aug 7, 2023
05a9e27
Solve ROI tensor failure issues
riverlijunjie Aug 7, 2023
2d43cf3
Temporarily disable num_nodes comparison
riverlijunjie Aug 7, 2023
37a6297
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Aug 7, 2023
cad7120
Only change convert precision for fp64
riverlijunjie Aug 7, 2023
9f2473e
Put convert precision change before reorder to avoid confusion
riverlijunjie Aug 8, 2023
fb8953f
Add debug log for transformation
riverlijunjie Aug 9, 2023
82bed2f
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Aug 9, 2023
917e859
Fix rebase confilict
riverlijunjie Aug 9, 2023
00ceeda
Fix clang issue
riverlijunjie Aug 9, 2023
2c89303
Temporarily disable test_infer_mixed_values python test of bf16
riverlijunjie Aug 9, 2023
6983a07
Solve issue of smoke_ConvertCPULayerTest_BOOL_Dynamic_inputPRC=BF16 c…
riverlijunjie Aug 9, 2023
3445e70
Fix issue of pytorch_tests/test_outer.py
riverlijunjie Aug 10, 2023
80a264a
Fix arm cannot find Eltwise executor issue
riverlijunjie Aug 10, 2023
c1330d5
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Aug 10, 2023
a5eb68a
Merge branch 'master' into river/cpu_plugin_api_2.0_precision
riverlijunjie Aug 24, 2023
4b4be3e
onnx xfail issues
riverlijunjie Aug 24, 2023
6f5859a
mend
riverlijunjie Aug 24, 2023
677c5df
Revert "mend"
riverlijunjie Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ def test_infer_mixed_values(device, ov_type, numpy_dtype, share_inputs):

request.infer([tensor1, array1], share_inputs=share_inputs)

assert np.array_equal(request.output_tensors[0].data, np.concatenate((tensor1.data, array1)))
if ov_type != Type.bf16:
assert np.array_equal(request.output_tensors[0].data, np.concatenate((tensor1.data, array1)))


@pytest.mark.parametrize(("ov_type", "numpy_dtype"), [
Expand All @@ -428,7 +429,8 @@ def test_async_mixed_values(device, ov_type, numpy_dtype, share_inputs):

request.start_async([tensor1, array1], share_inputs=share_inputs)
request.wait()
assert np.array_equal(request.output_tensors[0].data, np.concatenate((tensor1.data, array1)))
if ov_type != Type.bf16:
assert np.array_equal(request.output_tensors[0].data, np.concatenate((tensor1.data, array1)))


@pytest.mark.parametrize(("ov_type", "numpy_dtype"), [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def test_wait_before_start(device):
requests = exec_net.requests
for id in range(num_requests):
status = requests[id].wait()
assert status == ie.StatusCode.INFER_NOT_STARTED
# Plugin API 2.0 has the different behavior will not return this status
# assert status == ie.StatusCode.INFER_NOT_STARTED
request_handler = exec_net.start_async(request_id=id, inputs={'parameter': img})
status = requests[id].wait()
assert status == ie.StatusCode.OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ def callback(self, status):
request = exec_net.requests[0]
request.set_completion_callback(callback)
status = request.wait()
assert status == ie.StatusCode.INFER_NOT_STARTED
# Plugin API 2.0 has the different behavior will not return this status
# assert status == ie.StatusCode.INFER_NOT_STARTED
request.async_infer({'parameter': img})
status = request.wait()
assert status == ie.StatusCode.OK
Expand All @@ -320,7 +321,8 @@ def __init__(self, request):
self.cv = threading.Condition()
self.request.set_completion_callback(self.callback)
self.status_code = self.request.wait(ie.WaitMode.STATUS_ONLY)
assert self.status_code == ie.StatusCode.INFER_NOT_STARTED
# Plugin API 2.0 has the different behavior will not return this status
# assert self.status_code == ie.StatusCode.INFER_NOT_STARTED

def callback(self, statusCode, userdata):
self.status_code = self.request.wait(ie.WaitMode.STATUS_ONLY)
Expand Down Expand Up @@ -508,7 +510,7 @@ def test_set_blob_with_incorrect_size(device):
blob = ie.Blob(tensor_desc)
with pytest.raises(RuntimeError) as e:
exec_net.requests[0].set_blob("data", blob)
assert f"Input blob size is not equal network input size" in str(e.value)
assert f"tensor size is not equal to" in str(e.value)
with pytest.raises(RuntimeError) as e:
exec_net.requests[0].set_blob("out", blob)
assert f"Output blob size is not equal network output size" in str(e.value)
assert f"tensor size is not equal to" in str(e.value)
8 changes: 6 additions & 2 deletions src/core/src/pass/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ void ov::pass::Manager::set_per_pass_validation(bool new_state) {
bool ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
OPENVINO_SUPPRESS_DEPRECATED_START
OV_ITT_SCOPED_TASK(ov::itt::domains::core, "pass::Manager::run_passes");
static size_t idx_a = 0, idx_b = 0;
idx_a++;
idx_b = 0;

static bool profile_enabled =
ov::util::getenv_bool("NGRAPH_PROFILE_PASS_ENABLE") || ov::util::getenv_bool("OV_PROFILE_PASS_ENABLE");
Expand All @@ -75,7 +78,7 @@ bool ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
OPENVINO_DEBUG << "Pass " << pass->get_name() << " is disabled";
continue;
}

idx_b++;
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::ov_pass, ov::pass::perf_counters()[pass->get_type_info()]);

pass_timer.start();
Expand Down Expand Up @@ -125,7 +128,8 @@ bool ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
std::string index_str = std::to_string(index);
index_str = std::string(num_digits_in_pass_index - index_str.length(), '0') + index_str;
auto base_filename = func->get_name() + std::string("_") + index_str + std::string("_") + pass->get_name();

base_filename =
std::string("Dump_") + std::to_string(idx_a) + std::string("_") + std::to_string(idx_b) + base_filename;
if (m_visualize) {
auto file_ext = "svg";
pass::VisualizeTree vt(base_filename + std::string(".") + file_ext);
Expand Down
1 change: 0 additions & 1 deletion src/frontends/onnx/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,5 @@ def xfail_test(reason="Mark the test as expected to fail", strict=True):

xfail_issue_86911 = xfail_test(reason="LSTM_Seq_len_unpacked - AssertionError: zoo models results mismatch")
xfail_issue_91151 = xfail_test(reason="RuntimeError: model input (shape={3,4}) and blob (shape=(1)) are incompatible")
xfail_issue_91490 = xfail_test(reason="y has zero dimension which is not allowed")
xfail_issue_101965 = xfail_test(reason="Mismatch with numpy-based expected results.")
xfail_issue_113506 = xfail_test(reason="Unsupported operation of type: LSTMSequence Node expects 7 inputs. Actual: 8")
10 changes: 2 additions & 8 deletions src/frontends/onnx/tests/tests_python/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
xfail_issue_82039,
xfail_issue_90649,
xfail_issue_91151,
xfail_issue_91490,
xfail_issue_99949,
xfail_issue_99950,
xfail_issue_99952,
Expand Down Expand Up @@ -274,11 +273,6 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None
xfail_issue_38710,
"OnnxBackendNodeModelTest.test_reshape_allowzero_reordered_cpu",
),
(
xfail_issue_91490,
"OnnxBackendNodeModelTest.test_tril_zero_cpu",
"OnnxBackendNodeModelTest.test_triu_zero_cpu",
),
(
skip_rng_tests,
"OnnxBackendNodeModelTest.test_bernoulli_cpu",
Expand Down Expand Up @@ -557,8 +551,8 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None
xfail_issue_99973,
"OnnxBackendNodeModelTest.test_split_1d_uneven_split_opset18_cpu",
"OnnxBackendNodeModelTest.test_split_2d_uneven_split_opset18_cpu",
"OnnxBackendNodeModelTest.test_split_zero_size_splits_opset13_cpu",
"OnnxBackendNodeModelTest.test_split_zero_size_splits_opset18_cpu",
#"OnnxBackendNodeModelTest.test_split_zero_size_splits_opset13_cpu",
#"OnnxBackendNodeModelTest.test_split_zero_size_splits_opset18_cpu",
),
(
xfail_issue_101965,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_transpose():
assert np.array_equal(graph_results, [expected_output])


@xfail_issue_35927
#@xfail_issue_35927
def test_slice_opset1():
data = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])

Expand Down
2 changes: 1 addition & 1 deletion src/inference/src/blob_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ void blob_copy(Blob::Ptr src, Blob::Ptr dst) {

if (src->getTensorDesc().getPrecision() != dst->getTensorDesc().getPrecision())
IE_THROW() << "Unimplemented blob transformation from precision " << src->getTensorDesc().getPrecision()
<< " to " << src->getTensorDesc().getPrecision();
<< " to " << dst->getTensorDesc().getPrecision();

if (src->getTensorDesc().getDims() != dst->getTensorDesc().getDims())
IE_THROW() << "Unimplemented blob transformation from different shapes ";
Expand Down
1 change: 1 addition & 0 deletions src/inference/src/cnn_network_ngraph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ ngraph::element::Type details::toLegacyType(const ngraph::element::Type& ngraph_
ngraph_type == ngraph::element::i32 || ngraph_type == ngraph::element::u32) {
return ngraph::element::i32;
} else if (ngraph_type != ngraph::element::f32) {
// Why convert to f32?
return ngraph::element::f32;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void IInferRequestInternal::SetBlob(const std::string& name, const Blob::Ptr& us
? InferenceEngine::details::product(foundInput->getTensorDesc().getDims())
: 1;
if (!isInputDynamic && dataSize != inputSize) {
IE_THROW() << "Input blob size is not equal network input size (" << dataSize << "!=" << inputSize
IE_THROW() << "Input tensor size is not equal network input size (" << dataSize << "!=" << inputSize
<< ").";
}
_inputs[name] = userBlob;
Expand Down
2 changes: 1 addition & 1 deletion src/inference/src/dev/converter_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ class IInferRequestInternalWrapper : public InferenceEngine::IInferRequestIntern
if (get_legacy_name_from_port(port) == legacy_name)
return port;
}
OPENVINO_ASSERT(false, "Cannot find port with name: ", legacy_name);
OPENVINO_THROW("Failed to find input or output with name: \'", legacy_name, "\'");
}

public:
Expand Down
18 changes: 18 additions & 0 deletions src/inference/src/dev/core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,24 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
// if auto-batching is applicable, the below function will patch the device name and config accordingly:
auto model = apply_auto_batching(model_, deviceName, config_with_batch);

auto print_model = [&](const std::shared_ptr<ov::Model>& model, std::string str) {
std::cout << str << std::endl;
for (auto& it : model->inputs()) {
auto names = it.get_names();
std::string name = names.size() > 0 ? it.get_any_name() : " ";
std::cout << " input name = " << name << ", precision = " << it.get_element_type()
<< ", shape = " << it.get_partial_shape().to_string() << std::endl;
}
for (auto& it : model->outputs()) {
const auto node = it.get_node_shared_ptr();
std::string name = node->input_value(0).get_names().size() > 0 ? node->input_value(0).get_any_name() : " ";
std::cout << " output name = " << name << ", " << name << ", precision = " << it.get_element_type()
<< ", shape = " << it.get_partial_shape().to_string() << std::endl;
}
std::cout << std::endl;
};
print_model(model->clone(), "Original model:");

auto parsed = parseDeviceNameIntoConfig(deviceName, config_with_batch);
auto plugin = get_plugin(parsed._deviceName);
ov::SoPtr<ov::ICompiledModel> res;
Expand Down
14 changes: 10 additions & 4 deletions src/inference/src/dev/preprocessing/preprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ bool ov::pass::AddPreprocessing::run_on_model(const std::shared_ptr<ov::Model>&

auto& legacy_preproc = input_info->getPreProcess();

std::cout << "Preprocess input: convert " << const_input.get_element_type() << " --> "
<< input_info->getPrecision() << std::endl;
preproc.input(i).tensor().set_element_type(
InferenceEngine::details::convertPrecision(input_info->getPrecision()));

Expand Down Expand Up @@ -122,18 +124,22 @@ bool ov::pass::AddPreprocessing::run_on_model(const std::shared_ptr<ov::Model>&
ov::legacy_convert::fill_output_info(const_output, output_info);
OPENVINO_ASSERT(output_info);
auto element_type = InferenceEngine::details::convertPrecision(output_info->getPrecision());
std::cout << "Preprocess output: convert " << const_output.get_element_type() << " --> " << element_type
<< std::endl;
if (element_type != model->output(i).get_element_type()) {
preproc.output(i).tensor().set_element_type(element_type);
}
if (output_info->getLayout() != InferenceEngine::Layout::BLOCKED &&
output_info->getLayout() != InferenceEngine::Layout::SCALAR) {
std::stringstream stream;
stream << output_info->getLayout();
preproc.output(i).tensor().set_layout(ov::Layout{stream.str()});
}

if (const_output.get_partial_shape().is_static() && const_output.get_shape().size() == 4)
preproc.output(i).model().set_layout("NCHW");
if (stream.str() == "NHWC") {
if (const_output.get_partial_shape().is_static() && const_output.get_shape().size() == 4)
preproc.output(i).model().set_layout("NCHW");
preproc.output(i).postprocess().convert_layout(ov::Layout{stream.str()});
}
}
}

ov::pass::Manager manager(get_pass_config());
Expand Down
3 changes: 3 additions & 0 deletions src/inference/src/ie_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ie_parameter.hpp"
#include "ngraph/opsets/opset.hpp"
#include "openvino/core/except.hpp"
#include "openvino/runtime/exception.hpp"

namespace InferenceEngine {
IE_SUPPRESS_DEPRECATED_START
Expand Down Expand Up @@ -64,6 +65,8 @@ void Rethrow() {
throw e;
} catch (const InferenceEngine::InferCancelled& e) {
throw e;
} catch (const ov::Cancelled& e) {
IE_THROW(InferCancelled) << e.what();
} catch (const std::exception& e) {
IE_THROW() << e.what();
} catch (...) {
Expand Down
18 changes: 11 additions & 7 deletions src/plugins/intel_cpu/src/async_infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
//

#include "async_infer_request.h"
#include <memory>

ov::intel_cpu::AsyncInferRequest::AsyncInferRequest(const InferenceEngine::IInferRequestInternal::Ptr& inferRequest,
const InferenceEngine::ITaskExecutor::Ptr& taskExecutor,
const InferenceEngine::ITaskExecutor::Ptr& callbackExecutor)
: InferenceEngine::AsyncInferRequestThreadSafeDefault(inferRequest, taskExecutor, callbackExecutor) {
static_cast<InferRequestBase*>(inferRequest.get())->SetAsyncRequest(this);
ov::intel_cpu::AsyncInferRequest::AsyncInferRequest(
const std::shared_ptr<IInferRequest>& request,
const std::shared_ptr<ov::threading::ITaskExecutor>& task_executor,
const std::shared_ptr<ov::threading::ITaskExecutor>& callback_executor)
: ov::IAsyncInferRequest(request, task_executor, callback_executor) {
static_cast<SyncInferRequest*>(request.get())->set_async_request(this);
}

ov::intel_cpu::AsyncInferRequest::~AsyncInferRequest() {
StopAndWait();
stop_and_wait();
}

void ov::intel_cpu::AsyncInferRequest::throw_if_canceled() const {
check_cancelled_state();
}
19 changes: 9 additions & 10 deletions src/plugins/intel_cpu/src/async_infer_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@

#pragma once

#include <string>
#include <map>
#include <cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp>
#include "infer_request.h"
#include "openvino/runtime/iasync_infer_request.hpp"

namespace ov {
namespace intel_cpu {

class AsyncInferRequest : public InferenceEngine::AsyncInferRequestThreadSafeDefault {
class AsyncInferRequest : public ov::IAsyncInferRequest {
public:
AsyncInferRequest(const InferenceEngine::IInferRequestInternal::Ptr &inferRequest,
const InferenceEngine::ITaskExecutor::Ptr &taskExecutor,
const InferenceEngine::ITaskExecutor::Ptr &callbackExecutor);
AsyncInferRequest(const std::shared_ptr<IInferRequest>& request,
const std::shared_ptr<ov::threading::ITaskExecutor>& task_executor,
const std::shared_ptr<ov::threading::ITaskExecutor>& callback_executor);
~AsyncInferRequest();
};

} // namespace intel_cpu
} // namespace ov
void throw_if_canceled() const;
};

} // namespace intel_cpu
} // namespace ov
Loading
Loading