[WIP][FusedDeepMoe] offset state space of FusedDeepMoe operator#243
[WIP][FusedDeepMoe] offset state space of FusedDeepMoe operator#243wangqiankun13 wants to merge 1 commit intosgl-project:mainfrom
Conversation
…16 bytes, to avoid conflicts with norm operators Signed-off-by: wangqiankun <wangqiankun13@huawei.com>
Summary of ChangesHello @wangqiankun13, 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 implements a critical adjustment to the memory allocation strategy for the 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a 16-byte offset to the state space of the FusedDeepMoe operator to prevent memory conflicts, as described. The change is implemented by adding a WINDOWS_EXP_OFFSET macro and applying it consistently to address calculations involving localWindowsExp and windowsExp across several kernel files. The implementation appears correct and directly addresses the stated goal. I have one suggestion to improve the robustness of a modified macro definition.
| (((epRankId == rankId) \ | ||
| ? ((GM_ADDR)(winContext_->localWindowsExp)) \ | ||
| : ((GM_ADDR)(((HcclRankRelationResV2 *)(winContext_->remoteRes[rankId].nextDevicePtr))->windowsExp))) + \ | ||
| dataState * WIN_STATE_OFFSET) | ||
| dataState * WIN_STATE_OFFSET + WINDOWS_EXP_OFFSET) |
There was a problem hiding this comment.
For safety, it's a good practice to wrap the entire expression of a function-like macro in parentheses. This prevents potential operator precedence issues when the macro is used within a more complex expression.
((((epRankId == rankId) \
? ((GM_ADDR)(winContext_->localWindowsExp)) \
: ((GM_ADDR)(((HcclRankRelationResV2 *)(winContext_->remoteRes[rankId].nextDevicePtr))->windowsExp))) + \
dataState * WIN_STATE_OFFSET + WINDOWS_EXP_OFFSET))
[FusedDeepMoe] the state space of FusedDeepMoe operator is offset by 16 bytes, to avoid conflicts with norm operators