-
Notifications
You must be signed in to change notification settings - Fork 801
[SYCL][Graph] Correct assert usage #10969
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
Conversation
Fix [macOS CI fail in post-commit CI] (https://github.com/intel/llvm/actions/runs/5975037762/job/16210261083) by asserting on `false`, then providing the error string. ``` /Users/runner/work/llvm/llvm/src/sycl/source/detail/graph_impl.cpp:140:16: error: implicit conversion turns string literal into bool: 'const char[55]' to 'bool' [-Werror,-Wstring-conversion] assert("Node duplication failed. A duplicated node is missing."); ~~~~~~~^~~~~~~~~~~~~~~~~~~ ```
sycl/source/detail/graph_impl.cpp
Outdated
| assert("Node duplication failed. A duplicated node is missing."); | ||
| assert(false && | ||
| "Node duplication failed. A duplicated node is missing."); | ||
| } |
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.
You don't need to if statement in this case. Just move the condition to assert.
assert(NodesMap.find(NextNode) != NodesMap.end() && "Node duplication failed. A duplicated node is missing.");
auto Successor = NodesMap[NextNode];
NodeCopy->registerSuccessor(Successor, NodeCopy);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.
Maybe we can use at instead of operator [] to make out-of-bounds check by std::map and remove assert from the code? NOTE: this will enable the check in Release mode too, which might be not intended.
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.
@reble has pushed an update so that this PR uses at
Fix macOS CI fail in post-commit CI by asserting on
false, then providing the error string.Error