Quantcast
Channel: Overflows during folding of basic `arith` ops
Browsing all 12 articles
Browse latest View live

Overflows during folding of basic `arith` ops

Currently, basic arith operations can overflow during folding. For example, module { func.func @main() -> i8 { %0 = arith.constant 200 : i8 %1 = arith.constant 99 : i8 %2 = arith.addi %0, %1 : i8...

View Article



Overflows during folding of basic `arith` ops

I am not an expert at this, but I expect this may be related to the effort to align llvm and arith with respect to poison semantics (and supporting the nsw flag from the language reference: LLVM...

View Article

Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

Rik: the addition operations is the same for signed and unsigned integers in two’s complement arithmetic except when overflow occurs. I don’t quite follow the “except”: 2 complement should work...

View Article

Overflows during folding of basic `arith` ops

Separate operations (perhaps in another dialect?) for “checked arithmetic” would seem to be the right solution for modeling overflow checking (e.g. for C# checked arithmetic or GCC checked builtins ),...

View Article

Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

mehdi_amini: I don’t quite follow the “except”: 2 complement should work through overflow. What would you except as a difference? For example, a situation that I ran into was one with two constants:...

View Article


Overflows during folding of basic `arith` ops

I think the confusion might be here that arith.adids documentation is underspecified in this case. See [RFC] Define precise arith semantics e.g. Is it possible that you are expecting some particular...

View Article

Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

Rik: For the signed integers, however, the range is -128 to 127. Then, the result of the addition is an overflow since 130 is bigger than 127. That is back to what I wrote before: you may seem to...

View Article

Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

zero9178: I think the confusion might be here that arith.adids documentation is underspecified in this case. See [RFC] Define precise arith semantics e.g. Is it possible that you are expecting some...

View Article


Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

Rik: Well, I’m probably misunderstanding here, but I would expect the compiler (both MLIR and LLVM) to prefer correctness Sure but “correctness” has to refer to a spec. The “signed integer can’t...

View Article


Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

mehdi_amini: The “signed integer can’t overflow” expectation isn’t universal I believe (and “unsigned integer wrap around” isn’t either). Thanks for your clarification again. I was watching some...

View Article

Overflows during folding of basic `arith` ops

In general, 2s complement behavior on overflow is well-defined and well-understood. Keep in mind that the arith dialect is typically a component at a very low level of your complete software stack....

View Article

Image may be NSFW.
Clik here to view.

Overflows during folding of basic `arith` ops

Rik: Many applications would suffer severely from overflows, right? For example, CNC drill positioning or bank transfers. I don’t think we’re looking at it the same way. A question for you would be:...

View Article
Browsing all 12 articles
Browse latest View live




Latest Images