cyx-6 commented on PR #14318:
URL: https://github.com/apache/tvm/pull/14318#issuecomment-1472681942

   Hi @Lunderberg Here, we migrate from dispatch to the direct computation 
based on following concerns:
   
   1.  Methods like `T.Add` do not support the feature of auto-value-promotion, 
eg. `T.int64 + 1`.
   2. For your concerns about `0 < x`, current TVMScript parser does dispatch 
these logic ops, like `<, >, !=`. For those direct computation operators, 
Python support to overload the `__radd__`, as `1 + x` will be parsed as 
`T.Add(1, x)`. So we do not worry about the implicit swap in binary operators 
over `non-PrimExpr op PrimExpr`.
   4. As for unittests, there are very few cases when dispatch is neccessary, 
like `x + 0` generated by meta-schedule. Both dispatch and direct computation 
make no difference in most of our unittests set. Refer to #14200, there are 
only 5 unittests making difference.
   5. And direct computation keeps consistent with the `PrimExpr` original 
logic as much as possible. And we do offer directly calling `T.Add` in 
TVMScript as backdoor, if needed in unittests.
   6. Actually, the constants folding only occurs between non-PrimExpr, like `1 
+ 1`, and some `IntImm`, `FloatImm`.


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