Kathryn-cat commented on code in PR #11641:
URL: https://github.com/apache/tvm/pull/11641#discussion_r893820289
##########
src/meta_schedule/search_strategy/evolutionary_search.cc:
##########
@@ -719,9 +719,36 @@ class EvolutionarySearch : public SearchStrategy {
EvolutionarySearchNode);
};
+Array<Schedule> EvolutionarySearchSampleInitPopulation(ObjectRef _self, int
num) {
+ const EvolutionarySearchNode* self = _self.as<EvolutionarySearchNode>();
+ std::vector<Schedule> results = self->state_->SampleInitPopulation(num);
+ return Array<Schedule>(results.begin(), results.end());
+}
+
+Array<Schedule> EvolutionarySearchEvolveWithCostModel(ObjectRef _self,
Array<Schedule> population,
+ int num) {
+ Array<Schedule> result;
+ const EvolutionarySearchNode* self = _self.as<EvolutionarySearchNode>();
+ std::vector<Schedule> population_vec =
+ std::vector<Schedule>(population.begin(), population.end());
+ std::vector<Schedule> schs =
self->state_->EvolveWithCostModel(population_vec, num);
+ for (Schedule sch : schs) {
+ IRModule mod = sch->mod();
+ size_t shash = StructuralHash()(mod);
+ if (!self->state_->measured_workloads_.Has(mod, shash)) {
+ result.push_back(sch);
+ }
Review Comment:
I ignored here in the wrapper function because it is added to the
`measured_workloads_`
[here](https://github.com/apache/tvm/blob/main/src/meta_schedule/search_strategy/evolutionary_search.cc#L517-L519)
in the original `EvolveWithCostModel`, and I guess it does not need to be
repeated?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]