[v0.13.0][Fusion]add checks to skip fusion where split_rmsnorm_rope is not supported#6749
Conversation
Summary of ChangesHello @Angazenn, 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 enhances the robustness of the QKNorm and Rope fusion pass by introducing more precise conditions for its application. It centralizes the logic for determining the rotary embedding dimension into a new utility function, which is then used to validate 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
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 adds checks to skip the split_rmsnorm_rope fusion when it is not supported. This is achieved by refactoring the rope_dim calculation into a new get_rope_dim helper function and using it to validate the conditions for the fusion pass. While the refactoring is a good improvement, it introduces a critical bug in the new get_rope_dim function that could cause incorrect behavior by setting rope_dim to zero inappropriately. I have provided a specific comment and code suggestion to address this issue.
78d2276 to
5ff1c23
Compare
Signed-off-by: Angazenn <supperccell@163.com>
5ff1c23 to
f986213
Compare
What this PR does / why we need it?
With #6602 ,
npu_rotary_embeddingunifies all rope implementation in AscendRotaryEmbedding, but allows a wider range of application of fusion opsplit_qkv_rmsnorm_rope. This PR restricts the fusion ofsplit_qkv_rmsnorm_ropeto only cases wherehead_size== 128 &&rotary_dim==head_size. Further enhancement and generalization of this op will be accomplished by @whx-sjtu .Does this PR introduce any user-facing change?
How was this patch tested?