Hello All,
I have been using MLIR for about 6 months now, I spotted a problem in the ComposeSubView.cpp file, essentially the code does not check that all strides in the subviews involved in the transformation are 1 but it assumes so, hence a bug.
// Offsets, sizes and strides OpFoldResult for the combined 'SubViewOp'.
SmallVector<OpFoldResult> offsets, sizes, strides;
// Because we only support input strides of 1, the output stride is also
// always 1.
// NOTE: strides is an empty small vector here, hence the test below will not
// work as intended, the check for all strides being 1 is never performed, but it
// is assumed later
if (llvm::all_of(strides, [](OpFoldResult &valueOrAttr) {
Attribute attr = valueOrAttr.dyn_cast<Attribute>();
return attr && attr.cast<IntegerAttr>().getInt() == 1;
})) {
strides = SmallVector<OpFoldResult>(sourceOp.getMixedStrides().size(),
rewriter.getI64IntegerAttr(1));
} else {
return failure();
}