-
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: Update heavy operations with parallel_for #6348
Conversation
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 a small question.
412ae14
to
9c8dca0
Compare
@merrymercy @FrozenGene Plz have a look when you're free. :) |
src/auto_scheduler/compute_dag.cc
Outdated
out_states.push_back(std::move(out_state)); | ||
} | ||
if (out_state.defined()) { | ||
std::unique_lock<std::mutex> l(m); |
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.
Can we use low-level APIs from ArrayNode to remove this mutex lock?
Because we know the number of states, we can allocate n empty State()
in advance.
Do something like
std::vector<State> out_states(n, State());
parallel_for i in 0...n:
out_state[i] = process(states[i])
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.
Our original implementation in Ansor repo just worked in this way, while if there's any inferbound failure the out_state
will contains some empy State()
.
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.
Added a note in the doc string of ComputeDAG::Inferbound
, added necessary PruneInvalidState
to the search policy.
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
…for (apache#6348) * Update auto_scheduler with parallel_for * Update * Update * Update * Update inferbound
…for (apache#6348) * Update auto_scheduler with parallel_for * Update * Update * Update * Update inferbound
…for (apache#6348) * Update auto_scheduler with parallel_for * Update * Update * Update * Update inferbound
For the full upstream plan, see Ansor RFC.
This PR contains some small fix:
Currently add for:
SketchPolicyNode::SampleInitPopulation(some rules used the SketchPolicyNode->rand_gen, so this part still has to be protected by a std::mutex)Do we need to add parallel_for for EvolutionarySearch after [Ansor][AutoTVM v2.0] Phase 2: Evolutionary Search #6310 has been merged?cc @merrymercy @comaniac