Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
9006d76b
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看板
提交
9006d76b
编写于
7月 10, 2020
作者:
M
Megvii Engine Team
提交者:
Xu Xinran
7月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(serialization): do not gate enum entries by macro
GitOrigin-RevId: aa27ecbf21e3ba74ef64a9cd0d0c34f80a64918c
上级
ad4928c9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
7 deletion
+16
-7
src/core/include/megbrain/common.h
src/core/include/megbrain/common.h
+7
-0
src/serialization/impl/serializer.cpp
src/serialization/impl/serializer.cpp
+4
-2
src/serialization/include/megbrain/serialization/opr_load_dump.h
...ialization/include/megbrain/serialization/opr_load_dump.h
+5
-5
未找到文件。
src/core/include/megbrain/common.h
浏览文件 @
9006d76b
...
...
@@ -48,6 +48,13 @@ namespace mgb {
//! warn if result of a function is not used
#define MGB_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#if __cplusplus >= 201703L || __clang_major__ >= 4
#define MGB_FALLTHRU [[fallthrough]];
#elif __GNUC__ >= 7
#define MGB_FALLTHRU __attribute__((fallthrough));
#else
#define MGB_FALLTHRU
#endif
/* ================ exception and assertion ================ */
...
...
src/serialization/impl/serializer.cpp
浏览文件 @
9006d76b
...
...
@@ -53,10 +53,11 @@ bool GraphDumper::should_remove_in_dump(cg::OperatorNodeBase *opr) {
std
::
unique_ptr
<
GraphDumper
>
GraphDumper
::
make
(
std
::
unique_ptr
<
OutputFile
>
file
,
GraphDumpFormat
format
)
{
switch
(
format
)
{
#if MGB_ENABLE_FBS_SERIALIZATION
case
GraphDumpFormat
::
FLATBUFFERS
:
#if MGB_ENABLE_FBS_SERIALIZATION
return
make_fbs_dumper
(
std
::
move
(
file
));
#endif
MGB_FALLTHRU
default:
mgb_throw
(
SerializationError
,
"unsupported serialization format requested"
);
...
...
@@ -66,10 +67,11 @@ std::unique_ptr<GraphDumper> GraphDumper::make(std::unique_ptr<OutputFile> file,
std
::
unique_ptr
<
GraphLoader
>
GraphLoader
::
make
(
std
::
unique_ptr
<
InputFile
>
file
,
GraphDumpFormat
format
)
{
switch
(
format
)
{
#if MGB_ENABLE_FBS_SERIALIZATION
case
GraphDumpFormat
::
FLATBUFFERS
:
#if MGB_ENABLE_FBS_SERIALIZATION
return
make_fbs_loader
(
std
::
move
(
file
));
#endif
MGB_FALLTHRU
default:
mgb_throw
(
SerializationError
,
"unsupported serialization format requested"
);
...
...
src/serialization/include/megbrain/serialization/opr_load_dump.h
浏览文件 @
9006d76b
...
...
@@ -29,9 +29,7 @@ struct OperatorParamTraits;
enum
class
SerializationFormat
{
RAW_POD
,
#if MGB_ENABLE_FBS_SERIALIZATION
FLATBUFFERS
,
#endif
};
//! context for serializing a single operator
...
...
@@ -162,12 +160,12 @@ void OprDumpContext::write_param(const Param& p) {
case
SerializationFormat
::
RAW_POD
:
static_cast
<
OprDumpContextRawPOD
*>
(
this
)
->
write_param
(
p
);
break
;
#if MGB_ENABLE_FBS_SERIALIZATION
case
SerializationFormat
::
FLATBUFFERS
:
#if MGB_ENABLE_FBS_SERIALIZATION
static_cast
<
OprDumpContextFlatBuffers
*>
(
this
)
->
write_param
(
p
,
fbs
::
SupportFlatBuffersSerialization
<
Param
>
{});
break
;
#endif
break
;
}
}
...
...
@@ -322,11 +320,13 @@ Param OprLoadContext::read_param() {
case
SerializationFormat
::
RAW_POD
:
return
static_cast
<
OprLoadContextRawPOD
*>
(
this
)
->
read_param
<
Param
>
();
#if MGB_ENABLE_FBS_SERIALIZATION
case
SerializationFormat
::
FLATBUFFERS
:
#if MGB_ENABLE_FBS_SERIALIZATION
return
static_cast
<
OprLoadContextFlatBuffers
*>
(
this
)
->
read_param
<
Param
>
(
fbs
::
SupportFlatBuffersSerialization
<
Param
>
{});
#else
mgb_trap
();
#endif
}
mgb_assert
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录