Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPU] Remove compiler support version from config (#37301)

Bogdan Pereanu7b6c03f2b650
diff --git a/src/plugins/intel_npu/docs/example-adding-property.patch b/src/plugins/intel_npu/docs/example-adding-property.patch
index 02eef2256b9..4dc63d9807b 100644
--- a/src/plugins/intel_npu/docs/example-adding-property.patch
+++ b/src/plugins/intel_npu/docs/example-adding-property.patch
@@ -90,10 +90,6 @@ index 0ecd186c05..fa311e84de 100644
+ return 1337;
+ }
+
-+ static uint32_t compilerSupportVersion() {
-+ return ONEAPI_MAKE_VERSION(5, 5);
-+ }
-+
+ static bool isPublic() {
+ return true;
+ }
diff --git a/src/plugins/intel_npu/docs/example-removing-property.patch b/src/plugins/intel_npu/docs/example-removing-property.patch
index cb9e1b56afb..a4ef70fe618 100644
--- a/src/plugins/intel_npu/docs/example-removing-property.patch
+++ b/src/plugins/intel_npu/docs/example-removing-property.patch
@@ -90,10 +90,6 @@ index fa311e84de..0ecd186c05 100644
- return 1337;
- }
-
-- static uint32_t compilerSupportVersion() {
-- return ONEAPI_MAKE_VERSION(5, 5);
-- }
--
- static bool isPublic() {
- return true;
- }
diff --git a/src/plugins/intel_npu/docs/npu-properties-howto.md b/src/plugins/intel_npu/docs/npu-properties-howto.md
index a8075b2f327..80820a790a8 100644
--- a/src/plugins/intel_npu/docs/npu-properties-howto.md
+++ b/src/plugins/intel_npu/docs/npu-properties-howto.md
@@ -120,11 +120,6 @@ struct OptionBase {
return ov::PropertyMutability::RW;
}
- /// Overload this for options conditioned by compiler version
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static std::string toString(const ValueType& val) {
return OptionPrinter<ValueType>::toString(val);
}
@@ -198,10 +193,6 @@ struct EXAMPLE_PROPERTY final : OptionBase<EXAMPLE_PROPERTY, ov::intel_npu::Exam
return ov::intel_npu::ExampleType::VAL3;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 5);
- }
-
static bool isPublic() {
return true;
}
@@ -243,7 +234,6 @@ Notes:
- key(): needs to return the string name of the property (the NPU_EXAMPLE_PROPERTY defined in the property at step 1)
- getTypeName: returns the type name as a human-readable string
- defaultValue: returns the option's default value (if there was no user-defined value set, config.get or get_property(EXAMPLE_PROPERTY) will call this function
-- compilerSupportVersion: the compiler version from which this key is supported by compiler
- isPublic: defines whether the option is a **public or a private** one
- mode: defines the OptionMode of this option. Can be:
- CompileTime (for options used ONLY by the compiler)
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/config/config.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/config/config.hpp
index a85005c909d..a16ea0227fb 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/config/config.hpp
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/config/config.hpp
@@ -299,11 +299,6 @@ struct OptionBase {
return ov::PropertyMutability::RW;
}
- /// Overload this for options conditioned by compiler version
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(7, 23);
- }
-
static bool isValueSupported(std::string_view val) {
try {
(void)ActualOpt::parse(val);
@@ -377,7 +372,6 @@ struct OptionConcept final {
OptionMode (*mode)() = nullptr;
bool (*isPublic)() = nullptr;
ov::PropertyMutability (*mutability)() = nullptr;
- uint32_t (*compilerSupportVersion)() = nullptr;
bool (*isValueSupportedImpl)(std::string_view val) =
nullptr; // better make this private, but won't be able to use aggregate initialization anymore in
// "makeOptionModel"
@@ -426,7 +420,6 @@ OptionConcept makeOptionModel(
&Opt::mode,
&Opt::isPublic,
&Opt::mutability,
- &Opt::compilerSupportVersion,
&Opt::isValueSupported,
&validateAndParseFromString<Opt>,
&validateAndParseFromAny<Opt>,
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp
index f45071814e1..bd3ccfe3073 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/config/options.hpp
@@ -35,10 +35,6 @@ struct PERFORMANCE_HINT final : OptionBase<PERFORMANCE_HINT, ov::hint::Performan
return ov::PropertyMutability::RW;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::Both;
}
@@ -120,10 +116,6 @@ struct PERFORMANCE_HINT_NUM_REQUESTS final : OptionBase<PERFORMANCE_HINT_NUM_REQ
return ov::PropertyMutability::RW;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::RunTime;
}
@@ -142,10 +134,6 @@ struct INFERENCE_PRECISION_HINT final : OptionBase<INFERENCE_PRECISION_HINT, ov:
return ov::element::f16;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 4);
- }
-
static bool isPublic() {
return true;
}
@@ -190,10 +178,6 @@ struct PERF_COUNT final : OptionBase<PERF_COUNT, bool> {
return ov::PropertyMutability::RW;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::Both;
}
@@ -212,10 +196,6 @@ struct LOG_LEVEL final : OptionBase<LOG_LEVEL, ov::log::Level> {
return "OV_NPU_LOG_LEVEL";
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::Both;
}
@@ -293,10 +273,6 @@ struct PLATFORM final : OptionBase<PLATFORM, std::string> {
return true;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -323,10 +299,6 @@ struct DEVICE_ID final : OptionBase<DEVICE_ID, std::string> {
return ov::PropertyMutability::RW;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::RunTime;
}
@@ -475,10 +447,6 @@ struct BATCH_MODE final : OptionBase<BATCH_MODE, ov::intel_npu::BatchMode> {
return ov::intel_npu::BatchMode::AUTO;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 5);
- }
-
static bool isPublic() {
return false;
}
@@ -807,10 +775,6 @@ struct TURBO final : OptionBase<TURBO, bool> {
return true;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(7, 21);
- }
-
static OptionMode mode() {
return OptionMode::Both;
}
@@ -918,10 +882,6 @@ struct COMPILATION_MODE final : OptionBase<COMPILATION_MODE, std::string> {
return "";
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -948,10 +908,6 @@ struct EXECUTION_MODE_HINT final : OptionBase<EXECUTION_MODE_HINT, ov::hint::Exe
return ov::hint::ExecutionMode::PERFORMANCE;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 6);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -980,10 +936,6 @@ struct DYNAMIC_SHAPE_TO_STATIC final : OptionBase<DYNAMIC_SHAPE_TO_STATIC, bool>
return false;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -1006,10 +958,6 @@ struct COMPILATION_MODE_PARAMS final : OptionBase<COMPILATION_MODE_PARAMS, std::
return {};
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -1044,10 +992,6 @@ struct TILES final : OptionBase<TILES, int64_t> {
return true;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 4);
- }
-
static ov::PropertyMutability mutability() {
return ov::PropertyMutability::RW;
}
@@ -1072,10 +1016,6 @@ struct STEPPING final : OptionBase<STEPPING, int64_t> {
return -1;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 3);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -1098,10 +1038,6 @@ struct MAX_TILES final : OptionBase<MAX_TILES, int64_t> {
return {};
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(5, 3);
- }
-
static int64_t defaultValue() {
return -1;
}
@@ -1132,10 +1068,6 @@ struct DMA_ENGINES final : OptionBase<DMA_ENGINES, int64_t> {
return -1;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -1164,10 +1096,6 @@ struct BACKEND_COMPILATION_PARAMS final : OptionBase<BACKEND_COMPILATION_PARAMS,
return {};
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -1196,10 +1124,6 @@ struct COMPILATION_NUM_THREADS final : OptionBase<COMPILATION_NUM_THREADS, int32
}
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(0, 0);
- }
-
static OptionMode mode() {
return OptionMode::CompileTime;
}
@@ -1226,10 +1150,6 @@ struct COMPILER_DYNAMIC_QUANTIZATION final : OptionBase<COMPILER_DYNAMIC_QUANTIZ
return OptionMode::CompileTime;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(7, 1);
- }
-
static bool isPublic() {
return true;
}
@@ -1291,10 +1211,6 @@ struct QDQ_OPTIMIZATION final : OptionBase<QDQ_OPTIMIZATION, bool> {
static bool isPublic() {
return true;
}
-
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(7, 20);
- }
};
struct QDQ_OPTIMIZATION_AGGRESSIVE final : OptionBase<QDQ_OPTIMIZATION_AGGRESSIVE, bool> {
@@ -1388,10 +1304,6 @@ struct BATCH_COMPILER_MODE_SETTINGS final : OptionBase<BATCH_COMPILER_MODE_SETTI
return OptionMode::CompileTime;
}
- static uint32_t compilerSupportVersion() {
- return ONEAPI_MAKE_VERSION(7, 4);
- }
-
static bool isPublic() {
return false;
}
diff --git a/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp b/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp
index 8031d01a80d..b1488a57d06 100644
--- a/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp
+++ b/src/plugins/intel_npu/src/common/include/intel_npu/common/icompiler_adapter.hpp
@@ -34,7 +34,7 @@ public:
virtual ov::SupportedOpsMap query(const std::shared_ptr<const ov::Model>& model,
const FilteredConfig& config) const = 0;
virtual uint32_t get_version() const = 0;
- virtual std::optional<std::vector<std::string>> get_supported_options() const = 0;
+ virtual std::vector<std::string> get_supported_options() const = 0;
virtual bool is_option_supported(const std::string& optName,
const std::optional<std::string>& optValue = std::nullopt) const = 0;
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp
index 2ad7782da7d..141f3be2eb6 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/include/compiler_impl.hpp
@@ -83,9 +83,8 @@ public:
/**
* @brief Returns the compiler supported options list
- * @return false if the API is not supported, true otherwise
*/
- bool get_supported_options(std::vector<char>& options) const;
+ void get_supported_options(std::vector<char>& options) const;
/**
* @brief Checks whether the given option and value are supported by the compiler
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp
index a4d7b473d64..afae2a0b78d 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp
@@ -29,7 +29,7 @@ public:
ov::SupportedOpsMap query(const std::shared_ptr<const ov::Model>& model,
const FilteredConfig& config) const override;
- std::optional<std::vector<std::string>> get_supported_options() const override;
+ std::vector<std::string> get_supported_options() const override;
bool is_option_supported(const std::string& optName,
const std::optional<std::string>& optValue = std::nullopt) const override;
@@ -37,10 +37,6 @@ public:
uint32_t get_version() const override;
private:
- bool isCompilerOptionSupported(const FilteredConfig& config,
- const ze_graph_compiler_version_info_t& compilerVersion,
- const std::string& optionName) const;
-
// Fetches the runtime requirements of a compiled graph from the
// driver via zeDeviceGetRuntimeRequirements. Returns std::nullopt when the driver does not
// implement the extension, the handle is null, or the query fails.
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp
index c9f25234d72..3253e124b65 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/include/plugin_compiler_adapter.hpp
@@ -31,7 +31,7 @@ public:
ov::SupportedOpsMap query(const std::shared_ptr<const ov::Model>& model,
const FilteredConfig& config) const override;
- std::optional<std::vector<std::string>> get_supported_options() const override;
+ std::vector<std::string> get_supported_options() const override;
bool is_option_supported(const std::string& optName,
const std::optional<std::string>& optValue = std::nullopt) const override;
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp
index b08a6f9343f..04a774e4d92 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/src/compiler_impl.cpp
@@ -548,34 +548,25 @@ ov::SupportedOpsMap VCLCompilerImpl::query(const std::shared_ptr<const ov::Model
return result;
}
-bool VCLCompilerImpl::get_supported_options(std::vector<char>& options) const {
+void VCLCompilerImpl::get_supported_options(std::vector<char>& options) const {
_logger.debug("get_supported_options start");
size_t str_size = 0;
- try {
- THROW_ON_FAIL_FOR_VCL("vclGetCompilerSupportedOptions",
- vclGetCompilerSupportedOptions(_compilerHandle, nullptr, &str_size),
- _logHandle);
-
- if (str_size == 0) {
- _logger.debug("Option list size 0!");
- return true;
- }
-
- _logger.debug("obtain list");
- options.resize(str_size);
- THROW_ON_FAIL_FOR_VCL("vclGetCompilerSupportedOptions",
- vclGetCompilerSupportedOptions(_compilerHandle, options.data(), &str_size),
- _logHandle);
-
- _logger.debug("Option list size %d, got option list", str_size);
+ THROW_ON_FAIL_FOR_VCL("vclGetCompilerSupportedOptions",
+ vclGetCompilerSupportedOptions(_compilerHandle, nullptr, &str_size),
+ _logHandle);
- return true;
- } catch (const std::exception& e) {
- // The API is only supported in new version, just add log here
- _logger.debug("Exception in get_supported_options: %s", e.what());
+ if (str_size == 0) {
+ _logger.debug("Option list size 0!");
+ return;
}
- return false;
+ _logger.debug("obtain list");
+ options.resize(str_size);
+ THROW_ON_FAIL_FOR_VCL("vclGetCompilerSupportedOptions",
+ vclGetCompilerSupportedOptions(_compilerHandle, options.data(), &str_size),
+ _logHandle);
+
+ _logger.debug("Option list size %d, got option list", str_size);
}
bool VCLCompilerImpl::is_option_supported(const std::string& option, const std::optional<std::string>& optValue) const {
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.cpp
index 294aafa5126..0d757d33e3d 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
@@ -5,6 +5,10 @@
#include "driver_compiler_adapter.hpp"
#include <functional>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
#include "graph.hpp"
#include "intel_npu/common/filtered_config.hpp"
@@ -19,6 +23,46 @@
namespace intel_npu {
+namespace {
+
+struct PropertySupportInfo {
+ std::string name;
+ uint32_t version;
+};
+
+bool isVersionSupportedByCompiler(uint32_t version, const ze_graph_compiler_version_info_t& compilerVersion) {
+ const auto major = ONEAPI_VERSION_MAJOR(version);
+ const auto minor = ONEAPI_VERSION_MINOR(version);
+ return (compilerVersion.major > major) || ((compilerVersion.major == major) && (compilerVersion.minor >= minor));
+}
+
+const std::vector<PropertySupportInfo> _supportedPropertiesWithVersions = {
+ {ov::compilation_num_threads.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::enable_profiling.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::device::id.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::hint::execution_mode.name(), ONEAPI_MAKE_VERSION(5, 6)},
+ {ov::hint::inference_precision.name(), ONEAPI_MAKE_VERSION(5, 4)},
+ {ov::hint::num_requests.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::hint::performance_mode.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::log::level.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::batch_compiler_mode_settings.name(), ONEAPI_MAKE_VERSION(7, 4)},
+ {ov::intel_npu::batch_mode.name(), ONEAPI_MAKE_VERSION(5, 5)},
+ {ov::intel_npu::backend_compilation_params.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::compilation_mode.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::compilation_mode_params.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::compiler_dynamic_quantization.name(), ONEAPI_MAKE_VERSION(7, 1)},
+ {ov::intel_npu::dma_engines.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::dynamic_shape_to_static.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::max_tiles.name(), ONEAPI_MAKE_VERSION(5, 3)},
+ {ov::intel_npu::platform.name(), ONEAPI_MAKE_VERSION(0, 0)},
+ {ov::intel_npu::qdq_optimization.name(), ONEAPI_MAKE_VERSION(7, 20)},
+ {ov::intel_npu::tiles.name(), ONEAPI_MAKE_VERSION(5, 4)},
+ {ov::intel_npu::turbo.name(), ONEAPI_MAKE_VERSION(7, 21)},
+ {ov::intel_npu::stepping.name(), ONEAPI_MAKE_VERSION(5, 3)},
+};
+
+} // namespace
+
DriverCompilerAdapter::DriverCompilerAdapter(const std::shared_ptr<ZeroInitStructsHolder>& zeroInitStruct)
: _zeroInitStruct(zeroInitStruct),
_logger("DriverCompilerAdapter", Logger::global().level()) {
@@ -65,11 +109,9 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compile(const std::shared_ptr<con
std::string buildFlags;
const bool useIndices = !((compilerVersion.major < 5) || (compilerVersion.major == 5 && compilerVersion.minor < 9));
- const auto isOptionSupportedByCompiler = std::bind(&DriverCompilerAdapter::isCompilerOptionSupported,
- this,
- std::cref(updatedConfig),
- std::cref(compilerVersion),
- std::placeholders::_1);
+ const auto isOptionSupportedByCompiler = [this](const std::string& optionName) {
+ return is_option_supported(optionName);
+ };
_logger.debug("build flags");
buildFlags += compiler_utils::serializeIOInfo(model, useIndices);
@@ -158,11 +200,9 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compileWS(std::shared_ptr<ov::Mod
compile_model_mem_start = get_peak_memory_usage();
}
- const auto isOptionSupportedByCompiler = std::bind(&DriverCompilerAdapter::isCompilerOptionSupported,
- this,
- std::cref(updatedConfig),
- std::cref(compilerVersion),
- std::placeholders::_1);
+ const auto isOptionSupportedByCompiler = [this](const std::string& optionName) {
+ return is_option_supported(optionName);
+ };
while (true) {
_logger.debug("compileWS iteration %d", callNumber);
@@ -240,11 +280,9 @@ ov::SupportedOpsMap DriverCompilerAdapter::query(const std::shared_ptr<const ov:
updatedConfig.update({{ov::intel_npu::model_serializer_version.name(),
MODEL_SERIALIZER_VERSION::toString(serializedIR.serializerVersion)}});
}
- const auto isOptionSupportedByCompiler = std::bind(&DriverCompilerAdapter::isCompilerOptionSupported,
- this,
- std::cref(updatedConfig),
- std::cref(compilerVersion),
- std::placeholders::_1);
+ const auto isOptionSupportedByCompiler = [this](const std::string& optionName) {
+ return is_option_supported(optionName);
+ };
std::string buildFlags;
buildFlags += compiler_utils::serializeConfig(updatedConfig, compilerVersion, isOptionSupportedByCompiler);
@@ -271,20 +309,37 @@ uint32_t DriverCompilerAdapter::get_version() const {
return _zeroInitStruct->getCompilerVersion();
}
-std::optional<std::vector<std::string>> DriverCompilerAdapter::get_supported_options() const {
+std::vector<std::string> DriverCompilerAdapter::get_supported_options() const {
std::optional<std::string> compilerOptionsStr;
compilerOptionsStr = _zeGraphExt->getCompilerSupportedOptions();
- if (!compilerOptionsStr.has_value()) {
- return std::nullopt;
+ std::vector<std::string> compilerOpts;
+
+ if (compilerOptionsStr.has_value()) {
+ if (compilerOptionsStr->empty()) {
+ _logger.info("get_supported_options returned no options; returning an empty supported options vector.");
+ return {};
+ }
+
+ // vectorize string
+ std::istringstream suppstream(compilerOptionsStr.value());
+ std::string option;
+ while (suppstream >> option) {
+ compilerOpts.push_back(option);
+ }
+ return compilerOpts;
}
- // vectorize string
- std::istringstream suppstream(compilerOptionsStr.value());
- std::vector<std::string> compilerOpts;
- std::string option;
- while (suppstream >> option) {
- compilerOpts.push_back(option);
+ // legacy path
+ const auto& compilerVersion = _compilerProperties.compilerVersion;
+ for (const auto& prop : _supportedPropertiesWithVersions) {
+ if (isVersionSupportedByCompiler(prop.version, compilerVersion)) {
+ compilerOpts.push_back(prop.name);
+ }
+ }
+
+ if (compilerOpts.empty()) {
+ return {};
}
return compilerOpts;
}
@@ -292,27 +347,18 @@ std::optional<std::vector<std::string>> DriverCompilerAdapter::get_supported_opt
bool DriverCompilerAdapter::is_option_supported(const std::string& optName,
const std::optional<std::string>& optValue) const {
auto isOptionSupported = _zeGraphExt->isOptionSupported(optName, optValue);
- return isOptionSupported.value_or(false);
-}
-
-bool DriverCompilerAdapter::isCompilerOptionSupported(const FilteredConfig& config,
- const ze_graph_compiler_version_info_t& compilerVersion,
- const std::string& optionName) const {
- if (!config.hasOpt(optionName)) {
- return false;
+ if (isOptionSupported.has_value()) {
+ return isOptionSupported.value();
}
- const std::optional<bool> isSupported = _zeGraphExt->isOptionSupported(optionName);
- if (isSupported.has_value()) {
- return isSupported.value();
+ // legacy path
+ const auto& compilerVersion = _compilerProperties.compilerVersion;
+ for (const auto& prop : _supportedPropertiesWithVersions) {
+ if (prop.name == optName) {
+ return isVersionSupportedByCompiler(prop.version, compilerVersion);
+ }
}
-
- uint32_t compilerOptSupportValue = config.getOpt(optionName).compilerSupportVersion();
- uint32_t majorCompilerOptSupportValue = ZE_MAJOR_VERSION(compilerOptSupportValue);
- uint32_t minorCompilerOptSupportValue = ZE_MINOR_VERSION(compilerOptSupportValue);
- return (compilerVersion.major > majorCompilerOptSupportValue) ||
- ((compilerVersion.major == majorCompilerOptSupportValue) &&
- (compilerVersion.minor >= minorCompilerOptSupportValue));
+ return false;
}
std::optional<std::string> DriverCompilerAdapter::get_compatibility_descriptor(ze_graph_handle_t graphHandle) const {
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.cpp
index bc2c8a40cdd..1bbb5819ada 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
@@ -289,19 +289,19 @@ uint32_t PluginCompilerAdapter::get_version() const {
return _compiler->get_version();
}
-std::optional<std::vector<std::string>> PluginCompilerAdapter::get_supported_options() const {
+std::vector<std::string> PluginCompilerAdapter::get_supported_options() const {
std::vector<char> options;
- if (!_compiler->get_supported_options(options)) {
- _logger.warning("VCLCompilerImpl get_supported_options failed. Returning empty supported options.");
- return std::nullopt;
+ _compiler->get_supported_options(options);
+ size_t optionsSize = options.size();
+ while (optionsSize > 0 && options[optionsSize - 1] == '\0') {
+ --optionsSize;
}
-
- if (options.empty()) {
- _logger.warning("get_supported_options returned no options; returning an empty supported options vector.");
- return std::vector<std::string>{};
+ if (optionsSize == 0) {
+ _logger.info("get_supported_options returned no options; returning an empty supported options vector.");
+ return {};
}
- std::string compilerOptionsStr(options.data(), options.size());
+ std::string compilerOptionsStr(options.data(), optionsSize);
_logger.debug("VCLCompilerImpl return supported_options: %s", compilerOptionsStr.c_str());
// vectorize string
std::istringstream suppstream(compilerOptionsStr);
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp b/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp
index a15d9aa97d4..49ecd5abf08 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp
@@ -56,58 +56,29 @@ void filterPropertiesByCompilerSupport(intel_npu::FilteredConfig& config,
const ov::SoPtr<intel_npu::IEngineBackend>& backend,
const intel_npu::Logger& logger) {
using namespace intel_npu;
-
- bool legacy = false;
- std::optional<std::vector<std::string>> compilerSupportList{};
- uint32_t compilerVersion = 0;
-
OPENVINO_ASSERT(compiler != nullptr, "Compiler must be present to filter properties by compiler support");
- compilerVersion = compiler->get_version();
- compilerSupportList = compiler->get_supported_options();
-
- if (!compilerSupportList.has_value()) {
- logger.info("No compiler support options list received! Fallback to version-based option registration");
- legacy = true;
- }
-
- logger.debug("Compiler version: %u", compilerVersion);
- logger.debug("Legacy registration: %s", legacy ? "true" : "false");
- if (!legacy) {
- const auto& supportedOptions = compilerSupportList.value();
- logger.debug("Compiler supported options list (%zu): ", supportedOptions.size());
- for (const auto& str : supportedOptions) {
- logger.debug(" %s ", str.c_str());
- }
+ const auto& supportedOptions = compiler->get_supported_options();
+ logger.debug("Compiler supported options list (%zu): ", supportedOptions.size());
+ for (const auto& str : supportedOptions) {
+ logger.debug(" %s ", str.c_str());
}
config.walkEnables([&](const std::string& key) {
bool isEnabled = false;
- auto opt = config.getOpt(key);
// Special case for some both configs. Don't need compiler for these Both properties.
// Runtime (plugin-only) options are always enabled
- if (opt.mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) {
- if (legacy) {
- // Compiler or common option in Legacy mode? Checking its supported version
- if (compilerVersion >= opt.compilerSupportVersion()) {
- isEnabled = true;
- }
+ if (config.getOpt(key).mode() != OptionMode::RunTime && !isSpecialBothProperty(key)) {
+ if (std::find(supportedOptions.begin(), supportedOptions.end(), key) != supportedOptions.end()) {
+ isEnabled = true;
} else {
- // We have compiler, we are not in legacy mode = we have a valid list of supported options
- // Searching in the list
- const auto& supportedOptions = compilerSupportList.value();
- auto it = std::find(supportedOptions.begin(), supportedOptions.end(), key);
- if (it != supportedOptions.end()) {
- isEnabled = true;
+ // Not found in the supported options list.
+ if (compiler != nullptr) {
+ // Checking if it is a private option?
+ isEnabled = compiler->is_option_supported(key);
} else {
- // Not found in the supported options list.
- if (compiler != nullptr) {
- // Checking if it is a private option?
- isEnabled = compiler->is_option_supported(key);
- } else {
- // Not in the list and not a private option = disabling
- isEnabled = false;
- }
+ // Not in the list and not a private option = disabling
+ isEnabled = false;
}
}