-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Inconsistent results for mlir arith shift operations #80960
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
Comments
There is an unfortunate inconsistency between the llvm Support lib ( So your code gets lowered to undefined behavior even though the arith dialect should theoretically allow it. |
… amounts (#82133) This patch aligns the shift Ops in `arith` with respective LLVM instructions. Specifically, shifting by an amount equal to the bitwidth of the operand is now defined to return poison. Relevant discussion: https://discourse.llvm.org/t/some-question-on-the-semantics-of-the-arith-dialect/74861/10 Relevant issue: #80960
We have now updated the documentation to align it with the underlying LLVM instruction, which means that a shift amount equal to the bitwidth of the operand will return poison. This doesn't "fix" the issue that the results are inconsistent but it explains why these inconsistent results are to be expected. |
I have the following MLIR program:
test.mlir:
The above MLIR program can be lowered and executed using the following commands:
However, it has inconsistent results over multiple runs.
Is there some problem in the above arith shift operations?
My git version is adbf21f.
The text was updated successfully, but these errors were encountered: