[all-commits] [llvm/llvm-project] a8f386: [mlir][tensor] Fix bug in `tensor.extract(tensor.f...
Rafael Ubal via All-commits
all-commits at lists.llvm.org
Tue Dec 12 07:37:05 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a8f3860bcb644d724275f51e7db7b291c7a3f4df
https://github.com/llvm/llvm-project/commit/a8f3860bcb644d724275f51e7db7b291c7a3f4df
Author: Rafael Ubal <rubal at mathworks.com>
Date: 2023-12-12 (Tue, 12 Dec 2023)
Changed paths:
M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
M mlir/test/Dialect/Tensor/canonicalize.mlir
Log Message:
-----------
[mlir][tensor] Fix bug in `tensor.extract(tensor.from_elements)` folder (#75109)
The folder for `tensor.extract` is not operating correctly when it is
consuming the result of a `tensor.from_elements` operation.
The existing unit test named `@extract_from_tensor.from_elements_3d` in
`mlir/test/Dialect/Tensor/canonicalize.mlir` seems an attempt to stress
this code. However, this unit tests creates a `tensor.from_elements` op
exclusively from constants, which gets folded away into a single
constant tensor. Therefore, the buggy code was never executed in unit
tests.
I have added a new unit test named
`@extract_from_tensor.from_elements_variable_3d` that makes sure the
`tensor.from_elements` op is not folded away by having its input
operands come directly from function arguments. The original folder code
would have made this test fail.
This bug was notably affecting the lowering of the `tosa.pad` op in the
`tosa-to-tensor` pass, where the generated code is likely to contain a
`tensor.from_elements` + `tensor.extract` op sequence.
More information about the All-commits
mailing list