fixes hardcoded "cuda" device references in unit tests to use a dynamic device selection#12761
Conversation
Summary of ChangesHello @kalyank007, 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 improves the robustness and portability of unit tests by eliminating hardcoded "cuda" device references. By dynamically selecting the appropriate device, the tests can now run seamlessly on diverse hardware backends, ensuring broader compatibility and reducing maintenance overhead for different computing environments. Highlights
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
|
ac81f4c to
0d4be5d
Compare
There was a problem hiding this comment.
Code Review
This pull request is a good step towards making the unit tests device-agnostic by replacing hardcoded "cuda" strings with dynamic device selection.
However, the implementation is incomplete. The changes are only applied to _test_extend_attention_unified_vs_regular_once and test_build_unified_kv_indices, but many other test methods in test/srt/test_triton_attention_kernels.py still have hardcoded "cuda" device references. To fully achieve the goal of this PR, I recommend updating the following methods as well:
_test_extend_attention_once_test_extend_attention_sliding_window_once_test_context_attention_once_test_decode_attention_once_test_grouped_decode_attention_once
Most importantly, the current changes introduce a NameError because the get_device function is used without being imported. I've added a specific comment pointing out where this needs to be fixed.
aae7ece to
c8beb74
Compare
device selection function instead. This change improves test portability across different hardware backends (e.g., CUDA, XPU, ROCm, CPU). Key changes: Replaced all hardcoded "cuda" string literals with get_device() function calls, Applied changes to two test methods: test_build_unified_kv_indices and _test_extend_attention_unified_vs_regular_once
c8beb74 to
3f2fa43
Compare
resolved |
fixes hardcoded "cuda" device references in unit tests to use a dynamic device selection function instead. This change improves test portability across different hardware backends (e.g., CUDA, XPU, ROCm, CPU).
Key changes:
Replaced all hardcoded "cuda" string literals with get_device() function calls, Applied changes to two test methods: test_build_unified_kv_indices and _test_extend_attention_unified_vs_regular_once