Revert "perf(ROCm): add is_rdna() detection and optimize CE loss for RDNA GPUs"#4139
Conversation
…nslothai#4123)" This reverts commit 4d3e7d7.
Summary of ChangesHello, 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 reverts a prior performance optimization aimed at RDNA GPUs within the cross-entropy loss kernel. The decision to revert was based on post-merge benchmarks demonstrating that the 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. Changelog
Activity
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.
Code Review
This pull request reverts a previous performance optimization for RDNA GPUs in the cross-entropy loss kernel. The original change, which adjusted num_warps, was found to have no significant performance impact. The code changes correctly revert the num_warps calculation and remove the associated is_rdna utility function import. The revert is well-justified by the provided benchmarks and the implementation is correct. I have no suggestions for improvement.
danielhanchen
left a comment
There was a problem hiding this comment.
The benchmarks clearly show warps=16 vs warps=32 is within noise for RDNA (memory-bandwidth-bound at ~80-96% HBM utilization). The semantic point is also correct -- RDNA warp_size=32 matches NVIDIA, not CDNA's warp_size=64, so they should not be grouped in warp-count logic.
After this merges, the only remaining caller of is_rdna() is the Gemma3 NaN correctness workaround in loader.py -- which needs the broad detection to stay safe.
Clean 3-line revert, zero regression risk. LGTM.
Hi @danielhanchen, sorry for the noise — wanted to flag a post-merge finding.
This reverts the
num_warpschange from #4123 for RDNA GPUs in the chunked cross-entropy forward path.Reason
After stricter benchmarking (10 trials × 500 iters on W7900 gfx1100), the change turns out to have no meaningful effect:
The kernel is memory-bandwidth bound (~80–96% HBM utilization). The performance plateau starts at
warps=16, so both values are equivalent at the bandwidth ceiling — the originalwarps=32is already sufficient.More importantly, the
16 if is_cdna() or is_rdna() else 32expression risks misleading future contributors: RDNA haswarp_size=32(same as NVIDIA), not 64 like CDNA, so the two architectures should not be grouped together in warp logic.