[gcc/devel/omp/gcc-16] Fix strided `target update`

Sandra Loosemore via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:1441b4b4dd2bcee600eedaca2102053db0843680

commit 1441b4b4dd2bcee600eedaca2102053db0843680
Author: Paul-Antoine Arras <[email protected]>
Date:   Fri Jun 7 20:29:40 2024 +0200

    Fix strided `target update`
    
    OG14 fixup for mainline commit 25072a477a5
    "OpenMP: Call cuMemcpy2D/cuMemcpy3D for nvptx for omp_target_memcpy_rect"
    
    libgomp/ChangeLog
            * target.c (omp_target_memcpy_rect_worker): Require unit strides
            and matching element size.

Diff:
---
 libgomp/target.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libgomp/target.c b/libgomp/target.c
index 76e36a2fc15f..8a4a8df6a876 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -5552,6 +5552,9 @@ omp_target_memcpy_rect_worker (void *dst, const void *src, size_t element_size,
 
   /* host->device, device->host and intra device.  */
   if (num_dims == 2
+      && (!strides || (strides[0] == 1
+		       && strides[1] == 1
+		       && element_size == span))
       && ((src_devicep
 	   && src_devicep == dst_devicep
 	   && src_devicep->memcpy2d_func)
@@ -5578,6 +5581,10 @@ omp_target_memcpy_rect_worker (void *dst, const void *src, size_t element_size,
 	return ret ? 0 : EINVAL;
     }
   else if (num_dims == 3
+	   && (!strides || (strides[0] == 1
+			    && strides[1] == 1
+			    && strides[2] == 1
+			    && element_size == span))
 	   && ((src_devicep
 		&& src_devicep == dst_devicep
 		&& src_devicep->memcpy3d_func)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.