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

[TIR] Fix of inter thread reduction with shared memory prefetch #16406

Merged
merged 3 commits into from
Jan 21, 2024

Conversation

LeiWang1999
Copy link
Contributor

@LeiWang1999 LeiWang1999 commented Jan 16, 2024

This is a fix of LowerCrossThreadReduction: The pass will remove all the loops with thread bind under the inter thread reduction block, which will introduce some issues when we meet the case where there could be other non-reduction blocks under the reduction thread.

Before removing a thread-bound loop, check if the block(s) under this loop has reduction block var. If the block(s) under have reduction do not have any reduction block var, it means that block is not reduction, and therefore this thread-bound loop should be kept. Otherwise, we remove the thread-bound loop as usual.

related discussion: https://discuss.tvm.apache.org/t/missing-thread-bind-loops-under-block-reduction-when-transformed-with-tir/16232/6

Please CC @MasterJH5574

@LeiWang1999 LeiWang1999 changed the title [TIR] Fix of inter thread reduction with shared memory prefetch. [TIR] Fix of inter thread reduction with shared memory prefetch Jan 16, 2024
@LeiWang1999
Copy link
Contributor Author

@tvm-bot rerun

@MasterJH5574
Copy link
Contributor

Thank you @LeiWang1999 for the fix! Could you also add a regression test case here in this file? https://github.com/apache/tvm/blob/main/tests/python/tir-transform/test_tir_transform_lower_cross_thread_reduction.py

@LeiWang1999
Copy link
Contributor Author

Thank you @LeiWang1999 for the fix! Could you also add a regression test case here in this file? https://github.com/apache/tvm/blob/main/tests/python/tir-transform/test_tir_transform_lower_cross_thread_reduction.py

for sure, please check out the update.

@LeiWang1999
Copy link
Contributor Author

@tvm-bot rerun

Update lower_cross_thread_reduction.cc
@junrushao junrushao merged commit 81f8690 into apache:main Jan 21, 2024
17 checks passed
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