-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ti.bit_shr is broken when the input is unsigned #7650
Comments
ailzhang
added a commit
that referenced
this issue
Apr 7, 2023
Closes #7650 ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at b81d127</samp> Fix the demotion transformation for the bit shift right operation with unsigned integers and add a test case for it. This improves the correctness and test coverage for issue `#2840`. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at b81d127</samp> * Relax demotion condition for bit shift right operation to apply to both signed and unsigned integers ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-d217f2b07d4578612dc805b0f01e5dc1883be9acb906b222a8762313cfd0596bL154-R154)) * Modify demotion transformation for bit shift right operation to cast left operand to unsigned only if originally signed and perform bit shift arithmetic right ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-d217f2b07d4578612dc805b0f01e5dc1883be9acb906b222a8762313cfd0596bL163-R164)) * Add test case for bit shift right operation with unsigned integers in `test_bit_operations.py` ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-ea8fa4876c4d3e866c5c18e9d9d796364c5debf5eae6447e655326ed44f4257cR63-R71))
ailzhang
added a commit
to ailzhang/taichi
that referenced
this issue
Apr 12, 2023
Closes taichi-dev#7650 ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at b81d127</samp> Fix the demotion transformation for the bit shift right operation with unsigned integers and add a test case for it. This improves the correctness and test coverage for issue `taichi-dev#2840`. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at b81d127</samp> * Relax demotion condition for bit shift right operation to apply to both signed and unsigned integers ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-d217f2b07d4578612dc805b0f01e5dc1883be9acb906b222a8762313cfd0596bL154-R154)) * Modify demotion transformation for bit shift right operation to cast left operand to unsigned only if originally signed and perform bit shift arithmetic right ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-d217f2b07d4578612dc805b0f01e5dc1883be9acb906b222a8762313cfd0596bL163-R164)) * Add test case for bit shift right operation with unsigned integers in `test_bit_operations.py` ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-ea8fa4876c4d3e866c5c18e9d9d796364c5debf5eae6447e655326ed44f4257cR63-R71))
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
Closes taichi-dev#7650 ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at b81d127</samp> Fix the demotion transformation for the bit shift right operation with unsigned integers and add a test case for it. This improves the correctness and test coverage for issue `taichi-dev#2840`. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at b81d127</samp> * Relax demotion condition for bit shift right operation to apply to both signed and unsigned integers ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-d217f2b07d4578612dc805b0f01e5dc1883be9acb906b222a8762313cfd0596bL154-R154)) * Modify demotion transformation for bit shift right operation to cast left operand to unsigned only if originally signed and perform bit shift arithmetic right ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-d217f2b07d4578612dc805b0f01e5dc1883be9acb906b222a8762313cfd0596bL163-R164)) * Add test case for bit shift right operation with unsigned integers in `test_bit_operations.py` ([link](https://github.com/taichi-dev/taichi/pull/7757/files?diff=unified&w=0#diff-ea8fa4876c4d3e866c5c18e9d9d796364c5debf5eae6447e655326ed44f4257cR63-R71))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
ti.bit_shr is broken when the input is unsigned because we only transform it to bit_sar(unsigned) when the input is signed, and the codegen assumes that bit_shr should not exist when the ir reaches the codegen.
taichi/taichi/transforms/demote_operations.cpp
Lines 152 to 175 in 6a0b63e
To Reproduce
Log/Screenshots
Please post the full log of the program (instead of just a few lines around the error message, unless the log is > 1000 lines). This will help us diagnose what's happening. For example:
The text was updated successfully, but these errors were encountered: