Skip to content

Add idle model unload for mediapipe LLM graphs - #4486

Draft
atobiszei wants to merge 18 commits into
atobisze_refactor_servable_loadingfrom
atobisze_idle_servable_loading
Draft

Add idle model unload for mediapipe LLM graphs#4486
atobiszei wants to merge 18 commits into
atobisze_refactor_servable_loadingfrom
atobisze_idle_servable_loading

Conversation

@atobiszei

Copy link
Copy Markdown
Collaborator

Cherry-picked from idle-models branch (65f2bab).

atobiszei and others added 11 commits August 28, 2026 13:43
Cherry-picked from idle-models branch (65f2bab).
Adds UNLOADED state machine, per-graph idle unload, ActiveInferenceGuard,
config/schema/metrics additions, and related tests.
Cherry-picked from idle-models branch (ceb9f4d).
Adds ModelGroupManager, group_name config field, CLI idle_unload_timeout_seconds,
status codes, and model_group_manager tests.
Comment thread src/model_management/modelmanager.cpp
Comment thread src/model_management/modelmanager.hpp Outdated
Comment thread src/model_management/modelmanager.hpp Outdated
Comment thread src/model_management/modelmanager.hpp Outdated
Comment thread src/capi_frontend/capi_dag_utils.cpp Outdated
Comment thread src/dags/pipelinedefinitionstatus.cpp Outdated
Comment thread src/mediapipe_internal/mediapipefactory.cpp Outdated
Comment on lines +183 to +188
// Idle unload: timestamp (nanoseconds from steady_clock epoch) of the last
// inference activity. Updated in create() on every inference acquisition and
// when an in-flight inference finishes (via ActiveInferenceGuard destructor).
// Held as shared_ptr so executors can safely write to it even after the
// definition is retired/destroyed — the atomic outlives the definition.
std::shared_ptr<std::atomic<int64_t>> lastActivityTimeNs;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This possibly could be moved to servable definition?

Comment thread src/mediapipe_internal/mediapipegraphdefinition.hpp
Comment thread src/mediapipe_internal/mediapipegraphdefinition.hpp Outdated
Comment thread src/dags/pipelinedefinitionstatus.cpp Outdated
// Expect old stream to continue responding until closure
// Expect new stream to be rejected
TEST_F(MediapipeStreamFlowAddTest, InferOnUnloadedGraph) {
TEST_F(MediapipeStreamFlowAddTest, InferOnSleepingGraph) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Wrong rename

Comment thread src/model_management/model_group_manager.hpp Outdated
@atobiszei
atobiszei force-pushed the atobisze_idle_servable_loading branch from 9a971bb to 069d8c1 Compare September 1, 2026 16:16
Comment thread src/capi_frontend/capi_dag_utils.cpp Outdated
@atobiszei
atobiszei force-pushed the atobisze_idle_servable_loading branch from b07f19d to 7885431 Compare September 2, 2026 09:39
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