Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
d651a911
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d651a911
编写于
12月 19, 2018
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix build on win, fix use condition of crf decoding and layer norm and
enhance test precision test=develop
上级
141ebcd4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
6 deletion
+18
-6
paddle/fluid/operators/jit/CMakeLists.txt
paddle/fluid/operators/jit/CMakeLists.txt
+3
-1
paddle/fluid/operators/jit/more/intrinsic/crf_decoding.cc
paddle/fluid/operators/jit/more/intrinsic/crf_decoding.cc
+13
-3
paddle/fluid/operators/jit/more/intrinsic/layer_norm.cc
paddle/fluid/operators/jit/more/intrinsic/layer_norm.cc
+1
-1
paddle/fluid/operators/jit/test.cc
paddle/fluid/operators/jit/test.cc
+1
-1
未找到文件。
paddle/fluid/operators/jit/CMakeLists.txt
浏览文件 @
d651a911
...
...
@@ -20,4 +20,6 @@ endif()
cc_library
(
jit_kernel_helper SRCS
${
jit_kernel_cc_srcs
}
DEPS
${
JIT_KERNEL_DEPS
}
)
cc_test
(
jit_kernel_test SRCS test.cc DEPS jit_kernel_helper
)
cc_binary
(
jit_kernel_benchmark SRCS benchmark.cc DEPS jit_kernel_helper
)
if
(
NOT WIN32
)
cc_binary
(
jit_kernel_benchmark SRCS benchmark.cc DEPS jit_kernel_helper
)
endif
()
paddle/fluid/operators/jit/more/intrinsic/crf_decoding.cc
浏览文件 @
d651a911
...
...
@@ -22,11 +22,16 @@ namespace operators {
namespace
jit
{
namespace
more
{
namespace
intrinsic
{
// Note: intrinsic code is not runtime build.
// For example, if you build code on AVX, and run on AVX512 it can only use AVX
void
CRFDecoding
(
const
int
seq_len
,
const
float
*
x
,
const
float
*
w
,
float
*
alpha
,
int
*
track
,
int
tag_num
)
{
const
int
step_size
=
platform
::
MayIUse
(
platform
::
avx512f
)
?
ZMM_FLOAT_BLOCK
:
YMM_FLOAT_BLOCK
;
#ifdef __AVX512F__
const
int
step_size
=
ZMM_FLOAT_BLOCK
;
#else
const
int
step_size
=
YMM_FLOAT_BLOCK
;
#endif
const
int
end
=
tag_num
/
step_size
;
const
int
rest
=
tag_num
%
step_size
;
/* Setup the alpha initial value.*/
...
...
@@ -157,7 +162,12 @@ void CRFDecoding(const int seq_len, const float* x, const float* w,
}
bool
CRFDecodingKernel
::
UseMe
(
const
int
&
d
)
const
{
return
platform
::
MayIUse
(
platform
::
avx
);
#ifdef __AVX512F__
constexpr
int
block
=
ZMM_FLOAT_BLOCK
;
#else
constexpr
int
block
=
YMM_FLOAT_BLOCK
;
#endif
return
platform
::
MayIUse
(
platform
::
avx
)
&&
d
>=
block
;
}
}
// namespace intrinsic
...
...
paddle/fluid/operators/jit/more/intrinsic/layer_norm.cc
浏览文件 @
d651a911
...
...
@@ -154,7 +154,7 @@ void LayerNorm(float* x, float* out, float* mean, float* var,
}
bool
LayerNormKernel
::
UseMe
(
const
int
&
d
)
const
{
return
platform
::
MayIUse
(
platform
::
avx
);
return
platform
::
MayIUse
(
platform
::
avx
)
&&
d
>=
YMM_FLOAT_BLOCK
;
}
}
// namespace intrinsic
...
...
paddle/fluid/operators/jit/test.cc
浏览文件 @
d651a911
...
...
@@ -37,7 +37,7 @@ template <typename T>
void
ExpectEQ
(
const
T
*
target
,
const
T
*
refer
,
int
n
)
{
if
(
std
::
is_floating_point
<
T
>::
value
)
{
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
EXPECT_NEAR
(
target
[
i
],
refer
[
i
],
1e-
3
);
EXPECT_NEAR
(
target
[
i
],
refer
[
i
],
1e-
5
);
}
}
else
{
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录