Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
4557aa1b
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,发现更多精彩内容 >>
提交
4557aa1b
编写于
3月 22, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix opencl runtime bug.
上级
595003f9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
17 deletion
+15
-17
mace/core/mace.cc
mace/core/mace.cc
+1
-1
mace/core/runtime/opencl/opencl_runtime.cc
mace/core/runtime/opencl/opencl_runtime.cc
+9
-13
mace/core/runtime/opencl/opencl_runtime.h
mace/core/runtime/opencl/opencl_runtime.h
+5
-3
未找到文件。
mace/core/mace.cc
浏览文件 @
4557aa1b
...
...
@@ -355,7 +355,7 @@ void ConfigOpenCLRuntime(GPUPerfHint gpu_perf_hint,
GPUPriorityHint
gpu_priority_hint
)
{
VLOG
(
1
)
<<
"Set GPU configurations, gpu_perf_hint: "
<<
gpu_perf_hint
<<
", gpu_priority_hint: "
<<
gpu_priority_hint
;
OpenCLRuntime
::
C
reateGlobal
(
gpu_perf_hint
,
gpu_priority_hint
);
OpenCLRuntime
::
C
onfigure
(
gpu_perf_hint
,
gpu_priority_hint
);
}
void
ConfigOmpThreadsAndAffinity
(
int
omp_num_threads
,
...
...
mace/core/runtime/opencl/opencl_runtime.cc
浏览文件 @
4557aa1b
...
...
@@ -65,23 +65,19 @@ void OpenCLProfilingTimer::ClearTiming() {
accumulated_micros_
=
0
;
}
std
::
unique_ptr
<
OpenCLRuntime
>
OpenCLRuntime
::
runtime_instance_
=
nullptr
;
GPUPerfHint
OpenCLRuntime
::
gpu_perf_hint_
=
GPUPerfHint
::
PERF_DEFAULT
;
GPUPriorityHint
OpenCLRuntime
::
gpu_priority_hint_
=
GPUPriorityHint
::
PRIORITY_DEFAULT
;
OpenCLRuntime
*
OpenCLRuntime
::
Global
()
{
// FIXME: not thread safe
if
(
runtime_instance_
==
nullptr
)
{
return
CreateGlobal
(
GPUPerfHint
::
PERF_DEFAULT
,
GPUPriorityHint
::
PRIORITY_DEFAULT
);
}
return
runtime_instance_
.
get
();
static
OpenCLRuntime
runtime
(
gpu_perf_hint_
,
gpu_priority_hint_
);
return
&
runtime
;
}
OpenCLRuntime
*
OpenCLRuntime
::
CreateGlobal
(
GPUPerfHint
gpu_perf_hint
,
void
OpenCLRuntime
::
Configure
(
GPUPerfHint
gpu_perf_hint
,
GPUPriorityHint
gpu_priority_hint
)
{
runtime_instance_
=
std
::
unique_ptr
<
OpenCLRuntime
>
(
new
OpenCLRuntime
(
gpu_perf_hint
,
gpu_priority_hint
));
return
runtime_instance_
.
get
();
OpenCLRuntime
::
gpu_perf_hint_
=
gpu_perf_hint
;
OpenCLRuntime
::
gpu_priority_hint_
=
gpu_priority_hint
;
}
void
GetAdrenoContextProperties
(
std
::
vector
<
cl_context_properties
>
*
properties
,
...
...
mace/core/runtime/opencl/opencl_runtime.h
浏览文件 @
4557aa1b
...
...
@@ -39,7 +39,7 @@ class OpenCLProfilingTimer : public Timer {
class
OpenCLRuntime
{
public:
static
OpenCLRuntime
*
Global
();
static
OpenCLRuntime
*
CreateGlobal
(
GPUPerfHint
,
GPUPriorityHint
);
static
void
Configure
(
GPUPerfHint
,
GPUPriorityHint
);
cl
::
Context
&
context
();
cl
::
Device
&
device
();
...
...
@@ -52,10 +52,10 @@ class OpenCLRuntime {
cl
::
Kernel
BuildKernel
(
const
std
::
string
&
program_name
,
const
std
::
string
&
kernel_name
,
const
std
::
set
<
std
::
string
>
&
build_options
);
~
OpenCLRuntime
();
private:
OpenCLRuntime
(
GPUPerfHint
,
GPUPriorityHint
);
~
OpenCLRuntime
();
OpenCLRuntime
(
const
OpenCLRuntime
&
)
=
delete
;
OpenCLRuntime
&
operator
=
(
const
OpenCLRuntime
&
)
=
delete
;
...
...
@@ -74,7 +74,9 @@ class OpenCLRuntime {
std
::
map
<
std
::
string
,
cl
::
Program
>
built_program_map_
;
std
::
mutex
program_build_mutex_
;
std
::
string
kernel_path_
;
static
std
::
unique_ptr
<
OpenCLRuntime
>
runtime_instance_
;
static
GPUPerfHint
gpu_perf_hint_
;
static
GPUPriorityHint
gpu_priority_hint_
;
};
}
// namespace mace
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录