Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
e1c83d8d
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
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看板
提交
e1c83d8d
编写于
3月 05, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mgb/core): add warning information about const_var_shape when record mode
GitOrigin-RevId: a99f9c4e5ddf92c62aaa17fb7b1baf10b68a5411
上级
fc8b501b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
14 deletion
+31
-14
src/core/impl/comp_node/cpu/comp_node.cpp
src/core/impl/comp_node/cpu/comp_node.cpp
+13
-13
src/core/impl/comp_node/cpu/comp_node.h
src/core/impl/comp_node/cpu/comp_node.h
+1
-1
src/core/impl/graph/cg_impl_seq.cpp
src/core/impl/graph/cg_impl_seq.cpp
+17
-0
未找到文件。
src/core/impl/comp_node/cpu/comp_node.cpp
浏览文件 @
e1c83d8d
...
...
@@ -243,7 +243,7 @@ public:
};
using
CompNodeBaseImpl
=
CpuCompNode
::
CompNodeBaseImpl
;
using
CompNode
NoRecorderImpl
=
CpuCompNode
::
CompNodeNoRecorder
Impl
;
using
CompNode
DefaultImpl
=
CpuCompNode
::
CompNodeDefault
Impl
;
using
CompNodeRecorderImpl
=
CpuCompNode
::
CompNodeRecorderImpl
;
//! ==================== CompNodeBaseImpl ======================
...
...
@@ -466,29 +466,29 @@ public:
}
};
//! ==================== CompNode
NoRecorder
Impl ======================
//! ==================== CompNode
Default
Impl ======================
/**
* \note: CompNode
NoRecorder
Impl will use most implements in base including:
* \note: CompNode
Default
Impl will use most implements in base including:
* alloc_device, alloc_host, copy_to_host, copy_to_device, peer_copy_to,
* add_callback ...
*/
class
CpuCompNode
::
CompNode
NoRecorder
Impl
final
:
public
CompNodeBaseImpl
{
class
CpuCompNode
::
CompNode
Default
Impl
final
:
public
CompNodeBaseImpl
{
MGB_DYN_TYPE_OBJ_FINAL_DECL
;
public:
//! ptr to default cpu, only used by check_global_finalized
static
CompNode
NoRecorder
Impl
*
sm_default_cpu_comp_node_ptr
;
static
CompNode
Default
Impl
*
sm_default_cpu_comp_node_ptr
;
static
void
static_free_device
(
ImplBase
*
self
,
void
*
ptr
)
{
static_cast
<
CompNode
NoRecorder
Impl
*>
(
self
)
->
free_device
(
ptr
);
static_cast
<
CompNode
Default
Impl
*>
(
self
)
->
free_device
(
ptr
);
}
static
void
static_free_host
(
ImplBase
*
self
,
void
*
ptr
)
{
static_cast
<
CompNode
NoRecorder
Impl
*>
(
self
)
->
free_host
(
ptr
);
static_cast
<
CompNode
Default
Impl
*>
(
self
)
->
free_host
(
ptr
);
}
using
CpuEventImpl
=
CpuDispatchableBase
::
EventImpl
;
CompNode
NoRecorder
Impl
(
const
Locator
&
locator
,
CompNode
Default
Impl
(
const
Locator
&
locator
,
const
Locator
&
locator_logical
)
:
CompNodeBaseImpl
(
locator
,
locator_logical
,
static_free_device
,
static_free_host
)
{
...
...
@@ -501,7 +501,7 @@ public:
sm_default_cpu_comp_node_ptr
=
this
;
}
~
CompNode
NoRecorder
Impl
()
{
~
CompNode
Default
Impl
()
{
m_env
.
fini
();
sm_default_cpu_comp_node_ptr
=
nullptr
;
}
...
...
@@ -551,8 +551,8 @@ public:
SeqRecorderImpl
*
cur_recorder
()
const
override
{
return
nullptr
;
}
};
MGB_DYN_TYPE_OBJ_FINAL_IMPL
(
CompNode
NoRecorder
Impl
);
CompNode
NoRecorderImpl
*
CompNodeNoRecorder
Impl
::
sm_default_cpu_comp_node_ptr
=
MGB_DYN_TYPE_OBJ_FINAL_IMPL
(
CompNode
Default
Impl
);
CompNode
DefaultImpl
*
CompNodeDefault
Impl
::
sm_default_cpu_comp_node_ptr
=
nullptr
;
//! ==================== CompNodeRecorderImpl ======================
...
...
@@ -746,7 +746,7 @@ public:
void
peer_copy_to
(
Impl
*
dest_impl
,
void
*
dest
,
const
void
*
src
,
size_t
size
)
override
{
//! copy to default_cpu
if
(
dest_impl
->
same_type
<
CpuCompNode
::
CompNode
NoRecorder
Impl
>
())
{
if
(
dest_impl
->
same_type
<
CpuCompNode
::
CompNode
Default
Impl
>
())
{
CompNodeBaseImpl
::
peer_copy_to
(
dest_impl
,
dest
,
src
,
size
);
return
;
}
...
...
@@ -986,7 +986,7 @@ void CpuCompNode::sync_all() {
// CpuCompNode::Pool
CompNode
CompNode
::
default_cpu
()
{
static
Locator
locator
{
DeviceType
::
CPU
,
Locator
::
DEVICE_CPU_DEFAULT
,
{
-
1
}};
static
CompNode
NoRecorder
Impl
impl
{
locator
,
locator
};
static
CompNode
Default
Impl
impl
{
locator
,
locator
};
return
&
impl
;
}
...
...
src/core/impl/comp_node/cpu/comp_node.h
浏览文件 @
e1c83d8d
...
...
@@ -55,7 +55,7 @@ namespace mgb {
};
class
CompNodeBaseImpl
;
class
CompNode
NoRecorder
Impl
;
class
CompNode
Default
Impl
;
class
CompNodeRecorderImpl
;
static
void
foreach
(
thin_function
<
void
(
CompNode
)
>
callback
);
...
...
src/core/impl/graph/cg_impl_seq.cpp
浏览文件 @
e1c83d8d
...
...
@@ -11,6 +11,7 @@
#include "./cg_impl_seq.h"
#include "megbrain/graph/exc_extra_info.h"
#include "megbrain/opr/tensor_manip.h"
using
namespace
mgb
;
using
namespace
cg
;
...
...
@@ -255,6 +256,22 @@ ComputingGraphImpl::ComputingSequence::check_enable_comp_node_seq_recorder() {
}
}
}
auto
check_const_shape
=
[
&
]()
{
for
(
auto
i
:
*
m_opr_seq
)
{
for
(
auto
j
:
i
->
output
())
{
if
(
j
->
shape
().
ndim
&&
!
is_const_var_shape
(
j
))
{
mgb_log_warn
(
"Non-const var shape detected. Make sure all "
"shapes are constant. Check whether "
"'const_var_shape' is set "
"in GraphLoadConfig under record mode"
);
return
;
}
}
}
};
check_const_shape
();
auto
cn
=
*
m_used_comp_node
.
begin
();
auto
rec
=
cn
.
create_seq_recorder
(
m_owner_graph
);
if
(
!
rec
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录