wrongtest-intellif opened a new pull request, #17465:
URL: https://github.com/apache/tvm/pull/17465

   Below script would either segfault or report primitive error in 
`MetaScheduleTuneIRMod` with dynamic dim.
   
   ```python
   import tvm
   from tvm import relax
   from tvm.relax.frontend import nn
   from tvm.relax.transform import *
   
   class NNModule(nn.Module):
       def __init__(self):
           super().__init__()
           self.fc2 = nn.Linear(784, 128)
   
       def forward(self, x):
           x = self.fc2(x)
           return x
   
   mod, params = NNModule().export_tvm({"forward": {"x": nn.spec.Tensor(("n", 
784), "float32")}})
   mod.show()
   
   # with tvm.target.Target("cuda -max_threads_per_block=4096 
-max_shared_memory_per_block=8192 -arch=sm_70"):
   with tvm.target.Target("llvm -num-cores 32"):
       mod = LegalizeOps()(mod)
       mod = AnnotateTIROpPattern()(mod)
       mod = FoldConstant()(mod)
       mod = FuseOps()(mod)
       mod = FuseTIR()(mod)
       mod = MetaScheduleTuneIRMod({}, "myworkingdir", 3)(mod)
       application_pass = MetaScheduleApplyDatabase( "myworkingdir")
       mod = application_pass(mod)
       
   print(mod)
   m = relax.build(mod, target="llvm", pipeline="default_build")
   ```
   
   The change fix two related issues:
   
   1. `GetLoopIntExtent()` would return nullptr on non-const extent, thus the 
return value should check the nullity.
   
   2. `tir::SamplePerfectTile()` return -1 for dynamic factor part. While the 
`Split` primitive require None rv to denotes the dynamic dim inference. Thus it 
should handle this semantic gap in schedule interfaces.


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