tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[BUG] Schedule that doesn't support dynamic height/width is selected when compiling convolution for `arm_cpu`

Open lhutton1 opened this issue 1 year ago • 0 comments

Expected behaviour:

When an arm_cpu target is used, the model should compile successfully without an error.

Actual behaviour:

When compiled on an arm_cpu target, the models results in the following error:

python/tvm/autotvm/task/topi_integration.py:165: in wrapper
node = topi_compute(cfg, *args)
python/tvm/topi/arm_cpu/conv2d.py:50: in conv2d_nchw_spatial_pack
return conv2d_spatial_pack_nchw(

def conv2d_spatial_pack_nchw(cfg, data, kernel, strides, padding, dilation, out_dtype, num_tile):
    """compute define for Conv2d Spatial Pack with NCHW layout"""
    out_dtype = out_dtype or data.dtype
    N, CI, IH, IW = get_const_tuple(data.shape)
    if isinstance(N, tvm.tir.Any):
        N = tvm.te.size_var("n")
    if not isinstance(IH, int) or not isinstance(IW, int):
>           raise RuntimeError("ARM winograd conv2d doesn't support dynamic input height or width.")
E           RuntimeError: ARM winograd conv2d doesn't support dynamic input height or width.

Environment:

Tested with TVM at https://github.com/apache/tvm/commit/6a3fadc0654ecf9557ffe08d24677684c96e80b0. The issue was found as a result of the changes in https://github.com/apache/tvm/pull/16513, however it can be reproduced without as described below.

How to reproduce:

Run the following tests:

  • pytest tests/python/relay/test_any.py -k test_any_conv2d

with an arm_cpu target. Note: Reminder to remove any skip condition that exists in the test currently.


Likely schedule selection in relay/strategy/arm_cpu.py needs to be fixed not to select a schedule that doesn't support dynamic height/width.

lhutton1 avatar Feb 07 '24 10:02 lhutton1