[all-commits] [llvm/llvm-project] cfdea8: [MLIR][Tosa] Fix fp canonicalization for `clamp`
Rik Huijzer via All-commits
all-commits at lists.llvm.org
Wed Jun 7 11:08:29 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cfdea8f5bb6b0138719c5b4f3fe1616b6ea915a7
https://github.com/llvm/llvm-project/commit/cfdea8f5bb6b0138719c5b4f3fe1616b6ea915a7
Author: rikhuijzer <rikhuijzer at pm.me>
Date: 2023-06-07 (Wed, 07 Jun 2023)
Changed paths:
M mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
M mlir/test/Dialect/Tosa/canonicalize.mlir
Log Message:
-----------
[MLIR][Tosa] Fix fp canonicalization for `clamp`
The canonicalization for `clamp` removed the `clamp` operation when the
chosen min and max values were outside the range of what is possible to
represent with the input type. For example, if the input type is `i8`,
then the min and max values must be between -128 and 127. If the min and
max are, say, -200 and 200, then the `clamp` operation can be safely
removed.
However, as pointed out by @wyanzhao, this is wrong for floating point
types since they can represent infinity.
Fixes #62341.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D152123
More information about the All-commits
mailing list