Repository navigation
[AUTO] Include the CPU for cache warmup and update doc - #39561
peterchen-intel wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the extension of AUTO cache warm-up to eligible CPU candidates.
No open issues 🎉
What changed in this PR
This follow-up extends AUTO’s compile_for_all cache warm-up to eligible CPU candidates, preparing caches for later compilation without switching the current execution device. The property name and default (false) remain unchanged.
Changes:
- Remove CPU exclusions from candidate validation, scheduling, and background warm-up while still excluding the final execution device.
- Add regression coverage for CPU warm-up, startup-helper separation, and subsequent cache reuse.
- Document cache requirements, fallback behavior, resource costs, and Python/C++ usage.
| File | Description |
|---|---|
src/plugins/auto/tests/unit/cache_compile_for_all_test.cpp |
Add CPU warm-up cases and update compilation-count expectations. |
src/plugins/auto/tests/functional/behavior/caching_test.cpp |
Verify CPU cache creation and later reuse alongside other devices. |
src/plugins/auto/src/plugin.cpp |
Include CPU in warm-up candidate validation. |
src/plugins/auto/src/cache_warmup.cpp |
Allow background warm-up for non-selected CPU candidates. |
src/plugins/auto/src/auto_schedule.cpp |
Include CPU when deciding whether warm-up disables fallbacks. |
src/inference/include/openvino/runtime/auto/properties.hpp |
Clarify the public property’s behavior and requirements. |
src/bindings/c/include/openvino/c/auto/properties.h |
Document C API boolean values and fallback effects. |
src/bindings/c/docs/api_overview.md |
Add spacing between property declarations. |
docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/auto-device-selection.rst |
Add a dedicated warm-up subsection covering usage and trade-offs. |
docs/articles_en/assets/snippets/ov_auto.py |
Add a Python cache warm-up example. |
docs/articles_en/assets/snippets/AUTO0.cpp |
Add a C++ example, required header, and copyright notice. |
Review effort: Balanced
wangleis
left a comment
There was a problem hiding this comment.
Thank you for the updates. While reviewing the latest PR changes, we identified a few points regarding documentation consistency, snippet executability, and background CPU warm-up resource considerations. Detailed inline comments are provided below.
| std::vector<DeviceInformation> devices; | ||
| for (const auto& device : candidates) { | ||
| if (device.device_name != actual_device && ov::DeviceIDParser(device.device_name).get_device_name() != "CPU") { | ||
| if (device.device_name != actual_device) { |
There was a problem hiding this comment.
Now that CPU candidates are included in background cache warm-up (removing the previous CPU exclusion here and in AutoSchedule), please note that the class documentation in src/plugins/auto/src/cache_warmup.hpp (line 22) still says:
// 1. start() is called once the actual device is known. It filters out the actual device and CPU, then hands this
// object to CacheWarmupManager (once per object).Please update cache_warmup.hpp to remove "and CPU" so that the header comments remain consistent with this change.
| def part8(): | ||
| #! [compile_for_all] | ||
| core = ov.Core() | ||
| model = core.read_model("model.xml") |
There was a problem hiding this comment.
Two minor issues with this snippet:
part8()is defined here but never called inmain(), so this snippet is not validated when runningov_auto.py.- Unlike the other snippet functions in this file which use the shared
get_model()helper fromutils.py,part8()tries to load"model.xml"directly viacore.read_model("model.xml"), which will raiseFileNotFoundErrorif executed.
Please consider updating part8() to use get_model() and a temporary cache directory, and invoke part8() within the GPU-available check block in main().
| * Skips devices with caching disabled or a single-file cache path (``*.bin``). Warm-up failures are logged as warnings. | ||
| Core reuses compatible cache blobs and may rebuild invalid ones. | ||
|
|
||
| Warm-up compiles one device at a time and releases each temporary compiled model. Background compilation adds |
There was a problem hiding this comment.
Regarding background compilation overhead and resource usage:
When warming up GPU, make_warmup_config configures ov::intel_gpu::hint::host_task_priority(ov::hint::Priority::LOW). However, the CPU plugin does not support host_task_priority or compilation_num_threads. As a result, background warm-up on CPU runs with full TBB thread concurrency, competing for host CPU cores and memory bandwidth with active inference on the primary execution device.
It would be helpful to explicitly mention in this section that background CPU warm-up can cause host CPU and memory contention during ongoing inference (or consider applying a reduced-stream / lower-thread configuration in make_warmup_config for CPU, since CPU cache key generation depends only on full_name).
8d212d5 to
1da41d5
Compare
- Drop stale "and CPU" from the CacheWarmup class comment - Run the compile_for_all Python snippet from main() with get_model() and a temporary cache dir - Document host CPU/memory contention of background CPU warm-up - Remove the redundant candidate-count check in plugin.cpp; AutoSchedule::init owns it - Trim the public property comments to the contract - Revert the functional test change that does not exercise CPU - Make disablesStartupAndRuntimeFallback distinguish warm-up from the CPU startup helper
1da41d5 to
6e3aa46
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The published compilation fragment uses an undefined cache_dir, causing NameError when copied, and removes the temporary cache directory before releasing the compiled model, potentially racing background writes.
1 open issue
Review effort: Balanced
| device_name="AUTO", | ||
| config={ | ||
| device.priorities: "GPU,CPU", | ||
| properties.cache_dir: cache_dir, |

Summary
Follow-up to #39407 and the documentation review.
ov::intel_auto::compile_for_allcache warm-up instead of filtering them out in the plugin, scheduler, and worker. Continue to exclude the final execution device and devices removed after failed startup compilation.AUTO, cache prerequisites and ignore rules, conditional fallback disabling, later-cache reuse, and background memory/teardown costs.false). This is cache population for later compilation, not automatic execution on every device or a device-switching operation.Tickets:
Scope and risks
When CPU is an additional candidate, enabling
compile_for_allnow disables the CPU startup helper and runtime inference fallback, consistently with the existing warm-up policy. First-inference latency and background memory/compilation cost can increase. Warm-up remains best-effort and teardown waits for compilation already in flight.No changes to Core cache identity, C/Python binding implementation, or public property naming.
AI Assistance
AI assistance used: yes.