Skip to content
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

[OpenCL][kernel] Set PriorBox and PriorBoxVar as const weights in Box coder #5930

Merged
merged 2 commits into from
Apr 21, 2021

Conversation

zhaoyang-star
Copy link
Collaborator

@zhaoyang-star zhaoyang-star commented Apr 20, 2021

【问题】
SSD 网络结构中有 6 个 prior_box,该 op 没有 opencl 实现,因此 SSD 网络在 opencl 后端执行时在此处会额外带来 12 次 io_copy 和 layout_cast 的开销,严重影响性能。

【分析】
#5788 已新增了一个消融 pass ssd_boxes_calc_offline_pass,用来离线计算 prior_box,同时该 pass 内对 prior_box 后的 reshape/flattenconcat 进行了融合,本 PR 只需适配应用该 pass 即可,即将 box_coder 的 输入参数 PriorBoxPriorBoxVar 当成 weights 常量。

【效果】
原始模型结构:
image

应用pass后的精简模型结构:
image

image

@paddle-bot-old
Copy link

Thanks for your contribution!

Copy link
Collaborator

@daming5432 daming5432 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhaoyang-star zhaoyang-star merged commit c0afca6 into PaddlePaddle:develop Apr 21, 2021
@zhaoyang-star zhaoyang-star deleted the box_coder branch April 21, 2021 02:43
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