yzh119 commented on issue #14906:
URL: https://github.com/apache/tvm/issues/14906#issuecomment-1565940775

   Hi @uslumt , The reason you cannot parallelize the loop is because the 
`compute block` is not a reduction block.
   
   A reduction block should have an init block indicating how to initialize the 
output buffer, in your case, to make `compute` a reduction block, you need to 
write a `T.init` inside the block body:
   ```python
       for b, o, h, w, kc, kh, kw in T.grid(10, 2, 124, 124, 3, 3, 3):
               with T.block("compute"):
                   vb, vo, vh, vw, vkc, vkh, vkw = T.axis.remap("SSSSRRR", [b, 
o, h, w, kc, kh, kw])
                   with T.init():
                         result_compute[vb, vo, vh, vw] = T.float32(0)
                   result_compute[vb, vo, vh, vw] = result_compute[vb, vo, vh, 
vw] + input[vb, vkc, vh+vkh, vw+vkw] * kernel[vo, vkc, vkh, vkw]
   ```
   
   Another issue with your program is you seem annotate all block axes as 
"reduction", which is wrong because in `compute` block, `b, o, h, w` should be 
"spatial" axes. If you don't understand how to differentiate spatial/reduce 
axis, you could go through this tutorial first: 
https://mlc.ai/chapter_tensor_program/case_study.html.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to