[mlir][VectorOps] Redo the scalar loop emission in VectoToSCF to pad instead of clipping

This replaces the select chain for edge-padding with an scf.if that
performs the memory operation when the index is in bounds and uses the
pad value when it's not. For transfer_write the same mechanism is used,
skipping the store when the index is out of bounds.

The integration test has a bunch of cases of how I believe this should
work.

Differential Revision: https://reviews.llvm.org/D87241
This commit is contained in:
Benjamin Kramer
2020-09-07 17:39:16 +02:00
parent 67b37f571c
commit 239eff502b
4 changed files with 151 additions and 158 deletions

View File

@@ -1096,7 +1096,7 @@ static bool isContiguous(MemRefType memRefType,
SmallVectorImpl<int64_t> &strides) {
int64_t offset;
auto successStrides = getStridesAndOffset(memRefType, strides, offset);
bool isContiguous = (strides.back() == 1);
bool isContiguous = strides.empty() || strides.back() == 1;
if (isContiguous) {
auto sizes = memRefType.getShape();
for (int index = 0, e = strides.size() - 2; index < e; ++index) {