-
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
[CINN] add compile error handler #57198
[CINN] add compile error handler #57198
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
paddle/cinn/backends/compiler.cc
Outdated
std::stringstream content; | ||
content << info_.lowered_funcs[idx].front(); | ||
if (info_.Status(idx) > hlir::framework::CompilationStatus::LOWERING_FAIL) { |
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.
hlir::framework::CompilationStatus::LOWERING_FAIL
可以用using缩短一下,下同
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.
std::ostringstream os; | ||
os << "[CompileError] An error occurred during compilation with the error " | ||
"code: " | ||
<< utils::Enum2String(status_) << std::endl; |
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.
我看了下Enum2String
的实现,还挺复杂的,如果只是为了把enum转成相应的string,是不是可以简化一下实现,还是说有其他的考虑
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.
该实现可以支持任意枚举类转为String,未来若有其他需求可以复用,无需每个枚举类自己定义ToString().
std::vector<std::optional<std::string>> source_ptxs_; | ||
std::vector<std::unique_ptr<Instruction>> instructions_; | ||
std::unique_ptr<Program> runtime_program_; | ||
uint size_; |
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.
uint
好像不是C++中的常规数据类型,可能会被编译器识别为unsigned int
,可以正常使用,但还是建议换种写法
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.
已修改为int
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
* [CINN] add compile error handler * [Fix] cinn_compiler return value * Refine code style
* [CINN] add compile error handler * [Fix] cinn_compiler return value * Refine code style
PR types
Others
PR changes
Others
Description
Pcard-73602
Add CompileErrorHandler.
Replace some CHECKs in GraphCompile and improve error messages.
Make data members of CompilationResult private.