-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[microTVM][AutoTVM] Fix autotvm bug and tests #9003
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -691,11 +691,13 @@ void RPCEndpoint::Init() { | |
| * the key to modify their behavior. | ||
| */ | ||
| std::shared_ptr<RPCEndpoint> RPCEndpoint::Create(std::unique_ptr<RPCChannel> channel, | ||
| std::string name, std::string remote_key) { | ||
| std::string name, std::string remote_key, | ||
| TypedPackedFunc<void()> fshutdown) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tqchen this is needed when a Python-side session constructor may keep a reference to the underlying session. Does it make sense to you?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TQ requests change to |
||
| std::shared_ptr<RPCEndpoint> endpt = std::make_shared<RPCEndpoint>(); | ||
| endpt->channel_ = std::move(channel); | ||
| endpt->name_ = std::move(name); | ||
| endpt->remote_key_ = std::move(remote_key); | ||
| endpt->fshutdown_ = fshutdown; | ||
| endpt->Init(); | ||
| return endpt; | ||
| } | ||
|
|
@@ -734,6 +736,7 @@ void RPCEndpoint::ServerLoop() { | |
| (*f)(); | ||
| } | ||
| channel_.reset(nullptr); | ||
| if (fshutdown_ != nullptr) fshutdown_(); | ||
| } | ||
|
|
||
| int RPCEndpoint::ServerAsyncIOEventHandler(const std::string& in_bytes, int event_flag) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,11 +161,13 @@ class RPCEndpoint { | |
| * \param channel The communication channel. | ||
| * \param name The local name of the session, used for debug | ||
| * \param remote_key The remote key of the session | ||
| * \param fshutdown The shutdown Packed function | ||
| * if remote_key equals "%toinit", we need to re-intialize | ||
| * it by event handler. | ||
| */ | ||
| static std::shared_ptr<RPCEndpoint> Create(std::unique_ptr<RPCChannel> channel, std::string name, | ||
| std::string remote_key); | ||
| std::string remote_key, | ||
| TypedPackedFunc<void()> fshutdown = nullptr); | ||
|
|
||
| private: | ||
| class EventHandler; | ||
|
|
@@ -190,6 +192,8 @@ class RPCEndpoint { | |
| std::string name_; | ||
| // The remote key | ||
| std::string remote_key_; | ||
| // The shutdown Packed Function | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: say something more like: "invoked when the RPC session is terminated" |
||
| TypedPackedFunc<void()> fshutdown_; | ||
| }; | ||
|
|
||
| /*! | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -125,7 +125,7 @@ | |||
| do_fork=True, | ||||
| build_func=tvm.micro.autotvm_build_func, | ||||
| ) | ||||
| runner = tvm.autotvm.LocalRunner(number=1, repeat=1, timeout=0, module_loader=module_loader) | ||||
| runner = tvm.autotvm.LocalRunner(number=1, repeat=1, timeout=100, module_loader=module_loader) | ||||
|
|
||||
| measure_option = tvm.autotvm.measure_option(builder=builder, runner=runner) | ||||
|
|
||||
|
|
@@ -146,7 +146,7 @@ | |||
| # do_fork=False, | ||||
| # build_func=tvm.micro.autotvm_build_func, | ||||
| # ) | ||||
| # runner = tvm.autotvm.LocalRunner(number=1, repeat=1, timeout=0, module_loader=module_loader) | ||||
| # runner = tvm.autotvm.LocalRunner(number=1, repeat=1, timeout=100, module_loader=module_loader) | ||||
|
|
||||
| # measure_option = tvm.autotvm.measure_option(builder=builder, runner=runner) | ||||
|
|
||||
|
|
@@ -162,7 +162,7 @@ | |||
| n_trial=num_trials, | ||||
| measure_option=measure_option, | ||||
| callbacks=[ | ||||
| tvm.autotvm.callback.log_to_file("microtvm_autotune.log"), | ||||
| tvm.autotvm.callback.log_to_file("microtvm_autotune.log.txt"), | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the double extension here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be consistent with cleanup step in doc stage: tvm/tests/scripts/task_python_docs.sh Line 31 in ff4bf3b
|
||||
| tvm.autotvm.callback.progress_bar(num_trials, si_prefix="M"), | ||||
| ], | ||||
| si_prefix="M", | ||||
|
|
@@ -214,7 +214,7 @@ | |||
| ########################## | ||||
| # Once autotuning completes, you can time execution of the entire program using the Debug Runtime: | ||||
|
|
||||
| with tvm.autotvm.apply_history_best("microtvm_autotune.log"): | ||||
| with tvm.autotvm.apply_history_best("microtvm_autotune.log.txt"): | ||||
| with pass_context: | ||||
| lowered_tuned = tvm.relay.build(relay_mod, target=TARGET, params=params) | ||||
|
|
||||
|
|
||||
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.
perhaps for a future cleanup: let's ensure we avoid double-calling
__exit__by checking some local var to determine whether we did already.