-
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
[TUTORIAL][ANSOR] Using the template-free auto-scheduler on CPU #6488
Conversation
bd9c903
to
48aa0e9
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.
Fine to me.
@@ -156,16 +159,41 @@ def __init__( | |||
) | |||
|
|||
|
|||
def create_task(func, args, target, target_host=None, hardware_params=None): |
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 what's the different of calling SearchTask()
directly, seems they just have different input parameters.
I notice that AutoTVM used an api of autotvm.task.create()
, should we keep them the same?
Anyway, it's fine since we may continue to refine our APIs later.
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.
Python does not support constructor overloading, so I have to create a new function for this.
I think both auto_scheduler.create_task
and auto_scheduler.task.create
are okay.
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.
Seems we can next migrate the tuning scripts here, and start to reproduce the op/subgraph performance in our paper based on the new master.
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
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.
Nice work! I've only left cosmetic comments.
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. Just nits.
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
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.
Thanks @merrymercy LGTM
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've just had a quick play around with this tutorial and it looks good to me. There is one thing I wonder though, which is that even when I boost the number of trials it never seems to decide to inline the bias add (x86). Is this a limitation of Ansor or is inlining just not performant here?
@mbaret Good catch! It is actually a small bug introduced during the upstream. Now the bug is fixed and you can give it another try. |
59583c7
to
5cad061
Compare
Ah nice, it's working as I expected now. |
# We can kick off the search and let the auto-scheduler do its magic. | ||
# After some measurement trials, it will return the best schedule it found. | ||
|
||
sch, args = auto_scheduler.auto_schedule(task, tuning_options=tune_option) |
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.
It'd be nice to briefly describe what the return values of sch
and args
are here. I'm assuming that sch
is a schedule, but is it encoded in TIR, or some other data structure? Same with args
.
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.
If you check the doc string of the auto_scheduler.auto_schedule()
, you'll find the explaination of the return values: A te.schedule
and the a list of te.Tensor
to be used in tvm.lower
or tvm.build
.
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 merged this first and will see whether the docstring link on the tvm website works.
If it is not working, I can add more explanations in the next PR, which is a similar tutorial for GPU.
…he#6488) * add tutorial * add tutorial * update * Apply suggestions from code review Co-authored-by: Cody Yu <comaniac0422@gmail.com> * address comments * fix bugs * add the exmple for resuming the search * fix lint Co-authored-by: Cody Yu <comaniac0422@gmail.com>
…he#6488) * add tutorial * add tutorial * update * Apply suggestions from code review Co-authored-by: Cody Yu <comaniac0422@gmail.com> * address comments * fix bugs * add the exmple for resuming the search * fix lint Co-authored-by: Cody Yu <comaniac0422@gmail.com>
…he#6488) * add tutorial * add tutorial * update * Apply suggestions from code review Co-authored-by: Cody Yu <comaniac0422@gmail.com> * address comments * fix bugs * add the exmple for resuming the search * fix lint Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Add a tutorial on how to auto-schedule a subgraph for CPU.
Any feedback on the API is welcomed.
cc @jcf94 @tqchen @junrushao1994 @comaniac @jwfromm