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

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

Merged
merged 7 commits into from Apr 3, 2021
Merged

Conversation

zxybazh
Copy link
Member

@zxybazh zxybazh commented Apr 2, 2021

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
Copy link
Contributor

@comaniac comaniac left a comment

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
Copy link
Member Author

zxybazh commented Apr 2, 2021

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
Copy link
Contributor

comaniac commented Apr 2, 2021

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
Copy link
Member Author

zxybazh commented Apr 2, 2021

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
Copy link
Member Author

zxybazh commented Apr 2, 2021

cc @junrushao1994

Copy link
Contributor

@comaniac comaniac left a comment

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?

python/tvm/target/target.py Outdated Show resolved Hide resolved
@zxybazh
Copy link
Member Author

zxybazh commented Apr 2, 2021

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!

Copy link
Contributor

@comaniac comaniac left a comment

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

python/tvm/target/target.py Outdated Show resolved Hide resolved
@zxybazh
Copy link
Member Author

zxybazh commented Apr 2, 2021

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

Copy link
Contributor

@comaniac comaniac left a comment

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
Copy link
Member

@junrushao junrushao left a comment

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