Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
95b2a36f
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看板
提交
95b2a36f
编写于
10月 09, 2022
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(core): add zero copy input output from out of megengine
GitOrigin-RevId: 388d9d9551916b24ab28c206ecc3906965154ac2
上级
563a0d01
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
15 deletion
+36
-15
src/core/impl/comp_node/comp_node.cpp
src/core/impl/comp_node/comp_node.cpp
+18
-0
src/core/include/megbrain/comp_node.h
src/core/include/megbrain/comp_node.h
+18
-15
未找到文件。
src/core/impl/comp_node/comp_node.cpp
浏览文件 @
95b2a36f
...
...
@@ -659,6 +659,14 @@ void* CompNode::get_logical_addr_by_host_ptr(void* ptr, size_t size) {
return
m_impl
->
get_logical_addr_by_host_ptr
(
ptr
,
size
);
}
void
*
CompNode
::
register_external_device_ptr
(
void
*
ptr
,
size_t
size
)
{
return
m_impl
->
register_external_device_ptr
(
ptr
,
size
);
}
void
*
CompNode
::
unregister_external_device_ptr
(
void
*
ptr
,
size_t
size
)
{
return
m_impl
->
unregister_external_device_ptr
(
ptr
,
size
);
}
void
CompNode
::
ImplBase
::
map_to_cpu
(
void
*
ptr
,
size_t
size
,
bool
blocking
)
{
MGB_MARK_USED_VAR
(
ptr
);
MGB_MARK_USED_VAR
(
size
);
...
...
@@ -679,4 +687,14 @@ void* CompNode::ImplBase::get_logical_addr_by_host_ptr(void* ptr, size_t size) {
return
nullptr
;
}
void
*
CompNode
::
ImplBase
::
register_external_device_ptr
(
void
*
ptr
,
size_t
size
)
{
MGB_MARK_USED_VAR
(
size
);
return
ptr
;
}
void
*
CompNode
::
ImplBase
::
unregister_external_device_ptr
(
void
*
ptr
,
size_t
size
)
{
MGB_MARK_USED_VAR
(
size
);
return
ptr
;
}
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
src/core/include/megbrain/comp_node.h
浏览文件 @
95b2a36f
...
...
@@ -324,23 +324,22 @@ public:
/*!
* \brief get logical address by host ptr
*/
//! api for register memory info, in order compat old user code, do not change the
//! api name, this api have different behavior for with different OpenCL memory
//! type.
//! Map/UnMap: use to get logical_addr of cl_mem alloc by MegEngine, which can
//! be reset to TensorND storage raw_ptr, NOTICE: Map/UnMap do not support cl_mem
//! not alloc from MegEngine.
//! SVM: in fact do nothing, just return ptr same with args.
//! ION: this case support two case:
//! ION case one: IonHostPtr info is alloc by MegEngine, this case, args ptr is
//! tensor raw_ptr, and args size is tensor size in bytes, api will return
//! IonHostPtr ptr, then user can use it out of EegEngine.
//! ION case two: use to register user IonHostPtr info, args ptr is IonHostPtr, size
//! is IonHostPtr->ion_hostptr size_in_bytes, MegEngine will register it into DNN,
//! then just return IonHostPtr->ion_hostptr, which can be reset to TensorND storage
//! raw_ptr.
MGE_WIN_DECLSPEC_FUC
void
*
get_logical_addr_by_host_ptr
(
void
*
ptr
,
size_t
size
);
/*!
* \brief register user external device ptr, which means not malloc by MegEngine
* case 1: cpu and cuda compnode will do nothing, just return args ptr
* case 2: OpenCL(ION) compnode will do real register, OpenCL(map/svm) compnode will
* trigger assert, caused by OpenCL only can use extern ION ptr, can not use map/svm
* with different OpenCL context.
*/
MGE_WIN_DECLSPEC_FUC
void
*
register_external_device_ptr
(
void
*
ptr
,
size_t
size
);
/*!
* \brief unregister user external device ptr, which means not malloc by MegEngine
*/
MGE_WIN_DECLSPEC_FUC
void
*
unregister_external_device_ptr
(
void
*
ptr
,
size_t
size
);
/* =================== synchronization ======================== */
class
Event
;
...
...
@@ -598,6 +597,10 @@ protected:
virtual
void
*
get_logical_addr_by_host_ptr
(
void
*
ptr
,
size_t
size
);
virtual
void
*
register_external_device_ptr
(
void
*
ptr
,
size_t
size
);
virtual
void
*
unregister_external_device_ptr
(
void
*
ptr
,
size_t
size
);
virtual
size_t
get_mem_addr_alignment
()
=
0
;
virtual
size_t
get_mem_padding
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录