comaniac opened a new pull request #4260: [TOPI] Fix bug in Winograd on CUDA
URL: https://github.com/apache/incubator-tvm/pull/4260
 
 
   Several topics [1, 2, 3] in the discuss mention that the conv2d failed to 
pass the shape checking in the runtime after the conv2d has been tuned by 
AutoTVM. This PR investigated the reason and resolved the issue. (thanks the 
help from @kevinthesun, @Laurawly  and @vinx13 with the investigation).
   
   **Investigation**
   All errors happen at the same dimension: the output image height 
(arg2.shape[2]).
   For example in [1], the workload has input (1, 80, 73, 73) with stride=1 and 
padding=0, so the output shape should be (1, 192, 71, 71). However, it 
encountered the following error:
   
   ```bash
   TVMError: Check failed: ret == 0 (-1 vs. 0) : Assert fail: (73 == 
int32(arg2.shape[2])), Argument arg2.shape[2] has an unsatisfied constraint
   ```
   It means that somehow the output shape is set to 73 instead of 71 during 
scheduling. After digging into the code, we found that Winograd schedule 
overrides the strides and padding to be 1 regardless the input workload. It 
should be caused by a previous PR that enhance the Winograd to support 
different padding and kernel sizes.
   
   **Modification**
   Accordingly, this PR modified two parts. First, we get the stride and 
padding directly from the input workload and check if it is valid like 
previous. This change passed the isolated 
[example](https://gist.github.com/idy002/6f846c02a05d9b1d8e01ab77638e7226) that 
yyding provided in the TVM discuss.
   
   Second, the Winograd unittest uses fallback config, but the Winograd 
schedule will fallback to the direct template if the config is fallback. It 
means the alter layer for Winograd schedule is never tested. This PR also 
forced the fallback to be False to enable the testing, which was suggested by 
@vinx13.
   
   [1] 
https://discuss.tvm.ai/t/auto-tune-error-occurs-during-inference-when-using-auto-tuned-schedule
   [2] https://discuss.tvm.ai/t/error-float16-for-cuda-with-autotvm
   [3] 
https://discuss.tvm.ai/t/graphruntime-module-run-failed-when-created-with-logfile-from-autotvm-tuning

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to