-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relax] Refactoring Duplicate cuBLAS/hipBLAS Tests #18614
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
Conversation
Summary of ChangesHello @guan404ming, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the testing infrastructure for cuBLAS and hipBLAS codegen by extracting common testing logic into a new shared utility file. This change significantly reduces code duplication, improves the maintainability of the test suite, and streamlines the process for verifying BLAS offload functionalities across different backends. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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 successfully refactors duplicated test code from cuBLAS and hipBLAS tests into a shared utility file. This is a good improvement for code reuse and maintainability. The logic appears to be preserved correctly. I have one suggestion in the new common file to improve the clarity of a piece of logic that is a bit confusing, which could help future maintenance. Overall, this is a solid refactoring.
| if transpose_y: | ||
| y = np.swapaxes(y, -2, -1) | ||
| y_shape = (*y_shape[:-2], y_shape[-1], y_shape[-2]) |
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.
The logic for handling transpose_y is correct but confusing. The y_shape variable is used to define the shape of the y operand for matmul, but then it's reassigned to represent the shape of the y argument for the Relax function, which is different when transpose_y is true. This dual-purpose use of y_shape makes the code hard to reason about.
A refactor using separate variables (e.g., y_matmul_shape and y_arg_shape) would greatly improve readability and maintainability.
1bd48ce to
296a971
Compare
## Related #18614 ci error ## Why The CUDAModuleNode destructor was using CUDA_DRIVER_CALL and CUDA_CALL macros that call LOG(FATAL) (throw an exception) when CUDA operations fail. During interpreter shutdown, the CUDA context can become invalid, causing CUDA_ERROR_ILLEGAL_ADDRESS when cuModuleUnload is called. Throwing exceptions in destructors is undefined behavior and causes crashes. ## How 1. Removed the throwing macros from the destructor 2. Check cudaSetDevice return value and skip cleanup if it fails 3. Ignore errors from cuModuleUnload - during shutdown these are benign since the OS will reclaim resources anyway
296a971 to
a9b4a4f
Compare
a9b4a4f to
5362376
Compare
How