Skip to content
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

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

BiynXu
Copy link
Contributor

@BiynXu BiynXu commented Sep 11, 2023

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.

@paddle-bot
Copy link

paddle-bot bot commented Sep 11, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

std::stringstream content;
content << info_.lowered_funcs[idx].front();
if (info_.Status(idx) > hlir::framework::CompilationStatus::LOWERING_FAIL) {
Copy link
Contributor

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缩短一下,下同

Copy link
Contributor Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看了下Enum2String的实现,还挺复杂的,如果只是为了把enum转成相应的string,是不是可以简化一下实现,还是说有其他的考虑

Copy link
Contributor Author

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_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint好像不是C++中的常规数据类型,可能会被编译器识别为unsigned int,可以正常使用,但还是建议换种写法

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改为int

Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZzSean ZzSean merged commit ea35c7f into PaddlePaddle:develop Sep 18, 2023
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
* [CINN] add compile error handler

* [Fix] cinn_compiler return value

* Refine code style
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
* [CINN] add compile error handler

* [Fix] cinn_compiler return value

* Refine code style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants