OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[NPU] Add IMD as device for dynamic shape (#31109)
Alexandru Enache1170a8516970
diff --git a/src/plugins/intel_npu/tools/common/include/tools_helpers.hpp b/src/plugins/intel_npu/tools/common/include/tools_helpers.hppindex 7e2cd19f71b..2d2aee4311f 100644--- a/src/plugins/intel_npu/tools/common/include/tools_helpers.hpp+++ b/src/plugins/intel_npu/tools/common/include/tools_helpers.hpp@@ -110,12 +110,11 @@ void boundDynamicShape(std::shared_ptr<ov::Model>& model, bool shapeOrBatchGivenif (shapeOrBatchGiven) {throw std::logic_error("ERROR: Shape \"" + shape.to_string() + "\"" +" has dynamic batch size which is not supported by NPU\n");- }- else {+ } else {std::cout << "WARNING: Shape \"" + shape.to_string() + "\"" +- " has dynamic batch size which is not supported by NPU\n"- " Setting batch to 1 forcibly"- << std::endl;+ " has dynamic batch size which is not supported by NPU\n"+ " Setting batch to 1 forcibly"+ << std::endl;ov::set_batch(model, 1);// Get the shape againshape = item->get_partial_shape();@@ -148,8 +147,12 @@ void boundDynamicShape(std::shared_ptr<ov::Model>& model, bool shapeOrBatchGiven* the shape string contains multiple shapes for one input, or if the* model's shape is dynamic and not supported by the device.*/-void reshape(ov::OutputVector inputsInfo, InputsInfo& infoMap, std::shared_ptr<ov::Model>& model,- std::string& shapeString, int overrideModelBatchSize, std::string_view device) {+void reshape(ov::OutputVector inputsInfo,+ InputsInfo& infoMap,+ std::shared_ptr<ov::Model>& model,+ std::string& shapeString,+ int overrideModelBatchSize,+ std::string_view device) {std::vector<InputsInfo> infoMaps;// shape and override_model_batch_size cannot be specificed together@@ -212,8 +215,8 @@ void reshape(ov::OutputVector inputsInfo, InputsInfo& infoMap, std::shared_ptr<o}}model->reshape(newShapes);- } else { // FLAGS_shape is empty- if (device.find("NPU") != std::string::npos ||+ } else { // FLAGS_shape is empty+ if (device.find("NPU") != std::string::npos || device.find("IMD") != std::string::npos ||// FIXME: SIT on CPU also requires to bound dynamic shapesdevice.find("CPU") != std::string::npos || device.find("TEMPLATE") != std::string::npos) {boundDynamicShape(model, false);