https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110270

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>:

https://gcc.gnu.org/g:b25ea7ab78cdb7baec694e56eadb71002726a73e

commit r14-1923-gb25ea7ab78cdb7baec694e56eadb71002726a73e
Author: Tobias Burnus <tob...@codesourcery.com>
Date:   Mon Jun 19 09:08:51 2023 +0200

    OpenMP (C/C++): Keep pointer value of unmapped ptr with default mapping
[PR110270]

    For C/C++ pointers, default implicit mapping firstprivatizes the pointer
    but if the memory it points to is mapped, the it is updated to point to
    the device memory (by attaching a zero sized array section of the
pointed-to
    storage).

    However, if the pointed-to storage wasn't mapped, the pointer was set to
    NULL on the device side (OpenMP 5.0/5.1 semantic). With this commit, the
    pointer retains the on-host address in that case (OpenMP 5.2 semantic).

    The new semantic avoids an explicit map/firstprivate/is_device_ptr in the
    following sensible cases: Special values (e.g. pointer or 0x1, 0x2 etc.),
    explicitly device allocated memory (e.g. omp_target_alloc), and with
    (unified) shared memory.
    (Note: With (U)SM, mappings still must be tracked, at least when
    omp_target_associate_ptr does not fail when passing in two destinct
pointers.)

    libgomp/

            PR middle-end/110270
            * target.c (gomp_map_vars_internal): Copy host value instead of
NULL
            for  GOMP_MAP_ZERO_LEN_ARRAY_SECTION if not mapped.
            * libgomp.texi (OpenMP 5.2 Impl.): Mark as 'Y'.
            * testsuite/libgomp.c/target-19.c: Update expected value.
            * testsuite/libgomp.c++/target-18.C: Likewise.
            * testsuite/libgomp.c++/target-19.C: Likewise.
            * testsuite/libgomp.c-c++-common/requires-unified-addr-2.c: New
test.
            * testsuite/libgomp.c-c++-common/target-implicit-map-3.c: New test.
            * testsuite/libgomp.c-c++-common/target-implicit-map-4.c: New test.

Reply via email to