Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
85fb3268
Mace
项目概览
慢慢CG
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
85fb3268
编写于
10月 29, 2020
作者:
B
Bin Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: Support building multiple models of GPU and DSP together
上级
76f29748
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
8 deletion
+32
-8
mace/core/runtime/hexagon/hexagon_device.cc
mace/core/runtime/hexagon/hexagon_device.cc
+5
-3
mace/core/runtime/hexagon/hexagon_device.h
mace/core/runtime/hexagon/hexagon_device.h
+1
-1
mace/libmace/mace.cc
mace/libmace/mace.cc
+3
-2
mace/ops/eltwise.cc
mace/ops/eltwise.cc
+22
-0
tools/device.py
tools/device.py
+1
-2
未找到文件。
mace/core/runtime/hexagon/hexagon_device.cc
浏览文件 @
85fb3268
...
...
@@ -32,16 +32,18 @@ HexagonDevice::HexagonDevice(DeviceType device_type,
#ifdef MACE_ENABLE_OPENCL
GPURuntime
*
HexagonDevice
::
gpu_runtime
()
{
MACE_CHECK_NOTNULL
(
gpu_device_
);
return
gpu_device_
->
gpu_runtime
();
}
#endif // MACE_ENABLE_OPENCL
Allocator
*
HexagonDevice
::
allocator
()
{
#ifdef MACE_ENABLE_OPENCL
return
gpu_device_
->
allocator
();
#else
return
allocator_
.
get
();
if
(
gpu_device_
!=
nullptr
)
{
return
gpu_device_
->
allocator
();
}
#endif // MACE_ENABLE_OPENCL
return
allocator_
.
get
();
}
DeviceType
HexagonDevice
::
device_type
()
const
{
...
...
mace/core/runtime/hexagon/hexagon_device.h
浏览文件 @
85fb3268
...
...
@@ -39,7 +39,7 @@ class HexagonDevice : public CPUDevice {
HexagonDevice
(
DeviceType
device_type
,
#ifdef MACE_ENABLE_OPENCL
utils
::
ThreadPool
*
thread_pool
,
std
::
unique_ptr
<
GPUDevice
>
gpu_device
);
std
::
unique_ptr
<
GPUDevice
>
gpu_device
=
nullptr
);
#else
utils
::
ThreadPool
*
thread_pool
);
#endif // MACE_ENABLE_OPENCL
...
...
mace/libmace/mace.cc
浏览文件 @
85fb3268
...
...
@@ -578,8 +578,9 @@ MaceEngine::Impl::Impl(const MaceEngineConfig &config)
}
#endif
#if defined(MACE_ENABLE_HEXAGON) || defined(MACE_ENABLE_HTA)
if
(
device_type_
==
DeviceType
::
HEXAGON
||
device_type_
==
DeviceType
::
HTA
)
{
if
(
device_type_
==
DeviceType
::
HEXAGON
)
{
device_
.
reset
(
new
HexagonDevice
(
device_type_
,
thread_pool_
.
get
()));
}
else
if
(
device_type_
==
DeviceType
::
HTA
)
{
#ifdef MACE_ENABLE_OPENCL
device_
.
reset
(
new
HexagonDevice
(
device_type_
,
thread_pool_
.
get
(),
...
...
mace/ops/eltwise.cc
浏览文件 @
85fb3268
...
...
@@ -22,6 +22,7 @@
#include <cmath>
#include <functional>
#include <memory>
#include <set>
#include <utility>
#include <vector>
...
...
@@ -1198,6 +1199,27 @@ void RegisterEltwise(OpRegistry *op_registry) {
#endif // MACE_ENABLE_QUANTIZE
MACE_REGISTER_GPU_OP
(
op_registry
,
"Eltwise"
,
EltwiseOp
);
MACE_REGISTER_OP_CONDITION
(
op_registry
,
OpConditionBuilder
(
"Eltwise"
).
SetDevicePlacerFunc
(
[](
OpConditionContext
*
context
)
->
std
::
set
<
DeviceType
>
{
auto
op
=
context
->
operator_def
();
if
(
op
->
output_shape_size
()
!=
op
->
output_size
())
{
return
{
DeviceType
::
CPU
,
DeviceType
::
GPU
};
}
int
input_size
=
op
->
input_size
();
auto
ws
=
context
->
workspace
();
for
(
int
i
=
0
;
i
<
input_size
;
++
i
)
{
if
(
ws
->
HasTensor
(
op
->
input
(
i
))
&&
ws
->
GetTensor
(
op
->
input
(
i
))
->
is_weight
())
{
int
dims
=
ws
->
GetTensor
(
op
->
input
(
i
))
->
dim_size
();
if
(
dims
!=
1
&&
dims
!=
4
)
{
return
{
DeviceType
::
CPU
};
}
}
}
return
{
DeviceType
::
CPU
,
DeviceType
::
GPU
};
}));
}
}
// namespace ops
...
...
tools/device.py
浏览文件 @
85fb3268
...
...
@@ -279,8 +279,7 @@ class DeviceWrapper:
if
os
.
path
.
exists
(
opencl_parameter_file
):
self
.
push
(
opencl_parameter_file
,
self
.
data_dir
)
if
self
.
system
==
SystemType
.
android
\
and
device_type
==
common
.
DeviceType
.
HEXAGON
:
if
self
.
system
==
SystemType
.
android
:
self
.
push
(
"third_party/nnlib/%s/libhexagon_controller.so"
%
abi
,
self
.
data_dir
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录