tlopex opened a new pull request, #20461:
URL: https://github.com/apache/tvm/pull/20461

   The same as #20445 but for the main. This pr fixes incorrect code generation 
for boolean `BitwiseNot`.
   
   For boolean values, bitwise NOT should flip `false` to `true` and `true` to 
`false`. The current C code generator emits `~value`, but C/C++ first converts 
the boolean to an integer:
   
   - `~false` becomes `~0`, which is `-1`.
   - `~true` becomes `~1`, which is `-2`.
   
   Both results are nonzero, so converting them back to boolean produces `true` 
in both cases. CUDA boolean vectors have a related problem: their generated 
vector types do not support the `~` operator, causing compilation to fail.
   
   This change emits `value == false` for boolean operands. It produces the 
correct result for scalar booleans and uses the existing vector comparison code 
to apply the operation to each lane. Integer operands continue to use `~value`..


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to