Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
bde2efa3
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看板
提交
bde2efa3
编写于
4月 15, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(lite/load_and_run): support put and get model redis cache
GitOrigin-RevId: 55c82e28c197197dc1762ce5e5550f9d88087ae6
上级
48526abb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
38 addition
and
3 deletion
+38
-3
lite/load_and_run/CMakeLists.txt
lite/load_and_run/CMakeLists.txt
+21
-0
lite/load_and_run/src/options/model_options.cpp
lite/load_and_run/src/options/model_options.cpp
+4
-1
lite/load_and_run/src/options/model_options.h
lite/load_and_run/src/options/model_options.h
+1
-0
lite/src/mge/network_impl.h
lite/src/mge/network_impl.h
+4
-0
src/core/include/megbrain/utils/infile_persistent_cache.h
src/core/include/megbrain/utils/infile_persistent_cache.h
+7
-0
src/rdnn/impl/algo_chooser.cpp
src/rdnn/impl/algo_chooser.cpp
+0
-2
src/rdnn/include/megbrain/rdnn/algo_chooser.h
src/rdnn/include/megbrain/rdnn/algo_chooser.h
+1
-0
未找到文件。
lite/load_and_run/CMakeLists.txt
浏览文件 @
bde2efa3
...
@@ -30,11 +30,24 @@ if(UNIX)
...
@@ -30,11 +30,24 @@ if(UNIX)
endif
()
endif
()
endif
()
endif
()
if
(
LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32
)
# FXIME third_party cpp redis do not support build with clang-cl
target_include_directories
(
load_and_run PRIVATE
${
CPP_REDIS_INCLUDES
}
)
endif
()
install
(
install
(
TARGETS load_and_run
TARGETS load_and_run
EXPORT
${
LITE_EXPORT_TARGETS
}
EXPORT
${
LITE_EXPORT_TARGETS
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
if
(
BUILD_SHARED_LIBS
)
if
(
BUILD_SHARED_LIBS
)
if
(
LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32
)
# FXIME third_party cpp redis do not support build with clang-cl
list
(
APPEND SOURCES
${
CPP_REDIS_SRCS
}
)
endif
()
add_executable
(
load_and_run_depends_shared
${
SOURCES
}
)
add_executable
(
load_and_run_depends_shared
${
SOURCES
}
)
target_link_libraries
(
load_and_run_depends_shared lite_shared
)
target_link_libraries
(
load_and_run_depends_shared lite_shared
)
target_link_libraries
(
load_and_run_depends_shared gflags
)
target_link_libraries
(
load_and_run_depends_shared gflags
)
...
@@ -58,6 +71,14 @@ if(BUILD_SHARED_LIBS)
...
@@ -58,6 +71,14 @@ if(BUILD_SHARED_LIBS)
endif
()
endif
()
endif
()
endif
()
if
(
LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32
)
# FXIME third_party cpp redis do not support build with clang-cl
target_include_directories
(
load_and_run_depends_shared
PRIVATE
${
CPP_REDIS_INCLUDES
}
)
endif
()
install
(
install
(
TARGETS load_and_run_depends_shared
TARGETS load_and_run_depends_shared
EXPORT
${
MGE_EXPORT_TARGETS
}
EXPORT
${
MGE_EXPORT_TARGETS
}
...
...
lite/load_and_run/src/options/model_options.cpp
浏览文件 @
bde2efa3
...
@@ -10,9 +10,12 @@
...
@@ -10,9 +10,12 @@
#include "model_options.h"
#include "model_options.h"
#include "device_options.h"
#include "device_options.h"
#include "lite/pack_model.h"
#include "lite/pack_model.h"
#include "megbrain/opr/search_policy/algo_chooser.h"
#include "megbrain/utils/infile_persistent_cache.h"
#include "misc.h"
#include "misc.h"
#include "models/model_lite.h"
#include "models/model_lite.h"
#include "models/model_mdl.h"
#include "models/model_mdl.h"
#include "network_impl_base.h"
namespace
lar
{
namespace
lar
{
template
<
typename
ModelImpl
>
template
<
typename
ModelImpl
>
...
@@ -84,4 +87,4 @@ DEFINE_string(
...
@@ -84,4 +87,4 @@ DEFINE_string(
"https://megengine.megvii-inc.com/user-guide/deployment/lite/advance/"
"https://megengine.megvii-inc.com/user-guide/deployment/lite/advance/"
"pack-lite-model.html for more details."
);
"pack-lite-model.html for more details."
);
REGIST_OPTION_CREATOR
(
pack_model
,
lar
::
PackModelOption
::
create_option
);
REGIST_OPTION_CREATOR
(
pack_model
,
lar
::
PackModelOption
::
create_option
);
\ No newline at end of file
lite/load_and_run/src/options/model_options.h
浏览文件 @
bde2efa3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#pragma once
#pragma once
#include <gflags/gflags.h>
#include <gflags/gflags.h>
#include "megbrain/graph/operator_node.h"
#include "models/model.h"
#include "models/model.h"
#include "option_base.h"
#include "option_base.h"
...
...
lite/src/mge/network_impl.h
浏览文件 @
bde2efa3
...
@@ -176,6 +176,10 @@ public:
...
@@ -176,6 +176,10 @@ public:
//! dump network after global layout transform optimization
//! dump network after global layout transform optimization
void
dump_layout_transform_model
(
std
::
string
optimized_model_path
);
void
dump_layout_transform_model
(
std
::
string
optimized_model_path
);
mgb
::
serialization
::
GraphLoader
::
LoadResult
get_load_result
()
{
return
m_load_result
;
}
private:
private:
//! construct the outputspec according to the m_network_io, and set the
//! construct the outputspec according to the m_network_io, and set the
//! call_back to the outputspec
//! call_back to the outputspec
...
...
src/core/include/megbrain/utils/infile_persistent_cache.h
浏览文件 @
bde2efa3
...
@@ -78,6 +78,13 @@ public:
...
@@ -78,6 +78,13 @@ public:
MGE_WIN_DECLSPEC_FUC
void
put
(
MGE_WIN_DECLSPEC_FUC
void
put
(
const
std
::
string
&
category
,
const
Blob
&
key
,
const
Blob
&
value
)
override
;
const
std
::
string
&
category
,
const
Blob
&
key
,
const
Blob
&
value
)
override
;
bool
support_dump_cache
()
override
{
return
true
;
}
bool
support_dump_cache
()
override
{
return
true
;
}
std
::
unordered_map
<
std
::
string
,
std
::
unordered_map
<
BlobStorage
,
BlobStorage
,
BlobStorage
::
Hash
>>
get_cache
()
{
return
std
::
move
(
m_cache
);
}
};
};
}
// namespace mgb
}
// namespace mgb
...
...
src/rdnn/impl/algo_chooser.cpp
浏览文件 @
bde2efa3
...
@@ -28,8 +28,6 @@ using namespace mgb;
...
@@ -28,8 +28,6 @@ using namespace mgb;
// timeout delta to be added with fastest known algorithm for new algos
// timeout delta to be added with fastest known algorithm for new algos
constexpr
double
TIMEOUT_TOLERANCE
=
2
;
constexpr
double
TIMEOUT_TOLERANCE
=
2
;
#define CACHE_KEY_VERSION "v5"
namespace
{
namespace
{
template
<
class
MegDNNOpr
>
template
<
class
MegDNNOpr
>
...
...
src/rdnn/include/megbrain/rdnn/algo_chooser.h
浏览文件 @
bde2efa3
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "megbrain/utils/persistent_cache.h"
#include "megbrain/utils/persistent_cache.h"
#include "megdnn/oprs/base.h"
#include "megdnn/oprs/base.h"
#define CACHE_KEY_VERSION "v5"
namespace
mgb
{
namespace
mgb
{
namespace
rdnn
{
namespace
rdnn
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录