The main difference between tensor and memref is that the former is an immutable value-based type, while the memref is not immutable.
Layout aside, if a memref didn't have an element type, that means you would just have a typeless pointer to a buffer with a given byte size. Any access would need to compute offsets in bytes, and any load/store would need to provide the actual element type (at this point we're just directly into the LLVM land and I don't know what difference would remain between "memref" and a LLVM typeless pointer).
Imagine for example how to express this without shape and element type:
func @test6(%arg0 : index, %arg1 : index, %src : memref<10x10x10xf32>, %dst : memref<10x10x10xf32>) {
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
affine.for %i2 = 0 to 10 {
%1 = affine.load %src[%i2 + %arg0, %i0 + %i1, %i1 + %arg0 + %arg1]
: memref<10x10x10xf32>
affine.store %1, %dst[%i2 + %arg0, %i0 + %i1, %i1 + %arg0 + %arg1]
: memref<10x10x10xf32>
}
}
}
return
}
Hope this helps,
--
Mehdi
I was under the impression that a tensor was a logical type expressing memory shape, strides, and element type, and that a memref represents linear address space which is the backing store for a tensor or an array. So these are unrelated types?