Merged
Conversation
|
Thanks for your contribution! |
zhangbo9674
reviewed
Jul 25, 2025
paddlenlp/transformers/fp8_utils.py
Outdated
|
|
||
| return res | ||
| @staticmethod | ||
| def run_deep_gemm(a, a_scale, b, b_scale, out=None, num_sms=112, m_indices=None, is_grouped=False): |
Contributor
There was a problem hiding this comment.
这个 run_deep_gemm,需要考虑下和 wgrad_gemm 的区别
paddlenlp/transformers/fp8_utils.py
Outdated
| if (x.shape[axis] + 128 - (x.shape[axis] % 128)) % 512 != 0: | ||
| padding_size = 512 | ||
| @staticmethod | ||
| def kitchen_fp8_gemm( |
| do3_orig_shape = do3.shape | ||
| do3 = do3.reshape([-1, do3_orig_shape[-1]]) | ||
| @staticmethod | ||
| def fp8_mlp_bwd_norm_rc(do3, x, norm_w, norm_eps, w1, w2): |
paddlenlp/transformers/fp8_utils.py
Outdated
|
|
||
| # ===== compute norm grad ===== | ||
| dx, d_rms_norm_weight = fused_ln.fused_rms_norm_grad_func(x, norm_w, invar, d_norm_output, norm_eps) | ||
| if if_keep_x: |
Contributor
There was a problem hiding this comment.
if if_keep_x,这两个 if 也太奇怪了
…into rewrite_fp8_utils
zhangbo9674
reviewed
Jul 31, 2025
| if (x.shape[axis] + 128 - (x.shape[axis] % 128)) % 512 != 0: | ||
| padding_size = 512 | ||
| @staticmethod | ||
| def kitchen_gemm( |
1fb7393 to
6f04692
Compare
zhangbo9674
approved these changes
Jul 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting
testsfolder. If there are codecov issues, please add tests cases first.PR types
Others
PR changes
Others
Description
优化了 fp8_utils 中的各个函数,减少了一些重复实现,增加一下可维护性,主要做了以下工作