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] remove conv redundant's for opencl kernel. test=develop #3924

Merged
merged 3 commits into from
Jul 14, 2020

Conversation

ysh329
Copy link
Contributor

@ysh329 ysh329 commented Jul 9, 2020

状态:等待review

主要内容

1. 去掉OpenCL Conv计算期的所有冗余

这部分有:权重相关的部分(由PrepareForRun来做,且该方法只会执行一次),输入输出相关的部分(考虑变化的输入大小,由ReInitWhenNeeded来做,同时其中也有一个GlobalWorkSize的计算,因为gws也和输入输出的大小有关)。

其中包括不限于:

  1. 冗余的param结构体参数解包,改为在PrepareForRun和ReInitWhenNeeded做,同时将后续setArg时用到的参数全部挂载到class kernel上;
  2. arg_idx++。全部替换为数字常量,这样setArg过程,不做++等计算;
  3. 对于input_c_block_的计算,前置放到GlobalWorkSize里;
  4. 对于cl函数定义都包含bias,对应cl kernel文件里函数传参的地方不用宏判断bias,默认都传递bias。当has_bias_为false时,给定默认的bias image占位,大小为宽高为1x1的image。

2. 其它

tune拼写错误修正;

自测

  1. conv单测:都跑了loop_test,只有conv3x3目前会挂,对比了改前,会挂在相同的地方;
  2. 变化大小的输入:测试超分uint8输入输出,在同一个Predictor下,先小的输入尺寸(输入为255 / 3),后Resize为大的输入尺寸(并修改input data的值为 255 / 2),两个尺寸下的计算结果都正确。

@ysh329 ysh329 changed the title [LITE][OPENCL] remove conv redundant's for opencl kernel. test=develop [WIP][OPENCL] remove conv redundant's for opencl kernel. test=develop Jul 9, 2020
@ysh329 ysh329 changed the title [WIP][OPENCL] remove conv redundant's for opencl kernel. test=develop [OPENCL] remove conv redundant's for opencl kernel. test=develop Jul 13, 2020
Copy link
Collaborator

@xiebaiyuan xiebaiyuan left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants