[AutoParallel] fix GPT embedding placements #10834
Open
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
tests
folder. If there are codecov issues, please add tests cases first.PR types
Others
PR changes
Others
Description
GPT 动半下,修改 placemetns 以提高性能
1、修改 embedding 和 lmhead 层 weight 的 placemetns 为列切
2、修改
GPTEmbeddingsAuto
层输出的 placemetns 为 replicate修改前:
GPTEmbeddingsAuto
输出为[Replicate(), Reshard(2)]
,导致每次进入 encoder 层的状态都为[Replicate(), Reshard(2)]
,在进行residual + dropout
计算时,有[Replicate(), Reshard(2)]
->[Replicate(), Replicate()]
,这在前向和反向中会引入 allgather 通信GPT 单机8卡 H卡 最优配置 20layer 吞吐(token/card/s):7902.79
修改后:
GPTEmbeddingsAuto
输出为[Replicate(), Replicate()]
, encoder 层输入的状态也为 replicate,在进行residual + dropout
计算时,可以直接进行 replicate 计算,不引入额外通信GPT 单机8卡 H卡 最优配置 20layer 吞吐(token/card/s):8305.75(+402.96,+5.1%)