[Compiler] Cannot compile operator mean for CUDA target


#1

I was trying to compile a model containing a mean operator with CUDA target. It gives the error message as the following.

Traceback (most recent call last):
  File "/home/ubuntu/unison/tvm/python/tvm/_ffi/_ctypes/function.py", line 55, in cfun
    rv = local_pyfunc(*pyargs)
  File "/home/ubuntu/unison/tvm/topi/python/topi/cuda/reduction.py", line 127, in schedule_reduce
    traverse_after_reduce(outs[0].op)
  File "/home/ubuntu/unison/tvm/topi/python/topi/cuda/reduction.py", line 110, in traverse_after_reduce
    raise RuntimeError("Not yet support ewise after reduce")
RuntimeError: Not yet support ewise after reduce

Is this a bug or expected behavior. What needs to be done in order to support this operator for CUDA target? This script can reproduce the issue:

 import tvm
 import nnvm
 
 data = nnvm.sym.Variable('data')
 ret = nnvm.sym.mean(data, axis=(1, 2), keepdims=True)
 data_shapes = {'data': (1, 24, 24)}
 graph = nnvm.graph.create(ret)
 with open('test_mean.json', "w") as fo:
     fo.write(graph.json())
 target = tvm.target.cuda()
 opt_level = 3
 with nnvm.compiler.build_config(opt_level=opt_level):
     graph, lib, params = nnvm.compiler.build(
         graph, target, shape=data_shapes, target_host='llvm -target=x86_64-linux-gnu')

#2

can you update your tvm and try again? Very recently I reviewed the PR which should solve your issue.


#3

Thanks. I have verified it’s been fixed.