From e27c6f614140b6a02c6a2fccc8077e3a91c3f483 Mon Sep 17 00:00:00 2001 From: Alexandru Enache Date: Thu, 25 Jul 2024 09:47:54 +0300 Subject: [PATCH] [intel-npu] Adding fix for max_tiles and stepping initializations (#25618) ### Details: - MAX_TILES and STEPPING should be initialized with the default values from the used backend if the user does not set them. - these two properties will be initialized by the driver if L0 backend is used. ### Tickets: - *E#130074* --- .../intel_npu/src/plugin/src/plugin.cpp | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index c503605eabc8e0..98f037f7a47271 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -221,15 +221,6 @@ Plugin::Plugin() // parse again env_variables after backend is initialized to get backend proprieties _globalConfig.parseEnvVars(); - // initialize properties which have device-tied default values in global config - // *only if there is a driver available - if (_metrics->GetAvailableDevicesNames().size() > 0) { - _globalConfig.update({{ov::intel_npu::stepping.name(), - std::to_string(_metrics->GetSteppingNumber(get_specified_device_name(_globalConfig)))}}); - _globalConfig.update({{ov::intel_npu::max_tiles.name(), - std::to_string(_metrics->GetMaxTiles(get_specified_device_name(_globalConfig)))}}); - } - // Map from name to function {Config -> ov::Any} // Note that some properties are RW before network is loaded, and become RO after network is loaded _properties = { @@ -472,14 +463,24 @@ Plugin::Plugin() {ov::intel_npu::stepping.name(), {false, ov::PropertyMutability::RW, - [](const Config& config) { - return config.get(); + [&](const Config& config) { + if (!config.has()) { + const auto specifiedDeviceName = get_specified_device_name(config); + return static_cast(_metrics->GetSteppingNumber(specifiedDeviceName)); + } else { + return config.get(); + } }}}, {ov::intel_npu::max_tiles.name(), {false, ov::PropertyMutability::RW, - [](const Config& config) { - return config.get(); + [&](const Config& config) { + if (!config.has()) { + const auto specifiedDeviceName = get_specified_device_name(config); + return static_cast(_metrics->GetMaxTiles(specifiedDeviceName)); + } else { + return config.get(); + } }}}, {ov::intel_npu::compilation_mode.name(), {false, @@ -632,7 +633,8 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< // Update stepping w/ information from driver, unless provided by user or we are off-device // Ignore, if compilation was requested for platform, different from current if (!localConfig.has() && device != nullptr && - device->getName() == ov::intel_npu::Platform::standardize(platform)) { + device->getName() == ov::intel_npu::Platform::standardize(platform) && + _metrics->GetBackendName() == "level_zero") { try { localConfig.update({{ov::intel_npu::stepping.name(), std::to_string(device->getSubDevId())}}); } catch (...) { @@ -643,7 +645,8 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< // Update max_tiles w/ information from driver, unless provided by user or we are off-device // Ignore, if compilation was requested for platform, different from current if (!localConfig.has() && device != nullptr && - device->getName() == ov::intel_npu::Platform::standardize(platform)) { + device->getName() == ov::intel_npu::Platform::standardize(platform) && + _metrics->GetBackendName() == "level_zero") { try { localConfig.update({{ov::intel_npu::max_tiles.name(), std::to_string(device->getMaxNumSlices())}}); } catch (...) {