Navigation Menu

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

[SR-8097] Improve error handling infra in Graph Lowering #50630

Closed
swift-ci opened this issue Jun 25, 2018 · 1 comment
Closed

[SR-8097] Improve error handling infra in Graph Lowering #50630

swift-ci opened this issue Jun 25, 2018 · 1 comment
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement SILOptimizer Area → compiler: SIL optimization passes swift for tensorflow

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-8097
Radar None
Original Reporter hongm (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Swift for TensorFlow
Labels New Feature, StarterBug
Assignee dingobye (JIRA)
Priority Medium

md5: 139afabcce0b72ca2e6014cb5ccb90b5

Issue Description:

Currently the graph lowering pass uses the following member field to track if error has occurred:

bool errorOccurred = false;

bool errorOccurred = false;

It must be set at the lowest level of any call stack (e.g.

https://github.com/apple/swift/blob/d9d16ef9fbadcb5f1b0a73e632176121ae0945a5/lib/SILOptimizer/Mandatory/TFLowerGraph.cpp#L266), and at other places we must check for the error (e.g.

https://github.com/apple/swift/blob/d9d16ef9fbadcb5f1b0a73e632176121ae0945a5/lib/SILOptimizer/Mandatory/TFLowerGraph.cpp#L498). If the check statement is missed, graph lowering can incorrectly proceed despite of encoutering errors, leading to bugs in the code.

The code might be cleaner and less error prone if each function call returns a bool indicating whether something has failed (the LLVM/swift convention is to return true on error). This general "design pattern" of error handling could be to return a util::Status type of object, but returning a bool is probably sufficient for now.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jul 2, 2018

Comment by Mingsheng Hong (JIRA)

Resolved by dingobye (JIRA User) at #17660

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added improvement compiler The Swift compiler in itself SILOptimizer Area → compiler: SIL optimization passes and removed new feature labels Feb 2, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement SILOptimizer Area → compiler: SIL optimization passes swift for tensorflow
Projects
None yet
Development

No branches or pull requests

2 participants