[mlir] Added verification check for linalg.conv to ensure memrefs are of rank > 2
authorJakub Lichman <limo@google.com>
Thu, 23 Jul 2020 10:26:05 +0000 (12:26 +0200)
committerAlex Zinenko <zinenko@google.com>
Thu, 23 Jul 2020 10:27:05 +0000 (12:27 +0200)
commit919922b0c20e99de51bb0d06c98a5fc2fa5feec4
tree52e8b2681e67590ac2ab104f6e6340649aeef2b1
parent722e5d6aaeb5ec0e75506de19e582302c65734cc
[mlir] Added verification check for linalg.conv to ensure memrefs are of rank > 2

linalg.conv does not support memrefs with rank smaller than 3 as stated here:
https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/nn/convolution

However it does not verify it and thus crashes with "LLVM ERROR: out of memory"
error for 1D case and "nWin > 0 && "expected at least one window dimension"" assertion
for 2D case. This commit adds check for that in the verification method.

Differential Revision: https://reviews.llvm.org/D84317
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/Dialect/Linalg/invalid.mlir