-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[NewIR]Fix new ir concat split bug #55419
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
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
70de913
fix new ir concat op bug
phlrain 328e7da
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
phlrain 6d2e01b
fix bug
phlrain 15efa34
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
phlrain 3d28a0b
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
phlrain 35b1646
using add_n_with_kernel instead of add_n impl
phlrain 6db2902
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
phlrain d893ea0
fix pd_op yaml bug
phlrain 276fe4d
fix bug
phlrain 3b06c9d
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
phlrain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -977,7 +977,8 @@ struct SplitOpTranscriber : public OpTranscriber { | |
| // process sections | ||
| int num = paddle::get<int>(op_desc.GetAttr("num")); | ||
| if (num <= 0) { | ||
| if (op_desc.HasInput("SectionsTensorList")) { | ||
| if (op_desc.HasInput("SectionsTensorList") && | ||
| op_desc.Input("SectionsTensorList").size() > 0) { | ||
| // get SectionsTensorList from input | ||
|
|
||
| auto sec_tensor_list = op_desc.Input("SectionsTensorList"); | ||
|
|
@@ -989,7 +990,7 @@ struct SplitOpTranscriber : public OpTranscriber { | |
| ir::Attribute new_attr = attribute_translator( | ||
| "paddle::dialect::IntArrayAttribute", op_desc.GetAttr("sections")); | ||
| auto sec_defin_op = | ||
| InsertFullOperationForAttributeInput(ctx, program, new_attr); | ||
| InsertFullArrayOperationForAttributeInput(ctx, program, new_attr); | ||
| op_inputs.push_back(sec_defin_op->result(0)); | ||
| } | ||
| } | ||
|
|
@@ -1087,6 +1088,26 @@ struct FetchOpTranscriber : public OpTranscriber { | |
| } | ||
| }; | ||
|
|
||
| // NOTE, add_n op in legacy ops don't have a kernel, so we use a new op for now | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我看原本不管外面是不是inplace都会调用同一个kernel实现,这样的话是不是不管 Op的输入输出有没有同一个变量,都把它翻译为非inplace op,然后去掉现在 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 像这种op有必要区分它们的inplace语义吗? |
||
| struct AddNOpTranscriber : public OpTranscriber { | ||
| ir::OpInfo LoopkUpOpInfo(ir::IrContext* ctx, const OpDesc& op_desc) override { | ||
| std::string target_op_name = | ||
| kTargetDialectPrefix + OpNameCompatibleMapping(op_desc.Type()); | ||
| if (IsInplace(op_desc)) { | ||
| target_op_name += "_"; | ||
| } else { | ||
| target_op_name += "_with_kernel"; | ||
| } | ||
| const auto& op_info = ctx->GetRegisteredOpInfo(target_op_name); | ||
| if (!op_info) { | ||
| IR_THROW( | ||
| "Op assign_value should have corresponding OpInfo pd.assign_value_"); | ||
| } | ||
|
|
||
| return op_info; | ||
| } | ||
| }; | ||
|
|
||
| OpTranslator::OpTranslator() { | ||
| general_handler = OpTranscriber(); | ||
| special_handlers["feed"] = FeedOpTranscriber(); | ||
|
|
@@ -1098,6 +1119,7 @@ OpTranslator::OpTranslator() { | |
| special_handlers["assign_value"] = AssignValueOpTranscriber(); | ||
| special_handlers["increment"] = IncrementOpTranscriber(); | ||
| special_handlers["rnn"] = RnnOpTranscriber(); | ||
| special_handlers["add_n"] = AddNOpTranscriber(); | ||
| } | ||
|
|
||
| } // namespace translator | ||
|
|
||
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是写错了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done