Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c170074d
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看板
未验证
提交
c170074d
编写于
9月 06, 2023
作者:
傅
傅剑寒
提交者:
GitHub
9月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename StoreButMutator and fix RampMutator (#56966)
上级
0900a790
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
7 addition
and
20 deletion
+7
-20
paddle/cinn/optim/ir_simplify.cc
paddle/cinn/optim/ir_simplify.cc
+7
-20
未找到文件。
paddle/cinn/optim/ir_simplify.cc
浏览文件 @
c170074d
...
...
@@ -53,9 +53,9 @@ void PartialSimplify(
}
//! Simplify the expression but Load.
struct
Simplify
ButStoreLoad
Mutator
:
public
ir
::
IRMutator
<
ir
::
Expr
*>
{
struct
Simplify
NoPureMath
Mutator
:
public
ir
::
IRMutator
<
ir
::
Expr
*>
{
common
::
cas_intervals_t
&
var_intervals
;
explicit
Simplify
ButStoreLoad
Mutator
(
explicit
Simplify
NoPureMath
Mutator
(
common
::
cas_intervals_t
&
var_intervals
)
// NOLINT
:
var_intervals
(
var_intervals
)
{}
...
...
@@ -76,19 +76,6 @@ struct SimplifyButStoreLoadMutator : public ir::IRMutator<ir::Expr*> {
__
(
Max
)
#undef __
void
Visit
(
const
Ramp
*
op
,
Expr
*
expr
)
override
{
auto
*
node
=
expr
->
As
<
Ramp
>
();
CHECK
(
common
::
IsPureMath
(
node
->
base
));
CHECK
(
common
::
IsPureMath
(
node
->
stride
));
PartialSimplify
(
&
node
->
base
,
var_intervals
);
PartialSimplify
(
&
node
->
stride
,
var_intervals
);
}
void
Visit
(
const
Cast
*
op
,
Expr
*
expr
)
override
{
auto
*
node
=
expr
->
As
<
Cast
>
();
Visit
(
&
node
->
v
(),
&
node
->
v
());
}
void
Visit
(
const
PolyFor
*
op
,
Expr
*
expr
)
override
{
auto
*
node
=
expr
->
As
<
ir
::
PolyFor
>
();
node
->
condition
=
common
::
SolveInequality
(
op
->
condition
,
op
->
iterator
);
...
...
@@ -138,7 +125,7 @@ struct SimplifyLoadMutator : public ir::IRMutator<ir::Expr*> {
if
(
common
::
IsPureMath
(
idx
))
{
PartialSimplify
(
&
idx
,
var_intervals_
);
}
else
{
Simplify
ButStoreLoad
Mutator
mutator
(
var_intervals_
);
Simplify
NoPureMath
Mutator
mutator
(
var_intervals_
);
mutator
(
&
idx
);
}
}
...
...
@@ -176,7 +163,7 @@ struct SimplifyStoreMutator : public ir::IRMutator<ir::Expr*> {
if
(
common
::
IsPureMath
(
idx
))
{
PartialSimplify
(
&
idx
,
var_intervals_
);
}
else
{
Simplify
ButStoreLoad
Mutator
mutator
(
var_intervals_
);
Simplify
NoPureMath
Mutator
mutator
(
var_intervals_
);
mutator
(
&
idx
);
}
}
...
...
@@ -215,8 +202,8 @@ struct SimplifyRampMutator : public ir::IRMutator<Expr*> {
CHECK
(
common
::
IsPureMath
(
node
->
stride
))
<<
node
->
stride
<<
"is not a pure math!"
;
Simplify
(
&
node
->
base
);
Simplify
(
&
node
->
stride
);
Partial
Simplify
(
&
node
->
base
);
Partial
Simplify
(
&
node
->
stride
);
}
// ramp + ramp
void
Visit
(
const
Add
*
op
,
Expr
*
expr
)
override
{
...
...
@@ -370,7 +357,7 @@ void Simplify(Expr* expr) {
SimplifyIfThenElseMutator
()(
expr
);
common
::
cas_intervals_t
var_intervals
;
Simplify
ButStoreLoad
Mutator
mutator
(
var_intervals
);
Simplify
NoPureMath
Mutator
mutator
(
var_intervals
);
mutator
(
expr
);
ReplaceFracWithDivMutator
()(
expr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录