Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
2446ddfd
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,发现更多精彩内容 >>
提交
2446ddfd
编写于
4月 04, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Format codes.
上级
a2f2a3c6
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
16 addition
and
6 deletion
+16
-6
.gitignore
.gitignore
+1
-0
mace/core/file_storage_engine.cc
mace/core/file_storage_engine.cc
+4
-3
mace/core/file_storage_engine.h
mace/core/file_storage_engine.h
+1
-1
mace/core/runtime/opencl/opencl_runtime.cc
mace/core/runtime/opencl/opencl_runtime.cc
+2
-2
mace/core/runtime/opencl/opencl_runtime.h
mace/core/runtime/opencl/opencl_runtime.h
+1
-0
mace/utils/utils.h
mace/utils/utils.h
+1
-0
tools/generate_opencl_code.sh
tools/generate_opencl_code.sh
+2
-0
tools/generate_tuning_param_code.sh
tools/generate_tuning_param_code.sh
+2
-0
tools/sh_commands.py
tools/sh_commands.py
+2
-0
未找到文件。
.gitignore
浏览文件 @
2446ddfd
...
@@ -6,5 +6,6 @@ cmake-build-debug/
...
@@ -6,5 +6,6 @@ cmake-build-debug/
mace/codegen/models/
mace/codegen/models/
mace/codegen/opencl/
mace/codegen/opencl/
mace/codegen/opencl_bin/
mace/codegen/opencl_bin/
mace/codegen/tuning/
mace/codegen/version/
mace/codegen/version/
build/
build/
mace/core/file_storage_engine.cc
浏览文件 @
2446ddfd
...
@@ -10,10 +10,11 @@
...
@@ -10,10 +10,11 @@
namespace
mace
{
namespace
mace
{
std
::
string
FileStorageEngine
::
kStoragePath
=
"/data/local/tmp"
;
std
::
string
FileStorageEngine
::
kStoragePath
// NOLINT(runtime/string)
=
"/data/local/tmp"
;
FileStorageEngine
::
FileStorageEngine
(
const
std
::
string
&
file_name
)
:
FileStorageEngine
::
FileStorageEngine
(
const
std
::
string
&
file_name
)
:
file_name_
(
file_name
){}
file_name_
(
file_name
)
{}
void
FileStorageEngine
::
Write
(
void
FileStorageEngine
::
Write
(
const
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
char
>>
&
data
)
{
const
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
char
>>
&
data
)
{
...
@@ -25,7 +26,7 @@ void FileStorageEngine::Write(
...
@@ -25,7 +26,7 @@ void FileStorageEngine::Write(
int64_t
data_size
=
data
.
size
();
int64_t
data_size
=
data
.
size
();
ofs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
data_size
),
ofs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
data_size
),
sizeof
(
data_size
));
sizeof
(
data_size
));
for
(
auto
&
kv
:
data
)
{
for
(
auto
&
kv
:
data
)
{
int32_t
key_size
=
static_cast
<
int32_t
>
(
kv
.
first
.
size
());
int32_t
key_size
=
static_cast
<
int32_t
>
(
kv
.
first
.
size
());
ofs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
key_size
),
sizeof
(
key_size
));
ofs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
key_size
),
sizeof
(
key_size
));
ofs
.
write
(
kv
.
first
.
c_str
(),
key_size
);
ofs
.
write
(
kv
.
first
.
c_str
(),
key_size
);
...
...
mace/core/file_storage_engine.h
浏览文件 @
2446ddfd
...
@@ -15,7 +15,7 @@ namespace mace {
...
@@ -15,7 +15,7 @@ namespace mace {
class
FileStorageEngine
:
public
KVStorageEngine
{
class
FileStorageEngine
:
public
KVStorageEngine
{
public:
public:
FileStorageEngine
(
const
std
::
string
&
file_name
);
explicit
FileStorageEngine
(
const
std
::
string
&
file_name
);
public:
public:
void
Write
(
void
Write
(
const
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
char
>>
&
data
)
override
;
const
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
char
>>
&
data
)
override
;
...
...
mace/core/runtime/opencl/opencl_runtime.cc
浏览文件 @
2446ddfd
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <mutex> // NOLINT(build/c++11)
#include <mutex> // NOLINT(build/c++11)
#include <string>
#include <string>
#include <vector>
#include <vector>
#include <utility>
#include "mace/core/file_storage_engine.h"
#include "mace/core/file_storage_engine.h"
#include "mace/core/runtime/opencl/opencl_extension.h"
#include "mace/core/runtime/opencl/opencl_extension.h"
...
@@ -453,7 +454,7 @@ void OpenCLRuntime::BuildProgramFromSource(
...
@@ -453,7 +454,7 @@ void OpenCLRuntime::BuildProgramFromSource(
this
->
program_content_map_
.
emplace
(
built_program_key
,
this
->
program_content_map_
.
emplace
(
built_program_key
,
content
);
content
);
this
->
program_map_changed
=
true
;
this
->
program_map_changed
=
true
;
VLOG
(
3
)
<<
"Program from source: "
<<
built_program_key
;
VLOG
(
3
)
<<
"Program from source: "
<<
built_program_key
;
}
}
}
}
...
@@ -477,7 +478,6 @@ void OpenCLRuntime::BuildProgram(const std::string &program_name,
...
@@ -477,7 +478,6 @@ void OpenCLRuntime::BuildProgram(const std::string &program_name,
build_options_str
,
program
);
build_options_str
,
program
);
}
}
}
}
}
}
cl
::
Kernel
OpenCLRuntime
::
BuildKernel
(
cl
::
Kernel
OpenCLRuntime
::
BuildKernel
(
...
...
mace/core/runtime/opencl/opencl_runtime.h
浏览文件 @
2446ddfd
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <mutex> // NOLINT(build/c++11)
#include <mutex> // NOLINT(build/c++11)
#include <set>
#include <set>
#include <string>
#include <string>
#include <vector>
#include "mace/core/future.h"
#include "mace/core/future.h"
#include "mace/core/runtime/opencl/cl2_header.h"
#include "mace/core/runtime/opencl/cl2_header.h"
...
...
mace/utils/utils.h
浏览文件 @
2446ddfd
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include <sstream>
#include <sstream>
#include <string>
#include <string>
#include <utility>
#include <utility>
#include <vector>
namespace
mace
{
namespace
mace
{
template
<
typename
Integer
>
template
<
typename
Integer
>
...
...
tools/generate_opencl_code.sh
浏览文件 @
2446ddfd
...
@@ -17,6 +17,8 @@ TARGET_SOC=$2
...
@@ -17,6 +17,8 @@ TARGET_SOC=$2
CL_BIN_DIRS
=
$3
CL_BIN_DIRS
=
$3
PULL_OR_NOT
=
$4
PULL_OR_NOT
=
$4
mkdir
-p
${
CL_CODEGEN_DIR
}
if
[
x
"
$TYPE
"
==
x
"source"
]
;
then
if
[
x
"
$TYPE
"
==
x
"source"
]
;
then
python mace/python/tools/encrypt_opencl_codegen.py
\
python mace/python/tools/encrypt_opencl_codegen.py
\
--cl_kernel_dir
=
./mace/kernels/opencl/cl/
\
--cl_kernel_dir
=
./mace/kernels/opencl/cl/
\
...
...
tools/generate_tuning_param_code.sh
浏览文件 @
2446ddfd
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
CURRENT_DIR
=
`
dirname
$0
`
CURRENT_DIR
=
`
dirname
$0
`
source
${
CURRENT_DIR
}
/env.sh
source
${
CURRENT_DIR
}
/env.sh
mkdir
-p
${
TUNING_CODEGEN_DIR
}
if
[
"$#"
-eq
"0"
]
;
then
if
[
"$#"
-eq
"0"
]
;
then
python mace/python/tools/binary_codegen.py
\
python mace/python/tools/binary_codegen.py
\
--binary_file_name
=
mace_run.config
\
--binary_file_name
=
mace_run.config
\
...
...
tools/sh_commands.py
浏览文件 @
2446ddfd
...
@@ -128,6 +128,7 @@ def bazel_target_to_bin(target):
...
@@ -128,6 +128,7 @@ def bazel_target_to_bin(target):
################################
################################
# TODO this should be refactored
# TODO this should be refactored
def
gen_encrypted_opencl_source
(
codegen_path
=
"mace/codegen"
):
def
gen_encrypted_opencl_source
(
codegen_path
=
"mace/codegen"
):
sh
.
mkdir
(
"-p"
,
"%s/opencl"
%
codegen_path
)
sh
.
python
(
"mace/python/tools/encrypt_opencl_codegen.py"
,
sh
.
python
(
"mace/python/tools/encrypt_opencl_codegen.py"
,
"--cl_kernel_dir=./mace/kernels/opencl/cl/"
,
"--cl_kernel_dir=./mace/kernels/opencl/cl/"
,
"--output_path=%s/opencl/opencl_encrypt_program.cc"
%
codegen_path
)
"--output_path=%s/opencl/opencl_encrypt_program.cc"
%
codegen_path
)
...
@@ -138,6 +139,7 @@ def gen_mace_version(codegen_path="mace/codegen"):
...
@@ -138,6 +139,7 @@ def gen_mace_version(codegen_path="mace/codegen"):
"%s/version/version.cc"
%
codegen_path
)
"%s/version/version.cc"
%
codegen_path
)
def
gen_compiled_opencl_source
(
codegen_path
=
"mace/codegen"
):
def
gen_compiled_opencl_source
(
codegen_path
=
"mace/codegen"
):
sh
.
mkdir
(
"-p"
,
"%s/opencl"
%
codegen_path
)
sh
.
python
(
"mace/python/tools/opencl_codegen.py"
,
sh
.
python
(
"mace/python/tools/opencl_codegen.py"
,
"--output_path=%s/opencl/opencl_compiled_program.cc"
%
codegen_path
)
"--output_path=%s/opencl/opencl_compiled_program.cc"
%
codegen_path
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录