]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP, NVPTX: memcpy[23]D bias correction
authorJulian Brown <julian@codesourcery.com>
Wed, 23 Aug 2023 23:46:29 +0000 (23:46 +0000)
committerJulian Brown <julian@codesourcery.com>
Wed, 20 Dec 2023 21:35:36 +0000 (21:35 +0000)
commitd7e9ae4fa94afd5517536b4dfc7d6be0b3e8c2c3
tree28d8b922c8fee2956851f08b1a7482912d044e9c
parentba615557a4c698d27042a5fe058ea6e721a03b12
OpenMP, NVPTX: memcpy[23]D bias correction

This patch works around behaviour of the 2D and 3D memcpy operations in
the CUDA driver runtime.  Particularly in Fortran, the "base pointer"
of an array (used for either source or destination of a host/device copy)
may lie outside of data that is actually stored on the device.  The fix
is to make sure that we use the first element of data to be transferred
instead, and adjust parameters accordingly.

2023-10-02  Julian Brown  <julian@codesourcery.com>

libgomp/
* plugin/plugin-nvptx.c (GOMP_OFFLOAD_memcpy2d): Adjust parameters to
avoid out-of-bounds array checks in CUDA runtime.
(GOMP_OFFLOAD_memcpy3d): Likewise.
* testsuite/libgomp.c-c++-common/memcpyxd-bias-1.c: New test.
libgomp/plugin/plugin-nvptx.c
libgomp/testsuite/libgomp.c-c++-common/memcpyxd-bias-1.c [new file with mode: 0644]