forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NPU] Switching the I/O identification convention to indices (openvin…
…otoolkit#24248) ### Details: - Please see PR#10348 (compiler repository) for a detailed description and some extra validation. ### Tickets: - *CVS-142751*
- Loading branch information
1 parent
033a515
commit e567c9e
Showing
22 changed files
with
1,098 additions
and
902 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...unctional/shared_tests_instances/execution_graph_tests/duplicate_inputs_outputs_names.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "execution_graph_tests/duplicate_inputs_outputs_names.hpp" | ||
|
||
#include "common_test_utils/test_constants.hpp" | ||
|
||
using namespace ExecutionGraphTests; | ||
|
||
namespace { | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_duplicateInputsOutputsNames, | ||
ExecGraphDuplicateInputsOutputsNames, | ||
::testing::Values(ov::test::utils::DEVICE_CPU), | ||
ExecGraphDuplicateInputsOutputsNames::getTestCaseName); | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "intel_npu/al/icompiler.hpp" | ||
|
||
namespace intel_npu { | ||
|
||
void NetworkMetadata::bindRelatedDescriptors() { | ||
size_t ioIndex = 0; | ||
|
||
for (IODescriptor& input : inputs) { | ||
if (input.relatedDescriptorIndex.has_value()) { | ||
++ioIndex; | ||
continue; | ||
} | ||
|
||
if (input.isStateInput) { | ||
const auto relatedDescriptorIterator = | ||
std::find_if(outputs.begin(), outputs.end(), [&](const IODescriptor& output) { | ||
return output.isStateOutput && (output.nameFromCompiler == input.nameFromCompiler); | ||
}); | ||
|
||
if (relatedDescriptorIterator != outputs.end()) { | ||
input.relatedDescriptorIndex = std::distance(outputs.begin(), relatedDescriptorIterator); | ||
outputs.at(*input.relatedDescriptorIndex).relatedDescriptorIndex = ioIndex; | ||
} | ||
} else if (input.isShapeTensor) { | ||
const auto relatedDescriptorIterator = | ||
std::find_if(inputs.begin(), inputs.end(), [&](const IODescriptor& candidate) { | ||
return !candidate.isShapeTensor && (candidate.nameFromCompiler == input.nameFromCompiler); | ||
}); | ||
|
||
if (relatedDescriptorIterator != inputs.end()) { | ||
input.relatedDescriptorIndex = std::distance(inputs.begin(), relatedDescriptorIterator); | ||
inputs.at(*input.relatedDescriptorIndex).relatedDescriptorIndex = ioIndex; | ||
} | ||
} | ||
|
||
++ioIndex; | ||
} | ||
|
||
ioIndex = 0; | ||
|
||
for (IODescriptor& output : outputs) { | ||
if (output.relatedDescriptorIndex.has_value()) { | ||
++ioIndex; | ||
continue; | ||
} | ||
|
||
if (output.isShapeTensor) { | ||
const auto relatedDescriptorIterator = | ||
std::find_if(outputs.begin(), outputs.end(), [&](const IODescriptor& candidate) { | ||
return !candidate.isShapeTensor && (candidate.nameFromCompiler == output.nameFromCompiler); | ||
}); | ||
|
||
if (relatedDescriptorIterator != outputs.end()) { | ||
output.relatedDescriptorIndex = std::distance(outputs.begin(), relatedDescriptorIterator); | ||
outputs.at(*output.relatedDescriptorIndex).relatedDescriptorIndex = ioIndex; | ||
} | ||
} | ||
|
||
++ioIndex; | ||
} | ||
} | ||
|
||
} // namespace intel_npu |
Oops, something went wrong.