-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[AutoScheduler] Fix the conflict of thread pool in measurement #7166
Conversation
2070e6b
to
ad639bb
Compare
ad639bb
to
de601aa
Compare
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.
"""Call a function with timeout""" | ||
que = multiprocessing.Queue(2) | ||
process = multiprocessing.Process(target=_func_wrapper, args=(que, func, args, kwargs)) | ||
process = multiprocessing.Process( |
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.
I'm thinking about whether the bug was introduced by the multiprocessing
? Maybe directly use thread here can solve the problem.... I'm not sure, just a guess.
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.
We can only use Process
here. threading.Thread
does not support timeout when calling a c++ 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.
LGTM
Thanks @merrymercy @jcf94 |
Currently, due to the conflict between python' multiprocessing and tvm's thread pool, we cannot run auto-scheduler search after running any tvm-generated functions.
I found this conflict can be avoided if we run the measurement function in
LocalRunner
within a newthreading.Thread
.This PR just added such a new wrapper in
auto_scheduler.local_runner.run
. With this PR, we can freely run auto-scheduler search after executing any tvm-generated functions or relay's FoldConstant.