tsupei commented on pull request #7111:
URL: https://github.com/apache/tvm/pull/7111#issuecomment-745815015


   @zhiics I try to write a testcase modified from 
[https://github.com/apache/tvm/blob/main/tests/python/topi/python/test_topi_batch_matmul.py](https://github.com/apache/tvm/blob/main/tests/python/topi/python/test_topi_batch_matmul.py)
   
   ```python
   def verify_dynamic_batch_matmul(batch_size, M, N, K):
       dynamic_batch_size = te.var("dynamic_batch_size")
       dynamic_M = te.var("dynamic_M")
       dynamic_N = te.var("dynamic_N")
       dynamic_K = te.var("dynamic_K")
   
       x = te.placeholder((dynamic_batch_size, dynamic_M, dynamic_K), name="x")
       y = te.placeholder((dynamic_batch_size, dynamic_N, dynamic_K), name="y")
       dtype = x.dtype
       ...(skip)
   
   ```
   It seems that `te.var` is not supported in other places.  
   ```bash
   Running on target: llvm -device=arm_cpu
   Cannot find config for target=llvm -keys=arm_cpu,cpu -device=arm_cpu, 
workload=('batch_matmul.x86', ('TENSOR', (dynamic_batch_size, dynamic_M, 
dynamic_K), 'float32'), ('TENSOR', (dynamic_batch_size, dynamic_N, dynamic_K), 
'float32')). A fallback configuration is used, which may bring great 
performance regression.
   Traceback (most recent call last):
     File "tests/python/topi/python/test_topi_batch_matmul.py", line 120, in 
<module>
       test_batch_matmul()
     File "tests/python/topi/python/test_topi_batch_matmul.py", line 116, in 
test_batch_matmul
       verify_dynamic_batch_matmul(1, 16, 16, 32)
     File "tests/python/topi/python/test_topi_batch_matmul.py", line 69, in 
verify_dynamic_batch_matmul
       check_device(device, ctx)
     File "tests/python/topi/python/test_topi_batch_matmul.py", line 60, in 
check_device
       s = fschedule([out])
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/autotvm/task/topi_integration.py",
 line 235, in wrapper
       return topi_schedule(cfg, outs, *args, **kwargs)
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/topi/x86/batch_matmul.py", line 
128, in schedule_batch_matmul
       traverse_inline(s, outs[0].op, _callback)
     File "/home/jojo6174/tvm-installation/tvm/python/tvm/topi/utils.py", line 
68, in traverse_inline
       _traverse(final_op)
     File "/home/jojo6174/tvm-installation/tvm/python/tvm/topi/utils.py", line 
66, in _traverse
       callback(op)
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/topi/x86/batch_matmul.py", line 
106, in _callback
       cfg.define_split("tile_y", M, num_outputs=2)
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/autotvm/task/space.py", line 
730, in define_split
       return self._add_new_transform(SplitSpace, name, axes, policy, **kwargs)
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/autotvm/task/space.py", line 
829, in _add_new_transform
       axes = [x if isinstance(x, (VirtualAxis, Axis)) else self.axis(x) for x 
in axes]
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/autotvm/task/space.py", line 
829, in <listcomp>
       axes = [x if isinstance(x, (VirtualAxis, Axis)) else self.axis(x) for x 
in axes]
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/autotvm/task/space.py", line 
687, in axis
       return VirtualAxis(var)
     File 
"/home/jojo6174/tvm-installation/tvm/python/tvm/autotvm/task/space.py", line 
141, in __init__
       raise RuntimeError("Invalid type of axis: " + str(type(var)))
   RuntimeError: Invalid type of axis: <class 'tvm.tir.expr.Var'>
   
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to