Skip to content

[AutoParallel][PIR] Adjust dist2dense pass for kwargs-type inputs #68413

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

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

AndSonder
Copy link
Contributor

@AndSonder AndSonder commented Sep 24, 2024

PR Category

Auto Parallel

PR Types

Bug fixes

Description

Fix the dist2dense pass when the input needs to be cast to dense, as shown below.

1eaba9029d5ce901292da6c60f4daa1c

The kwargs-type inputs will cause error when run pm.run(ir_program)

e3c3b713b7598a747dc8ad80d7137bc6

Pcard-76459

@AndSonder AndSonder changed the title [AutoParallel][PIR] Adjust the dist2dense pass when the kwargs-type input needs to be cast to dense [AutoParallel][PIR] Adjust the dist2dense pass for kwargs-type inputs Sep 24, 2024
@AndSonder AndSonder changed the title [AutoParallel][PIR] Adjust the dist2dense pass for kwargs-type inputs [AutoParallel][PIR] Adjust dist2dense pass for kwargs-type inputs Sep 24, 2024
@@ -73,6 +73,14 @@ void ProcessDistBlock(pir::Block* block) {
auto result = op_item->result(i);
result.set_type(CastToLocalType(result.type()));
}

for (size_t i = 0; i < op_item->num_operands(); ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么用 operands 判断,不用 result 判断

Copy link
Contributor Author

Choose a reason for hiding this comment

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

之前用 result 的逻辑没有动,grad merge 场景下有些 var 是从 startup_program 拿过来的,属于 kwargs, 这一类的 value 在 dist_program 里面就没有 op 把它作为输出,所有 dist2dence 的时候就会给这些 value 漏掉

Copy link
Contributor

@JZ-LIANG JZ-LIANG left a comment

Choose a reason for hiding this comment

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

LGTM

@JZ-LIANG JZ-LIANG merged commit 726c1fc into PaddlePaddle:develop Sep 25, 2024
25 of 27 checks passed
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