[Feature] support v1 update/clear api for RL#6761
Open
liyonghua0910 wants to merge 3 commits intoPaddlePaddle:developfrom
Open
[Feature] support v1 update/clear api for RL#6761liyonghua0910 wants to merge 3 commits intoPaddlePaddle:developfrom
liyonghua0910 wants to merge 3 commits intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #6761 +/- ##
==========================================
Coverage ? 71.17%
==========================================
Files ? 395
Lines ? 54984
Branches ? 8678
==========================================
Hits ? 39137
Misses ? 13060
Partials ? 2787
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cd16fe2 to
350a315
Compare
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
This PR upgrades the weight clearing and updating flow for RL scenarios.
The legacy control path mainly relied on shared memory to synchronize state across the engine, worker, and cache-related components. While functional, the signal path was not explicit enough, and it was difficult to trace how failed requests were handled across components. In addition, the old workflow usually cleared weights through
clear_load_weightfirst, even though residual requests could still exist, and then relied on a manualreset_schedulercall to clean up the scheduler queue. This made the lifecycle less explicit and introduced risks of inconsistent states during asynchronous resource recycling.The goal of this PR is to move the control flow to an explicit control-request path and replace the legacy weight clear/reload flow with the new
sleep/wakeupworkflow, so state transitions and troubleshooting become more straightforward.Modifications
ControlRequest/ControlResponsepath, so each control request has its own request ID and can be traced through logs end to end./v1/sleepand/v1/wakeup, withtagssupport to specify which part of GPU memory should be offloaded or reloaded. Enable these APIs byexport FD_ENABLE_V1_UPDATE_WEIGHTS=1./clear_load_weightand/update_model_weightfor compatibility:FD_ENABLE_V1_UPDATE_WEIGHTS=0,/clear_load_weightand/update_model_weightstill rely on shared memory for control and multi-process synchronization.FD_ENABLE_V1_UPDATE_WEIGHTS=1,/clear_load_weightand/update_model_weightswitch to the new control path, using the engine worker queue, engine cache queue, and FMQ for request dispatch and response collection./v1/pauseand/v1/resumewith cache-transfer-manager coordination to support multi-level cache and KV-cache-backend scenarios.Usage or Command
Export the following environment variable when starting server:
export FD_ENABLE_V1_UPDATE_WEIGHTS=1Send control requests:
Accuracy Tests
Checklist
pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.