[Core][GPU fraction][3/n] Encapsulate NodeResources::available behind wrapper methods#63184
[Core][GPU fraction][3/n] Encapsulate NodeResources::available behind wrapper methods#63184dancingactor wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request encapsulates the available resource set in the NodeResources class by adding getter and setter methods, updating the GCS and cluster resource managers accordingly. The review feedback suggests optimizing the SetAvailable method and its usage by employing std::move to prevent unnecessary copies of resource sets.
acabe64 to
a39dbd6
Compare
|
Thanks so much for the PR! The code change LGTM. Could you please update the PR description to explain why we need to first refactor to use wrapper methods? |
|
Thanks for review! I have updated the PR description to clarify the context and the reason for this refactor |
Yicheng-Lu-llll
left a comment
There was a problem hiding this comment.
lgtm. Thanks! cc @MengjinYan for review/merge.
MengjinYan
left a comment
There was a problem hiding this comment.
Overall looks good!
I have a couple of general questions:
- Wondering are you aiming to replace all the reference to
availablewith the newly added base functions? - After the change, the
availablefield is still public so we cannot prevent future PRs from accessing it elsewhere. Should we make it private to complete the encapsulation? - I understand that it is not necessary to create the functions for accessing total. At the same time, the access will be asymmetric which might confuse people. So wondering what's the end state of the available and total fields?
|
Really appreciate your feedbacks!
Yes, the goal is to replace all direct references to
Yes, I will make it private. Thanks!
I think we should encapsulate both the |
… wrapper methods Signed-off-by: dancingactor <s990346@gmail.com>
Signed-off-by: dancingactor <s990346@gmail.com>
Signed-off-by: dancingactor <s990346@gmail.com>
- Modify tests to use wrapper methods - Modify some missing direct access to use wrapper methods Signed-off-by: dancingactor <s990346@gmail.com>
92aa44a to
24f1f0f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 24f1f0f. Configure here.
|
Hi @MengjinYan, I have applied the changes in 24f1f0f. PTAL
|
Signed-off-by: dancingactor <s990346@gmail.com>
a9d3949 to
ad48475
Compare
|
Hi @MengjinYan, gentle ping on this PR for review/merge whenever you have a moment. Thanks again! |

Description
Context
availabletype fromNodeResourceSet(scalar) toNodeResourceInstanceSet(per-instance vector) for accurate GPU fragmentation detection([core] Fix GPU fractional scheduling by tracking per-instance availability #62005)What This PR Does
availablefield behind wrapper methods so that we can include the wrapper methods in the base caseNote: This PR contains no logic changes, it only wraps original direct access calls with wrapper methods
Introduced methods in
NodeResourcesGetAvailableSum(ResourceID)GetAvailableResourceIds()GetAvailableResourceMap()SubtractAvailable(ResourceSet)SetAvailableResource(ResourceID, FixedPoint)SetAvailable(NodeResourceSet)HasAvailableResource(ResourceID)GetAvailable()TakeAvailable()Related PRs
Related to #62005