Add description of deprecated property ov::Affinity (#22029)
* add description of affinity * add @deprecated
This commit is contained in:
parent
847e08512f
commit
1616f1e849
|
|
@ -503,9 +503,11 @@ int main(int argc, char* argv[]) {
|
|||
};
|
||||
|
||||
auto set_nthreads_pin = [&](const std::string& str) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
auto property_name = str == "nthreads" ? ov::inference_num_threads.name() : ov::affinity.name();
|
||||
auto property = str == "nthreads" ? ov::inference_num_threads(int(FLAGS_nthreads))
|
||||
: ov::affinity(fix_pin_option(FLAGS_pin));
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
if (supported(property_name) || device_name == "AUTO") {
|
||||
// create nthreads/pin primary property for HW device or AUTO if -d is AUTO directly.
|
||||
device_config[property.first] = property.second;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ void regmodule_properties(py::module m) {
|
|||
wrap_property_RW(m_properties, ov::num_streams, "num_streams");
|
||||
wrap_property_RW(m_properties, ov::inference_num_threads, "inference_num_threads");
|
||||
wrap_property_RW(m_properties, ov::compilation_num_threads, "compilation_num_threads");
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
wrap_property_RW(m_properties, ov::affinity, "affinity");
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
wrap_property_RW(m_properties, ov::force_tbb_terminate, "force_tbb_terminate");
|
||||
wrap_property_RW(m_properties, ov::enable_mmap, "enable_mmap");
|
||||
|
||||
|
|
|
|||
|
|
@ -1143,11 +1143,14 @@ inline std::istream& operator>>(std::istream& is, Affinity& affinity) {
|
|||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @deprecated Use ov::hint::enable_cpu_pinning
|
||||
* @brief The name for setting CPU affinity per thread option.
|
||||
* @ingroup ov_runtime_cpp_prop_api
|
||||
* @note The setting is ignored, if the OpenVINO compiled with OpenMP and any affinity-related OpenMP's
|
||||
* environment variable is set (as affinity is configured explicitly)
|
||||
*/
|
||||
OPENVINO_DEPRECATED(
|
||||
"This property is deprecated and will be removed soon. Use ov::hint::enable_cpu_pinning instead of it.")
|
||||
static constexpr Property<Affinity> affinity{"AFFINITY"};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ void IStreamsExecutor::Config::set_property(const ov::AnyMap& property) {
|
|||
". Expected only YES(binds to cores) / NO(no binding) / NUMA(binds to NUMA nodes) / "
|
||||
"HYBRID_AWARE (let the runtime recognize and use the hybrid cores)");
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == ov::affinity) {
|
||||
ov::Affinity affinity;
|
||||
std::stringstream{value.as<std::string>()} >> affinity;
|
||||
|
|
@ -74,6 +75,7 @@ void IStreamsExecutor::Config::set_property(const ov::AnyMap& property) {
|
|||
default:
|
||||
OPENVINO_THROW("Unsupported affinity type");
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == CONFIG_KEY(CPU_THROUGHPUT_STREAMS)) {
|
||||
if (value.as<std::string>() == CONFIG_VALUE(CPU_THROUGHPUT_NUMA)) {
|
||||
_streams = static_cast<int>(get_available_numa_nodes().size());
|
||||
|
|
@ -263,6 +265,7 @@ ov::Any IStreamsExecutor::Config::get_property(const std::string& key) const {
|
|||
};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
return properties;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (key == ov::affinity) {
|
||||
switch (_threadBindingType) {
|
||||
case IStreamsExecutor::ThreadBindingType::NONE:
|
||||
|
|
@ -274,6 +277,7 @@ ov::Any IStreamsExecutor::Config::get_property(const std::string& key) const {
|
|||
case IStreamsExecutor::ThreadBindingType::HYBRID_AWARE:
|
||||
return ov::Affinity::HYBRID_AWARE;
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == ov::num_streams) {
|
||||
return decltype(ov::num_streams)::value_type{_streams};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
|
|
|
|||
|
|
@ -73,8 +73,10 @@ void CumuSchedule::init() {
|
|||
idx++;
|
||||
} else {
|
||||
cpu_device_information = device;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
cpu_device_information.config.insert(
|
||||
{ov::affinity.name(), ov::Any(ov::Affinity::CORE).as<std::string>()});
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
}
|
||||
if (!cpu_device_information.device_name.empty())
|
||||
|
|
|
|||
|
|
@ -152,7 +152,9 @@ std::vector<DeviceInformation> Plugin::parse_meta_devices(const std::string& pri
|
|||
|
||||
if (get_device_name() == "MULTI") {
|
||||
auto is_set_numstreams = properties.find(ov::num_streams.name()) != properties.end();
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
auto is_set_affinity = properties.find(ov::affinity.name()) != properties.end();
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
auto is_set_numthreads = properties.find(ov::inference_num_threads.name()) != properties.end();
|
||||
if (!is_set_perfhint && !is_set_affinity && !is_set_numthreads && !is_set_device_properties&& !is_set_numstreams) {
|
||||
// setting tput as the default performance mode if
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
|
|||
};
|
||||
|
||||
if (name == ov::supported_properties) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
return std::vector<ov::PropertyName>{
|
||||
RO_property(ov::supported_properties.name()),
|
||||
RO_property(ov::model_name.name()),
|
||||
|
|
@ -207,6 +208,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
|
|||
RO_property(ov::log::level.name()),
|
||||
RO_property(ov::intel_cpu::sparse_weights_decompression_rate.name()),
|
||||
};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
if (name == ov::model_name) {
|
||||
|
|
@ -221,6 +223,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
|
|||
const auto streams = config.streamExecutorConfig._streams;
|
||||
return decltype(ov::num_streams)::value_type(
|
||||
streams); // ov::num_streams has special negative values (AUTO = -1, NUMA = -2)
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (name == ov::affinity) {
|
||||
const auto affinity = config.streamExecutorConfig._threadBindingType;
|
||||
switch (affinity) {
|
||||
|
|
@ -234,6 +237,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
|
|||
return ov::Affinity::HYBRID_AWARE;
|
||||
}
|
||||
return ov::Affinity::NONE;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (name == ov::inference_num_threads) {
|
||||
const auto num_threads = config.streamExecutorConfig._threads;
|
||||
return decltype(ov::inference_num_threads)::value_type(num_threads);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {
|
|||
if (streamExecutorConfigKeys.end() !=
|
||||
std::find(std::begin(streamExecutorConfigKeys), std::end(streamExecutorConfigKeys), key)) {
|
||||
streamExecutorConfig.set_property(key, val.as<std::string>());
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
if (key == ov::affinity.name()) {
|
||||
changedCpuPinning = true;
|
||||
try {
|
||||
|
|
@ -89,6 +90,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {
|
|||
". Expected only ov::Affinity::CORE/NUMA/HYBRID_AWARE.");
|
||||
}
|
||||
}
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (key == ov::hint::performance_mode.name()) {
|
||||
try {
|
||||
hintPerfMode = val.as<ov::hint::PerformanceMode>();
|
||||
|
|
|
|||
|
|
@ -619,6 +619,7 @@ ov::Any Engine::get_property(const std::string& name, const ov::AnyMap& options)
|
|||
const auto streams = engConfig.streamExecutorConfig._streams;
|
||||
return decltype(ov::num_streams)::value_type(
|
||||
streams); // ov::num_streams has special negative values (AUTO = -1, NUMA = -2)
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
} else if (name == ov::affinity) {
|
||||
const auto affinity = engConfig.streamExecutorConfig._threadBindingType;
|
||||
switch (affinity) {
|
||||
|
|
@ -632,6 +633,7 @@ ov::Any Engine::get_property(const std::string& name, const ov::AnyMap& options)
|
|||
return ov::Affinity::HYBRID_AWARE;
|
||||
}
|
||||
return ov::Affinity::NONE;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else if (name == ov::device::id.name()) {
|
||||
return decltype(ov::device::id)::value_type{engConfig.device_id};
|
||||
} else if (name == ov::inference_num_threads) {
|
||||
|
|
@ -705,6 +707,7 @@ ov::Any Engine::get_ro_property(const std::string& name, const ov::AnyMap& optio
|
|||
RO_property(ov::device::architecture.name()),
|
||||
};
|
||||
// the whole config is RW before model is loaded.
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
std::vector<ov::PropertyName> rwProperties {RW_property(ov::num_streams.name()),
|
||||
RW_property(ov::affinity.name()),
|
||||
RW_property(ov::inference_num_threads.name()),
|
||||
|
|
@ -721,6 +724,7 @@ ov::Any Engine::get_ro_property(const std::string& name, const ov::AnyMap& optio
|
|||
RW_property(ov::log::level.name()),
|
||||
RW_property(ov::intel_cpu::sparse_weights_decompression_rate.name()),
|
||||
};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
std::vector<ov::PropertyName> supportedProperties;
|
||||
supportedProperties.reserve(roProperties.size() + rwProperties.size());
|
||||
|
|
|
|||
Loading…
Reference in New Issue