comaniac opened a new pull request #4276: [TOPI][CUDA] Fix Winograd Kernel Size Support URL: https://github.com/apache/incubator-tvm/pull/4276 The merged PR #4260 fixes the padding issue when building Winograd conv2d for CUDA, but we found the kernel size is still a problem. The constraints of using Winograd on CUDA has been released in the previous PR #3553. Specifically, the original Winograd limits the kernel size (=3x3), padding (=1x1) and strides (=1x1). PR #3553 released them to square kernel size (e.g., 3x3, 5x5, 7x7), strides (=1x1), and arbitrary padding. However, even PR #4260 fixes the miscalculation issue caused by padding size, the miscalculation caused by kernel size is still there. Here is a code snippet in `conv2d_winograd.py` after PR #4260: ```python if not pre_computed: # kernel tensor is raw tensor, do strict check if dilation_h != 1 or dilation_w != 1: kernel = dilation(kernel, (1, 1, dilation_h, dilation_w)) CO, CI, KH, KW = get_const_tuple(kernel.shape) assert HSTR == 1 and WSTR == 1 and KH == KW else: # kernel tensor is pre-transfomred. this op is created by alter op layout. # dilation is not supported _, _, CI, CO = get_const_tuple(kernel.shape) KH = KW = 3 assert HSTR == 1 and WSTR == 1 and dilation_h == 1 and dilation_w == 1 ``` As can be seen, kernel size is forced to 3x3 in the pre-computed case, but it could be any size according to PR #3553. This PR supports the kernel size recovery as follows: ```python alpha, _, CI, CO = get_const_tuple(kernel.shape) KH = KW = alpha + 1 - tile_size ``` Here is another pending issue that I haven't resolved in this PR: the fixed errors in #4260 as well as this PR should be detected by the unit tests but they weren't. The reaons is that the unit test doesn't cover the part with `pre_computed=True`, but I have no idea how to cover it. @cbalint13 @vinx13 could you review and suggest how to improve the unit test? Thanks.
---------------------------------------------------------------- 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] With regards, Apache Git Services
