ganler edited a comment on pull request #8706:
URL: https://github.com/apache/tvm/pull/8706#issuecomment-897311045


   @YuchenJin Good question to discuss. 
   
   As I said a more thorough fix would be supporting `CastNode` in constant 
folding, but it can be tricky. In this PR, I only made a safe/harmless change 
by casting lower-bit `uint` constant value to higher-bit `int`. 
   
   However, when we have, say `int32` and `uint32`, the question is that how 
should we perform casting? i.e., what is the logic of `op(int32(lhs), 
uint32(rhs))`? In TVM, we will cast all types to a signed integer with maximum 
bits (regarding the operands). i.e., `op(int32(lhs), int32(uint32(rhs)))`. But 
here, `int32(uint32(rhs))` is not `IntImm` but `CastNode`... Then your question 
would be: shall we directly evaluate the `CastNode` during casting (all so need 
to change the value of `IntImm`).
   
   
![image](https://user-images.githubusercontent.com/38074777/129131777-4b4c88db-4c85-4eaa-a4aa-e34fd5995373.png)
   
   


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