Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
7ee727a8
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
7ee727a8
编写于
11月 05, 2021
作者:
C
CtfGo
提交者:
GitHub
11月 05, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cinn_launch_op: remove the check on extracting temporary variables (#36997)
cinn_launch_op: remove the check on extracting temporary variables
上级
09d407b0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
10 deletion
+8
-10
paddle/fluid/operators/cinn_launch_op.cc
paddle/fluid/operators/cinn_launch_op.cc
+1
-3
paddle/fluid/operators/cinn_launch_op.h
paddle/fluid/operators/cinn_launch_op.h
+7
-4
paddle/fluid/operators/cinn_launch_op_test.cc
paddle/fluid/operators/cinn_launch_op_test.cc
+0
-3
未找到文件。
paddle/fluid/operators/cinn_launch_op.cc
浏览文件 @
7ee727a8
...
@@ -137,9 +137,7 @@ std::vector<std::string> SeperateTempVar(
...
@@ -137,9 +137,7 @@ std::vector<std::string> SeperateTempVar(
[](
const
auto
&
name_view
)
{
return
std
::
string
(
name_view
.
data
());
});
[](
const
auto
&
name_view
)
{
return
std
::
string
(
name_view
.
data
());
});
auto
exclude_fn
=
[
&
all_cinn_names
](
const
auto
&
cinn_name
)
{
auto
exclude_fn
=
[
&
all_cinn_names
](
const
auto
&
cinn_name
)
{
PADDLE_ENFORCE_EQ
(
all_cinn_names
.
erase
(
cinn_name
),
1
,
all_cinn_names
.
erase
(
cinn_name
);
platform
::
errors
::
NotFound
(
"Variable(%s) not found in cinn scope"
,
cinn_name
));
};
};
std
::
for_each
(
input_cinn_names
.
begin
(),
input_cinn_names
.
end
(),
exclude_fn
);
std
::
for_each
(
input_cinn_names
.
begin
(),
input_cinn_names
.
end
(),
exclude_fn
);
...
...
paddle/fluid/operators/cinn_launch_op.h
浏览文件 @
7ee727a8
...
@@ -178,7 +178,7 @@ class CinnLaunchOpKernel : public framework::OpKernel<T> {
...
@@ -178,7 +178,7 @@ class CinnLaunchOpKernel : public framework::OpKernel<T> {
tensor
);
tensor
);
}
}
VLOG
(
4
)
<<
"Prepare out
n
put argument-"
<<
i
<<
":"
VLOG
(
4
)
<<
"Prepare output argument-"
<<
i
<<
":"
<<
"name("
<<
var_name
<<
"->"
<<
cinn_name
<<
"), "
<<
"name("
<<
var_name
<<
"->"
<<
cinn_name
<<
"), "
<<
"tensor(type:"
<<
tensor
->
type
()
<<
","
<<
"tensor(type:"
<<
tensor
->
type
()
<<
","
<<
"dims:"
<<
tensor
->
dims
()
<<
")."
;
<<
"dims:"
<<
tensor
->
dims
()
<<
")."
;
...
@@ -187,9 +187,12 @@ class CinnLaunchOpKernel : public framework::OpKernel<T> {
...
@@ -187,9 +187,12 @@ class CinnLaunchOpKernel : public framework::OpKernel<T> {
hold_buffers
.
emplace_back
(
std
::
move
(
buffer
));
hold_buffers
.
emplace_back
(
std
::
move
(
buffer
));
}
}
// 3.3 Prepare temporary variables: Create a temporary scope
// 3.3 Prepare internal or temporary variables: Create a temporary
// to keep temporary variables needed by compiled runtime program
// scope to keep internal variables within graph or temporary
// in addition, they directly use the names from CinnScope.
// variables needed by the compiled runtime program in addition.
// Here we directly use the names from CinnScope as Paddle variable
// names, because they will not be used outside the graph
// and should be destructed after computation finished.
auto
temp_variable_names
=
details
::
SeperateTempVar
(
auto
temp_variable_names
=
details
::
SeperateTempVar
(
cinn_scope
,
input_cinn_names
,
output_cinn_names
);
cinn_scope
,
input_cinn_names
,
output_cinn_names
);
auto
temp_scope
=
scope
.
NewTmpScope
();
auto
temp_scope
=
scope
.
NewTmpScope
();
...
...
paddle/fluid/operators/cinn_launch_op_test.cc
浏览文件 @
7ee727a8
...
@@ -263,9 +263,6 @@ TEST(CinnLaunchOpHelperTest, TestSeperateTempVar) {
...
@@ -263,9 +263,6 @@ TEST(CinnLaunchOpHelperTest, TestSeperateTempVar) {
SeperateTempVar
(
cinn_scope
,
{
"cinn_var1"
,
"cinn_var2"
},
{
"cinn_var4"
});
SeperateTempVar
(
cinn_scope
,
{
"cinn_var1"
,
"cinn_var2"
},
{
"cinn_var4"
});
ASSERT_EQ
(
temp_names
.
size
(),
1
);
ASSERT_EQ
(
temp_names
.
size
(),
1
);
EXPECT_EQ
(
temp_names
.
front
(),
"cinn_var3"
);
EXPECT_EQ
(
temp_names
.
front
(),
"cinn_var3"
);
ASSERT_THROW
(
SeperateTempVar
(
cinn_scope
,
{
"cinn_var1"
,
"not_exist"
},
{
"cinn_var4"
}),
paddle
::
platform
::
EnforceNotMet
);
}
}
TEST
(
CinnLaunchOpHelperTest
,
TestShareTensorWithCinnBuffer
)
{
TEST
(
CinnLaunchOpHelperTest
,
TestShareTensorWithCinnBuffer
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录