masahi commented on a change in pull request #10689:
URL: https://github.com/apache/tvm/pull/10689#discussion_r836009106



##########
File path: src/tir/schedule/primitive/sampling.cc
##########
@@ -299,22 +299,12 @@ std::vector<int64_t> 
SamplePerfectTile(support::LinearCongruentialEngine::TRandS
     return SamplePerfectTile(rand_state, extent, n_splits);
   }
   CHECK_GE(n_splits, 2) << "ValueError: Cannot tile a loop into " << n_splits 
<< " splits";
-  std::vector<int32_t> innermost_candidates;
-  innermost_candidates.reserve(max_innermost_factor);
-  for (int32_t i = 1; i <= max_innermost_factor; ++i) {
-    if (extent % i == 0) {
-      innermost_candidates.push_back(i);
+  while (true) {
+    std::vector<int64_t> result = SamplePerfectTile(rand_state, extent, 
n_splits);
+    if (result.back() <= max_innermost_factor) {
+      return result;

Review comment:
       Yes, `extent = 1024`, `max_innermost_factor = 128` and `n_splits=2`.
   
   It hangs on the second call to `schedule_batch_matmul`, where 
`SamplePerfectTile` keeps returning 1024. The following alternative definition 
works fine:
   
   ```
   def schedule_rule_batch_matmul_vnni(sch: tir.Schedule, bmm_block):
       schedule_batch_matmul(bmm_block, None, True, sch, 
layout_trans_compute_root=False)
       return [sch]
   ```
   
   I think the issue has to be related to the use of `rand_state`, since this 
is the only stateful input to `SamplePerfectTile(rand_state, extent, 
n_splits)`. Note that I'm applying the same schedule on two copies of `sch`. 
Maybe when I make a copy of schedule by `sch_copy = sch.copy()`, the RNG engine 
is not copied?




-- 
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]


Reply via email to