You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/17 20:10:40 UTC

[GitHub] [tvm] zxybazh opened a new pull request, #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

zxybazh opened a new pull request, #13421:
URL: https://github.com/apache/tvm/pull/13421

   This PR fixes an issue that would cause dynamic loop when reorder is applied during auto binding incorrectly. This would cause failed cuda kernel generation. This PR provided a fix by patching the binding function with `allow_reorder` argument.
   
   Test is also added and locally tested on `nvidia/geforce-rtx-3070` target.
   
   Thanks for @junrushao for the guidance and @yelite for reporting this issue.


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tvm-bot commented on pull request #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13421:
URL: https://github.com/apache/tvm/pull/13421#issuecomment-1319145616

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on a diff in pull request #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

Posted by GitBox <gi...@apache.org>.
junrushao commented on code in PR #13421:
URL: https://github.com/apache/tvm/pull/13421#discussion_r1025696792


##########
src/meta_schedule/schedule/cuda/thread_bind.cc:
##########
@@ -55,14 +55,14 @@ std::function<ExprRV(int64_t)> MakeFactorSampler(Schedule sch, Array<Integer> th
 
 Array<LoopRV> BindSpatialLoop(Schedule sch, LoopRV loop, int64_t max_threadblocks,
                               int64_t max_threads_per_block,
-                              std::function<ExprRV(int64_t)> get_factor) {
+                              std::function<ExprRV(int64_t)> get_factor, bool allow_reorder) {
   int64_t extent = -1;
   if (const int64_t* e = as_const_int(sch->Get(loop)->extent)) {
     extent = *e;
   } else {
     extent = std::numeric_limits<int64_t>::max();
   }
-  if (extent <= max_threadblocks * max_threads_per_block) {
+  if (extent <= max_threadblocks * max_threads_per_block || !allow_reorder) {
     if (!get_factor) {
       get_factor = MakeFactorSampler(sch, {32, 64, 128, 256, 512, 1024});
     }

Review Comment:
   let's instead do this:
   
   ```c++
   if (extent <= xxx) {
   } else if (allow_reorder) {
     split by [None, max_threadblocks, max_threads_per_block];
   } else {
     split by [max_threadblocks, max_threads_per_block, None];
   }
   ```



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #13421:
URL: https://github.com/apache/tvm/pull/13421#issuecomment-1319147667

   CC @junrushao @Hzfengsy 


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao commented on a diff in pull request #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

Posted by GitBox <gi...@apache.org>.
junrushao commented on code in PR #13421:
URL: https://github.com/apache/tvm/pull/13421#discussion_r1025925326


##########
tests/python/unittest/test_meta_schedule_tune_tir.py:
##########
@@ -32,6 +32,96 @@
 logging.basicConfig()
 logging.getLogger("tvm.meta_schedule").setLevel(logging.DEBUG)
 
+# fmt: off
+@tvm.script.ir_module

Review Comment:
   please move this test to `tests/python/unittest/test_meta_schedule_space_cuda_winograd.py`



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] zxybazh commented on pull request #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

Posted by GitBox <gi...@apache.org>.
zxybazh commented on PR #13421:
URL: https://github.com/apache/tvm/pull/13421#issuecomment-1320707871

   Test integrated into the cuda winograd search space. Please take a 2nd look, thanks!


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] junrushao merged pull request #13421: [MetaSchedule] Fix Dynamic Loop from AutoBinding

Posted by GitBox <gi...@apache.org>.
junrushao merged PR #13421:
URL: https://github.com/apache/tvm/pull/13421


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org