-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PIR] Add pir::ConstantTensorOp and improve constant_folding_pass #59244
Conversation
11ef05d
to
373e1d2
Compare
373e1d2
to
f27f0a2
Compare
20c8ba3
to
1299062
Compare
for (uint32_t i = 0; i < op->num_results(); i++) { | ||
auto use_ops = pir::GetUseOpsForOutput(op, i); | ||
for (auto* use_op : use_ops) { | ||
if (use_op->isa<pir::CombineOp>()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CombineOp
是不是可以再根据CombineOp
的user来判断?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CombineOp
是不是可以再根据CombineOp
的user来判断?
好滴
"Type of value must be strattribute"); | ||
} | ||
|
||
ConstantTensorOp ConstantTensorOp::dyn_cast(Operation *op) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConstantTensorOp 的 isa 和 dyn_cast 有点问题,需要判断一下 value 是不是一个 TensorNameAttribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConstantTensorOp 的 isa 和 dyn_cast 有点问题,需要判断一下 value 是不是一个 TensorNameAttribute
已增加
@@ -495,6 +495,22 @@ void ConstantOp::VerifySig() const { | |||
|
|||
Attribute ConstantOp::value() const { return attributes().at("value"); } | |||
|
|||
void ConstantTensorOp::VerifySig() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少一个 TensorNameAttibute 用于代表一个 Tensor名字的属性
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少一个 TensorNameAttibute 用于代表一个 Tensor名字的属性
已增加
935378a
to
856f35d
Compare
paddle/pir/core/builtin_attribute.h
Outdated
|
||
bool operator<(const TensorNameAttribute& right) const; | ||
|
||
std::string AsString() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string AsString() const; | |
std::string data() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done~
paddle/pir/core/builtin_attribute.h
Outdated
|
||
size_t size() const; | ||
|
||
static TensorNameAttribute get(IrContext* ctx, const std::string& value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static TensorNameAttribute get(IrContext* ctx, const std::string& value); | |
static TensorNameAttribute get(IrContext* ctx, const std::string& tensor_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done~
69da83b
to
76f57f5
Compare
01836f6
to
1e7afe1
Compare
fe29420
to
245f6df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ddlePaddle#59244) * [pir]Adding constant_tensor_op, rewrite constant folding pass * fix * fix * Update analysis_predictor.cc
PR types
New features
PR changes
Others
Description
Add pir::ConstantTensorOp and improve constant_folding_pass