Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
b382a0dd
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b382a0dd
编写于
10月 23, 2019
作者:
X
xiebaiyuan
提交者:
GitHub
10月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimise conv 1x1 ,test=develop (#2248)
上级
aa507f9b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
62 addition
and
103 deletion
+62
-103
mobile/src/operators/kernel/cl/cl_kernel/conv_kernel.inc.cl
mobile/src/operators/kernel/cl/cl_kernel/conv_kernel.inc.cl
+62
-103
未找到文件。
mobile/src/operators/kernel/cl/cl_kernel/conv_kernel.inc.cl
浏览文件 @
b382a0dd
...
@@ -1093,138 +1093,97 @@ __kernel void conv_1x1_spl(
...
@@ -1093,138 +1093,97 @@ __kernel void conv_1x1_spl(
half4 weight2 = read_imageh(filter, sampler, (int2)(out_c, i * 4 + 2));
half4 weight2 = read_imageh(filter, sampler, (int2)(out_c, i * 4 + 2));
half4 weight3 = read_imageh(filter, sampler, (int2)(out_c, i * 4 + 3));
half4 weight3 = read_imageh(filter, sampler, (int2)(out_c, i * 4 + 3));
if ((max_w_bound - pos_in.x-1) < input_width && (max_w_bound - pos_in.x-1)>=0 ){
int bound_gap = max_w_bound - pos_in.x - 1;
if (bound_gap < input_width && bound_gap >= 0){
if (burndary_index==0){
if (burndary_index==0){
output0 = mad(input0.x, weight0, output0);
// do nothing
output0 = mad(input0.y, weight1, output0);
output0 = mad(input0.z, weight2, output0);
output0 = mad(input0.w, weight3, output0);
} else if (burndary_index==1){
} else if (burndary_index==1){
output0 = mad(input0.x, weight0, output0);
input0.w = 0.0f;
output0 = mad(input0.y, weight1, output0);
output0 = mad(input0.z, weight2, output0);
output0 = mad(0.0f, weight3, output0);
} else if (burndary_index==2){
} else if (burndary_index==2){
output0 = mad(input0.x, weight0, output0);
input0.z = 0.0f;
output0 = mad(input0.y, weight1, output0);
input0.w = 0.0f;
output0 = mad(0.0f, weight2, output0);
output0 = mad(0.0f, weight3, output0);
} else if (burndary_index==3){
} else if (burndary_index==3){
output0 = mad(input0.x, weight0, output0)
;
input0.y = 0.0f
;
output0 = mad(0.0f, weight1, output0)
;
input0.z = 0.0f
;
output0 = mad(0.0f, weight2, output0)
;
input0.w = 0.0f
;
output0 = mad(0.0f, weight3, output0);
}
}
}
}else {
output0 = mad(input0.x, weight0, output0);
output0 = mad(input0.x, weight0, output0);
output0 = mad(input0.y, weight1, output0);
output0 = mad(input0.y, weight1, output0);
output0 = mad(input0.z, weight2, output0);
output0 = mad(input0.z, weight2, output0);
output0 = mad(input0.w, weight3, output0);
output0 = mad(input0.w, weight3, output0);
}
// -------------1--------------
// -------------1--------------
pos_in = (int2)(i * input_width + in_pos_in_one_block1.x, in_pos_in_one_block1.y);
pos_in = (int2)(i * input_width + in_pos_in_one_block1.x, in_pos_in_one_block1.y);
half4 input1 = read_imageh(input_image, sampler, pos_in);
half4 input1 = read_imageh(input_image, sampler, pos_in);
if (abs(max_w_bound - pos_in.x) < input_width){
bound_gap = max_w_bound - pos_in.x - 1;
if (bound_gap < input_width && bound_gap >= 0){
if (burndary_index==0){
if (burndary_index==0){
output1 = mad(input1.x, weight0, output1);
// do nothing
output1 = mad(input1.y, weight1, output1);
output1 = mad(input1.z, weight2, output1);
output1 = mad(input1.w, weight3, output1);
} else if (burndary_index==1){
} else if (burndary_index==1){
output1 = mad(input1.x, weight0, output1);
input1.w = 0.0f;
output1 = mad(input1.y, weight1, output1);
output1 = mad(input1.z, weight2, output1);
output1 = mad(0.0f, weight3, output1);
} else if (burndary_index==2){
} else if (burndary_index==2){
output1 = mad(input1.x, weight0, output1);
input1.z = 0.0f;
output1 = mad(input1.y, weight1, output1);
input1.w = 0.0f;
output1 = mad(0.0f, weight2, output1);
output1 = mad(0.0f, weight3, output1);
} else if (burndary_index==3){
} else if (burndary_index==3){
output1 = mad(input1.x, weight0, output1)
;
input1.y = 0.0f
;
output1 = mad(0.0f, weight1, output1)
;
input1.z = 0.0f
;
output1 = mad(0.0f, weight2, output1)
;
input1.w = 0.0f
;
output1 = mad(0.0f, weight3, output1);
}
}
}
}else {
output1 = mad(input1.x, weight0, output1);
output1 = mad(input1.x, weight0, output1);
output1 = mad(input1.y, weight1, output1);
output1 = mad(input1.y, weight1, output1);
output1 = mad(input1.z, weight2, output1);
output1 = mad(input1.z, weight2, output1);
output1 = mad(input1.w, weight3, output1);
output1 = mad(input1.w, weight3, output1);
}
// -------------2--------------
// -------------2--------------
pos_in = (int2)(i * input_width + in_pos_in_one_block2.x, in_pos_in_one_block2.y);
pos_in = (int2)(i * input_width + in_pos_in_one_block2.x, in_pos_in_one_block2.y);
half4 input2 = read_imageh(input_image, sampler, pos_in);
half4 input2 = read_imageh(input_image, sampler, pos_in);
if (abs(max_w_bound - pos_in.x) < input_width){
bound_gap = max_w_bound - pos_in.x - 1;
if (bound_gap < input_width && bound_gap >= 0){
if (burndary_index==0){
if (burndary_index==0){
output2 = mad(input2.x, weight0, output2);
// do nothing
output2 = mad(input2.y, weight1, output2);
output2 = mad(input2.z, weight2, output2);
output2 = mad(input2.w, weight3, output2);
} else if (burndary_index==1){
} else if (burndary_index==1){
output2 = mad(input2.x, weight0, output2);
input2.w = 0.0f;
output2 = mad(input2.y, weight1, output2);
output2 = mad(input2.z, weight2, output2);
output2 = mad(0.0f, weight3, output2);
} else if (burndary_index==2){
} else if (burndary_index==2){
output2 = mad(input2.x, weight0, output2);
input2.z = 0.0f;
output2 = mad(input2.y, weight1, output2);
input2.w = 0.0f;
output2 = mad(0.0f, weight2, output2);
output2 = mad(0.0f, weight3, output2);
} else if (burndary_index==3){
} else if (burndary_index==3){
output2 = mad(input2.x, weight0, output2)
;
input2.y = 0.0f
;
output2 = mad(0.0f, weight1, output2)
;
input2.z = 0.0f
;
output2 = mad(0.0f, weight2, output2)
;
input2.w = 0.0f
;
output2 = mad(0.0f, weight3, output2);
}
}
}
}else {
output2 = mad(input2.x, weight0, output2);
output2 = mad(input2.x, weight0, output2);
output2 = mad(input2.y, weight1, output2);
output2 = mad(input2.y, weight1, output2);
output2 = mad(input2.z, weight2, output2);
output2 = mad(input2.z, weight2, output2);
output2 = mad(input2.w, weight3, output2);
output2 = mad(input2.w, weight3, output2);
}
// -------------3--------------
// -------------3--------------
pos_in = (int2)(i * input_width + in_pos_in_one_block3.x, in_pos_in_one_block3.y);
pos_in = (int2)(i * input_width + in_pos_in_one_block3.x, in_pos_in_one_block3.y);
half4 input3 = read_imageh(input_image, sampler, pos_in);
half4 input3 = read_imageh(input_image, sampler, pos_in);
bound_gap = max_w_bound - pos_in.x - 1;
if (
abs(max_w_bound - pos_in.x) < input_width
){
if (
bound_gap < input_width && bound_gap >= 0
){
if (burndary_index==0){
if (burndary_index==0){
output3 = mad(input3.x, weight0, output3);
// do nothing
output3 = mad(input3.y, weight1, output3);
output3 = mad(input3.z, weight2, output3);
output3 = mad(input3.w, weight3, output3);
} else if (burndary_index==1){
} else if (burndary_index==1){
output3 = mad(input3.x, weight0, output3);
input3.w = 0.0f;
output3 = mad(input3.y, weight1, output3);
output3 = mad(input3.z, weight2, output3);
output3 = mad(0.0f, weight3, output3);
} else if (burndary_index==2){
} else if (burndary_index==2){
output3 = mad(input3.x, weight0, output3);
input3.z = 0.0f;
output3 = mad(input3.y, weight1, output3);
input3.w = 0.0f;
output3 = mad(0.0f, weight2, output3);
output3 = mad(0.0f, weight3, output3);
} else if (burndary_index==3){
} else if (burndary_index==3){
output3 = mad(input3.x, weight0, output3);
input3.y = 0.0f;
output3 = mad(0.0f, weight1, output3);
input3.z = 0.0f;
output3 = mad(0.0f, weight2, output3);
input3.w = 0.0f;
output3 = mad(0.0f, weight3, output3);
}
}
}else {
}
output3 = mad(input3.x, weight0, output3);
output3 = mad(input3.x, weight0, output3);
output3 = mad(input3.y, weight1, output3);
output3 = mad(input3.y, weight1, output3);
output3 = mad(input3.z, weight2, output3);
output3 = mad(input3.z, weight2, output3);
output3 = mad(input3.w, weight3, output3);
output3 = mad(input3.w, weight3, output3);
}
}
}
#ifdef BATCH_NORM
#ifdef BATCH_NORM
output0 = output0 * read_imageh(new_scale, sampler, (int2)(out_c, 0)) +
output0 = output0 * read_imageh(new_scale, sampler, (int2)(out_c, 0)) +
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录