Skip to content

External 4230 cache dir fix#4378

Open
rasapala wants to merge 7 commits into
mainfrom
external_4230_cache_dir
Open

External 4230 cache dir fix#4378
rasapala wants to merge 7 commits into
mainfrom
external_4230_cache_dir

Conversation

@rasapala

Copy link
Copy Markdown
Collaborator

🛠 Summary

Issue #4230

🧪 Checklist

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

exzile and others added 4 commits July 16, 2026 13:04
The continuous batching servable initializer constructs the GenAI
ContinuousBatchingPipeline directly and never applied the server-level
--cache_dir (ServerSettings.cacheDir). Unlike the non-CB path, which
applies it via ModelInstance::setCacheOptions, the CB path left model
compilation caching disabled unless the user duplicated the value into
the node's plugin_config as CACHE_DIR. As a result, .blob/.cl_cache
artifacts were never persisted and every restart fully recompiled the
model.

Inject the global cache_dir into the pipeline plugin config before
constructing the pipeline. An explicit CACHE_DIR in the node's
plugin_config remains authoritative.

Adds a regression test (LLMNodeOptionsCacheDirPropagation) covering both
propagation of the global value and precedence of an explicit node value.

Fixes #4230

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LLMNodeOptionsCacheDirPropagation only asserts that --cache_dir lands in
properties->pluginConfig, which doesn't prove OpenVINO Core actually persists
compiled-model cache artifacts -- the actual symptom in #4230 (log said
"cache enabled", nothing was ever written to disk). Addresses feedback on
the issue: #4230 (comment)

LLMNodeOptionsCacheDirWritesCacheArtifacts constructs a real
ContinuousBatchingPipeline against a temp --cache_dir and asserts at least
one cache file actually lands there. Verified locally on Windows (MSVC)
against facebook/opt-125m:

[       OK ] LLMOptionsHttpTest.LLMNodeOptionsCacheDirWritesCacheArtifacts (707 ms)
Extract the global --cache_dir propagation into a shared
GenAiServableInitializer::applyGlobalCacheDir helper and call it from all
GenAI initializers. The continuous batching path already applied it (and
VLM_CB shares that same initializer), but the legacy LM and legacy VLM
paths construct their pipelines directly and never applied the
server-level cache_dir. Routing every path through one helper covers all
four pipeline types (LM/VLM x CB/legacy) and removes the duplicated
inline block from the CB initializer.

In the cache_dir tests, replace the manual end-of-test Config restore
with a GlobalCacheDirGuard RAII helper so a failed ASSERT mid-test can no
longer leak the modified --cache_dir singleton into subsequent tests in
the suite. The guard also removes the temporary cache directory on scope
exit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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 addresses a regression where the server-level --cache_dir was not propagated into OpenVINO GenAI pipeline plugin configuration for LLM/VLM servables, preventing compiled-model cache artifacts from being persisted across restarts (issue #4230).

Changes:

  • Introduces a shared GenAiServableInitializer::applyGlobalCacheDir() helper to inject the global --cache_dir into pluginConfig when the node doesn’t explicitly set CACHE_DIR.
  • Applies this helper in GenAI servable initializers (continuous batching + legacy).
  • Adds/extends unit tests and updates model cache documentation.

Reviewed changes

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

Show a summary per file
File Description
src/test/llm/llmnode_test.cpp Adds regression tests for --cache_dir propagation and attempts an end-to-end cache artifact check.
src/llm/servable_initializer.hpp Declares applyGlobalCacheDir() helper for GenAI initializers.
src/llm/servable_initializer.cpp Implements applyGlobalCacheDir() and adds required includes.
src/llm/language_model/continuous_batching/servable_initializer.cpp Calls applyGlobalCacheDir() before constructing the CB pipeline.
src/llm/language_model/legacy/servable_initializer.cpp Calls applyGlobalCacheDir() before constructing the legacy pipeline.
src/llm/visual_language_model/legacy/servable_initializer.cpp Calls applyGlobalCacheDir() before constructing the legacy VLM pipeline.
docs/model_cache.md Documents how --cache_dir interacts with GenAI/LLM node plugin_config overrides.

Comment thread src/test/llm/llmnode_test.cpp Outdated
Comment thread src/test/llm/llmnode_test.cpp Outdated
Comment thread src/test/llm/llmnode_test.cpp
Comment thread src/llm/servable_initializer.cpp Outdated
Comment thread docs/model_cache.md Outdated
@dtrawins dtrawins added this to the 2026.3 milestone Jul 16, 2026
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.

4 participants