From 0a570eddeb806a88117d2e78dd64c2683c5f124e Mon Sep 17 00:00:00 2001 From: Lianmin Zheng Date: Sun, 5 May 2019 16:05:18 +0800 Subject: [PATCH] [TOPI] Fix mali conv2d performance regression (#3131) * [TOPI] fix mali conv * fix typo * address comments --- python/tvm/autotvm/tophub.py | 2 +- topi/python/topi/mali/conv2d.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/tvm/autotvm/tophub.py b/python/tvm/autotvm/tophub.py index 1fa0409def58..850f501cb1fc 100644 --- a/python/tvm/autotvm/tophub.py +++ b/python/tvm/autotvm/tophub.py @@ -42,7 +42,7 @@ 'cuda': "v0.04", 'rocm': "v0.02", 'opencl': "v0.02", - 'mali': "v0.04", + 'mali': "v0.05", 'vta': "v0.04", } diff --git a/topi/python/topi/mali/conv2d.py b/topi/python/topi/mali/conv2d.py index 1d89d7e7cef6..9a333353f41d 100644 --- a/topi/python/topi/mali/conv2d.py +++ b/topi/python/topi/mali/conv2d.py @@ -352,9 +352,11 @@ def _decl_winograd(cfg, data, kernel, strides, padding, dilation, layout, out_dt # unpack output output = tvm.compute((N, CO, H, W), lambda n, co, h, w: Y[co][n * nH * nW + (h//m) * nW + w//m][h % m][w % m] - # thw following term is used to make the padding effective, - # otherwise the padding will be eliminated by bound inference - + tvm.const(0, out_dtype) * M[alpha-1][alpha-1][CO-1][P_round-1], + # The following hack term is used to make the padding in batch gemm ("M") + # effective, otherwise the padding will be eliminated by bound inference. + # Use `tvm.expr.Mul` instead of `*` to avoid issues in const folding. + + tvm.expr.Mul(tvm.const(0, out_dtype), + M[alpha-1][alpha-1][CO-1][P_round-1]), name='output', tag='winograd_conv2d_output') # we have to manually assign effective GFLOP for winograd