Skip to content
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

layer_norm_grad for npu #10560

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

layer_norm_grad for npu #10560

wants to merge 2 commits into from

Conversation

fpzh2011
Copy link
Contributor

@fpzh2011 fpzh2011 commented Nov 7, 2024

因为 NPU GPT2 测试场景下,layer_norm 都是 affine 的,为减少 CANN 调用,对 layer_norm_grad 进行重构。在一个 kernel 内完成 gamma,beta,dx 的梯度计算。

fpzh2011 and others added 2 commits November 7, 2024 08:56
Fix SBP settings for LayerNormGradOp to ensure correct gradient
aggregation for gamma_diff and beta_diff

Changes

- Updated SBP strategy in LayerNormGradOp: Set gamma_diff and beta_diff
to use PartialSum instead of Split to avoid dimension mismatches during
distributed training.
- Added consistency check for begin_norm_axis and begin_params_axis:
Enforce equality to ensure proper alignment of normalization and
parameter dimensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants