[all-commits] [llvm/llvm-project] 455305: [mlir][Index] Implement InferIntRangeInterface
Krzysztof Drewniak via All-commits
all-commits at lists.llvm.org
Thu Jan 19 09:48:36 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 455305624884cf9237143e2ba0635fcc5ba5206a
https://github.com/llvm/llvm-project/commit/455305624884cf9237143e2ba0635fcc5ba5206a
Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
Date: 2023-01-19 (Thu, 19 Jan 2023)
Changed paths:
M mlir/include/mlir/Dialect/Index/IR/IndexOps.h
M mlir/include/mlir/Dialect/Index/IR/IndexOps.td
A mlir/include/mlir/Interfaces/Utils/InferIntRangeCommon.h
M mlir/lib/Dialect/Arith/IR/CMakeLists.txt
M mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp
M mlir/lib/Dialect/Index/IR/CMakeLists.txt
A mlir/lib/Dialect/Index/IR/InferIntRangeInterfaceImpls.cpp
M mlir/lib/Interfaces/CMakeLists.txt
A mlir/lib/Interfaces/Utils/CMakeLists.txt
A mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
A mlir/test/Dialect/Index/int-range-inference.mlir
Log Message:
-----------
[mlir][Index] Implement InferIntRangeInterface
Implement InferIntRangeInterface for all operations in the Index dialect. The
inference implementation, unlike the one for Arith, accounts for the
fact that Index can be either 64 or 32 bits long by evaluating both
cases. Bounds are stored as if index were i64, but when inferring new
bounds, we compute both f(...) and f(trunc(...)). We then compare
trunc(f(...)) to f(trunc(...)). If they are equal in the relevant
range components, we use the 64-bit range computation, otherwise we
give the range ext(f(trunc(...))) union f(...).
Note that this can cause surprising behavior as seen in the tests,
where, for example, the order of min and max operations impacts the
behavior of the inference. The inference could perhaps be made more
precise in the future (ex. by tracking 32 and 64-bit results
separately and having them influence each other somehow) butt, since
my project targets an index=i32 platform and doesn't see index-valued
values > uint32_max, I'm not too concerned about it.
Depends on https://reviews.llvm.org/D141299
Depends on https://reviews.llvm.org/D141296
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D140899
More information about the All-commits
mailing list