Skip to content

tune default cpu properties#4323

Open
dtrawins wants to merge 4 commits into
mainfrom
fix-default-streams-dualcpu
Open

tune default cpu properties#4323
dtrawins wants to merge 4 commits into
mainfrom
fix-default-streams-dualcpu

Conversation

@dtrawins

Copy link
Copy Markdown
Collaborator

🛠 Summary

CVS-188024
Fix detection of throughput mode and correct default parameters for multi socket host

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

Copilot AI review requested due to automatic review settings June 25, 2026 08:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tunes OpenVINO CPU default property selection in Docker to better handle throughput mode detection and multi-socket hosts, and adds targeted unit tests for the new decision logic.

Changes:

  • Add CPU socket-count detection and refine physical-core-per-socket detection from /proc/cpuinfo.
  • Refactor applyDefaultCpuProperties into a testable overload that caps num_streams by physical cores across sockets and avoids setting inference_num_threads when the environment appears unconstrained (e.g., HT-visible cores > physical cores).
  • Move CPU default property application from ModelManager initialization to per-model compilation for CPU, and add unit tests covering constrained/unconstrained + latency/throughput cases.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/test/ov_utils_test.cpp Adds unit tests for the new applyDefaultCpuProperties overload and its Docker/throughput/latency behaviors.
src/systeminfo.hpp Declares new getSocketsCount() API to support multi-socket-aware defaults.
src/systeminfo.cpp Implements getSocketsCount() and adjusts physical core detection to be per-socket.
src/ov_utils.hpp Exposes a testable overload of applyDefaultCpuProperties accepting explicit system parameters.
src/ov_utils.cpp Implements new CPU default property logic (streams/threads/pinning) and delegates the runtime overload to system info helpers.
src/modelmanager.cpp Removes global CPU property initialization on ov::Core construction.
src/modelinstance.cpp Applies CPU defaults during CPU model compilation (instead of globally at core init).

Comment thread src/systeminfo.cpp
Comment thread src/ov_utils.cpp
Comment on lines +160 to +164
bool isThroughput = false;
const auto perfIt = properties.find(ov::hint::performance_mode.name());
if (perfIt != properties.end()) {
try {
isThroughput = (perfIt->second.as<ov::hint::PerformanceMode>() == ov::hint::PerformanceMode::THROUGHPUT);
Comment on lines +244 to +246
#ifdef __linux__
#include "../systeminfo.hpp"

Comment thread src/modelinstance.cpp
Comment on lines +1026 to +1033
if (config.getTargetDevice() == "CPU") {
Status status = applyDefaultCpuProperties(pluginConfig);
if (!status.ok()) {
SPDLOG_LOGGER_ERROR(modelmanager_logger, "Failed to apply default CPU properties for model: {}; version: {}; error: {}",
getName(), getVersion(), status.string());
return status;
}
}
@dtrawins dtrawins requested review from atobiszei and kpapis June 25, 2026 11:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dtrawins dtrawins requested a review from rasapala June 26, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants