Skip to content

[Target] Fix empty target and host for autotvm task - #7791

Merged
tqchen merged 7 commits into
apache:mainfrom
zxybazh:fix
Apr 3, 2021
Merged

tqchen merged 7 commits into
apache:mainfrom
zxybazh:fix

Conversation

@zxybazh

@zxybazh zxybazh commented Apr 2, 2021

Copy link
Copy Markdown
Member

In order to patch the empty target and host situation in Issue 7790.

@comaniac comaniac linked an issue Apr 2, 2021 that may be closed by this pull request

@comaniac comaniac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems to me that __setstate__ also has this issue? If you save the state with both target and target_host are None, then you will get the same problem in L202.

@comaniac comaniac self-assigned this Apr 2, 2021
@zxybazh

zxybazh commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

Thanks @comaniac for pointing that out. I have added check in this case. In order to prevent this issue, I would take a look at other occurrences as well and update in this PR.

@comaniac

comaniac commented Apr 2, 2021

Copy link
Copy Markdown
Contributor

Thanks @comaniac for pointing that out. I have added check in this case. In order to prevent this issue, I would take a look at other occurances as well and update in this PR.

Sure. Please comment here once it's ready for reivew.

@comaniac comaniac added the status: need update need update based on feedbacks label Apr 2, 2021
@zxybazh

zxybazh commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

Hi, I've checked all occurences and found other cases possible to reach the same error, e.g., the _build_module_no_factory function. Some the the functions calls does not have guarantee about whether target is None. Therefore, instead of adding extra checks in occurrences, I changed the check_and_update_host_consist function and add a warning to warn about some corner cases. After all IMO empty target should not be a typical case in the system, and should be avoided in the future. What do you think @comaniac ?

@zxybazh

zxybazh commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

cc @junrushao1994

@comaniac comaniac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like we don't have a test case for check_and_update_host_consist. Should we add one?

Comment thread python/tvm/target/target.py Outdated
@zxybazh

zxybazh commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

Hi Cody, I don't intend to add test for the function because this is a temporary function for migration to the new target system. It should be deprecated soon after target host deprecation and is not encouraged for any other usage. I have also added the assertion as per your good point. Please review and let me know any other advice, thanks!

@comaniac comaniac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well...I don't quite agree on this point. Even this is just a temporary function, it is here now, and it is being used at more than 30 places in the current code base, which means a bug in this function affects 30+ places. Plus, the "tempoaray" could be one day or one to several months. It's not guaranteed that the final PR will be merged by when.

Would like to hear other's opinion.
cc @junrushao1994

Comment thread python/tvm/target/target.py Outdated
@zxybazh

zxybazh commented Apr 2, 2021

Copy link
Copy Markdown
Member Author

Well, it does impact a lot of functions. I have added tests and fixed assertion warning as suggested. Please check, thanks!

@comaniac comaniac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks

@comaniac comaniac added status: accepted and removed status: need update need update based on feedbacks labels Apr 2, 2021

@junrushao junrushao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix!

@tqchen
tqchen merged commit 1f59139 into apache:main Apr 3, 2021
@zxybazh
zxybazh deleted the fix branch April 3, 2021 17:17
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
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.

target = None error while tuing an autotvm task

4 participants