Concatenating 2 or more memrefs

Hello.
Could you please tell me how can I copy the data from 2 (or more) memrefs and to put the data concatenated in 1 resulting memref.
I know that in the LLVM dialect for example a memref<1x1x1x1000xf16> is represented as a llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>. (What the elements of this struct represent is described at https://mlir.llvm.org/docs/TargetLLVMIR/#ranked-memref-types .) This llvm.struct has a size in bytes equal to 2 * sizeof(ptr) + 8 + 2 * 4*8, which is 88 for a 64-bit system (excluding alignment concerns).
Do you recommend me to use to perform copies the llvm.ssa.copy intrinsic (https://llvm.org/docs/LangRef.html#llvm-ssa-copy-intrinsic)?

Thank you very much,
Alex

Your problem is under-specified: memref are multi-dimensional strided arrays in memory, what does it mean to you here to “concatenate” two different memref?

In general the basic tools are likely memref.alloc to create a new one, and memref.copy to copy the two memref into the new one. See 'memref' Dialect - MLIR

It’s not clear to me why the struct it is relevant, this is just metadata and not the data the memref is referring to.

The doc says:

The llvm.ssa.copy intrinsic can be used to attach information to operations by copying them and giving them new names.

Do you think this matches what you’re trying to do at the LLVM level?