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

[AutoSchedule] Support multiple cache read and fix bugs #6686

Merged
merged 10 commits into from
Oct 19, 2020

Conversation

comaniac
Copy link
Contributor

This PR improves the cache read sketch generation rule in auto-scheduler to support multiple cache reads. Previously, cache read sketch generation rule will simply give up if a tensor has multiple consumers. This results in all consumers read that tensor directly from the host memory, which hurts the performance a lot. This PR resolves this limitation.

In addition, this PR also fixes the following bugs/issues:

  • Consider max_threads_per_block in cross thread reduction rule condition, so that we can guarantee computation intensive ops won't have cross thread reduction sketch, which usually doesn't help.
  • Add .d suffix to the name of redundant cache read ops to avoid conflict. Without this change, auto-scheduler outputs Python schedule APIs won't work for multiple cache reads.
  • Add a new constructor of ComputeDAG by taking a schedule, so that we can enforce stage order consistency.

cc @merrymercy @jcf94 @tqchen

@comaniac comaniac requested a review from merrymercy October 14, 2020 21:39
@merrymercy merrymercy self-assigned this Oct 15, 2020
Copy link
Contributor

@jcf94 jcf94 left a comment

Choose a reason for hiding this comment

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

Looks good.
And the add of taking schedule as an input of ComputeDAG is really a good way to simplify many problems.

src/auto_scheduler/compute_dag.cc Show resolved Hide resolved
src/te/schedule/schedule_dataflow_rewrite.cc Show resolved Hide resolved
@comaniac
Copy link
Contributor Author

The failed case in CI seems related to #6417

@merrymercy merrymercy merged commit c5dc98c into apache:main Oct 19, 2020
@comaniac comaniac deleted the ansor_for_backward branch October 19, 2020 22:52
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Oct 29, 2020
* Add shape to DAG print

* avoid useless cross-thread reduction

* Fix stage order

* support multiple cache_read

* lint

* fix

* fix

* address comment

* fix ci

* Trigger CI & Update doc strings

Co-authored-by: Lianmin Zheng <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
* Add shape to DAG print

* avoid useless cross-thread reduction

* Fix stage order

* support multiple cache_read

* lint

* fix

* fix

* address comment

* fix ci

* Trigger CI & Update doc strings

Co-authored-by: Lianmin Zheng <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
* Add shape to DAG print

* avoid useless cross-thread reduction

* Fix stage order

* support multiple cache_read

* lint

* fix

* fix

* address comment

* fix ci

* Trigger CI & Update doc strings

Co-authored-by: Lianmin Zheng <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
* Add shape to DAG print

* avoid useless cross-thread reduction

* Fix stage order

* support multiple cache_read

* lint

* fix

* fix

* address comment

* fix ci

* Trigger CI & Update doc strings

Co-authored-by: Lianmin Zheng <[email protected]>
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.

3 participants