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
[PIR] register some fused_ops #57655
[PIR] register some fused_ops #57655
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
… register_fused_operations
… register_fused_operations
const OpOutputMapping& arg_to_idx) override { | ||
OpTranscriber::RecordOpResultMapping( | ||
ctx, param_map, op_desc, operation, arg_to_idx); | ||
if (op_desc.HasOutput("Out")) { |
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.
Sometimes, the original fused_feedforward
will have two outputs pointing to same variable, which uses same memory buffer.
Paddle/paddle/fluid/framework/ir/fused_feedforward_pass.cc
Lines 188 to 192 in 3ce66d5
if (!add_residual) { | |
if (use_dropout_2) { | |
GET_IR_NODE_FROM_SUBGRAPH( | |
dropout_out_2, dropout_out_2, fused_feedforward_pattern); | |
fused_feedforward_op_desc.SetOutput("Out", {dropout_out_2->Name()}); |
After translating, the two outputs will be mapped to two values while having different memory buffers and result in precision problem.
By forcing this duplicate variable mapping to output out
only, we can get the right result.
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.
建议针对该问题添加必要 Warning 日志
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.
LGTM
单测删除
dropout1_seed: Dropout1Seed | ||
dropout2_seed: Dropout2Seed |
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.
这两个是不可变attribute?
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.
不是,fused_feedforward的kernel参数重既包含dropout1_seed,又包含dropout1_seed_val
* register_fused_ops * add unittest * fix bug and add test * refine * refine * set timeout
* register_fused_ops * add unittest * fix bug and add test * refine * refine * set timeout
* register_fused_ops * add unittest * fix bug and add test * refine * refine * set timeout
PR types
Others
PR changes
Others
Description
fused_attention_grad
in pirfused_feedforward
and its grad op in pirFusedAttentionInfermeta
frommultiary.cc
tofusion.cc
by comments in [PIR] register fused_attention in pir #57557Others
Pcard-67164