Skip to content

fix: correct DDP handling and backward gradients - #214

Merged
kilinchange merged 2 commits into
masterfrom
fix/backend-independent-correctness
Sep 11, 2026
Merged

fix: correct DDP handling and backward gradients#214
kilinchange merged 2 commits into
masterfrom
fix/backend-independent-correctness

Conversation

@chen2021673

Copy link
Copy Markdown
Contributor

Summary

Fix several backend-independent correctness issues in DDP, autograd, and CUDA linear backward.

Changes

  • honor average_in_collective across DDP reduction paths
  • validate DDP parameters and buffers against the process group device
  • fix Exp backward and avoid aliased gradients in Add backward
  • fix CUDA linear bias-gradient reduction
  • remove an unsupported distributed optimizer test
  • clean up related build configuration, diagnostics, and test documentation

Comment thread tests/optimizer/test_optimizer_parameter_names.cc
Comment thread infini_train/src/autograd/elementwise.cc
@chen2021673
chen2021673 force-pushed the fix/backend-independent-correctness branch from 0c2b716 to 26d2402 Compare September 2, 2026 09:11
@chen2021673

chen2021673 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

精度测试:
image

这里精度出现偏差主要是因为 layernorm 和 linear kernel 的修复影响了 GPT 测例的精度。以 gpt2_1 测例为例,修复后精度与pytorch更加接近:
image
image

性能测试:
image

@kilinchange
kilinchange self-requested a review September 11, 2026 02:35

virtual int GetGroupRank(int global_rank) const;

Device::DeviceType backend() const { return backend_; }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

实现写到 .cc 里。

@chen2021673
chen2021673 force-pushed the fix/backend-independent-correctness branch from 519872c to 22bf5b5 Compare September 11, 2026 05:24
- honor DDP reduction configuration and validate process group devices
- fix elementwise and CUDA linear backward correctness
- remove the unsupported distributed optimizer test
- clean up related build diagnostics and test documentation
@chen2021673

Copy link
Copy Markdown
Contributor Author

复测

精度测试:
image
image

gpt2 测例精度得到修正,llama3 测例不变。

性能测试:
image

视为波动。

@kilinchange
kilinchange merged commit 9d20934 into master Sep 11, 2026
2 checks passed
@kilinchange
kilinchange deleted the fix/backend-independent-correctness branch September 11, 2026 06:46
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