-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
[platform] Move get_cu_count to utils #27005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[platform] Move get_cu_count to utils #27005
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request removes the get_cu_count method from the platform interface, replacing its usages with direct calls to torch.cuda.get_device_properties(0).multi_processor_count. While this simplifies the platform interface, it introduces code duplication and a potential correctness issue in multi-GPU environments due to the hardcoded device ID 0. My review includes critical feedback on this hardcoded device ID and suggests introducing a cached helper function to improve correctness, performance, and maintainability. I've also provided a suggestion to refactor the test code to improve its performance and robustness.
5a08372 to
3f03c40
Compare
3f03c40 to
1c7e2e4
Compare
|
@DarkLight1337 @youkaichao platform interface cleanup. Need your review. Thanks. |
Signed-off-by: wangxiyuan <[email protected]>
Head branch was pushed to by a user without write access
1c7e2e4 to
9cc9a26
Compare
Yikun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, if no more objection I will merge tmr.
tjtanaa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if this is a platform agnostic function.
Signed-off-by: wangxiyuan <[email protected]> Signed-off-by: George D. Torres <[email protected]>
Signed-off-by: wangxiyuan <[email protected]> Signed-off-by: Bram Wasti <[email protected]>
Purpose
get_cu_countis only used by rocm which is controlled bycurrent_platform.is_rocmalready. Remove this redundant platform interface and move it to utils instead.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.