You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Lucien0 (via GitHub)" <gi...@apache.org> on 2023/08/14 07:17:56 UTC

[GitHub] [tvm] Lucien0 commented on pull request #15547: [TVMScript] Create loop var with min_val dtype in for frame

Lucien0 commented on PR #15547:
URL: https://github.com/apache/tvm/pull/15547#issuecomment-1676803133

   Thanks for reply. I think these two problems can be shown in one example:
   
   ```
   uint_var = T.call_extern("uint32", "some_function")
   divided_var = T.truncdiv(128, uint_var)
   for i in range(divided_var):
       xxx
   
   if divided_var % 4 == 0:
       xxx
   ```
   
   1. Our hardware has an architecture like OpenCL, here this function may like get_local_id. I used the divided_var after the for loop in mod, which will analysis its min_val in pass lower intrin. If set to int, its min_val will be -128 rather than 0.
   Actually, I can indeed cast like `for i in range(T.int32(divided_var))`, but it is horrible to add this in every for statement and is unnecessary. Just let the variable adapt to the later type.
   
   3. I just create uint var through call_extern. 
   
   BTW, I come from Arm China. And we discovered this issue when utilizing TVM Script to create a DSL for our custom operators during the process of writing the actual operators. cc @Johnson9009 
   
    
   


-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org