Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一WILLPOWER一
Paddle
提交
bb6356e8
P
Paddle
项目概览
一WILLPOWER一
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
bb6356e8
编写于
10月 31, 2022
作者:
C
Chenxiao Niu
提交者:
GitHub
10月 31, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MLU] fix compile error & add mlu blacklist function. (#47439)
上级
f5912d0c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
1 deletion
+49
-1
paddle/fluid/imperative/prepared_operator.cc
paddle/fluid/imperative/prepared_operator.cc
+48
-0
paddle/fluid/operators/strided_slice_op_mlu.cc
paddle/fluid/operators/strided_slice_op_mlu.cc
+1
-1
未找到文件。
paddle/fluid/imperative/prepared_operator.cc
浏览文件 @
bb6356e8
...
...
@@ -149,6 +149,48 @@ PreparedOp::PreparedOp(const framework::OperatorBase& op,
kernel_signature_
(
std
::
move
(
kernel_signature
)),
phi_kernel_
(
phi_kernel
)
{}
#ifdef PADDLE_WITH_MLU
static
void
tokenize
(
const
std
::
string
&
ops
,
char
delim
,
std
::
unordered_set
<
std
::
string
>*
op_set
)
{
std
::
string
::
size_type
beg
=
0
;
for
(
uint64_t
end
=
0
;
(
end
=
ops
.
find
(
delim
,
end
))
!=
std
::
string
::
npos
;
++
end
)
{
op_set
->
insert
(
ops
.
substr
(
beg
,
end
-
beg
));
beg
=
end
+
1
;
}
op_set
->
insert
(
ops
.
substr
(
beg
));
}
static
bool
is_in_mlu_black_list
(
const
std
::
string
&
op_name
)
{
static
bool
inited
=
false
;
static
std
::
unordered_set
<
std
::
string
>
mlu_black_list
;
static
std
::
mutex
s_mtx
;
if
(
!
inited
)
{
std
::
lock_guard
<
std
::
mutex
>
guard
(
s_mtx
);
if
(
!
inited
)
{
if
(
std
::
getenv
(
"MLU_BLACK_LIST"
)
!=
nullptr
)
{
std
::
string
ops
(
std
::
getenv
(
"MLU_BLACK_LIST"
));
tokenize
(
ops
,
','
,
&
mlu_black_list
);
}
inited
=
true
;
VLOG
(
3
)
<<
"MLU Black List: "
;
for
(
auto
iter
=
mlu_black_list
.
begin
();
iter
!=
mlu_black_list
.
end
();
++
iter
)
{
VLOG
(
3
)
<<
*
iter
<<
" "
;
}
}
}
if
(
mlu_black_list
.
find
(
op_name
)
!=
mlu_black_list
.
end
())
{
return
true
;
}
return
false
;
}
#endif
template
<
typename
VarType
>
PreparedOp
PrepareImpl
(
const
NameVarMap
<
VarType
>&
ins
,
...
...
@@ -212,6 +254,12 @@ PreparedOp PrepareImpl(
paddle
::
platform
::
is_in_xpu_black_list
(
op
.
Type
());
#endif
#ifdef PADDLE_WITH_MLU
if
(
is_in_mlu_black_list
(
op
.
Type
()))
{
expected_kernel_key
.
place_
=
platform
::
CPUPlace
();
}
#endif
bool
has_phi_kernel
=
false
;
const
auto
*
arg_map_fn
=
phi_op_utils_map
.
GetArgumentMappingFn
(
op
.
Type
());
...
...
paddle/fluid/operators/strided_slice_op_mlu.cc
浏览文件 @
bb6356e8
...
...
@@ -20,7 +20,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
using
Tensor
=
framework
::
Tensor
;
using
Tensor
=
phi
::
Dense
Tensor
;
using
Variable
=
framework
::
Variable
;
using
LoDTensorArray
=
framework
::
LoDTensorArray
;
using
DDim
=
framework
::
DDim
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录