-
Notifications
You must be signed in to change notification settings - Fork 74
[bug fix] Dispatch FP8 #296
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @kaniel-outis, 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 addresses a bug related to quantization in the A2 dispatch mechanism. It primarily introduces support for FP8 quantization by modifying 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. 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
The pull request modifies dispatch_normal_a2.cpp by adding a printf debugging statement, removing several blocks of commented-out code, and refactoring the GET_TILING_DATA_WITH_STRUCT call to be conditionally executed within specific TILING_KEY_IS branches. Specifically, it removes TILING_KEY_IS(2000000000) and TILING_KEY_IS(2000001000) blocks, adds GET_TILING_DATA_WITH_STRUCT to the TILING_KEY_IS(2100001000) block, and introduces a new TILING_KEY_IS(2100001002) block that initializes CamMoeDistributeDispatchA2Layered with int8_t and different template parameters. The review comment highlights that the newly added printf statement is for debugging and should be removed before merging to prevent log spam and performance degradation in production.
| { | ||
| // REGISTER_TILING_DEFAULT(NotifyDispatchA2TilingData); | ||
| // GET_TILING_DATA_WITH_STRUCT(NotifyDispatchA2TilingData, tilingData, tiling); | ||
| printf("[dispatch_normal_a2] blockId: %d\n", GetBlockIdx()); |
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.
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.
solved
|
Please supplement the performance difference of a single operator before and after quantization and the performance difference of the end-to-end model before and after quantization. |
| DataCopyPad(tokenTempTensorU8_, xGMTensorU8_[(startTokenId + i) * tokenLenInStruct_], | ||
| tokenCopyParamsNoQuant, tokenPadParams); | ||
| } | ||
| SyncFunc<AscendC::HardEvent::V_MTE2>(); |
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.
Add a comment explaining what problems would occur if this synchronization is not added, and why adding this synchronization would prevent these problems.
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.
added
| action="store_true", | ||
| help="Whether to enable diagnose for testing", | ||
| ) | ||
| parser.add_argument( |
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 switch for enabling or disabling quantization needs to be added to the test script.
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.
added
| ) | ||
| if local_rank == 0: | ||
| print( | ||
| f'[tuning] Dispatch ({"FP8" if isinstance(current_x, tuple) else "BF16"}) {recv_bytes / 1e9 / t:.2f} GB/s (HCCS), ' |
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 determining whether to enable quantization is incorrect here. Please correct it.
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.
fixed
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.
Add relative test cases to pr-test-npu.yml,but need a2 in CI
Motivation
Supports quantization mode for the dispatch normal operator.
Result and Report
Two 910B tested:python test_internode.py
Before:
Accuracy issues arise after enabling fp8 quantization mode.
After:
The accuracy is correct; the script has completed execution.
performance:
single operator:
bf16:[tuning] Dispatch (BF16) 37.41 GB/s (HCCS), 9.37 GB/s (RDMA), avg_t: 12495.23 us, notify_t: 3939.33 us
[tuning] Combine 52.73 GB/s (HCCS), 13.21 GB/s (RDMA), avg_t: 8864.13 us
int8:[tuning] Dispatch (INT8) 34.00 GB/s (HCCS), 8.52 GB/s (RDMA), avg_t: 6873.71 us, notify_t: 2805.58 us
[tuning] Combine 53.17 GB/s (HCCS), 13.32 GB/s (RDMA), avg_t: 8790.47 us
model:
bf16:
int8: