[core] Weight sharing manage context lifetime#34845
Merged
praasz merged 14 commits intoopenvinotoolkit:masterfrom Apr 3, 2026
Merged
[core] Weight sharing manage context lifetime#34845praasz merged 14 commits intoopenvinotoolkit:masterfrom
praasz merged 14 commits intoopenvinotoolkit:masterfrom
Conversation
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
- store context in compiled model to prolong its life if compiled model exists - Add context manger to restore context if exist as base for single file storage Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
t-jankowski
approved these changes
Mar 23, 2026
Co-authored-by: Tomasz Jankowski <tomasz1.jankowski@intel.com>
…e-runtime-data Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends OpenVINO core model caching/weight sharing so that a shared weight context can be re-used across compilations and its lifetime can be prolonged by compiled models. It introduces an in-core shared context manager keyed by cache location, adds support for runtime-only weight buffers in the shared context, and updates hashing/version utilities plus tests to reflect the new initialization flow.
Changes:
- Add
SharedContextManagerand integrate it intoCoreImplcaching flow to init/sync a shared weight context and keep it alive via compiled models. - Add runtime-only weight sources support in
SingleFileStorageshared context and introduce explicitinitialize()forIContextStore. - Update hashing utilities (path-based hash combining), make
util::Versioncomparisonsconstexpr, and adjust unit/functional tests accordingly.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/inference/src/dev/core_impl.cpp | Hooks shared context manager into cache compilation/load paths; stores a lifetime token on compiled models. |
| src/inference/src/shared_context_manager.hpp | New manager API for init/sync and cleanup of shared contexts (weak_ptr registry). |
| src/inference/src/shared_context_manager.cpp | Implementation of shared context init/sync and expired-context cleanup. |
| src/inference/src/single_file_storage.cpp | Moves content-index building to initialize(); extends shared context with runtime sources. |
| src/inference/dev_api/openvino/runtime/single_file_storage.hpp | Exposes initialize() on SingleFileStorage as an IContextStore. |
| src/inference/dev_api/openvino/runtime/icache_manager.hpp | Adds virtual destructor and new IContextStore::initialize(...) contract. |
| src/inference/dev_api/openvino/runtime/icompiled_model.hpp | Adds m_weight_context member intended to extend shared context lifetime. |
| src/inference/tests/unit/single_file_storage.cpp | Updates unit tests to call initialize() for SingleFileStorage. |
| src/inference/tests/functional/caching_test.cpp | Extends context equality checks to include runtime sources; updates cache property usage in one place. |
| src/common/util/include/openvino/util/common_util.hpp | Updates u64_hash_combine API to accept a seed + list. |
| src/common/util/src/os/lin/lin_mmap_object.cpp | Uses new hash-combine signature with std::filesystem::hash_value(path) seed. |
| src/common/util/src/os/win/win_mmap_object.cpp | Uses new hash-combine signature for mmap IDs (path-based and handle-based). |
| src/common/util/include/openvino/util/ov_version.hpp | Makes Version default ctor + comparisons constexpr. |
| src/inference/src/dev/core_impl.hpp | Minor whitespace-only change. |
olpipi
reviewed
Mar 31, 2026
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
olpipi
approved these changes
Apr 1, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 3, 2026
### Details: - Add weight sharing context lifetime management. The core check created context if exist and use it as base before read meta data from file. The compiled model keeps shared context to extend its lifetime if is used. - Add runtime data buffer ins shared context (not stored in cache) - Add util function to combine hash for path - Update OV version util to be more constexpr - Update test to check if context exist or not if compiled model exists ### Tickets: - CVS-177972 ### AI Assistance: - *AI assistance used: no* --------- Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com> Co-authored-by: Tomasz Jankowski <tomasz1.jankowski@intel.com>
Merged
via the queue into
openvinotoolkit:master
with commit Apr 3, 2026
ad50d01
262 of 272 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details:
Tickets:
AI Assistance: