-
Notifications
You must be signed in to change notification settings - Fork 699
Fix Unchecked errors in Partitioner #3505 #3511
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
RETURN_ERR_IF_NOT(subF->verify(), | ||
strFormat("Conversion led to invalid function: %s", | ||
subF->getName().str().data())); | ||
if (!subF->verify()) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
lib/Partitioner/Partitioner.cpp
Outdated
subF->getName().str().data())); | ||
if (!subF->verify()) { | ||
return MAKE_ERR(GlowErr::ErrorCode::PARTITIONER_ERROR, | ||
"Conversion led to invalid function" + |
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.
space after "function"
lib/Partitioner/Partitioner.cpp
Outdated
subF, strFormat("Invalid function name %s.", node->name.data())); | ||
if (!subF) { | ||
return MAKE_ERR(GlowErr::ErrorCode::PARTITIONER_ERROR, | ||
"Invalid function name" + node->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.
space after "name"
Also same comment as above and why not continue to use strFormat?
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.
This one looks simpler :)
tests/unittests/PartitionerTest.cpp
Outdated
@@ -343,7 +344,10 @@ TEST_F(PartitionerTest, Error1) { | |||
Partitioner myPartitioner(&EEP.getModule(), devices); | |||
CompilationContext cctx; | |||
auto dagList = myPartitioner.partition(cctx); | |||
EXPECT_FALSE((bool)dagList); | |||
ASSERT_FALSE(handleErrors(dagList.takeError(), [](const GlowErr &GE) { |
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.
use glow::errToBool
I have fixed these unchecked errors in #3515 |
But since this introduces |
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
@@ -250,6 +250,7 @@ TEST_F(PartitionerTest, Basic2) { | |||
Partitioner myPartitioner(&EEP.getModule(), devices, /* saturateHost */ true); | |||
CompilationContext cctx; | |||
auto dagList = myPartitioner.partition(cctx); | |||
EXPECT_TRUE((bool)dagList); |
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.
glow::errToBool
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.
@beicy has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary:
Fix unchecked errors in Partitioner, rewrite the way to report an error.
#3505
Documentation:
[Optional Fixes]
Test Plan:
ninja test.
Please see a detailed explanation of how to fill out the fields in the relevant sections in PULL_REQUEST.md.