Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
2b8e7940
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2b8e7940
编写于
12月 10, 2021
作者:
M
Megvii Engine Team
提交者:
XindaH
12月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(lite/cambricon): fix cambricon models which have multiple comp node
GitOrigin-RevId: 624fd7f0ce7cadcaabf5584b10619532a7f5a231
上级
cfad9a5d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
3 deletion
+34
-3
imperative/src/impl/ops/magicmind_runtime.cpp
imperative/src/impl/ops/magicmind_runtime.cpp
+9
-0
lite/src/mge/network_impl.cpp
lite/src/mge/network_impl.cpp
+11
-0
src/cambricon/impl/magicmind_runtime_opr.cpp
src/cambricon/impl/magicmind_runtime_opr.cpp
+3
-1
src/cambricon/impl/magicmind_runtime_opr.sereg.h
src/cambricon/impl/magicmind_runtime_opr.sereg.h
+4
-0
src/cambricon/include/megbrain/cambricon/magicmind_runtime_opr.h
...bricon/include/megbrain/cambricon/magicmind_runtime_opr.h
+2
-0
src/cambricon/test/magicmind_runtime_opr.cpp
src/cambricon/test/magicmind_runtime_opr.cpp
+2
-0
src/core/impl/comp_node/cpu/comp_node.cpp
src/core/impl/comp_node/cpu/comp_node.cpp
+3
-2
未找到文件。
imperative/src/impl/ops/magicmind_runtime.cpp
浏览文件 @
2b8e7940
...
...
@@ -20,11 +20,20 @@ namespace {
namespace
magicmind_runtime
{
auto
apply_on_var_node
(
const
OpDef
&
def
,
const
VarNodeArray
&
inputs
)
{
#if CNRT_MAJOR_VERSION >= 5
auto
&&
op
=
static_cast
<
const
MagicMindRuntime
&>
(
def
);
SymbolVarArray
symbol_var_inputs
(
inputs
.
begin
(),
inputs
.
end
());
OperatorNodeConfig
config
{
op
.
make_name
()};
return
opr
::
MagicMindRuntimeOpr
::
make
(
op
.
buf
.
c_str
(),
op
.
buf_size
,
symbol_var_inputs
,
config
);
#else
mgb_assert
(
false
,
"Magicmind runtime opr is disabled at compile time, the reason of which is "
"the version of cnrt runtime is lower than 5.0. Please check the version "
"of your cambricon toolkit, and recompile megengine."
);
return
SymbolVar
{};
#endif
}
OP_TRAIT_REG
(
MagicMindRuntime
,
MagicMindRuntime
)
.
apply_on_var_node
(
apply_on_var_node
)
...
...
lite/src/mge/network_impl.cpp
浏览文件 @
2b8e7940
...
...
@@ -129,6 +129,17 @@ void NetworkImplDft::application_config() {
loc
.
stream
=
m_nr_threads
;
}
};
//! currently not set Locator type because a cambricon mgb model is a
//! cross-compnode graph
}
else
if
(
device_type
==
LiteDeviceType
::
LITE_CAMBRICON
)
{
m_load_config
.
comp_node_mapper
=
[
this
](
mgb
::
CompNode
::
Locator
&
loc
)
{
if
(
loc
.
type
==
mgb
::
CompNode
::
DeviceType
::
CAMBRICON
)
{
loc
.
device
=
m_compnode_locator
.
device
;
loc
.
stream
=
m_compnode_locator
.
stream
;
}
else
if
(
loc
.
type
==
mgb
::
CompNode
::
DeviceType
::
MULTITHREAD
)
{
loc
.
stream
=
m_nr_threads
;
}
};
}
else
{
m_load_config
.
comp_node_mapper
=
[
this
](
mgb
::
CompNode
::
Locator
&
loc
)
{
loc
=
m_compnode_locator
;
...
...
src/cambricon/impl/magicmind_runtime_opr.cpp
浏览文件 @
2b8e7940
...
...
@@ -14,6 +14,7 @@
#include "megbrain/comp_node_env.h"
#if MGB_CAMBRICON
#if CNRT_MAJOR_VERSION >= 5
using
namespace
mgb
;
using
namespace
opr
;
...
...
@@ -168,7 +169,7 @@ MagicMindRuntimeOpr::MagicMindRuntimeOpr(
m_allocator
{
std
::
move
(
allocator
)},
m_engine
{
nullptr
},
m_context
{
nullptr
},
m_model
{
std
::
move
(
model
)},
m_model
{
std
::
move
(
model
)},
m_current_ptr
{
nullptr
}
{
mgb_assert
(
inputs
[
0
]
->
comp_node
().
device_type
()
==
CompNode
::
DeviceType
::
CAMBRICON
,
...
...
@@ -387,6 +388,7 @@ SymbolVarArray MagicMindRuntimeOpr::make(
return
make
(
std
::
move
(
model
),
std
::
move
(
cambricon_allocator
),
src
,
config
);
}
#endif // CNRT_MAJOR_VERSION
#endif // MGB_CAMBRICON
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
src/cambricon/impl/magicmind_runtime_opr.sereg.h
浏览文件 @
2b8e7940
...
...
@@ -12,6 +12,8 @@
#include "megbrain/cambricon/magicmind_runtime_opr.h"
#include "megbrain/serialization/sereg.h"
#if CNRT_MAJOR_VERSION >= 5
namespace
mgb
{
namespace
serialization
{
...
...
@@ -62,4 +64,6 @@ MGB_REG_OPR_SHALLOW_COPY(MagicMindRuntimeOpr, opr_shallow_copy_magicmind_runtime
}
// namespace opr
}
// namespace mgb
#endif
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
src/cambricon/include/megbrain/cambricon/magicmind_runtime_opr.h
浏览文件 @
2b8e7940
...
...
@@ -15,6 +15,7 @@
#include "megbrain/serialization/file.h"
#if MGB_CAMBRICON
#if CNRT_MAJOR_VERSION >= 5
#include <sstream>
#include "interface_runtime.h"
...
...
@@ -99,6 +100,7 @@ private:
}
// namespace opr
}
// namespace mgb
#endif // CNRT_MAJOR_VERSION
#endif // MGB_CAMBRICON
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
src/cambricon/test/magicmind_runtime_opr.cpp
浏览文件 @
2b8e7940
...
...
@@ -17,6 +17,7 @@
#include "megbrain/test/helper.h"
#if MGB_CAMBRICON
#if CNRT_MAJOR_VERSION >= 5
#include "megbrain/cambricon/magicmind_runtime_opr.h"
...
...
@@ -827,6 +828,7 @@ TEST(TestMagicMindRuntimeOpr, CrossCNCopy) {
MGB_ASSERT_TENSOR_NEAR
(
o2
,
o2_mm
,
1e-4
);
}
#endif
#endif
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
src/core/impl/comp_node/cpu/comp_node.cpp
浏览文件 @
2b8e7940
...
...
@@ -1097,7 +1097,8 @@ void CpuCompNode::CpuDispatchableBase::EventImpl::do_device_wait_by(Impl* cn_imp
mgb_throw_if
(
type
!=
CompNode
::
DeviceType
::
CPU
&&
type
!=
CompNode
::
DeviceType
::
CUDA
&&
type
!=
CompNode
::
DeviceType
::
ATLAS
&&
type
!=
CompNode
::
DeviceType
::
ATLAS
&&
type
!=
CompNode
::
DeviceType
::
CAMBRICON
,
MegBrainError
,
"currently CPU can only wait for CPU, CUDA, ATLAS"
...
...
@@ -1116,7 +1117,7 @@ void CpuCompNode::CpuDispatchableBase::EventImpl::do_device_wait_by(Impl* cn_imp
#else
mgb_throw
(
MegBrainError
,
"Cambricon comp_node used but
MGB_CAMBRICON
not enabled"
);
"Cambricon comp_node used but
CAMBRICON BUILD
not enabled"
);
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录