-
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
[Ansor][AutoTVM v2.0] Phase 2: Basic CPU Sketch Search Policy #6184
Conversation
@merrymercy I realized that a base class of CostModel is also needed in this PR. We can sync that part first when you start to work on the cost model PR(Or have a separate PR for the basic random model support?). Another problem is that I found the setting of random seed does not work on the current implementation of random number generation in RandomModel(neither the python |
Thanks! |
d1a5777
to
510339c
Compare
|
a232b40
to
e625554
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. Only some minor doc improvements.
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.
Overall LGTM, but I'd like to raise the discussion about the file organization for search policy. Now sketch_search_policy.cc
has about one thousand line and it might continue to grow in the future. Here is the organization in my mind:
auto_scheduler
|- serach_policy
|- sketch_search
|- sketch_search_policy.{h,cc}
|- sketch_rules.{h,cc}
|- utils.{h,cc}
|- empty_search
|- utils.{h,cc}
- Have
auto_scheduler/search_policy/{sketch_policy, empty_policy}
. - Separate all
SketchGenerationRule
andInitPopulationRule
tosearch_policy/sketch_policy/sketch_rules
. - Rename
src/auto_scheduler/search_policy/utils.{h,cc}
to 'src/auto_scheduler/search_policy/utils.{h,cc}' (still undersearch_policy
), and move all sketch search specific functions such as Mutation (not included in this PR) toauto_scheduler/search_policy/sketch_policy/utils.{h,cc}
.
sch, tensors = _ffi_api.AutoSchedule(task, search_policy, | ||
tuning_options if tuning_options else TuningOptions()) | ||
# TODO(jcf94): Remove EmptyPolicy after finish the porting of SketchSearchPolicy | ||
sch, tensors = _ffi_api.AutoSchedule(search_policy or EmptyPolicy(task), tuning_options) |
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.
Should we make sketch search policy as the default one? Otherwise I can imagine lots of people will ask in the discuss forum about why auto scheduler doesn't do any search...
Currently I just split out the |
@comaniac @junrushao1994 Wait for your approval and I will merge this |
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.
LGTM. The file organization is much clearer now. Thanks :)
…#6184) * Init commit to pass the compile * First commit to pass the test * Update * Add UTs for sketch generation * Update * Add ASF to new UT file. * Update rule for winograd * Update * File renamed * Lint fix
…#6184) * Init commit to pass the compile * First commit to pass the test * Update * Add UTs for sketch generation * Update * Add ASF to new UT file. * Update rule for winograd * Update * File renamed * Lint fix
…#6184) * Init commit to pass the compile * First commit to pass the test * Update * Add UTs for sketch generation * Update * Add ASF to new UT file. * Update rule for winograd * Update * File renamed * Lint fix
…#6184) * Init commit to pass the compile * First commit to pass the test * Update * Add UTs for sketch generation * Update * Add ASF to new UT file. * Update rule for winograd * Update * File renamed * Lint fix
…#6184) * Init commit to pass the compile * First commit to pass the test * Update * Add UTs for sketch generation * Update * Add ASF to new UT file. * Update rule for winograd * Update * File renamed * Lint fix
…#6184) * Init commit to pass the compile * First commit to pass the test * Update * Add UTs for sketch generation * Update * Add ASF to new UT file. * Update rule for winograd * Update * File renamed * Lint fix
For full upstream plan, see Ansor RFC.
In this PR, we bring the basic Sketch search policy which is proposed in our paper on CPU ops/subgraphs.
The complete search policy still waits for the feature extraction & cost model support, so this will be a basic search policy using random cost model.
We'll continue to work on the upstreaming process to bring the complete auto schedule support for various workloads on CPU/GPU with some reproducible performance results, a custom sketch rule support to work like the AutoTVM, as well as the tutorials of how to play with AutoScheduler.
Review guide
Main changes:
auto_scheduler::AutoSchedule
,TuningOptions
andSearchPolicy::Search
;compute_dag.h/cc
,cost_model.h/cc
;search_policy/sketch_search_policy.h/cc
,search_policy/utils.h/cc
, these're the key parts of this PR;In the SketchSearchPolicy, we can start the review from
SketchSearchPolicyNode::Search
andSketchSearchPolicyNode::SearchOneRound
, which are the main entrance.SketchGenerationRule
andInitPopulationRule
are used to generate the schedule automatically.Some methods used by the SketchSearchPolicy are put on the
search_policy/utils.h/cc
.