Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
680f8b42
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
680f8b42
编写于
4月 16, 2018
作者:
L
Liangliang He
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'd2s-bug' into 'master'
Fix depth_to_space opencl global work size bug. See merge request !386
上级
e80428fc
b55b537b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
18 addition
and
19 deletion
+18
-19
mace/kernels/depth_to_space.h
mace/kernels/depth_to_space.h
+2
-2
mace/kernels/opencl/depth_to_space_opencl.cc
mace/kernels/opencl/depth_to_space_opencl.cc
+16
-17
未找到文件。
mace/kernels/depth_to_space.h
浏览文件 @
680f8b42
...
...
@@ -108,11 +108,11 @@ struct DepthToSpaceOpFunctor<DeviceType::OPENCL, T> {
:
block_size_
(
block_size
),
d2s_
(
d2s
)
{}
void
operator
()(
const
Tensor
*
input
,
Tensor
*
output
,
StatsFuture
*
future
);
const
int
block_size_
;
bool
d2s_
;
cl
::
Kernel
kernel_
;
uint32_t
kwg_size_
;
std
::
unique_ptr
<
BufferBase
>
kernel_error_
;
const
int
block_size_
;
bool
d2s_
;
std
::
vector
<
index_t
>
input_shape_
;
};
...
...
mace/kernels/opencl/depth_to_space_opencl.cc
浏览文件 @
680f8b42
...
...
@@ -22,16 +22,31 @@ void DepthToSpaceOpFunctor<DeviceType::OPENCL, T>::operator()(
const
char
*
kernel_name
=
nullptr
;
uint32_t
gws
[
3
];
std
::
stringstream
ss
;
index_t
output_height
,
output_width
,
output_depth
;
if
(
d2s_
)
{
output_height
=
input_height
*
block_size_
;
if
(
d2s_
)
{
output_height
=
input_height
*
block_size_
;
output_width
=
input_width
*
block_size_
;
output_depth
=
input_depth
/
(
block_size_
*
block_size_
);
kernel_name
=
"depth_to_space"
;
gws
[
0
]
=
static_cast
<
uint32_t
>
(
RoundUpDiv4
(
output_depth
));
gws
[
1
]
=
static_cast
<
uint32_t
>
(
output_width
);
gws
[
2
]
=
static_cast
<
uint32_t
>
(
output_height
*
batch
);
ss
<<
"depth_to_space_opencl_kernel_"
<<
batch
<<
"_"
<<
output_height
<<
"_"
<<
output_width
<<
"_"
<<
output_depth
;
}
else
{
output_height
=
input_height
/
block_size_
;
output_width
=
input_width
/
block_size_
;
output_depth
=
input_depth
*
block_size_
*
block_size_
;
kernel_name
=
"space_to_depth"
;
gws
[
0
]
=
static_cast
<
uint32_t
>
(
RoundUpDiv4
(
input_depth
));
gws
[
1
]
=
static_cast
<
uint32_t
>
(
input_width
);
gws
[
2
]
=
static_cast
<
uint32_t
>
(
input_height
*
batch
);
ss
<<
"space_to_depth_opencl_kernel_"
<<
input
->
dim
(
0
)
<<
"_"
<<
input
->
dim
(
1
)
<<
"_"
<<
input
->
dim
(
2
)
<<
"_"
<<
input
->
dim
(
3
);
}
const
index_t
input_depth_blocks
=
RoundUpDiv4
(
input_depth
);
const
index_t
output_depth_blocks
=
RoundUpDiv4
(
output_depth
);
...
...
@@ -73,23 +88,7 @@ void DepthToSpaceOpFunctor<DeviceType::OPENCL, T>::operator()(
static_cast
<
uint32_t
>
(
runtime
->
GetKernelMaxWorkGroupSize
(
kernel_
));
}
uint32_t
gws
[
3
];
std
::
stringstream
ss
;
if
(
!
IsVecEqual
(
input_shape_
,
input
->
shape
()))
{
if
(
d2s_
)
{
gws
[
0
]
=
static_cast
<
uint32_t
>
(
output_depth_blocks
);
gws
[
1
]
=
static_cast
<
uint32_t
>
(
output_width
);
gws
[
2
]
=
static_cast
<
uint32_t
>
(
output_height
*
batch
);
ss
<<
"depth_to_space_opencl_kernel_"
<<
output
->
dim
(
0
)
<<
"_"
<<
output
->
dim
(
1
)
<<
"_"
<<
output
->
dim
(
2
)
<<
"_"
<<
output
->
dim
(
3
);
}
else
{
gws
[
0
]
=
static_cast
<
uint32_t
>
(
input_depth_blocks
);
gws
[
1
]
=
static_cast
<
uint32_t
>
(
input_width
);
gws
[
2
]
=
static_cast
<
uint32_t
>
(
input_height
*
batch
);
ss
<<
"space_to_depth_opencl_kernel_"
<<
input
->
dim
(
0
)
<<
"_"
<<
input
->
dim
(
1
)
<<
"_"
<<
input
->
dim
(
2
)
<<
"_"
<<
input
->
dim
(
3
);
}
uint32_t
idx
=
0
;
if
(
runtime
->
IsOutOfRangeCheckEnabled
())
{
kernel_
.
setArg
(
idx
++
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录