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

Fixes dynamic shapes #27776

Merged
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Set bounded dims for shapeFromIRModel
Signed-off-by: Skrebkov, Artemy <[email protected]>
ArtemySkrebkov committed Dec 20, 2024

Verified

This commit was signed with the committer’s verified signature.
mertalev Mert
commit c02784289d6a8ab37331beab25b75281e9dc3c50
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@
#include "intel_npu/utils/zero/zero_api.hpp"
#include "intel_npu/utils/zero/zero_result.hpp"
#include "intel_npu/utils/zero/zero_wrappers.hpp"
#include "openvino/core/dimension.hpp"
#include "openvino/core/model.hpp"
#include "openvino/core/partial_shape.hpp"

#define NotSupportQuery(T) (T <= ZE_GRAPH_EXT_VERSION_1_2)

@@ -400,7 +402,8 @@ ze_graph_handle_t ZeGraphExtWrappers::getGraphHandle(const std::vector<uint8_t>&
static IODescriptor getIODescriptor(const ze_graph_argument_properties_3_t& arg,
const std::optional<ze_graph_argument_metadata_t>& metadata) {
ov::element::Type_t precision = toOVElementType(arg.devicePrecision);
ov::Shape shapeFromCompiler, shapeFromIRModel;
ov::Shape shapeFromCompiler;
ov::PartialShape shapeFromIRModel;
std::unordered_set<std::string> outputTensorNames;

for (uint32_t id = 0; id < arg.associated_tensor_names_count; id++) {
@@ -411,11 +414,15 @@ static IODescriptor getIODescriptor(const ze_graph_argument_properties_3_t& arg,
}
if (metadata.has_value()) {
const auto dynamicDim = std::numeric_limits<uint64_t>::max();
shapeFromIRModel.reserve(metadata->shape_size);
for (uint32_t id = 0; id < metadata->shape_size; id++) {
if (metadata->shape[id] != dynamicDim) {
shapeFromIRModel.push_back(metadata->shape[id]);
} else {
shapeFromIRModel.push_back(-1);
// lower bound is ignored, so we set it to 1 just to satisfy the Dimension constructor,
// upper bound is set to the value from shapeFromCompiler as it is filled with upper bounds
// in case of dynamic dimensions
shapeFromIRModel.push_back(ov::Dimension(1, shapeFromCompiler[id]));
}
}
}