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



##########
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:
       😱 seems not!!!!!
   
   
https://github.com/junrushao1994/tvm/blob/673355b2a423dfbb8f5e311cfd74503ae91fbba9/src/tir/schedule/concrete_schedule.cc#L189
   
   We didn't set the new random state by:
   
   ```C++
   n->rand_state_ = self->ForkSeed(); // (also we need to change the Copy 
method to a non-const one)
   ```
   
   and thus likely the state is always some default value......I'm very 
surprised that we didn't find out in previous performance alignment.
   
   Would you mind sending a quick PR fixing this dangerous behavior? Thanks a 
lot!




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