When building operation using edsc, I can’t put AffineMin\Max Values as indices for AffineIndexedValue.
AffineIndexedValue iv(input), fv(filters), ov(convRes);
Value ihBounded = affine_min(builder.getIndexType(), minMap, ValueRange{affine_max(builder.getIndexType(), maxMap, ValueRange{ih}), ihDim});
Value iwBounded = affine_min(builder.getIndexType(), minMap, ValueRange{affine_max(builder.getIndexType(), maxMap, ValueRange{iw}), iwDim});
iv(b, fi, ihBounded, iwBounded);
will cause an error
error: 'affine.load' op index must be a dimension or symbol identifier
I traced error to function bool mlir::isValidDim(Value value, Region *region);
inside mlir/lib/Dialect/Affine/IR/AffineOps.cpp
file,
simple addition of this two cases fix the problem, MLIR successfully converted into LLVMIR and after into executable, computation was correct too.
My question is, is there any reason why affineMin\Max operators couldn’t be used as indicies for AffineIndexedValues, and is my straightforward fix correct? It looks like right now this funciton will always fail for affineMin/Max values.