Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
d9a58a5e
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,发现更多精彩内容 >>
提交
d9a58a5e
编写于
7月 26, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix opencl cache update bug.
上级
b2a64047
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
10 deletion
+17
-10
mace/core/file_storage.cc
mace/core/file_storage.cc
+9
-2
mace/core/file_storage.h
mace/core/file_storage.h
+1
-0
mace/core/runtime/opencl/opencl_runtime.cc
mace/core/runtime/opencl/opencl_runtime.cc
+6
-7
mace/core/runtime/opencl/opencl_runtime.h
mace/core/runtime/opencl/opencl_runtime.h
+0
-1
mace/public/mace_runtime.h
mace/public/mace_runtime.h
+1
-0
未找到文件。
mace/core/file_storage.cc
浏览文件 @
d9a58a5e
...
@@ -121,13 +121,20 @@ int FileStorage::Load() {
...
@@ -121,13 +121,20 @@ int FileStorage::Load() {
return
0
;
return
0
;
}
}
void
FileStorage
::
Clear
()
{
utils
::
WriteLock
lock
(
&
data_mutex_
);
data_
.
clear
();
data_changed_
=
true
;
}
bool
FileStorage
::
Insert
(
const
std
::
string
&
key
,
bool
FileStorage
::
Insert
(
const
std
::
string
&
key
,
const
std
::
vector
<
unsigned
char
>
&
value
)
{
const
std
::
vector
<
unsigned
char
>
&
value
)
{
utils
::
WriteLock
lock
(
&
data_mutex_
);
utils
::
WriteLock
lock
(
&
data_mutex_
);
auto
res
=
data_
.
emplace
(
key
,
value
);
auto
res
=
data_
.
emplace
(
key
,
value
);
if
(
res
.
second
)
{
if
(
!
res
.
second
)
{
data_
changed_
=
tr
ue
;
data_
[
key
]
=
val
ue
;
}
}
data_changed_
=
true
;
return
true
;
return
true
;
}
}
...
...
mace/core/file_storage.h
浏览文件 @
d9a58a5e
...
@@ -30,6 +30,7 @@ class FileStorage : public KVStorage {
...
@@ -30,6 +30,7 @@ class FileStorage : public KVStorage {
public:
public:
int
Load
()
override
;
int
Load
()
override
;
void
Clear
()
override
;
bool
Insert
(
const
std
::
string
&
key
,
bool
Insert
(
const
std
::
string
&
key
,
const
std
::
vector
<
unsigned
char
>
&
value
)
override
;
const
std
::
vector
<
unsigned
char
>
&
value
)
override
;
const
std
::
vector
<
unsigned
char
>
*
Find
(
const
std
::
string
&
key
)
override
;
const
std
::
vector
<
unsigned
char
>
*
Find
(
const
std
::
string
&
key
)
override
;
...
...
mace/core/runtime/opencl/opencl_runtime.cc
浏览文件 @
d9a58a5e
...
@@ -393,6 +393,7 @@ OpenCLRuntime::OpenCLRuntime():
...
@@ -393,6 +393,7 @@ OpenCLRuntime::OpenCLRuntime():
MACE_CHECK_CL_SUCCESS
(
err
);
MACE_CHECK_CL_SUCCESS
(
err
);
extern
std
::
shared_ptr
<
KVStorageFactory
>
kStorageFactory
;
extern
std
::
shared_ptr
<
KVStorageFactory
>
kStorageFactory
;
std
::
string
cached_binary_platform_info
;
if
(
kStorageFactory
!=
nullptr
)
{
if
(
kStorageFactory
!=
nullptr
)
{
cache_storage_
=
cache_storage_
=
kStorageFactory
->
CreateStorage
(
kPrecompiledProgramFileName
);
kStorageFactory
->
CreateStorage
(
kPrecompiledProgramFileName
);
...
@@ -405,13 +406,16 @@ OpenCLRuntime::OpenCLRuntime():
...
@@ -405,13 +406,16 @@ OpenCLRuntime::OpenCLRuntime():
auto
platform_info_array
=
auto
platform_info_array
=
this
->
cache_storage_
->
Find
(
kOpenCLPlatformInfoKey
);
this
->
cache_storage_
->
Find
(
kOpenCLPlatformInfoKey
);
if
(
platform_info_array
!=
nullptr
)
{
if
(
platform_info_array
!=
nullptr
)
{
cached_binary_platform_info
_
=
cached_binary_platform_info
=
std
::
string
(
platform_info_array
->
begin
(),
std
::
string
(
platform_info_array
->
begin
(),
platform_info_array
->
end
());
platform_info_array
->
end
());
if
(
cached_binary_platform_info
!=
platform_info_
)
{
cache_storage_
->
Clear
();
}
}
}
}
}
if
(
cached_binary_platform_info
_
!=
platform_info_
)
{
if
(
cached_binary_platform_info
!=
platform_info_
)
{
if
(
OpenCLRuntime
::
kPrecompiledBinaryPath
.
empty
())
{
if
(
OpenCLRuntime
::
kPrecompiledBinaryPath
.
empty
())
{
LOG
(
WARNING
)
<<
"There is no precompiled OpenCL binary in"
LOG
(
WARNING
)
<<
"There is no precompiled OpenCL binary in"
" all OpenCL binary paths"
;
" all OpenCL binary paths"
;
...
@@ -476,11 +480,6 @@ bool OpenCLRuntime::BuildProgramFromCache(
...
@@ -476,11 +480,6 @@ bool OpenCLRuntime::BuildProgramFromCache(
cl
::
Program
*
program
)
{
cl
::
Program
*
program
)
{
// Find from binary
// Find from binary
if
(
this
->
cache_storage_
==
nullptr
)
return
false
;
if
(
this
->
cache_storage_
==
nullptr
)
return
false
;
if
(
cached_binary_platform_info_
!=
platform_info_
)
{
VLOG
(
3
)
<<
"cached OpenCL binary version is not same"
" with current version"
;
return
false
;
}
auto
content
=
this
->
cache_storage_
->
Find
(
built_program_key
);
auto
content
=
this
->
cache_storage_
->
Find
(
built_program_key
);
if
(
content
==
nullptr
)
{
if
(
content
==
nullptr
)
{
return
false
;
return
false
;
...
...
mace/core/runtime/opencl/opencl_runtime.h
浏览文件 @
d9a58a5e
...
@@ -136,7 +136,6 @@ class OpenCLRuntime {
...
@@ -136,7 +136,6 @@ class OpenCLRuntime {
std
::
string
platform_info_
;
std
::
string
platform_info_
;
OpenCLVersion
opencl_version_
;
OpenCLVersion
opencl_version_
;
std
::
string
precompiled_binary_platform_info_
;
std
::
string
precompiled_binary_platform_info_
;
std
::
string
cached_binary_platform_info_
;
bool
out_of_range_check_
;
bool
out_of_range_check_
;
uint64_t
device_gloabl_mem_cache_size_
;
uint64_t
device_gloabl_mem_cache_size_
;
uint32_t
device_compute_units_
;
uint32_t
device_compute_units_
;
...
...
mace/public/mace_runtime.h
浏览文件 @
d9a58a5e
...
@@ -51,6 +51,7 @@ class KVStorage {
...
@@ -51,6 +51,7 @@ class KVStorage {
public:
public:
// return: 0 for success, -1 for error
// return: 0 for success, -1 for error
virtual
int
Load
()
=
0
;
virtual
int
Load
()
=
0
;
virtual
void
Clear
()
=
0
;
virtual
bool
Insert
(
const
std
::
string
&
key
,
virtual
bool
Insert
(
const
std
::
string
&
key
,
const
std
::
vector
<
unsigned
char
>
&
value
)
=
0
;
const
std
::
vector
<
unsigned
char
>
&
value
)
=
0
;
virtual
const
std
::
vector
<
unsigned
char
>
*
Find
(
const
std
::
string
&
key
)
=
0
;
virtual
const
std
::
vector
<
unsigned
char
>
*
Find
(
const
std
::
string
&
key
)
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录