-
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
[IR&PASS] part 3-1: Add PatternMatch base class. #54385
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
|
||
std::string debug_name() const { return debug_name_; } | ||
|
||
void set_debug_name(const std::string& name) { debug_name_ = 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.
设值函数统一驼峰式命名,SetDebugName
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
}; | ||
|
||
//---------------------------------------------------------// | ||
// Pattern Class |
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.
.h里这种注释给删了吧?
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
|
||
const std::vector<std::string>& debug_labels() const { return debug_labels_; } | ||
|
||
void add_debug_labels(const std::vector<std::string>& labels) { |
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.
同上
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
debug_labels_.insert(debug_labels_.end(), labels.begin(), labels.end()); | ||
} | ||
|
||
void add_debug_labels(const std::string& label) { |
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.
同上
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
namespace ir { | ||
|
||
//---------------------------------------------------------// | ||
// Pattern Class |
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.
.cc里的这种注释可以参考pass.cc里的形式
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
// const std::vector<std::string>& generated_names, | ||
// PatternBenefit benefit, | ||
// ir::IrContext* context); | ||
std::string op_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.
pass/下的编码习惯是,各成员变量以空行分隔
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.
google编码规范没有这个要求吧
#include "paddle/utils/small_vector.h" | ||
namespace ir { | ||
|
||
/// The design is mainly from MLIR, very thanks to the greate project. |
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.
这句话有必要保留吗?
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.
留着吧
|
||
unsigned benefit() { return val_; } | ||
|
||
bool operator==(const PatternBenefit& rhs) const { return val_ == rhs.val_; } |
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.
密集恐惧症表示,这一块建议以空行分隔
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.
clang-format格式检查没换行
// op->erase(); | ||
// } | ||
void RewriterBase::EraseOp(Operation* op) { | ||
// assert(op->use_empty() && "expected 'op' to have no uses"); |
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.
ir下有计划将assert和throw统一换成paddle下enforce和throw,后面需要统一改一下
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.
等从phi里独立出来之后统一改下
#include "paddle/ir/core/type_id.h" | ||
#include "paddle/ir/core/type_name.h" | ||
#include "paddle/ir/core/value.h" | ||
#include "paddle/utils/small_vector.h" |
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.
small_vector有用到?
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
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
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
PR types
Others
PR changes
Others
Description
Pcard-71500
新IR下的新PASS体系,新PASS体系适配新IR。该系列PR主要包括如下几个部分:
主要包括四个部分:(1) Pass base & PassManager & PassAdaptor; #54023 (2) AnalysisManager & Pass Instrumentation (PassTiming, IRPrinting..); #54170 #54308 #54348 (3) Pattern Rewrite ... (4) 其他。
后续PR: