Skip to content

Commit

Permalink
[NPU] Fail for non continuous tensors (openvinotoolkit#28132)
Browse files Browse the repository at this point in the history
### Details:
 - *Fail if non continuous tensor is set*

### Tickets:

---------

Signed-off-by: Bogdan Pereanu <[email protected]>
  • Loading branch information
pereanub authored and 11happy committed Dec 23, 2024
1 parent 0610f17 commit 8287dfd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class IGraph : public std::enable_shared_from_this<IGraph> {

uint32_t get_unique_id();
void set_last_submitted_id(uint32_t id_index);
const uint32_t get_last_submitted_id() const;
uint32_t get_last_submitted_id() const;

const std::optional<std::size_t> get_batch_size() const;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/src/common/src/igraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void IGraph::set_last_submitted_id(uint32_t id_index) {
_last_submitted_id = id_index;
}

const uint32_t IGraph::get_last_submitted_id() const {
uint32_t IGraph::get_last_submitted_id() const {
return _last_submitted_id;
}

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/intel_npu/src/common/src/sync_infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ void SyncInferRequest::check_tensor(const ov::Output<const ov::Node>& port,
bool is_input = ov::op::util::is_parameter(port.get_node());
std::string tensor_type = is_input ? "input" : "output";

OPENVINO_ASSERT(tensor->is_continuous(), "The tensor is not continuous");

OPENVINO_ASSERT(port.get_element_type() == tensor->get_element_type(),
"The tensor element type is not corresponding with output element type (",
tensor->get_element_type(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
::testing::ValuesIn(batchingConfigs)),
InferRequestRunTests::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTest,
ROITensorInference,
::testing::Combine(::testing::Values(tensor_roi::roi_nchw()),
::testing::Values(ov::test::utils::DEVICE_NPU)),
ov::test::utils::appendPlatformTypeTestName<OVInferRequestInferenceTests>);
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <thread>

#include "base/ov_behavior_test_utils.hpp"
#include "behavior/ov_infer_request/inference.hpp"
#include "common/npu_test_env_cfg.hpp"
#include "common/utils.hpp"
#include "functional_test_utils/ov_plugin_cache.hpp"
Expand Down Expand Up @@ -766,6 +767,21 @@ TEST_P(BatchingRunSeqTests, CheckMultipleBatchingRunsSeq) {
}
}

using ROITensorInference = OVInferRequestInferenceTests;

TEST_P(ROITensorInference, InferenceROITensor) {
auto model = OVInferRequestInferenceTests::create_n_inputs(1, ov::element::f32, m_param.m_shape);
auto compiled_model = ie->compile_model(model, target_device);
// Create InferRequest
ov::InferRequest req;
req = compiled_model.create_infer_request();
const std::string tensor_name = "tensor_input0";

OV_EXPECT_THROW_HAS_SUBSTRING(req.set_tensor(tensor_name, m_param.m_input_tensor),
ov::Exception,
"The tensor is not continuous");
}

} // namespace behavior
} // namespace test
} // namespace ov

0 comments on commit 8287dfd

Please sign in to comment.