[all-commits] [llvm/llvm-project] 8b61ae: [MLIR][Tensor] Avoid crash on negative dimensions
Rik Huijzer via All-commits
all-commits at lists.llvm.org
Thu Jul 20 01:09:59 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8b61ae4e931842cf909c0365664eb79b65253598
https://github.com/llvm/llvm-project/commit/8b61ae4e931842cf909c0365664eb79b65253598
Author: Rik Huijzer <github at huijzer.xyz>
Date: 2023-07-20 (Thu, 20 Jul 2023)
Changed paths:
M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
A mlir/test/Dialect/Tensor/invalid-canonicalize.mlir
Log Message:
-----------
[MLIR][Tensor] Avoid crash on negative dimensions
In https://reviews.llvm.org/D151611, a check was added to the tensor verifier to
emit an error on negative tensor dimensions. This check allowed for dynamic
dimensions, hence negative dimensions were still able to get through the verifier.
This is a problem in situations such as #60558, where the dynamic dimension is
converted to a static (and possibly negative) dimension by another pass in the
compiler. This patch fixes that by doing another check during the
`StaticTensorGenerate` conversion, and return a failure if the dimension is
negative.
As a side-note, I have to admit that I do not know why returning a failure in
`StaticTensorGenerate` gives a nice "tensor dimensions must be non-negative"
error. I suspect that the verifier runs again when `return failure()` is called,
but I am not sure.
Fixes #60558.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D155728
More information about the All-commits
mailing list