[Mlir-commits] [mlir] [MLIR][GPU] Added FoldSelfCopy pattern to gpu memcpy (PR #221216)

Fabian Mora llvmlistbot at llvm.org
Sun Sep 13 06:24:52 PDT 2026


fabianmcg wrote:

Thank you for the PR! IMO this is not a valid canonicalization, self copies might create runtime errors or UB:
[`hipMemcpy():` "The src and dst must not overlap."](https://rocm.docs.amd.com/projects/HIP/en/latest/doxygen/html/group___memory.html#gac1a055d288302edd641c6d7416858e1e)

[`cudaMemcpy2D`: "The memory areas may not overlap"](https://docs.nvidia.com/cuda/cuda-runtime-api/cuda_runtime_api/group__CUDART__MEMORY.html#_CPPv412cudaMemcpy2DPv6size_tPKv6size_t6size_t6size_t14cudaMemcpyKind)


However, this could be a valid optimization.

https://github.com/llvm/llvm-project/pull/221216


More information about the Mlir-commits mailing list