Skip to content

【BUAA】【Infer Symbolic Shape】Add moe, multiclass_nms3, shadow_feed_tensor operator for CINN compiler - #67337

Merged
luotao1 merged 34 commits into
PaddlePaddle:developfrom
Jeff114514:moe
Aug 16, 2024
Merged

luotao1 merged 34 commits into
PaddlePaddle:developfrom
Jeff114514:moe

Conversation

@Jeff114514

@Jeff114514 Jeff114514 commented Aug 12, 2024 •

Copy link
Copy Markdown
Contributor

PR Category

CINN

PR Types

Others

Description

shadow_feed_tensor缺失单测,multiclass_nms3有单测但未开启check_pir测试,仿照fused_moe为moe添加一个单测

@paddle-bot

paddle-bot Bot commented Aug 12, 2024

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@Jeff114514 Jeff114514 closed this Aug 12, 2024
@Jeff114514 Jeff114514 reopened this Aug 12, 2024
@paddle-bot paddle-bot Bot added the contributor External developers label Aug 12, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 13, 2024
@Jeff114514

Copy link
Copy Markdown
Contributor Author

已修改单测

box_dims.size()));

if (score_size == 3) {
PADDLE_ENFORCE_EQ(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个5个dim的约束需要修改为使用Addequalcstr()添加

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

不包含||的约束已进行修改

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

score_size和box_dims.size()均为int类型

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.

不包含||的约束已进行修改

剩下的约束目前shape dialect无法表示了,直接删掉或者写成TODO,不能直接使用静态值判断

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已完成修改

out_shape.emplace_back(box_dims[2] + 2);

std::vector<symbol::DimExpr> index_shape;
index_shape.emplace_back(next_symbol_out_and_index);

@gongshaotian gongshaotian Aug 14, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

怎么确定的out_shape 与 index_shape的第一维是相同的动态维度

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

MultiClassNMSKernel out和index第一维总是相同的

index_shape.emplace_back(1);

std::vector<symbol::DimExpr> nms_rois_num_shape;
nms_rois_num_shape.emplace_back(next_symbol_nms_rois_num);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

如果能确定这个动态维度与上面两个无关,这里就可以不再使用中间变量了,直接emplace_back(infer_context->GetNextSymName());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已完成修改

OP_DECLARE_INFER_SYMBOLIC_SHAPE(Scatter_)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(Select)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(ShadowFeed)
OP_DECLARE_INFER_SYMBOLIC_SHAPE(ShadowFeedTensors)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个算子有点问题先不添加了

Comment thread test/legacy_test/test_moe_op.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

moe这个算子符号推导逻辑比较简单,而且注意到已有test_moe_api.py测试文件存在,建议删除这个单测文件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants