Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

beicy
Copy link
Contributor

@beicy beicy commented Sep 13, 2019

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.

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.

subF->getName().str().data()));
if (!subF->verify()) {
return MAKE_ERR(GlowErr::ErrorCode::PARTITIONER_ERROR,
"Conversion led to invalid function" +
Copy link
Contributor

Choose a reason for hiding this comment

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

space after "function"

subF, strFormat("Invalid function name %s.", node->name.data()));
if (!subF) {
return MAKE_ERR(GlowErr::ErrorCode::PARTITIONER_ERROR,
"Invalid function name" + node->name);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one looks simpler :)

@@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use glow::errToBool

@jackm321
Copy link
Contributor

I have fixed these unchecked errors in #3515

@jackm321
Copy link
Contributor

But since this introduces PARTITIONER_ERROR, feel free to land it and I can rebase.

Copy link
Contributor

@jackm321 jackm321 left a 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);
Copy link
Contributor

Choose a reason for hiding this comment

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

glow::errToBool

Copy link

@facebook-github-bot facebook-github-bot left a 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.

@facebook-github-bot
Copy link

@beicy merged this pull request in 16dd2fd.

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

Successfully merging this pull request may close these issues.

3 participants