Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
f36e99d3
MegEngine
项目概览
MegEngine 天元
/
MegEngine
接近 2 年 前同步成功
通知
414
Star
4708
Fork
583
代码
文件
提交
分支
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看板
提交
f36e99d3
编写于
4月 29, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(build): fix naive build
GitOrigin-RevId: 0050ff5d9c760564c179219cf7164fdc2c49c1f3
上级
51676939
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
90 addition
and
89 deletion
+90
-89
dnn/src/common/handle.cpp
dnn/src/common/handle.cpp
+89
-88
dnn/src/common/relayout_helper.h
dnn/src/common/relayout_helper.h
+1
-1
未找到文件。
dnn/src/common/handle.cpp
浏览文件 @
f36e99d3
...
...
@@ -6,7 +6,8 @@
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*/
#include "megdnn/basic_types.h"
...
...
@@ -90,9 +91,10 @@ std::unique_ptr<Handle> Handle::make(megcoreComputingHandle_t computing_handle,
}
else
{
megdnn_throw
(
"Debug level must be 0/1/2."
);
}
#endif
}
MIDOUT_END
();
#endif
}
else
if
(
platform
==
megcorePlatformROCM
)
{
#if MEGDNN_WITH_ROCM
...
...
@@ -100,15 +102,13 @@ std::unique_ptr<Handle> Handle::make(megcoreComputingHandle_t computing_handle,
#else
return
nullptr
;
#endif
}
else
if
(
platform
==
megcorePlatformCambricon
)
{
}
else
if
(
platform
==
megcorePlatformCambricon
)
{
#if MEGDNN_WITH_CAMBRICON
return
make_unique
<
cambricon
::
HandleImpl
>
(
computing_handle
);
#else
return
nullptr
;
#endif
}
else
if
(
platform
==
megcorePlatformAtlas
)
{
}
else
if
(
platform
==
megcorePlatformAtlas
)
{
#if MEGDNN_WITH_ATLAS
return
make_unique
<
atlas
::
HandleImpl
>
(
computing_handle
);
#else
...
...
@@ -126,38 +126,38 @@ std::unique_ptr<Handle> Handle::make(megcoreComputingHandle_t computing_handle,
#endif
}
return
nullptr
;
}
}
void
Handle
::
set_destructor
(
const
thin_function
<
void
()
>&
d
)
{
void
Handle
::
set_destructor
(
const
thin_function
<
void
()
>&
d
)
{
megdnn_assert
(
!
m_destructor
,
"destructor can be set only once"
);
m_destructor
=
d
;
}
}
Handle
::~
Handle
()
{
Handle
::~
Handle
()
{
if
(
m_destructor
)
m_destructor
();
m_alive_magic
=
0
;
}
}
size_t
Handle
::
alignment_requirement
()
const
{
size_t
Handle
::
alignment_requirement
()
const
{
// default to 32
return
32
;
}
}
size_t
Handle
::
image2d_pitch_alignment
()
const
{
size_t
Handle
::
image2d_pitch_alignment
()
const
{
megdnn_throw
(
"image2d tensor format not supported on this handle"
);
}
}
megdnn
::
HandleImplHelper
::
HandleVendorType
Handle
::
vendor_type
()
const
{
megdnn
::
HandleImplHelper
::
HandleVendorType
Handle
::
vendor_type
()
const
{
return
HandleVendorType
::
NOT_SPEC
;
}
}
bool
Handle
::
check_cross_dev_copy_constraint
(
const
TensorLayout
&
src
)
{
bool
Handle
::
check_cross_dev_copy_constraint
(
const
TensorLayout
&
src
)
{
return
src
.
is_contiguous
();
}
}
void
Handle
::
on_opr_destructed
(
OperatorBase
*
opr
)
{
void
Handle
::
on_opr_destructed
(
OperatorBase
*
opr
)
{
if
(
m_alive_magic
!=
ALIVE_MAGIC
)
{
megdnn_log_error
(
"Handle is destructed before opr gets destructed. "
...
...
@@ -169,12 +169,14 @@ std::unique_ptr<Handle> Handle::make(megcoreComputingHandle_t computing_handle,
if
(
m_on_opr_destructed
)
{
m_on_opr_destructed
(
opr
);
}
}
}
OperatorBase
::~
OperatorBase
()
{
m_handle
->
on_opr_destructed
(
this
);
}
OperatorBase
::~
OperatorBase
()
{
m_handle
->
on_opr_destructed
(
this
);
}
template
<
typename
Opr
>
std
::
unique_ptr
<
Opr
>
Handle
::
create_operator
()
{
template
<
typename
Opr
>
std
::
unique_ptr
<
Opr
>
Handle
::
create_operator
()
{
#define CASE(etype, nm) \
case HandleType::etype: { \
MIDOUT_BEGIN(HandleOpr, Opr, midout_iv(HandleType::etype)) { \
...
...
@@ -201,7 +203,7 @@ std::unique_ptr<Handle> Handle::make(megcoreComputingHandle_t computing_handle,
#endif
#endif // !MEGDNN_NAIVE
#if MEGDNN_WITH_CUDA
CASE
(
CUDA
,
cuda
);
CASE
(
CUDA
,
cuda
);
#endif
#if MEGDNN_WITH_ATLAS
CASE
(
ATLAS
,
atlas
);
...
...
@@ -221,10 +223,9 @@ std::unique_ptr<Handle> Handle::make(megcoreComputingHandle_t computing_handle,
megdnn_throw
(
"bad handle type"
);
}
#undef CASE
}
}
#define INST(opr) template std::unique_ptr<opr> Handle::create_operator();
MEGDNN_FOREACH_OPR_CLASS
(
INST
)
MEGDNN_FOREACH_OPR_CLASS
(
INST
)
#undef INST
// vim: syntax=cpp.doxygen
dnn/src/common/relayout_helper.h
浏览文件 @
f36e99d3
...
...
@@ -41,7 +41,7 @@ bool is_transpose(const TensorLayout& src, const TensorLayout& dst,
namespace
transpose_fallback
{
#if MEGDNN_X86
#if MEGDNN_X86
|| MEGDNN_NAIVE
constexpr
size_t
BLOCK_LINE_SIZE_BYTES
=
64
;
#elif MEGDNN_AARCH64 || MEGDNN_ARMV7
/*BEGIN-INLINE-INTERNAL*/
|| \
MEGDNN_MIPS
/*END-INLINE-INTERNAL*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录