diff --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h --- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h +++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h @@ -47,7 +47,8 @@ /// id), transferring chunks of number_of_elements_per_stride every stride until /// %num_elements are transferred. Either both or no stride arguments should be /// specified. The value of 'num_elements' must be a multiple of -/// 'number_of_elements_per_stride'. +/// 'number_of_elements_per_stride'. If the source and destination locations +/// overlap the behavior of this operation is not defined. // // For example, an AffineDmaStartOp operation that transfers 256 elements of a // memref '%src' in memory space 0 at indices [%i + 3, %j] to memref '%dst' in diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h --- a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h +++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h @@ -62,7 +62,9 @@ // 'index' type, and specify a stride for the slower memory space (memory space // with a lower memory space id), transferring chunks of // number_of_elements_per_stride every stride until %num_elements are -// transferred. Either both or no stride arguments should be specified. +// transferred. Either both or no stride arguments should be specified. If the +// source and destination locations overlap the behavior of this operation is +// not defined. // // For example, a DmaStartOp operation that transfers 256 elements of a memref // '%src' in memory space 0 at indices [%i, %j] to memref '%dst' in memory space diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -1078,10 +1078,6 @@ if (!getOperand(getTagMemRefOperandIndex()).getType().isa()) return emitOpError("expected DMA tag to be of memref type"); - // DMAs from different memory spaces supported. - if (getSrcMemorySpace() == getDstMemorySpace()) { - return emitOpError("DMA should be between different memory spaces"); - } unsigned numInputsAllMaps = getSrcMap().getNumInputs() + getDstMap().getNumInputs() + getTagMap().getNumInputs(); diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp --- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp +++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp @@ -943,10 +943,6 @@ [](Type t) { return t.isIndex(); })) return emitOpError("expected tag indices to be of index type"); - // DMAs from different memory spaces supported. - if (getSrcMemorySpace() == getDstMemorySpace()) - return emitOpError("DMA should be between different memory spaces"); - // Optional stride-related operands must be either both present or both // absent. if (numOperands != numExpectedOperands && diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir --- a/mlir/test/IR/invalid-ops.mlir +++ b/mlir/test/IR/invalid-ops.mlir @@ -388,15 +388,6 @@ // ----- -func @dma_start_same_space( - %src: memref<2x2xf32>, %idx: index, %dst: memref<2xf32>, - %tag: memref) { - // expected-error@+1 {{DMA should be between different memory spaces}} - memref.dma_start %src[%idx, %idx], %dst[%idx], %idx, %tag[] : memref<2x2xf32>, memref<2xf32>, memref -} - -// ----- - func @dma_start_too_many_operands( %src: memref<2x2xf32>, %idx: index, %dst: memref<2xf32,1>, %tag: memref) {