Repository navigation
[Fix] Prevent multimodal feature offload races - #41468
Closed
NewbieOrange wants to merge 2 commits into
Closed
NewbieOrange wants to merge 2 commits into
NewbieOrange wants to merge 2 commits into
Conversation
NewbieOrange
requested review from
Ying1123,
hnyls2002,
merrymercy and
xiezhq-hermann
as code owners
September 27, 2026 15:53
Author
|
Just saw its already fixed in #40621, closing. agent mistakenly took the fixed patch and submitted, sorry. :( |
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.
Motivation
Multimodal features are asynchronously copied from CUDA to CPU after embedding so chunked prefill can retain a fallback without holding GPU memory. The previous implementation released the CUDA source and exposed the CPU destination without tracking completion.
This created two races:
The DP ViT path made the issue visible because it reads selected feature rows later and across multiple encoder ranks. The fix is generic multimodal scheduling and does not change model math.
Modifications
test/registered/unit/managers/test_mm_feature_offload_race.pywith deterministic pending-offload regressions for precomputed embeddings and encoder feature reads.Accuracy Tests
The new regression test delays an offload completion while a later consumer reads the same feature:
367e370. The consumers observe pre-offload zeros instead of the completed value7.0.Test file:
test/registered/unit/managers/test_mm_feature_offload_race.pySpeed Tests and Profiling
No throughput regression is expected. The change adds no kernels and does not synchronize during normal feature use. It only waits when a later consumer would otherwise read a pending CPU offload or asks a deferred encoder to read CPU feature data.
No standalone throughput benchmark was run because this is an asynchronous lifetime correctness fix rather than a compute-path change.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Missing
run-cilabel -- add it to run CI tests.Latest PR Test (Extra): ❌ Blocked --
run-ciis required first.Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.