llvm/mlir
Lei Zhang cb2e651800 [mlir][linalg] Fix incorrect bound calculation for tiling conv
For convolution, the input window dimension's access affine map
is of the form `(d0 * s0 + d1)`, where `d0`/`d1` is the output/
filter window dimension, and `s0` is the stride.

When tiling, https://reviews.llvm.org/D109267 changed how the
way dimensions are acquired. Instead of directly querying using
`*.dim` ops on the original convolution op, we now get it by
applying the access affine map to the loop upper bounds. This
is fine for dimensions having single-dimension affine maps,
like matmul, but not for convolution input. It will cause
incorrect compuation and out of bound. A concrete example, say
we have 1x225x225x3 (NHWC) input, 3x3x3x32 (HWCF) filter, and
1x112x112x3 (NHWC) output with stride 2, (112 * 2 + 3) would be
227, which is different from the correct input window dimension
size 225.

Instead, we should first calculate the max indices for each loop,
and apply the affine map to them, and then plus one to get the
dimension size. Note this makes no difference for matmul-like
ops given they will have `d0 - 1 + 1` effectively.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D110849
2021-09-30 13:50:57 -04:00
..
cmake/modules [mlir][python] Simplify python extension loading. 2021-09-03 00:43:28 +00:00
docs [mlir] Add min/max operations to Standard. 2021-09-28 09:40:22 +02:00
examples [mlir] Add value_begin/value_end methods to DenseElementsAttr 2021-09-21 01:57:43 +00:00
include [mlir] Remove old "tc" linalg ods generator. 2021-09-30 16:30:06 +00:00
lib [mlir][linalg] Fix incorrect bound calculation for tiling conv 2021-09-30 13:50:57 -04:00
python [mlir][python] provide bindings for ops from the sparse_tensor dialect 2021-09-30 15:53:16 +02:00
test [mlir][linalg] Fix incorrect bound calculation for tiling conv 2021-09-30 13:50:57 -04:00
tools [mlir] Remove old "tc" linalg ods generator. 2021-09-30 16:30:06 +00:00
unittests [ODS/AsmParser] Don't pass MLIRContext with DialectAsmParser. 2021-09-30 05:10:28 +00:00
utils Update MLIR generate-test-checks.py to add the notice from the source into the generated file 2021-09-20 23:19:40 +00:00
.clang-format
.clang-tidy
CMakeLists.txt MLIR can't support -Bsymbolic link option, fail at CMake time with a helpful message instead of broken runtime 2021-09-26 00:36:31 +00:00
LICENSE.TXT
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.