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] Remove config from the graph constructors (#38418)
Bogdan Pereanu95c7dbf0ef37
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/dynamic_graph.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/dynamic_graph.hppindex a5abdefe9a4..2205c05c832 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/dynamic_graph.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/dynamic_graph.hpp@@ -6,6 +6,7 @@#include <ze_graph_ext.h>+#include <atomic>#include <mutex>#include "intel_npu/common/igraph.hpp"@@ -20,7 +21,6 @@ class DynamicGraph final : public IGraph {public:DynamicGraph(const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct,ov::Tensor blob,- const Config& config,BlobType blobType = BlobType::LLVM);std::pair<uint64_t, std::optional<std::vector<uint64_t>>> export_blob(std::ostream& stream) const override;@@ -57,8 +57,8 @@ public:BlobType get_blob_type() const override;private:- void initialize_impl(const Config& config) override;- bool release_blob(const Config& config);+ void initialize_impl(const Config& runtimeConfig) override;+ bool release_blob();void initialize_engine(const Config& config);void create_execution_engine(const Config& config);void prepare_metadata();@@ -74,7 +74,6 @@ private:mutable std::mutex _commandQueueDescMutex;CommandQueueDesc _commandQueueDesc;- std::vector<std::shared_ptr<Event>> _lastSubmittedEvent;std::optional<ov::Tensor> _blob;BlobType _blobType = BlobType::LLVM;@@ -91,7 +90,8 @@ private:npu_vm_runtime_handle_t _engine = nullptr;npu_vm_runtime_properties_t _engineProperties{};npu_vm_runtime_version_t _apiVersion = NPU_VM_RUNTIME_VERSION_1_0;- bool _engineInitialized = false;+ // Set once the VM engine is created and _metadata is populated from it; get_metadata() throws before that+ std::atomic<bool> _metadataInitialized{false};};} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/compiler_adapter/include/graph.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/graph.hppindex 11459d87ead..a58f52e77c3 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/graph.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/graph.hpp@@ -25,7 +25,6 @@ public:const GraphDescriptor& graphDesc,NetworkMetadata metadata,std::optional<ov::Tensor> blob,- const Config& config,const std::optional<std::string>& compatibilityDescriptor = std::nullopt,const bool blobIsPersistent = false);diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/weightless_graph.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/weightless_graph.hppindex 237c9190282..b92141946de 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/weightless_graph.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/weightless_graph.hpp@@ -40,7 +40,6 @@ public:std::variant<std::monostate,std::shared_ptr<const ov::Model>,std::pair<std::string, std::shared_ptr<ov::ICore>>>&& weightsSource,- const Config& config,const bool blobIsPersistent = false,const std::optional<std::string>& compatibilityDescriptor = std::nullopt);diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cppindex d2a01ba2fcd..5ab1471cdb7 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp@@ -144,7 +144,6 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compile(const std::shared_ptr<congraphDesc,std::move(networkMeta),/* blob = */ std::nullopt,- updatedConfig,get_compatibility_descriptor(graphDesc._handle));}@@ -264,7 +263,6 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compileWS(std::shared_ptr<ov::Modstd::move(initNetworkMetadata),/* initBlobs = */ std::nullopt,std::move(model),- updatedConfig,/* persistentBlob = */ false,get_compatibility_descriptor(mainGraphHandle._handle));}diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cppindex c70cb1ad47e..639f061b446 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp@@ -71,8 +71,11 @@ void DynamicGraph::prepare_metadata() {_metadata.outputs.clear();for (uint32_t i = 0; i < _engineProperties.numOfGraphArgs; ++i) {// TODO: follow graph ext to support Optional metadata for weightless model- ze_graph_argument_properties_3_t arg;- ze_graph_argument_metadata_t meta;+ ze_graph_argument_properties_3_t arg = {};+ arg.stype = ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_PROPERTIES_3;+ ze_graph_argument_metadata_t meta = {};+ meta.stype = ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_METADATA;+std::array<int64_t, ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE> upperBound = {};if (npuVMRuntimeGetMetadata(_engine, i, &arg, &meta, upperBound.data()) != NPU_VM_RUNTIME_RESULT_SUCCESS) {OPENVINO_THROW("Failed to get VM runtime metadata");@@ -96,17 +99,15 @@ void DynamicGraph::prepare_metadata() {}void DynamicGraph::initialize_engine(const Config& config) {- if (!_engineInitialized) {- create_execution_engine(config);- prepare_metadata();- _engineInitialized = true;- _metadata.numberOfSubgraphs = _engineProperties.numOfSubGraphs;-- _logger.debug("num of subgraphs: %d inputs: %d outputs: %d",- _engineProperties.numOfSubGraphs,- _metadata.inputs.size(),- _metadata.outputs.size());- }+ create_execution_engine(config);+ prepare_metadata();+ _metadata.numberOfSubgraphs = _engineProperties.numOfSubGraphs;+ _metadataInitialized.store(true, std::memory_order_release);++ _logger.debug("num of subgraphs: %d inputs: %d outputs: %d",+ _engineProperties.numOfSubGraphs,+ _metadata.inputs.size(),+ _metadata.outputs.size());if (_logger.level() >= ov::log::Level::DEBUG) {_logger.debug("Dump metadata info from blob");@@ -131,17 +132,12 @@ void DynamicGraph::initialize_engine(const Config& config) {DynamicGraph::DynamicGraph(const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct,ov::Tensor blob,- const Config& config,BlobType blobType): _zeroInitStruct(zeroInitStruct),_blob(std::move(blob)),_blobType(blobType),- _logger("DynamicGraph", config.get<LOG_LEVEL>()) {+ _logger("DynamicGraph", Logger::global().level()) {_logger.info("Create DynamicGraph");- // Metadata comes from the VM runtime parsing the blob; unlike a regular Graph, it is not prefetched by the- // compiler/parser and must be available before plugin builds a dummy ov::Model for the CompiledModel.- // This is CPU-side parsing only - no L0/device setup.- initialize_engine(config);}std::pair<uint64_t, std::optional<std::vector<uint64_t>>> DynamicGraph::export_blob(std::ostream& stream) const {@@ -197,6 +193,8 @@ std::pair<uint64_t, std::optional<std::vector<uint64_t>>> DynamicGraph::export_b}const NetworkMetadata& DynamicGraph::get_metadata() const {+ OPENVINO_ASSERT(_metadataInitialized.load(std::memory_order_acquire),+ "DynamicGraph metadata is not initialized yet. The graph must be initialized first.");return _metadata;}@@ -261,44 +259,41 @@ void* DynamicGraph::get_handle() const {return _engine;}-void DynamicGraph::initialize_impl(const Config& config) {+void DynamicGraph::initialize_impl(const Config& runtimeConfig) {_logger.debug("Graph initialize start");- if (!_engineInitialized) {- // initialize VM execution engine, metadata, input&output descriptors- initialize_engine(config);- }-if (!_zeroInitStruct) {_logger.warning("Zero device is not available, skip graph initialize!");return;}- _logger.debug("Graph initialize without graph handle");+ // initialize VM execution engine, metadata, input&output descriptors+ initialize_engine(runtimeConfig);uint32_t commandQueueOptions = 0;- if (config.get<TURBO>()) {+ if (runtimeConfig.get<TURBO>()) {OPENVINO_ASSERT(_zeroInitStruct->getCommandQueueDdiTable().version() >= ZE_MAKE_VERSION(1, 0),"Turbo is not supported by the current driver");_logger.debug("Set ZE_NPU_COMMAND_QUEUE_OPTION_TURBO in command queue options");commandQueueOptions = commandQueueOptions | ZE_NPU_COMMAND_QUEUE_OPTION_TURBO;}- if (config.get<RUN_INFERENCES_SEQUENTIALLY>()) {+ if (runtimeConfig.get<RUN_INFERENCES_SEQUENTIALLY>()) {OPENVINO_ASSERT(_zeroInitStruct->getCommandQueueDdiTable().version() >= ZE_MAKE_VERSION(1, 1),"Running inferences sequentially is not supported by the current driver");_logger.debug("Set ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC in command queue options");commandQueueOptions = commandQueueOptions | ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC;}- bool sharedCommonQueue = config.get<SHARED_COMMON_QUEUE>();+ bool sharedCommonQueue = runtimeConfig.get<SHARED_COMMON_QUEUE>();{std::lock_guard<std::mutex> lock(_commandQueueDescMutex);- _commandQueueDesc = CommandQueueDesc{- zeroUtils::toZeQueuePriority(config.get<MODEL_PRIORITY>()),- config.has<WORKLOAD_TYPE>() ? zeroUtils::toZeQueueWorkloadType(config.get<WORKLOAD_TYPE>()) : std::nullopt,- commandQueueOptions,- this,- sharedCommonQueue};+ _commandQueueDesc = CommandQueueDesc{zeroUtils::toZeQueuePriority(runtimeConfig.get<MODEL_PRIORITY>()),+ runtimeConfig.has<WORKLOAD_TYPE>()+ ? zeroUtils::toZeQueueWorkloadType(runtimeConfig.get<WORKLOAD_TYPE>())+ : std::nullopt,+ commandQueueOptions,+ this,+ sharedCommonQueue};if (!use_npu_vm_runtime_v2_api(_apiVersion) && sharedCommonQueue == false) {// Keep it alive per compiled model when the shared common queue feature is disabled.@@ -312,7 +307,7 @@ void DynamicGraph::initialize_impl(const Config& config) {_init_completed.store(true, std::memory_order_release);}-bool DynamicGraph::release_blob(const Config& config) {+bool DynamicGraph::release_blob() {_logger.warning("Release blob is skipped, no handle for DynamicGraph");return false;}@@ -322,17 +317,14 @@ uint32_t DynamicGraph::get_unique_id() {}void DynamicGraph::set_last_submitted_id(uint32_t id_index) {- _lastSubmittedId = id_index;+ OPENVINO_THROW("Setting last submitted ID is not supported for DynamicGraph");}uint32_t DynamicGraph::get_last_submitted_id() const {- return _lastSubmittedId;+ OPENVINO_THROW("Getting last submitted ID is not supported for DynamicGraph");}DynamicGraph::~DynamicGraph() {- if (!_lastSubmittedEvent.empty()) {- _lastSubmittedEvent.clear();- }if (_engine != nullptr) {npuVMRuntimeDestroy(_engine);_engine = nullptr;diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/graph.cppindex 78efbd5c6fc..f5df09744d0 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp@@ -23,7 +23,6 @@ Graph::Graph(const std::shared_ptr<ZeGraphExtWrappers>& zeGraphExt,const GraphDescriptor& graphDesc,NetworkMetadata metadata,std::optional<ov::Tensor> blob,- const Config& config,const std::optional<std::string>& compatibilityDescriptor,const bool blobIsPersistent): IGraph(),@@ -34,7 +33,7 @@ Graph::Graph(const std::shared_ptr<ZeGraphExtWrappers>& zeGraphExt,_blob(std::move(blob)),_compatibilityDescriptor(compatibilityDescriptor),_blobIsPersistent(blobIsPersistent),- _logger("Graph", config.get<LOG_LEVEL>()) {}+ _logger("Graph", Logger::global().level()) {}const NetworkMetadata& Graph::get_metadata() const {return _metadata;diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/parser.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/parser.cppindex eefcce68c44..ed9964a0564 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/parser.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/parser.cpp@@ -44,7 +44,9 @@ std::shared_ptr<IGraph> Parser::parse("NPU driver, and NPU_ALLOW_BYTECODE is disabled, so only native NPU device blobs are accepted.");_logger.debug("Create graph for dynamic blob, use internal function to get metadata!");NPUVMRuntimeApi::initializeFromBlob(data, size);- return std::make_shared<DynamicGraph>(_zeroInitStruct, mainBlob, config, blobType.value());+ auto dynamicGraph = std::make_shared<DynamicGraph>(_zeroInitStruct, mainBlob, blobType.value());+ dynamicGraph->initialize(config); // load metadata+ return dynamicGraph;}GraphDescriptor mainGraphDesc;@@ -70,7 +72,6 @@ std::shared_ptr<IGraph> Parser::parse(mainGraphDesc,std::move(mainNetworkMetadata),mainBlob,- config,compatibilityDescriptor,blobIsPersistent);}@@ -101,7 +102,6 @@ std::shared_ptr<IGraph> Parser::parse(std::move(initNetworkMetadata),initBlobs,std::move(weightsSource),- config,blobIsPersistent,compatibilityDescriptor);}diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cppindex 340acadaa4a..77733001cd5 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/plugin_compiler_adapter.cpp@@ -95,7 +95,7 @@ std::shared_ptr<IGraph> PluginCompilerAdapter::compile(const std::shared_ptr<con// metadata will be obtained in initialze() of DynamicGraph_logger.debug("Use dynamicGraph to hold blob for HostCompile mode!");- return std::make_shared<DynamicGraph>(_zeroInitStruct, std::move(tensor), config, blobType);+ return std::make_shared<DynamicGraph>(_zeroInitStruct, std::move(tensor), blobType);}GraphDescriptor graphDesc;@@ -123,7 +123,6 @@ std::shared_ptr<IGraph> PluginCompilerAdapter::compile(const std::shared_ptr<congraphDesc,std::move(networkMeta),std::move(tensor),- config,compatibilityDescriptor,/* persistentBlob = */ true); // exporting the blob shall be available in such a scenario}@@ -280,7 +279,6 @@ std::shared_ptr<IGraph> PluginCompilerAdapter::compileWS(std::shared_ptr<ov::Modstd::move(initNetworkMetadata),tensorsInits,std::move(model),- localConfig,/* persistentBlob = */ true,compatibilityDescriptor); // exporting the blob shall be available in such a scenario}diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cppindex 2a54cd5525d..9dddd06eb46 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp@@ -263,7 +263,6 @@ WeightlessGraph::WeightlessGraph(std::optional<std::vector<ov::Tensor>> initBlobs,std::variant<std::monostate, std::shared_ptr<const ov::Model>, std::pair<std::string, std::shared_ptr<ov::ICore>>>&&weightsSource,- const Config& config,const bool blobIsPersistent,const std::optional<std::string>& compatibilityDescriptor): Graph(zeGraphExt,@@ -271,14 +270,13 @@ WeightlessGraph::WeightlessGraph(mainGraphDesc,std::move(mainMetadata),std::move(mainBlob),- config,compatibilityDescriptor,blobIsPersistent),_initsGraphDesc(initGraphDesc),_initBlobs(std::move(initBlobs)),_initsMetadata(std::move(initMetadata)),_constants(extract_constants_map(std::move(weightsSource), _initsMetadata)),- _wgLogger("WeightlessGraph", config.get<LOG_LEVEL>()) {}+ _wgLogger("WeightlessGraph", Logger::global().level()) {}std::pair<uint64_t, std::optional<std::vector<uint64_t>>> WeightlessGraph::export_blob(std::ostream& stream) const {if (_blobIsReleased) {diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.cpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.cppindex 1cbc07c9996..dc059f9d460 100644--- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.cpp+++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile.cpp@@ -236,20 +236,20 @@ public:configuration[ov::intel_npu::compile_log_level.name()] = ov::log::Level::ERR;std::vector<std::string> deviceNames =- core->get_property("NPU", ov::available_devices.name()).as<std::vector<std::string>>();+ core.get_property("NPU", ov::available_devices.name()).as<std::vector<std::string>>();for (auto name : deviceNames) {if (target_device.find(name) != std::string::npos) {isTargetDevice = true;break;}}- originalLogLevel = core->get_property("NPU", ov::log::level.name()).as<ov::log::Level>();+ originalLogLevel = core.get_property("NPU", ov::log::level.name()).as<ov::log::Level>();APIBaseTest::SetUp();}void TearDown() {- core->set_property("NPU", ov::log::level(originalLogLevel));+ core.set_property("NPU", ov::log::level(originalLogLevel));}static void compareInferenceResult(const std::shared_ptr<ov::Model>& model,@@ -274,7 +274,7 @@ public:RuntimeCompareSetupResult prepareRuntimeCompareContext(const std::shared_ptr<ov::Model>& model);protected:- std::shared_ptr<ov::Core> core = utils::PluginCache::get().core();+ ov::Core core;ov::AnyMap configuration;std::string selectedModelName;bool isTargetDevice = false;@@ -369,7 +369,7 @@ InferWithHostCompileTests::RuntimeCompareSetupResult InferWithHostCompileTests::result.context.model = model;try {- result.context.compiledModel = core->compile_model(model, target_device, configuration);+ result.context.compiledModel = core.compile_model(model, target_device, configuration);} catch (const ov::Exception& e) {result.status = RuntimeCompareStatus::fail;result.message = std::string("Failed to compile model for target device: ") + e.what();@@ -377,7 +377,7 @@ InferWithHostCompileTests::RuntimeCompareSetupResult InferWithHostCompileTests::}try {- result.context.referenceCompiledModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ result.context.referenceCompiledModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception& e) {result.status = RuntimeCompareStatus::skip;result.message = std::string("CPU plugin is not available for reference comparison: ") + e.what();@@ -412,14 +412,14 @@ TEST_P(InferWithHostCompileTests, CompileAndImportAndInfer) {ov::CompiledModel compiledModel;- OV_ASSERT_NO_THROW(compiledModel = core->compile_model(model, target_device, configuration));+ OV_ASSERT_NO_THROW(compiledModel = core.compile_model(model, target_device, configuration));std::stringstream modelStream;OV_ASSERT_NO_THROW(compiledModel.export_model(modelStream));ov::InferRequest reqDynamic;ov::CompiledModel importedModel;- OV_ASSERT_NO_THROW(importedModel = core->import_model(modelStream, target_device));+ OV_ASSERT_NO_THROW(importedModel = core.import_model(modelStream, target_device));OV_ASSERT_NO_THROW(reqDynamic = importedModel.create_infer_request());OV_ASSERT_NO_THROW(reqDynamic.infer());}@@ -436,7 +436,7 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithDecreasedSize) {auto model = createModelByName(selectedModelName);ScopedLogCapture logCapture;- core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG));+ core.set_property("NPU", ov::log::level(ov::log::Level::DEBUG));auto setupResult = prepareRuntimeCompareContext(model);if (setupResult.status == RuntimeCompareStatus::fail) {FAIL() << setupResult.message;@@ -513,7 +513,7 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithIncreasedSize) {auto model = createModelByName(selectedModelName);ScopedLogCapture logCapture;- core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG));+ core.set_property("NPU", ov::log::level(ov::log::Level::DEBUG));auto setupResult = prepareRuntimeCompareContext(model);if (setupResult.status == RuntimeCompareStatus::fail) {FAIL() << setupResult.message;@@ -589,7 +589,7 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) {auto model = createModelByName(selectedModelName);ScopedLogCapture logCapture;- core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG));+ core.set_property("NPU", ov::log::level(ov::log::Level::DEBUG));auto setupResult = prepareRuntimeCompareContext(model);if (setupResult.status == RuntimeCompareStatus::fail) {FAIL() << setupResult.message;@@ -639,7 +639,7 @@ TEST_P(InferWithHostCompileTests, CompileAndInferWithZeroTensor) {<< logCapture.str();logCapture.clear();- auto zeroContext = core->get_default_context(target_device);+ auto zeroContext = core.get_default_context(target_device);auto inputHostTensorForForthInfer = zeroContext.create_host_tensor(model->input().get_element_type(), shape);auto hostTensorSourceForForthInfer =ov::test::utils::create_and_fill_tensor(model->input().get_element_type(), shape, 100, 0);@@ -721,7 +721,7 @@ TEST_P(InferWithHostCompileTests, DynamicBatchUsesOneVMExecution) {auto model = createModelByName(selectedModelName);ScopedLogCapture logCapture;- core->set_property("NPU", ov::log::level(ov::log::Level::DEBUG));+ core.set_property("NPU", ov::log::level(ov::log::Level::DEBUG));auto setupResult = prepareRuntimeCompareContext(model);if (setupResult.status == RuntimeCompareStatus::fail) {FAIL() << setupResult.message;@@ -861,7 +861,7 @@ TEST_P(InferWithHostCompileTests, SharedCommonQueue_ZeroTensorInputOutputSet) {auto& ctx = setupResult.context;const std::string tag = sharedQueue ? "shared" : "nonshared";- auto zeroContext = core->get_default_context(target_device);+ auto zeroContext = core.get_default_context(target_device);ov::Shape shape;if (selectedModelName == "MaxPool_NCHW") {shape = {1, 16, 720, 1280};@@ -968,14 +968,14 @@ TEST_P(InferWithHostCompileTests, CompileTimeConfig_WorkloadType) {try {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "workload_type compile-time config not supported: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1012,14 +1012,14 @@ TEST_P(InferWithHostCompileTests, CompileTimeConfig_Turbo) {try {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "turbo compile-time config not supported: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1071,14 +1071,14 @@ TEST_P(InferWithHostCompileTests, SetProperty_CombinedPriorityAndWorkload) {try {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "compile_model failed: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1224,14 +1224,14 @@ TEST_P(InferWithHostCompileTests, SetProperty_WorkloadType_SingleCompiledModel)try {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "compile_model failed: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1277,7 +1277,7 @@ TEST_P(InferWithHostCompileTests, CompileTimeConfig_Turbo_SharedCommonQueue) {auto model = createModelByName(selectedModelName);ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1296,7 +1296,7 @@ TEST_P(InferWithHostCompileTests, CompileTimeConfig_Turbo_SharedCommonQueue) {ov::CompiledModel compiledModel;try {- compiledModel = core->compile_model(model, target_device, cfg);+ compiledModel = core.compile_model(model, target_device, cfg);} catch (const ov::Exception& e) {GTEST_SKIP() << "turbo compile-time config not supported: " << e.what();}@@ -1341,14 +1341,14 @@ TEST_P(InferWithHostCompileTests, SetProperty_Priority_BetweenTwoRequests) {try {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "compile_model failed: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1448,14 +1448,14 @@ TEST_P(InferWithHostCompileTests, SetProperty_WorkloadType_SingleCompiledModel_Ntry {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "compile_model failed: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1499,7 +1499,7 @@ TEST_P(InferWithHostCompileTests, CompileTimeConfig_Turbo_NonSharedCommonQueue)auto model = createModelByName(selectedModelName);ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1518,7 +1518,7 @@ TEST_P(InferWithHostCompileTests, CompileTimeConfig_Turbo_NonSharedCommonQueue)ov::CompiledModel compiledModel;try {- compiledModel = core->compile_model(model, target_device, cfg);+ compiledModel = core.compile_model(model, target_device, cfg);} catch (const ov::Exception& e) {GTEST_SKIP() << "turbo compile-time config not supported in nonshared queue mode: " << e.what();}@@ -1549,14 +1549,14 @@ TEST_P(InferWithHostCompileTests, SetProperty_Priority_BetweenTwoRequests_NonShatry {auto savedCfg = configuration;configuration = cfg;- compiledModel = core->compile_model(model, target_device, configuration);+ compiledModel = core.compile_model(model, target_device, configuration);configuration = savedCfg;} catch (const ov::Exception& e) {GTEST_SKIP() << "compile_model failed: " << e.what();}ov::CompiledModel refModel;try {- refModel = core->compile_model(model, ov::test::utils::DEVICE_TEMPLATE);+ refModel = core.compile_model(model, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -1706,7 +1706,7 @@ TEST_P(InferWithHostCompileTests, MemRefReuse_OutputPtrChange) {// 3rd inference: set a new output tensor (different pointer, same shape) → recordingconst auto outputShape = ctx.reqDynamic.get_tensor(model->output()).get_shape();- auto zeroCtx = core->get_default_context(target_device);+ auto zeroCtx = core.get_default_context(target_device);auto newOutputTensor = zeroCtx.create_host_tensor(model->output().get_element_type(), outputShape);OV_ASSERT_NO_THROW(ctx.reqDynamic.set_tensor(model->output(), newOutputTensor));OV_ASSERT_NO_THROW(inferAndCompare(model, ctx.reqDynamic, ctx.reqReference, tag + "_v2out_output_ptr_change"));@@ -1741,7 +1741,7 @@ TEST_P(InferWithDefaultHostCompileTests, CompileDynamicModelWithNoHostCompileModov::CompiledModel compiledModel;// Compilation shall pass since load of openvino_intel_npu_mlir_runtime is deffered with NPU_CREATE_EXECUTOR=0- OV_ASSERT_NO_THROW(compiledModel = core->compile_model(model, target_device, configuration));+ OV_ASSERT_NO_THROW(compiledModel = core.compile_model(model, target_device, configuration));std::stringstream modelStream;OV_ASSERT_NO_THROW(compiledModel.export_model(modelStream));@@ -1758,7 +1758,7 @@ TEST_P(InferWithDefaultHostCompileTests, CompileDynamicModelWithNoHostCompileModov::InferRequest reqDynamic;try {- ov::CompiledModel importedModel = core->import_model(modelStream, target_device);+ ov::CompiledModel importedModel = core.import_model(modelStream, target_device);reqDynamic = importedModel.create_infer_request();} catch (const ov::Exception& e) {if (std::string(e.what()).find("Cannot load library") == std::string::npos) {diff --git a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile_multithread.cpp b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile_multithread.cppindex d7eae196012..fa4157ec23e 100644--- a/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile_multithread.cpp+++ b/src/plugins/intel_npu/tests/functional/behavior/dynamic_host_pipeline/infer_with_host_compile_multithread.cpp@@ -194,7 +194,7 @@ public:configuration[ov::intel_npu::compile_log_level.name()] = ov::log::Level::ERR;std::vector<std::string> deviceNames =- core->get_property("NPU", ov::available_devices.name()).as<std::vector<std::string>>();+ core.get_property("NPU", ov::available_devices.name()).as<std::vector<std::string>>();for (const auto& name : deviceNames) {if (target_device.find(name) != std::string::npos) {isTargetDevice = true;@@ -392,7 +392,7 @@ protected:return cfg;}- std::shared_ptr<ov::Core> core = utils::PluginCache::get().core();+ ov::Core core;ov::AnyMap configuration;std::string selectedModelName;std::string target_device;@@ -416,7 +416,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_PerThreadCompileCreateInfer) {auto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -430,7 +430,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_PerThreadCompileCreateInfer) {kThreadCount,[this, &cfg, &shape, &referenceCompiledModel, &requests, &referenceRequests, &inputs](size_t threadIdx) {auto model = createModelByName(selectedModelName);- auto compiledModel = core->compile_model(model, target_device, cfg);+ auto compiledModel = core.compile_model(model, target_device, cfg);requests[threadIdx] = std::make_shared<ov::InferRequest>(compiledModel.create_infer_request());referenceRequests[threadIdx] =std::make_shared<ov::InferRequest>(referenceCompiledModel.create_infer_request());@@ -464,7 +464,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_SingleCompileParallelCreateRequeauto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -473,7 +473,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_SingleCompileParallelCreateRequeconst auto cfg = makeConfig(sharedQueue);auto model = createModelByName(selectedModelName);ov::CompiledModel compiledModel;- OV_ASSERT_NO_THROW(compiledModel = core->compile_model(model, target_device, cfg));+ OV_ASSERT_NO_THROW(compiledModel = core.compile_model(model, target_device, cfg));std::vector<std::shared_ptr<ov::InferRequest>> requests(kThreadCount);std::vector<std::shared_ptr<ov::InferRequest>> referenceRequests(kThreadCount);@@ -515,7 +515,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_ConcurrentInferThenSetPriorityAnauto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -527,7 +527,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_ConcurrentInferThenSetPriorityAnauto model = createModelByName(selectedModelName);ov::CompiledModel compiledModel;try {- compiledModel = core->compile_model(model, target_device, cfg);+ compiledModel = core.compile_model(model, target_device, cfg);} catch (const ov::Exception& e) {GTEST_SKIP() << "model priority is not supported: " << e.what();}@@ -618,7 +618,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_MultiCompiledModelsMultiRequestsauto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -631,7 +631,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_MultiCompiledModelsMultiRequestscompiledModels.reserve(kModelCount);auto producer = std::async(std::launch::async, [this, &compiledModels, &model, &cfg, kModelCount]() {for (size_t i = 0; i < kModelCount; ++i) {- compiledModels.emplace_back(core->compile_model(model, target_device, cfg));+ compiledModels.emplace_back(core.compile_model(model, target_device, cfg));}});producer.get();@@ -718,7 +718,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_SingleCompileParallelZeroInputOuauto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -727,7 +727,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_SingleCompileParallelZeroInputOuconst auto cfg = makeConfig(sharedQueue);auto model = createModelByName(selectedModelName);ov::CompiledModel compiledModel;- OV_ASSERT_NO_THROW(compiledModel = core->compile_model(model, target_device, cfg));+ OV_ASSERT_NO_THROW(compiledModel = core.compile_model(model, target_device, cfg));std::atomic<size_t> successInferCount{0};std::vector<std::shared_ptr<ov::InferRequest>> requests(kThreadCount);@@ -754,7 +754,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_SingleCompileParallelZeroInputOureferenceRequests[threadIdx] =std::make_shared<ov::InferRequest>(referenceCompiledModel.create_infer_request());}- auto zeroContext = core->get_default_context(target_device);+ auto zeroContext = core.get_default_context(target_device);const int startFrom = static_cast<int>(100 + threadIdx * 11 + inferIdx);inputs[threadIdx] = makeZeroInputTensor(zeroContext, model, shape, startFrom);outputs[threadIdx] = zeroContext.create_host_tensor(model->output().get_element_type(), shape);@@ -797,7 +797,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_PerThreadCompileZeroInputOutputTauto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -830,13 +830,13 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_PerThreadCompileZeroInputOutputTif (!models[threadIdx]) {models[threadIdx] = createModelByName(selectedModelName);compiledModels[threadIdx] = std::make_shared<ov::CompiledModel>(- core->compile_model(models[threadIdx], target_device, cfg));+ core.compile_model(models[threadIdx], target_device, cfg));requests[threadIdx] =std::make_shared<ov::InferRequest>(compiledModels[threadIdx]->create_infer_request());referenceRequests[threadIdx] =std::make_shared<ov::InferRequest>(referenceCompiledModel.create_infer_request());}- auto zeroContext = core->get_default_context(target_device);+ auto zeroContext = core.get_default_context(target_device);const int startFrom = static_cast<int>(100 + threadIdx * 11 + inferIdx);inputs[threadIdx] = makeZeroInputTensor(zeroContext, models[threadIdx], shape, startFrom);outputs[threadIdx] =@@ -877,7 +877,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_CompileAndInferOverlap) {auto referenceModel = createModelByName(selectedModelName);ov::CompiledModel referenceCompiledModel;try {- referenceCompiledModel = core->compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);+ referenceCompiledModel = core.compile_model(referenceModel, ov::test::utils::DEVICE_TEMPLATE);} catch (const ov::Exception&) {GTEST_SKIP() << "TEMPLATE plugin unavailable";}@@ -959,7 +959,7 @@ TEST_P(InferWithHostCompileMultithreadTests, MT_CompileAndInferOverlap) {start.wait();try {for (size_t i = 0; i < kModelCount; ++i) {- auto compiledModel = core->compile_model(model, target_device, cfg);+ auto compiledModel = core.compile_model(model, target_device, cfg);{std::lock_guard<std::mutex> lock(mutex);compiledModels.push_back(compiledModel);