Skip to content

[core] Weight sharing manage context lifetime#34845

Merged
praasz merged 14 commits intoopenvinotoolkit:masterfrom
praasz:feature/weight-share-runtime-data
Apr 3, 2026
Merged

[core] Weight sharing manage context lifetime#34845
praasz merged 14 commits intoopenvinotoolkit:masterfrom
praasz:feature/weight-share-runtime-data

Conversation

@praasz
Copy link
Copy Markdown
Contributor

@praasz praasz commented Mar 23, 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:

AI Assistance:

  • AI assistance used: no

praasz added 4 commits March 23, 2026 06:31
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>
@praasz praasz added this to the 2026.2 milestone Mar 23, 2026
@praasz praasz requested a review from a team as a code owner March 23, 2026 05:51
@github-actions github-actions bot added category: inference OpenVINO Runtime library - Inference category: Core OpenVINO Core (aka ngraph) labels Mar 23, 2026
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
praasz and others added 4 commits March 23, 2026 11:55
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>
@praasz praasz changed the title [core] weight sharing manage context lifetime [core] Weight sharing manage context lifetime Mar 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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 SharedContextManager and integrate it into CoreImpl caching flow to init/sync a shared weight context and keep it alive via compiled models.
  • Add runtime-only weight sources support in SingleFileStorage shared context and introduce explicit initialize() for IContextStore.
  • Update hashing utilities (path-based hash combining), make util::Version comparisons constexpr, 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.

@praasz praasz requested a review from olpipi April 1, 2026 08:08
@praasz praasz enabled auto-merge April 2, 2026 07:56
@praasz praasz added this pull request to the merge queue Apr 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 3, 2026
@praasz praasz added this pull request to the merge queue Apr 3, 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 ad50d01 Apr 3, 2026
262 of 272 checks passed
@praasz praasz deleted the feature/weight-share-runtime-data branch April 3, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Core OpenVINO Core (aka ngraph) category: inference OpenVINO Runtime library - Inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants