Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
8c75039c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
8c75039c
编写于
9月 07, 2023
作者:
W
wanghuancoder
提交者:
GitHub
9月 07, 2023
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine stride flag (#57005)
* refine stride flag
上级
30c9dad1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
8 deletion
+28
-8
paddle/phi/core/kernel_factory.cc
paddle/phi/core/kernel_factory.cc
+28
-8
未找到文件。
paddle/phi/core/kernel_factory.cc
浏览文件 @
8c75039c
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
#include "paddle/phi/core/kernel_factory.h"
#include "paddle/phi/core/kernel_factory.h"
#include <regex>
#include <string>
#include <unordered_set>
#include "glog/logging.h"
#include "glog/logging.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/utils/flags.h"
#include "paddle/utils/flags.h"
...
@@ -33,6 +37,10 @@ PHI_DEFINE_EXPORTED_bool(use_stride_kernel,
...
@@ -33,6 +37,10 @@ PHI_DEFINE_EXPORTED_bool(use_stride_kernel,
true
,
true
,
"Whether to use strdie kernel if op support stride."
);
"Whether to use strdie kernel if op support stride."
);
PHI_DEFINE_EXPORTED_string
(
stride_kernel_blacklist
,
""
,
"It controls the strided kernel subset do not use."
);
PD_DECLARE_int32
(
low_precision_op_list
);
PD_DECLARE_int32
(
low_precision_op_list
);
PD_DECLARE_bool
(
enable_api_kernel_fallback
);
PD_DECLARE_bool
(
enable_api_kernel_fallback
);
PD_DECLARE_bool
(
run_kp_kernel
);
PD_DECLARE_bool
(
run_kp_kernel
);
...
@@ -226,6 +234,16 @@ KernelResult KernelFactory::SelectKernelOrThrowError(
...
@@ -226,6 +234,16 @@ KernelResult KernelFactory::SelectKernelOrThrowError(
phi
::
errors
::
NotFound
(
"The kernel `%s` is not registered."
,
kernel_name
));
phi
::
errors
::
NotFound
(
"The kernel `%s` is not registered."
,
kernel_name
));
if
(
FLAGS_use_stride_kernel
&&
use_strided_kernel
)
{
if
(
FLAGS_use_stride_kernel
&&
use_strided_kernel
)
{
std
::
regex
reg
(
","
);
std
::
unordered_set
<
std
::
string
>
elems
{
std
::
sregex_token_iterator
(
FLAGS_stride_kernel_blacklist
.
begin
(),
FLAGS_stride_kernel_blacklist
.
end
(),
reg
,
-
1
),
std
::
sregex_token_iterator
()};
elems
.
erase
(
""
);
if
(
!
elems
.
count
(
kernel_name
))
{
auto
stride_kernel_iter
=
iter
->
second
.
find
(
auto
stride_kernel_iter
=
iter
->
second
.
find
(
{
const_kernel_key
.
backend
()
==
paddle
::
experimental
::
Backend
::
GPUDNN
{
const_kernel_key
.
backend
()
==
paddle
::
experimental
::
Backend
::
GPUDNN
?
paddle
::
experimental
::
Backend
::
GPU
?
paddle
::
experimental
::
Backend
::
GPU
...
@@ -233,9 +251,11 @@ KernelResult KernelFactory::SelectKernelOrThrowError(
...
@@ -233,9 +251,11 @@ KernelResult KernelFactory::SelectKernelOrThrowError(
phi
::
DataLayout
::
STRIDED
,
phi
::
DataLayout
::
STRIDED
,
const_kernel_key
.
dtype
()});
const_kernel_key
.
dtype
()});
if
(
stride_kernel_iter
!=
iter
->
second
.
end
())
{
if
(
stride_kernel_iter
!=
iter
->
second
.
end
())
{
VLOG
(
1
)
<<
"use strided kernel, kernel_name = "
<<
kernel_name
;
return
{
stride_kernel_iter
->
second
,
false
,
true
};
return
{
stride_kernel_iter
->
second
,
false
,
true
};
}
}
}
}
}
KernelKey
kernel_key
=
KernelKey
(
const_kernel_key
.
backend
(),
KernelKey
kernel_key
=
KernelKey
(
const_kernel_key
.
backend
(),
phi
::
DataLayout
::
ALL_LAYOUT
,
phi
::
DataLayout
::
ALL_LAYOUT
,
...
...
saxon_zh
@saxon_zh
mentioned in commit
429b2b0d
·
9月 09, 2023
mentioned in commit
429b2b0d
mentioned in commit 429b2b0d33ee38097ea104403406e4dddcd898f8
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录