Skip to content
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 1: The base class for cost models #6187

Merged
merged 3 commits into from
Aug 6, 2020

Conversation

merrymercy
Copy link
Member

@merrymercy merrymercy commented Aug 2, 2020

For the full upstream plan, see Ansor RFC.

This PR adds the base class for cost models and a random cost model.
Because learning-based models typically use python packages (e.g., xgboost, pytorch, tensorflow), we prefer to implement them in python and use the c++ wrapper PythonBasedCostModel for calling them in c++.

The later PR will introduce a cost model based on manual features and xgboost.

@merrymercy merrymercy changed the title [Ansor][AutoTVM v2.0] Phase 1: Cost model base class [Ansor][AutoTVM v2.0] Phase 1: The base class for cost models Aug 2, 2020
@merrymercy
Copy link
Member Author

merrymercy commented Aug 2, 2020

@junrushao
Copy link
Member

Will review Tuesday night

* \param state_scores The predicted scores for all states
* \param stage_scores The predicted scores for all stages in all stages
*/
virtual void PredictStages(const SearchTask& task, const std::vector<State>& states,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this part? Since out current search policy only apply cost model on a complete schedule.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed by crossover, and it should be useful for future developments IMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@merrymercy would that be better to also make this as a virtual function, or setup a flag or something to indicate if this cost model supports PredictStages or not instead of just throwing an error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, your suggestion seems to be better.

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* \param state_scores The predicted scores for all states
* \param stage_scores The predicted scores for all stages in all stages
*/
virtual void PredictStages(const SearchTask& task, const std::vector<State>& states,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@merrymercy would that be better to also make this as a virtual function, or setup a flag or something to indicate if this cost model supports PredictStages or not instead of just throwing an error?

python/tvm/auto_scheduler/cost_model/cost_model.py Outdated Show resolved Hide resolved
python/tvm/auto_scheduler/cost_model/cost_model.py Outdated Show resolved Hide resolved
@FrozenGene FrozenGene merged commit 7ef89ad into apache:master Aug 6, 2020
wjliu1998 pushed a commit to wjliu1998/incubator-tvm that referenced this pull request Aug 13, 2020
…#6187)

* add the base class for cost models

* address comments

* Update tests/python/unittest/test_auto_scheduler_cost_model.py

Disable test if user doesn't have llvm

Co-authored-by: Zhao Wu <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
…#6187)

* add the base class for cost models

* address comments

* Update tests/python/unittest/test_auto_scheduler_cost_model.py

Disable test if user doesn't have llvm

Co-authored-by: Zhao Wu <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
…#6187)

* add the base class for cost models

* address comments

* Update tests/python/unittest/test_auto_scheduler_cost_model.py

Disable test if user doesn't have llvm

Co-authored-by: Zhao Wu <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
…#6187)

* add the base class for cost models

* address comments

* Update tests/python/unittest/test_auto_scheduler_cost_model.py

Disable test if user doesn't have llvm

Co-authored-by: Zhao Wu <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Sep 2, 2020
…#6187)

* add the base class for cost models

* address comments

* Update tests/python/unittest/test_auto_scheduler_cost_model.py

Disable test if user doesn't have llvm

Co-authored-by: Zhao Wu <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Sep 3, 2020
…#6187)

* add the base class for cost models

* address comments

* Update tests/python/unittest/test_auto_scheduler_cost_model.py

Disable test if user doesn't have llvm

Co-authored-by: Zhao Wu <[email protected]>
@merrymercy merrymercy deleted the pr-cost-model branch September 27, 2020 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants