Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
64401dfe
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看板
提交
64401dfe
编写于
4月 21, 2020
作者:
M
Megvii Engine Team
提交者:
Xinran Xu
5月 06, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(dnn/x86): fix gcc5 -O0 compiler error
GitOrigin-RevId: 237e2f27f21c2818f638da24b6efd0465f2dbb8e
上级
e3de2011
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
86 addition
and
78 deletion
+86
-78
dnn/src/x86/avx_helper.h
dnn/src/x86/avx_helper.h
+84
-0
dnn/src/x86/conv_bias/f32/strategy_2x3_8x8.cpp
dnn/src/x86/conv_bias/f32/strategy_2x3_8x8.cpp
+1
-1
dnn/src/x86/conv_bias/f32/strategy_6x3_8x8.cpp
dnn/src/x86/conv_bias/f32/strategy_6x3_8x8.cpp
+1
-1
dnn/src/x86/simd_helper.h
dnn/src/x86/simd_helper.h
+0
-76
未找到文件。
dnn/src/x86/avx_helper.h
浏览文件 @
64401dfe
...
...
@@ -17,6 +17,10 @@
#include <avx2intrin.h>
#include <fmaintrin.h>
#if !defined (__clang__)
#pragma GCC target ("avx")
#endif
namespace
megdnn
{
namespace
x86
{
...
...
@@ -27,6 +31,86 @@ static inline __m256 _mm256_loadu2_m128_emulate(
_mm_loadu_ps
(
hiaddr
),
1
);
}
template
<
typename
ctype
,
size_t
len
>
struct
Vector
;
template
<
>
struct
Vector
<
float
,
8
>
{
__m256
value
;
Vector
()
{}
Vector
(
const
float
v
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_set1_ps
(
v
);
}
Vector
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
lr
.
value
;
}
Vector
(
const
Vector
&&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
std
::
move
(
lr
.
value
);
}
Vector
(
const
__m256
&
v
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
v
;
}
static
Vector
load
(
const
float
*
addr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
v
;
v
.
value
=
_mm256_loadu_ps
(
addr
);
return
v
;
}
static
void
save
(
float
*
addr
,
const
Vector
&
v
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
_mm256_storeu_ps
(
addr
,
v
.
value
);
}
void
save
(
float
*
addr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
save
(
addr
,
*
this
);
}
Vector
operator
+
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_add_ps
(
value
,
lr
.
value
);
return
dst
;
}
Vector
&
operator
+=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_add_ps
(
value
,
lr
.
value
);
return
*
this
;
}
Vector
operator
-
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_sub_ps
(
value
,
lr
.
value
);
return
dst
;
}
Vector
&
operator
-=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_sub_ps
(
value
,
lr
.
value
);
return
*
this
;
}
Vector
operator
*
(
float
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_mul_ps
(
value
,
_mm256_set1_ps
(
lr
));
return
dst
;
}
Vector
operator
*
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_mul_ps
(
value
,
lr
.
value
);
return
dst
;
}
Vector
&
operator
*=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_mul_ps
(
value
,
lr
.
value
);
return
*
this
;
}
Vector
&
operator
=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
lr
.
value
;
return
*
this
;
}
Vector
&
operator
=
(
const
Vector
&&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
std
::
move
(
lr
.
value
);
return
*
this
;
}
Vector
operator
-
()
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
-
value
;
return
dst
;
}
};
#if !defined (__clang__)
#pragma GCC reset_options
#endif
}
// namespace x86
}
// namespace megdnn
...
...
dnn/src/x86/conv_bias/f32/strategy_2x3_8x8.cpp
浏览文件 @
64401dfe
...
...
@@ -15,7 +15,7 @@
#include "src/fallback/conv_bias/winograd/winograd.h"
#include "src/x86/conv_bias/f32/strategy.h"
#include "src/x86/elemwise_helper/op_unary.h"
#include "src/x86/
simd
_helper.h"
#include "src/x86/
avx
_helper.h"
#include <x86intrin.h>
#ifdef WIN32CMAKE
...
...
dnn/src/x86/conv_bias/f32/strategy_6x3_8x8.cpp
浏览文件 @
64401dfe
...
...
@@ -16,7 +16,7 @@
#include "src/fallback/conv_bias/winograd/winograd.h"
#include "src/x86/conv_bias/f32/strategy.h"
#include "src/x86/elemwise_helper/op_unary.h"
#include "src/x86/
simd
_helper.h"
#include "src/x86/
avx
_helper.h"
#include <x86intrin.h>
#ifdef WIN32CMAKE
...
...
dnn/src/x86/simd_helper.h
浏览文件 @
64401dfe
...
...
@@ -140,82 +140,6 @@ struct simd_traits<SIMDType::FMA>: simd_traits_avx_base {
}
};
template
<
typename
ctype
,
size_t
len
>
struct
Vector
;
template
<
>
struct
Vector
<
float
,
8
>
{
__m256
value
;
Vector
()
{}
Vector
(
const
float
v
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_set1_ps
(
v
);
}
Vector
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
lr
.
value
;
}
Vector
(
const
Vector
&&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
std
::
move
(
lr
.
value
);
}
Vector
(
const
__m256
&
v
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
v
;
}
static
Vector
load
(
const
float
*
addr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
v
;
v
.
value
=
_mm256_loadu_ps
(
addr
);
return
v
;
}
static
void
save
(
float
*
addr
,
const
Vector
&
v
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
_mm256_storeu_ps
(
addr
,
v
.
value
);
}
void
save
(
float
*
addr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
save
(
addr
,
*
this
);
}
Vector
operator
+
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_add_ps
(
value
,
lr
.
value
);
return
dst
;
}
Vector
&
operator
+=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_add_ps
(
value
,
lr
.
value
);
return
*
this
;
}
Vector
operator
-
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_sub_ps
(
value
,
lr
.
value
);
return
dst
;
}
Vector
&
operator
-=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_sub_ps
(
value
,
lr
.
value
);
return
*
this
;
}
Vector
operator
*
(
float
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_mul_ps
(
value
,
_mm256_set1_ps
(
lr
));
return
dst
;
}
Vector
operator
*
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
_mm256_mul_ps
(
value
,
lr
.
value
);
return
dst
;
}
Vector
&
operator
*=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
_mm256_mul_ps
(
value
,
lr
.
value
);
return
*
this
;
}
Vector
&
operator
=
(
const
Vector
&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
lr
.
value
;
return
*
this
;
}
Vector
&
operator
=
(
const
Vector
&&
lr
)
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
value
=
std
::
move
(
lr
.
value
);
return
*
this
;
}
Vector
operator
-
()
MEGDNN_ATTRIBUTE_TARGET
(
"avx"
)
{
Vector
dst
;
dst
.
value
=
-
value
;
return
dst
;
}
};
}
// namespace x86
}
// namespace megdnn
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录