From the discussion about running sparse CNNs, I have implemented prototypes of a dense NCHW GEMM convolution, and what I think is a working CSR NCHW GEMM convolution.
I will share the code once it’s a bit more mature.
I’m doing sparse GEMM convolution first, rather than sparse spatial pack, since there are already sparse GEMM methods in TVM I can leverage, whereas a sparse spatial pack would require some cleverness.
However, when building my standalone function as a module, I am getting the following error:
from tvm.contrib import sparse
# create placeholder tensors
...
n = out_c
k = kdim_h * kdim_w * in_c
sparse_weights = sparse.placeholder((n,k), nonzeros=(1-sparsity)*n*k, name='W') # weights
...
# create output using compositions of te.compute
conv = gemm_conv_sparse(sparse_weights, ...)
# build function
s = te.create_schedule(conv.op)
dtype = 'float32'
func = tvm.build(s, [data, sparse_weights, conv], target=target, name='gemm_conv2d')
# ^ returns ValueError: args must be Tensor, Buffer or Var
Any ideas on how I’d pass my sparse.placeholder
to tvm.build
?