Commit Graph

1360 Commits

Author SHA1 Message Date
Thomas Schwinge
b4eb45a15d Add 'libgomp.c++/target-std__[...]-concurrent-usm.C' test cases for C++ 'std::unordered_map', 'std::unordered_multimap', 'std::unordered_multiset', 'std::unordered_set'
libgomp/
	* testsuite/libgomp.c++/target-std__unordered_map-concurrent-usm.C:
	New.
	* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_set-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_map-concurrent.C:
	Adjust.
	* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_set-concurrent.C:
	Likewise.
2026-01-14 16:00:56 +01:00
Thomas Schwinge
4b60a4da49 Add 'libgomp.c++/target-std__[...]-concurrent-usm.C' test cases for C++ 'std::flat_map', 'std::flat_multimap', 'std::flat_multiset', 'std::flat_set'
libgomp/
	* testsuite/libgomp.c++/target-std__flat_map-concurrent-usm.C:
	New.
	* testsuite/libgomp.c++/target-std__flat_multimap-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_multiset-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_set-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_map-concurrent.C: Adjust.
	* testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_set-concurrent.C:
	Likewise.
2026-01-14 16:00:56 +01:00
Thomas Schwinge
e9e76f7607 Fix up 'libgomp.c++/target-std__[...]-concurrent-usm.C' dynamic memory allocation
OpenMP/USM implies memory accessible from host as well as device, but doesn't
imply that allocation vs. deallocation may be done in the opposite context.
For most of the test cases, (by construction) we're not allocating memory
during device execution, so have nothing to clean up.  (..., but still document
these semantics.)  But for a few, we have to clean up:
'libgomp.c++/target-std__map-concurrent-usm.C',
'libgomp.c++/target-std__multimap-concurrent-usm.C',
'libgomp.c++/target-std__multiset-concurrent-usm.C',
'libgomp.c++/target-std__set-concurrent-usm.C'.

For 'libgomp.c++/target-std__multimap-concurrent-usm.C' (only), this issue
already got addressed in commit 90f2ab4b6e
"libgomp.c++/target-std__multimap-concurrent.C: Fix USM memory freeing".
However, instead of invoking the 'clear' function (which doesn't generally
guarantee to release dynamically allocated memory; for example, see PR123582
"C++ unordered associative container: dynamic memory management"), we properly
restore the respective object into pristine state.

	libgomp/
	* testsuite/libgomp.c++/target-std__array-concurrent-usm.C:
	'#define OMP_USM'.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__list-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__span-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__map-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__set-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__vector-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__deque-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__array-concurrent.C: Comment.
	* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__deque-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__list-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__span-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__valarray-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__vector-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__map-concurrent.C [OMP_USM]:
	Fix up dynamic memory allocation.
	* testsuite/libgomp.c++/target-std__multimap-concurrent.C
	[OMP_USM]: Likewise.
	* testsuite/libgomp.c++/target-std__multiset-concurrent.C
	[OMP_USM]: Likewise.
	* testsuite/libgomp.c++/target-std__set-concurrent.C [OMP_USM]:
	Likewise.
2026-01-14 16:00:56 +01:00
Thomas Schwinge
3dc9eedd95 libgomp: Add a few more OpenMP/USM test cases
... where there are clear differences in behavior for OpenMP/USM run-time
configurations.

We shall further clarify all the intended semantics, once the implementation
begins to differentiate OpenMP 'requires unified_shared_memory' vs.
'requires self_maps'.

	libgomp/
	* testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c: New.
	* testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c:
	Likewise.
	* testsuite/libgomp.c-c++-common/struct-elem-5-usm.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-present-1-usm.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-present-2-usm.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-present-3-usm.c: Likewise.
	* testsuite/libgomp.fortran/map-subarray-5-usm.f90: Likewise.
	* testsuite/libgomp.fortran/map-subarray-6-usm.f90: Likewise.
	* testsuite/libgomp.fortran/map-subarray-7-usm.f90: Likewise.
	* testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90:
	Likewise.
	* testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90:
	Likewise.
	* testsuite/libgomp.fortran/target-enter-data-2-usm.F90: Likewise.
	* testsuite/libgomp.fortran/target-present-1-usm.f90: Likewise.
	* testsuite/libgomp.fortran/target-present-2-usm.f90: Likewise.
	* testsuite/libgomp.fortran/target-present-3-usm.f90: Likewise.
	* testsuite/libgomp.fortran/target-allocatable-1-1.f90: Adjust.
	* testsuite/libgomp.fortran/target-allocatable-1-2.f90: Likewise.
	* testsuite/libgomp.fortran/target-present-1.f90: Likewise.
	* testsuite/libgomp.fortran/target-present-2.f90: Likewise.
	* testsuite/libgomp.fortran/target-present-3.f90: Likewise.
2026-01-14 16:00:56 +01:00
Thomas Schwinge
105fddf356 amdgcn: Adjust failure mode for gfx908 USM: 'libgomp.fortran/map-alloc-comp-9-usm.f90'
The change/rationale that commit 1cf9fda493
"amdgcn: Adjust failure mode for gfx908 USM" applied to a number of test cases
likewise applies to 'libgomp.fortran/map-alloc-comp-9-usm.f90'.

	libgomp/
	* testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90: Require
	working Unified Shared Memory to run the test.
2026-01-13 11:10:03 +01:00
Thomas Schwinge
954f804b73 openmp: Bump Version from 4.5 to 5.2 (2/4): Some more '-Wno-deprecated-openmp'
These changes should've been included in
commit 382edf047e
"openmp: Bump Version from 4.5 to 5.2 (2/4)", to avoid some more instances of:

    warning: use of 'omp declare target' as a synonym for 'omp begin declare target' has been deprecated since OpenMP 5.2 [-Wdeprecated-openmp]

    warning: 'to' clause with 'declare target' deprecated since OpenMP 5.2, use 'enter' [-Wdeprecated-openmp]

    Warning: Non-C_PTR type argument at (1) is deprecated, use HAS_DEVICE_ADDR [-Wdeprecated-openmp]

    Warning: 'to' clause with 'declare target' at (1) deprecated since OpenMP 5.2, use 'enter' [-Wdeprecated-openmp]

	libgomp/
	* testsuite/libgomp.c++/examples-4/declare_target-2.C: Add
	'-Wno-deprecated-openmp'.
	* testsuite/libgomp.c/declare-variant-3-sm30.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm35.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm37.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm52.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm53.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm61.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm70.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm75.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm80.c: Likewise.
	* testsuite/libgomp.c/declare-variant-3-sm89.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c:
	Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1030.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1031.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1032.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1033.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1034.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1035.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1036.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1100.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1101.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1102.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1103.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1150.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1151.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1152.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1153.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c:
	Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx900.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx902.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx904.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx906.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx908.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx909.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90a.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90c.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx942.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx950.c: Likewise.
	* testsuite/libgomp.c/examples-4/async_target-2.c: Likewise.
	* testsuite/libgomp.c/interop-hsa.c: Likewise.
	* testsuite/libgomp.c/target-20.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-1.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-2.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-3.c: Likewise.
	* testsuite/libgomp.fortran/alloc-managed-1.f90: Likewise.
	* testsuite/libgomp.fortran/target9.f90: Likewise.
2026-01-13 11:08:34 +01:00
Thomas Schwinge
ba21851b8d openmp: Bump Version from 4.5 to 5.2 (2/4): 'libgomp.oacc-c-c++-common/vred2d-128.c' [PR123098]
'libgomp.oacc-c-c++-common/vred2d-128.c' had gotten '-Wno-deprecated-openmp'
applied as part of commit 382edf047e
"openmp: Bump Version from 4.5 to 5.2 (2/4)", which conceptually doesn't make
sense, as 'libgomp.oacc-c-c++-common/vred2d-128.c' isn't an OpenMP test case.
In commit 9c119b0fdd
"openmp: Limit - reduction -Wdeprecated-openmp diagnostics to OpenMP, testsuite fixes [PR123098]",
the erroneous diagnostic got disabled, so we don't need
'-Wno-deprecated-openmp' anymore.

	PR testsuite/123098
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Remove
	'-Wno-deprecated-openmp'.
2026-01-13 11:07:21 +01:00
Rainer Orth
c885d2a055 libgomp: Skip libgomp.c++/target-cdtor-2.C on Solaris [PR81337]
The libgomp.c++/target-cdtor-2.C test FAILs on Solaris:

FAIL: libgomp.c++/target-cdtor-2.C output pattern test

Compared to the Linux output

~S, 5, 1
[...]
finiDH1, 1

the Solaris output has a different order:

finiDH1, 1
[...]
~S, 5, 1

This is another instance of the long-standing PR c++/81337.  As detailed
there, the relative order of ~S::S() and __attribute__((destructor()))
functions isn't guaranteed.  Since xfail'ing the dg-output parts isn't
practical, this patch skips the whole test on Solaris.

Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.

2025-12-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgomp:
	PR c++/81337
	* testsuite/libgomp.c++/target-cdtor-2.C: Skip on Solaris.
	Fix comments.
2026-01-12 10:36:19 +01:00
supers1ngular
cdb15b3900 openmp: Improve Fortran Diagnostics for Linear Clause
This patch improves diagnostics for the linear clause,
providing a more accurate and intuitive recommendation
for remediation if the deprecated syntax is used.
Additionally updates the relevant test to reflect the
changed verbiage of the warning.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_clauses): New diagnostic logic.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/pr84418-1.f90: Fix verbiage of
	dg-warning to reflect updated warning.
2026-01-05 17:09:02 -08:00
Jakub Jelinek
254a858ae7 Update copyright years. 2026-01-02 09:56:11 +01:00
Thomas Schwinge
12b329d00b libgomp: Robustify effective-target 'omp_usm' check
This was added in commit 1cf9fda493
"amdgcn: Adjust failure mode for gfx908 USM".

In a GCC configuration with both AMD and NVIDIA GPU code offloading supported,
and the selected AMD GPU code generation not supporting USM, but an USM-capable
NVIDIA GPU available, I see all test cases that require effective-target
'omp_usm' turn UNSUPPORTED, because:

    Executing on host: gcc  usm_available_2778376.c [...]
    [...]
    In function 'main._omp_fn.0':
    lto1: warning: Unified Shared Memory is required, but XNACK is disabled
    lto1: note: Try -foffload-options=-mxnack=any
    gcn mkoffload: warning: conflicting settings; XNACK is forced off but Unified Shared Memory is required
    UNSUPPORTED: [...]

That warning is, however, not relevant in the scenario described above: we're
not going to exercise AMD GPU code offloading at run time.

With the effective-target 'omp_usm' check robustified like this, the affected
test cases are then no longer UNSUPPORTED, but of course, there's then the
corollary issue that compilation of the test case itself now emits the very
same warning, which results in the "test for excess errors" FAILing, despite
the execution test PASSing, for example:

    FAIL: libgomp.c++/target-std__valarray-concurrent-usm.C (test for excess errors)
    PASS: libgomp.c++/target-std__valarray-concurrent-usm.C execution test

That's clearly not ideal either (but is representative of what real-world usage
would run into), but is certainly better than the whole test case turning
UNSUPPORTED.  To be continued, I guess...

	libgomp/
	* testsuite/lib/libgomp.exp (check_effective_target_omp_usm):
	Robustify.
2025-12-24 10:56:22 +01:00
Tobias Burnus
50e2c80545 libgomp.fortran/uses_allocators_1.f90: Fix dg-error for r16-6273
Missed to commit dg-error changes for the new diagnostic due to commit
r16-6273-g7044071f07d763   OpenMP: uses_allocators with ';'-separated list

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/uses_allocators_1.f90: Update dg-error.
2025-12-22 10:57:11 +01:00
Tobias Burnus
7044071f07 OpenMP: uses_allocators with ';'-separated list
OpenMP 6.0 has the following wording for the uses_allocators clause:
"More than one clause-argument-specification may be specified";
this permits ';' lists. While that's pointless for predefined
allocators, for user-defined allocators it saves redundant
') uses_allocators(' by permitting:
  uses_allocators( traits(t1): alloc1 ; traits(t2): alloc2 )

Additionally, the order in the tree dump has been changed to
place the modifiers before the allocator variable, matching
the input syntax.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_clause_uses_allocators): Accept
	multiple clause-argument-specifications separated by ';'.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_clause_uses_allocators): Accept
	multiple clause-argument-specifications separated by ';'.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_clause_uses_allocators): Accept
	multiple clause-argument-specifications separated by ';'.

gcc/ChangeLog:

	* tree-pretty-print.cc (dump_omp_clause): For uses_allocators,
	print modifier before allocator variable.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/uses_allocators-7.f90: Add ';' test.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/uses_allocators-8.c: New test.
2025-12-19 12:07:58 +01:00
Rainer Orth
b95290e856 libgomp: Fix libgomp.c/affinity-1.c on non-Linux
The new libgomp.c/affinity-1.c test FAILs on Solaris and Darwin:

FAIL: libgomp.c/affinity-1.c (test for excess errors)

Excess errors:
libgomp.c/affinity-1.c:194:3: warning: 'omp_proc_bind_master' is deprecated [-Wdeprecated-declarations]
libgomp.c/affinity-1.c:267:3: warning: 'omp_set_nested' is deprecated [-Wdeprecated-declarations]
libgomp.c/affinity-1.c:272:5: warning: 'omp_proc_bind_master' is deprecated [-Wdeprecated-declarations]
libgomp.c/affinity-1.c:285:43: warning: 'master' affinity deprecated since OpenMP 5.1, use 'primary' [-Wdeprecated-openmp]

and several more.  This happens because the required -Wno-* options have
only been added for Linux.  This patch adds them unconditionally
instead.

Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
x86_64-apple-darwin25.1.0, and x86_64-pc-linux-gnu.

2025-12-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgomp:
	* testsuite/libgomp.c/affinity-1.c: Always add warnings.
2025-12-17 15:39:20 +01:00
Tobias Burnus
350794cb07 Fix libgomp.fortran/dep-uses-allocators.f90
libgomp/ChangeLog:

	* testsuite/libgomp.fortran/dep-uses-allocators.f90: Properly
	escape '(..)' in dg-warning.
2025-12-12 22:50:39 +01:00
Tobias Burnus
d02eebea7e OpenMP/Fortran: uses_allocators - suggest 5.2 format in the warning
Actually mention how the new 5.2+ syntax looks like when outputting
the deprecation warning for 'uses_allocators'.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_clause_uses_allocators): Mention
	new syntax in deprecation warning.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/dep-uses-allocators.f90: Update
	dg-warning.
2025-12-12 22:44:15 +01:00
Chung-Lin Tang
0a01b42b22 OpenMP: Add uses_allocators parser support to C/C++
This is the parser part for C/C++, including early middle end bits,
but then stops with a 'sorry, unimplemented'. It also adds support
for omp_null_alloctor (6.0 clarificiation, is to be ignored). As
predefined allocators do not require any special handling in GCC,
those are ignored. Therefore, this patch fully supports
uses_allocators that only use predefined allocators - only printing
a sorry for those that use the (implicit) traits/memspace modifer.

(The parsing support for Fortran was added before; this patch just
adds omp_null_allocator support to Fortran. The sorry message for
Fortran is also still in the FE and not in gimplify.cc, but that
only make a difference for the original dump.)

Except for some minor fixes, this is the same patch as
https://gcc.gnu.org/pipermail/gcc-patches/2025-November/700345.html
with the middle-end + libgomp handling excluded. That patch in turn
is based on previous patches, the latest previous one was
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637415.html
and, in particular, the C/C++ parser style was updated following the
review comments. Also, more C++ template-handling fixes have been
applied.

gcc/c-family/ChangeLog:

	* c-omp.cc (c_omp_split_clauses): Hande uses_allocators.
	* c-pragma.h (enum pragma_omp_clause): Add
	PRAGMA_OMP_CLAUSE_USES_ALLOCATORS.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_clause_uses_allocators): New function.
	(c_parser_omp_clause_name, c_parser_omp_all_clauses,
	OMP_TARGET_CLAUSE_MASK): Handle uses_allocators.
	* c-typeck.cc (c_finish_omp_clauses): Likewise.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_clause_uses_allocators): New function.
	(cp_parser_omp_clause_name, cp_parser_omp_all_clauses,
	OMP_TARGET_CLAUSE_MASK): Handle uses_allocators.
	* semantics.cc (finish_omp_clauses): Likewise.
	* pt.cc (tsubst_omp_clauses): Likewise.

gcc/fortran/ChangeLog:

	* openmp.cc (resolve_omp_clauses): Handle omp_null_allocator.
	* trans-openmp.cc (gfc_trans_omp_clauses): Mention it in a comment.

gcc/ChangeLog:

	* gimplify.cc (gimplify_scan_omp_clauses): Handle uses_allocators
	by printing a 'sorry, unimplemented' and removing it.
	* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_USES_ALLOCATORS.
	* tree.cc (omp_clause_num_ops, omp_clause_code_name): Likewise.
	* tree-pretty-print.cc (dump_omp_clause): Handle it.
	* tree.h (OMP_CLAUSE_USES_ALLOCATORS_ALLOCATOR,
	OMP_CLAUSE_USES_ALLOCATORS_MEMSPACE,
	OMP_CLAUSE_USES_ALLOCATORS_TRAITS): New.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/uses_allocators_1.f90: Add check for
	omp_null_allocator.
	* testsuite/libgomp.fortran/uses_allocators-7.f90: New test.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/uses_allocators-1.c: New test.
	* c-c++-common/gomp/uses_allocators-2.c: New test.
	* c-c++-common/gomp/uses_allocators-4.c: New test.
	* c-c++-common/gomp/uses_allocators-7.c: New test.
	* g++.dg/gomp/deprecate-2.C: New test.
	* g++.dg/gomp/uses_allocators-1.C: New test.
	* gcc.dg/gomp/deprecate-2.c: New test.

Co-authored-by: Tobias Burnus <tburnus@baylibre.com>
Co-authored-by: Andrew Stubbs <ams@baylibre.com>
2025-12-12 21:20:33 +01:00
supers1ngular
52d7f5b103 openmp: Bump Version from 4.5 to 5.2 (3/4)
Implements the OpenMP 5.2 Fortran deprecations. Uses the warning
established in patch 1/4, -Wdeprecated-openmp, for said deprecations.
Similarly, we do not implement the relaxing of constraints for the
interop construct since it is not a deprecation. However, the
deprecation for 'uses_allocators' is implemented, since support
exists in Fortran mainline. Additionally implements the
Fortran-specific deprecation for executable allocate directives,
and adds new tests.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_clause_reduction): Deprecate '-'
	operator for reductions.
	(gfc_match_omp_clause_uses_allocators): Deprecate
	allocator(traits) pattern for 'uses_allocators'.
	(gfc_match_omp_clauses): Deprecate 'sink' and 'source' for
	'depend' clause. Deprecate list items as arguments with 'linear'
	clause. Deprecate non-comma-separated modifiers for the map
	clause. Deprecate 'to' clause with declare target.
	(gfc_match_omp_declare_target): Whitespace.
	(match_omp_metadirective): Deprecate 'default' clause on
	metadirectives.
	(resolve_omp_clauses): Deprecate executable allocate directives.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/allocate-8a.f90: Suppress warnings.
	* testsuite/libgomp.fortran/allocators-1.f90: Ditto.
	* testsuite/libgomp.fortran/allocators-2.f90: Ditto.
	* testsuite/libgomp.fortran/allocators-4.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-1.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-2.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-indirect-1.f90: Ditto.
	* testsuite/libgomp.fortran/declare-target-indirect-2.f90: Ditto.
	* testsuite/libgomp.fortran/doacross1.f90: Ditto.
	* testsuite/libgomp.fortran/doacross2.f90: Ditto.
	* testsuite/libgomp.fortran/doacross3.f90: Ditto.
	* testsuite/libgomp.fortran/map-alloc-ptr-2.f90: Ditto.
	* testsuite/libgomp.fortran/pr84418-1.f90: Ditto.
	* testsuite/libgomp.fortran/pr84418-2.f90: Ditto.
	* testsuite/libgomp.fortran/reduction1.f90: Ditto.
	* testsuite/libgomp.fortran/udr11.f90: Ditto.
	* testsuite/libgomp.fortran/uses_allocators_1.f90: Ditto.
	* testsuite/libgomp.fortran/uses_allocators_2.f90: Ditto.
	* testsuite/libgomp.fortran/dep-uses-allocators.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/allocate-14.f90: Suppress warnings.
	* gfortran.dg/gomp/allocate-16.f90: Ditto.
	* gfortran.dg/gomp/allocate-5.f90: Ditto.
	* gfortran.dg/gomp/allocate-6.f90: Ditto.
	* gfortran.dg/gomp/allocate-7.f90: Ditto.
	* gfortran.dg/gomp/allocators-3.f90: Ditto.
	* gfortran.dg/gomp/declare-simd-2.f90: Ditto.
	* gfortran.dg/gomp/declare-simd-6.f90: Ditto.
	* gfortran.dg/gomp/declare-target-1.f90: Ditto.
	* gfortran.dg/gomp/declare-target-2.f90: Ditto.
	* gfortran.dg/gomp/declare-target-4.f90: Ditto.
	* gfortran.dg/gomp/declare-target-5.f90: Ditto.
	* gfortran.dg/gomp/declare-target-indirect-1.f90: Ditto.
	* gfortran.dg/gomp/declare-target-indirect-2.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-10.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-8.f90: Ditto.
	* gfortran.dg/gomp/implicit-save.f90: Ditto.
	* gfortran.dg/gomp/linear-1.f90: Ditto.
	* gfortran.dg/gomp/linear-2.f90: Ditto.
	* gfortran.dg/gomp/linear-3.f90: Ditto.
	* gfortran.dg/gomp/linear-4.f90: Ditto.
	* gfortran.dg/gomp/linear-6.f90: Ditto.
	* gfortran.dg/gomp/map-12.f90: Ditto.
	* gfortran.dg/gomp/map-6.f90: Ditto.
	* gfortran.dg/gomp/map-7.f90: Ditto.
	* gfortran.dg/gomp/map-8.f90: Ditto.
	* gfortran.dg/gomp/order-8.f90: Ditto.
	* gfortran.dg/gomp/pr83977.f90: Ditto.
	* gfortran.dg/gomp/reduction1.f90: Ditto.
	* gfortran.dg/gomp/schedule-modifiers-2.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-55.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-56.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-57.f90: Ditto.
	* gfortran.dg/gomp/workshare-reduction-58.f90: Ditto.
	* gfortran.dg/gomp/52-deps.f90: New test.
2025-12-11 08:12:50 -08:00
supers1ngular
382edf047e openmp: Bump Version from 4.5 to 5.2 (2/4)
Implements the OpenMP 5.2 C and C++ deprecations. Uses the warning
established in patch 1/4, -Wdeprecated-openmp, for said deprecations.
Not implemented is 'uses_allocators', since the base is not yet in
mainline, along with the relaxing of constraints for the interop
construct, since this is not a deprecation. Additionally does not
deprecate 'destroy' with no arguments on depobj construct, since
this was undeprecated in OpenMP 6.0. Adds new tests.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_clause_reduction): Deprecate '-'
	operator for reductions.
	(c_parser_omp_clause_linear): Deprecate modifiers with parens.
	(c_parser_omp_clause_depend): Deprecate 'sink' and 'source'
	modifiers for 'depend' clause.
	(c_parser_omp_clause_map): Map clause modifiers comma-separated.
	(c_parser_omp_declare_target): Deprecate synonymous omp declare
	target for omp begin declare target. Deprecate 'to' clause.
	(c_parser_omp_metadirective): Deprecate default clause on
	metadirectives.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_clause_reduction): Deprecate '-'
	operator.
	(cp_parser_omp_clause_linear): Deprecate modifiers with parens.
	(cp_parser_omp_clause_depend): Deprecate sink and source.
	(cp_parser_omp_clause_map): Map clause modifiers
	comma-separated.
	(cp_parser_omp_declare_target): Deprecate synonymous omp declare
	target for omp begin declare target. Deprecate to clause.
	(cp_parser_omp_metadirective): Deprecate default clause on
	metadirectives.

libgomp/ChangeLog:

	* testsuite/libgomp.c++/declare_target-1.C: Suppress warnings.
	* testsuite/libgomp.c++/depobj-1.C: Ditto.
	* testsuite/libgomp.c++/doacross-1.C: Ditto.
	* testsuite/libgomp.c++/for-15.C: Ditto.
	* testsuite/libgomp.c++/for-24.C: Ditto.
	* testsuite/libgomp.c++/pr101544-1-O0.C: Ditto.
	* testsuite/libgomp.c++/pr101544-1.C: Ditto.
	* testsuite/libgomp.c++/pr96835-1-O0.C: Ditto.
	* testsuite/libgomp.c++/pr96835-1.C: Ditto.
	* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C: Ditto.
	* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C: Ditto.
	* testsuite/libgomp.c++/static-aggr-constructor-destructor-3.C: Ditto.
	* testsuite/libgomp.c++/target-13.C: Ditto.
	* testsuite/libgomp.c++/target-cdtor-1.C: Ditto.
	* testsuite/libgomp.c++/target-cdtor-2.C: Ditto.
	* testsuite/libgomp.c++/target-std__array-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__array-concurrent.C: Ditto.
	* testsuite/libgomp.c++/target-std__cmath.C: Ditto.
	* testsuite/libgomp.c++/target-std__complex.C: Ditto.
	* testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__deque-concurrent.C: Ditto.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Ditto.
	* testsuite/libgomp.c++/target-std__list-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__list-concurrent.C: Ditto.
	* testsuite/libgomp.c++/target-std__numbers.C: Ditto.
	* testsuite/libgomp.c++/target-std__span-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__span-concurrent.C: Ditto.
	* testsuite/libgomp.c++/target-std__valarray-1.C: Ditto.
	* testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Ditto.
	* testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: Ditto.
	* testsuite/libgomp.c++/target-std__vector-concurrent.C: Ditto.
	* testsuite/libgomp.c-c++-common/declare_target-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/depend-2.c: Ditto.
	* testsuite/libgomp.c-c++-common/depobj-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-11.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-12.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-16.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-3.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-5.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-6.c: Ditto.
	* testsuite/libgomp.c-c++-common/for-9.c: Ditto.
	* testsuite/libgomp.c-c++-common/function-not-offloaded.c: Ditto.
	* testsuite/libgomp.c-c++-common/metadirective-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/metadirective-2.c: Ditto.
	* testsuite/libgomp.c-c++-common/metadirective-3.c: Ditto.
	* testsuite/libgomp.c-c++-common/metadirective-5.c: Ditto.
	* testsuite/libgomp.c-c++-common/monotonic-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/monotonic-2.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr100059-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-2.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-4.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-5.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-6.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-7.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-8.c: Ditto.
	* testsuite/libgomp.c-c++-common/pr66199-9.c: Ditto.
	* testsuite/libgomp.c-c++-common/ptr-attach-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/reverse-offload-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-10.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-40.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-abi-struct-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-cdtor-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-same-name-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/task-reduction-14.c: Ditto.
	* testsuite/libgomp.c-c++-common/variable-not-offloaded.c: Ditto.
	* testsuite/libgomp.c/declare-variant-3.c: Ditto.
	* testsuite/libgomp.c/declare-variant-4.c: Ditto.
	* testsuite/libgomp.c/doacross-1.c: Ditto.
	* testsuite/libgomp.c/doacross-2.c: Ditto.
	* testsuite/libgomp.c/doacross-3.c: Ditto.
	* testsuite/libgomp.c/examples-4/async_target-1.c: Ditto.
	* testsuite/libgomp.c/examples-4/declare_target-1.c: Ditto.
	* testsuite/libgomp.c/examples-4/declare_target-3.c: Ditto.
	* testsuite/libgomp.c/examples-4/declare_target-4.c: Ditto.
	* testsuite/libgomp.c/examples-4/declare_target-5.c: Ditto.
	* testsuite/libgomp.c/max_vf-1.c: Ditto.
	* testsuite/libgomp.c/pr81778.c: Ditto.
	* testsuite/libgomp.c/pr86660.c: Ditto.
	* testsuite/libgomp.c/reduction-4.c: Ditto.
	* testsuite/libgomp.c/switch-conversion.c: Ditto.
	* testsuite/libgomp.c/target-26.c: Ditto.
	* testsuite/libgomp.c/target-28.c: Ditto.
	* testsuite/libgomp.c/target-30.c: Ditto.
	* testsuite/libgomp.c/target-32.c: Ditto.
	* testsuite/libgomp.c/target-35.c: Ditto.
	* testsuite/libgomp.c/target-38.c: Ditto.
	* testsuite/libgomp.c/target-39.c: Ditto.
	* testsuite/libgomp.c/target-9.c: Ditto.
	* testsuite/libgomp.c/target-link-1.c: Ditto.
	* testsuite/libgomp.c/target-teams-1.c: Ditto.
	* testsuite/libgomp.c/thread-limit-2.c: Ditto.
	* testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Ditto.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/Wparentheses-2.c: Suppress warnings.
	* c-c++-common/gomp/attrs-metadirective-1.c: Ditto.
	* c-c++-common/gomp/attrs-metadirective-2.c: Ditto.
	* c-c++-common/gomp/attrs-metadirective-3.c: Ditto.
	* c-c++-common/gomp/attrs-metadirective-4.c: Ditto.
	* c-c++-common/gomp/attrs-metadirective-5.c: Ditto.
	* c-c++-common/gomp/attrs-metadirective-8.c: Ditto.
	* c-c++-common/gomp/begin-declare-target-1.c: Ditto.
	* c-c++-common/gomp/begin-declare-target-2.c: Ditto.
	* c-c++-common/gomp/clauses-3.c: Ditto.
	* c-c++-common/gomp/declare-target-1.c: Ditto.
	* c-c++-common/gomp/declare-target-2.c: Ditto.
	* c-c++-common/gomp/declare-target-3.c: Ditto.
	* c-c++-common/gomp/declare-target-4.c: Ditto.
	* c-c++-common/gomp/declare-target-5.c: Ditto.
	* c-c++-common/gomp/declare-target-7.c: Ditto.
	* c-c++-common/gomp/declare-target-indirect-1.c: Ditto.
	* c-c++-common/gomp/declare-target-indirect-2.c: Ditto.
	* c-c++-common/gomp/declare-variant-10.c: Ditto.
	* c-c++-common/gomp/declare-variant-8.c: Ditto.
	* c-c++-common/gomp/defaultmap-2.c: Ditto.
	* c-c++-common/gomp/defaultmap-3.c: Ditto.
	* c-c++-common/gomp/depend-iterator-2.c: Ditto.
	* c-c++-common/gomp/depobj-1.c: Ditto.
	* c-c++-common/gomp/directive-1.c: Ditto.
	* c-c++-common/gomp/distribute-1.c: Ditto.
	* c-c++-common/gomp/doacross-1.c: Ditto.
	* c-c++-common/gomp/doacross-2.c: Ditto.
	* c-c++-common/gomp/doacross-3.c: Ditto.
	* c-c++-common/gomp/doacross-4.c: Ditto.
	* c-c++-common/gomp/doacross-8.c: Ditto.
	* c-c++-common/gomp/linear-1.c: Ditto.
	* c-c++-common/gomp/linear-2.c: Ditto.
	* c-c++-common/gomp/linear-3.c: Ditto.
	* c-c++-common/gomp/loop-6.c: Ditto.
	* c-c++-common/gomp/map-1.c: Ditto.
	* c-c++-common/gomp/map-3.c: Ditto.
	* c-c++-common/gomp/map-6.c: Ditto.
	* c-c++-common/gomp/metadirective-1.c: Ditto.
	* c-c++-common/gomp/metadirective-2.c: Ditto.
	* c-c++-common/gomp/metadirective-3.c: Ditto.
	* c-c++-common/gomp/metadirective-4.c: Ditto.
	* c-c++-common/gomp/metadirective-5.c: Ditto.
	* c-c++-common/gomp/metadirective-8.c: Ditto.
	* c-c++-common/gomp/metadirective-construct.c: Ditto.
	* c-c++-common/gomp/metadirective-device.c: Ditto.
	* c-c++-common/gomp/metadirective-target-device-1.c: Ditto.
	* c-c++-common/gomp/metadirective-target-device-2.c: Ditto.
	* c-c++-common/gomp/order-2.c: Ditto.
	* c-c++-common/gomp/ordered-3.c: Ditto.
	* c-c++-common/gomp/ordered-5.c: Ditto.
	* c-c++-common/gomp/pr102640.c: Ditto.
	* c-c++-common/gomp/pr106836.c: Ditto.
	* c-c++-common/gomp/pr120180-1.c: Ditto.
	* c-c++-common/gomp/pr88203-1.c: Ditto.
	* c-c++-common/gomp/pr88203-2.c: Ditto.
	* c-c++-common/gomp/pr88203-3.c: Ditto.
	* c-c++-common/gomp/pr91401-2.c: Ditto.
	* c-c++-common/gomp/pr91987.c: Ditto.
	* c-c++-common/gomp/reverse-offload-1.c: Ditto.
	* c-c++-common/gomp/schedule-modifiers-1.c: Ditto.
	* c-c++-common/gomp/sink-1.c: Ditto.
	* c-c++-common/gomp/sink-2.c: Ditto.
	* c-c++-common/gomp/sink-3.c: Ditto.
	* c-c++-common/gomp/sink-4.c: Ditto.
	* c-c++-common/gomp/sink-5.c: Ditto.
	* c-c++-common/gomp/target-teams-1.c: Ditto.
	* g++.dg/gomp/attrs-12.C: Ditto.
	* g++.dg/gomp/attrs-5.C: Ditto.
	* g++.dg/gomp/attrs-9.C: Ditto.
	* g++.dg/gomp/clause-3.C: Ditto.
	* g++.dg/gomp/declare-simd-3.C: Ditto.
	* g++.dg/gomp/declare-simd-4.C: Ditto.
	* g++.dg/gomp/declare-simd-6.C: Ditto.
	* g++.dg/gomp/declare-simd-7.C: Ditto.
	* g++.dg/gomp/declare-simd-8.C: Ditto.
	* g++.dg/gomp/declare-target-1.C: Ditto.
	* g++.dg/gomp/declare-target-2.C: Ditto.
	* g++.dg/gomp/declare-target-3.C: Ditto.
	* g++.dg/gomp/declare-target-indirect-1.C: Ditto.
	* g++.dg/gomp/depend-iterator-2.C: Ditto.
	* g++.dg/gomp/depobj-1.C: Ditto.
	* g++.dg/gomp/doacross-2.C: Ditto.
	* g++.dg/gomp/linear-1.C: Ditto.
	* g++.dg/gomp/linear-2.C: Ditto.
	* g++.dg/gomp/linear-3.C: Ditto.
	* g++.dg/gomp/linear-5.C: Ditto.
	* g++.dg/gomp/map-1.C: Ditto.
	* g++.dg/gomp/pr118876.C: Ditto.
	* g++.dg/gomp/pr119370.C: Ditto.
	* g++.dg/gomp/sink-1.C: Ditto.
	* g++.dg/gomp/sink-2.C: Ditto.
	* g++.dg/gomp/sink-3.C: Ditto.
	* g++.dg/gomp/target-simd-clone-1.C: Ditto.
	* g++.dg/gomp/target-simd-clone-2.C: Ditto.
	* g++.dg/gomp/target-teams-1.C: Ditto.
	* g++.dg/gomp/udr-5.C: Ditto.
	* gcc.dg/gomp/attrs-12.c: Ditto.
	* gcc.dg/gomp/attrs-5.c: Ditto.
	* gcc.dg/gomp/attrs-9.c: Ditto.
	* gcc.dg/gomp/clause-1.c: Ditto.
	* gcc.dg/gomp/declare-simd-3.c: Ditto.
	* gcc.dg/gomp/linear-1.c: Ditto.
	* gcc.dg/gomp/metadirective-1.c: Ditto.
	* gcc.dg/gomp/pr104757.c: Ditto.
	* gcc.dg/gomp/sink-fold-1.c: Ditto.
	* gcc.dg/gomp/sink-fold-2.c: Ditto.
	* gcc.dg/gomp/sink-fold-3.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-1.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-2.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-3.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-4.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-5.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-6.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-7.c: Ditto.
	* gcc.dg/gomp/target-simd-clone-8.c: Ditto.
	* gcc.dg/gomp/workshare-reduction-55.c: Ditto.
	* gcc.dg/gomp/workshare-reduction-56.c: Ditto.
	* gcc.dg/gomp/workshare-reduction-57.c: Ditto.
	* gcc.dg/gomp/workshare-reduction-58.c: Ditto.
	* c-c++-common/gomp/52-deps.c: New test.
	* g++.dg/gomp/map-csm-dep.C: New test.
	* gcc.dg/gomp/map-csm-dep.c: New test.
2025-12-11 07:47:44 -08:00
supers1ngular
a57b0e3ecb [PATCH v2 1/4] openmp: Bump Version from 4.5 to 5.2 (1/4)
Bumps OpenMP from 4.5 (201511) to 5.2 (202111), with deprecation and
test support to 5.1 (202011). Adds new tests and a new warning.
Suppresses deprecation warnings in all relevant tests and removes
suppression pragmas visible outside of the testsuite. Additionally
implements new warning in the relevant frontends. Otherwise, cleans
up some whitespace and fixed a misspelled pragma in a testcase. Also
fixes an indentation error.

gcc/c-family/ChangeLog:

	* c-cppbuiltin.cc (c_cpp_builtins): Bump _OPENMP version.
	* c.opt (Wdeprecated-openmp): Add warning.
	* c.opt.urls: Regenerated.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_clause_proc_bind): Deprecate master
	affinity.
	(c_parser_omp_master): Deprecate master construct.
	(c_parser_transaction): Whitespace.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_postfix_expression): Whitespace.
	(cp_parser_builtin_c23_va_start): Ditto.
	(cp_parser_omp_clause_proc_bind): Deprecate master affinity.
	(cp_parser_omp_master): Deprecate master construct.

gcc/ChangeLog:

	* doc/invoke.texi: Update docs for '-Wdeprecated-openmp'.

gcc/fortran/ChangeLog:

	* cpp.cc (cpp_define_builtins): Bump _OPENMP version.
	* invoke.texi: Update docs for '-Wdeprecated-openmp'.
	* lang.opt (Wdeprecated-openmp): Add warning.
	* lang.opt.urls: Regenerated.
	* openmp.cc (gfc_match_omp_clauses): Deprecate master affinity
	policy.
	(gfc_match_omp_parallel_master): Deprecate master construct.
	(gfc_match_omp_parallel_master_taskloop): Ditto.
	(gfc_match_omp_parallel_master_taskloop_simd): Ditto.
	(gfc_match_omp_master): Ditto.
	(gfc_match_omp_master_taskloop): Ditto.
	(gfc_match_omp_master_taskloop_simd): Ditto.
	(resolve_omp_clauses): Warn for deprecated use of
	{use,is}_device_ptr.

libgomp/ChangeLog:

	* env.c (omp_display_env): Bump _OPENMP version.
	* fortran.c (ialias_redirect): Remove suppression pragmas.
	(omp_set_dynamic_8_): Ditto.
	(omp_set_nested_8_): Ditto.
	(omp_get_nested_): Ditto.
	* icv.c (omp_get_dynamic): Ditto.
	(omp_get_nested): Ditto.
	(ialias): Ditto.
	* omp_lib.f90.in: Bump openmp_version.
	* omp_lib.h.in: Ditto.
	* testsuite/libgomp.c++/affinity-1.C: Suppress deprecation
	warnings.
	* testsuite/libgomp.c++/ctor-1.C: Ditto.
	* testsuite/libgomp.c++/ctor-11.C: Ditto.
	* testsuite/libgomp.c++/ctor-13.C: Ditto.
	* testsuite/libgomp.c++/ctor-2.C: Ditto.
	* testsuite/libgomp.c++/ctor-5.C: Ditto.
	* testsuite/libgomp.c++/ctor-7.C: Ditto.
	* testsuite/libgomp.c++/depend-iterator-1.C: Ditto.
	* testsuite/libgomp.c++/loop-13.C: Ditto.
	* testsuite/libgomp.c++/master-1.C: Ditto.
	* testsuite/libgomp.c++/pr26943.C: Ditto.
	* testsuite/libgomp.c++/pr81130.C: Ditto.
	* testsuite/libgomp.c++/pr81314.C: Ditto.
	* testsuite/libgomp.c++/target-in-reduction-1.C: Ditto.
	* testsuite/libgomp.c++/target-in-reduction-2.C: Ditto.
	* testsuite/libgomp.c++/task-1.C: Ditto.
	* testsuite/libgomp.c++/task-2.C: Ditto.
	* testsuite/libgomp.c++/task-6.C: Ditto.
	* testsuite/libgomp.c++/task-reduction-7.C: Ditto.
	* testsuite/libgomp.c++/task-reduction-9.C: Ditto.
	* testsuite/libgomp.c++/taskloop-reduction-1.C: Ditto.
	* testsuite/libgomp.c-c++-common/cancel-taskgroup-4.c: Ditto.
	* testsuite/libgomp.c-c++-common/depend-inoutset-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/depend-iterator-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/master-combined-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-in-reduction-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/target-in-reduction-2.c: Ditto.
	* testsuite/libgomp.c-c++-common/task-detach-12.c: Ditto.
	* testsuite/libgomp.c-c++-common/task-reduction-15.c: Ditto.
	* testsuite/libgomp.c-c++-common/task-reduction-5.c: Ditto.
	* testsuite/libgomp.c-c++-common/task-reduction-6.c: Ditto.
	* testsuite/libgomp.c-c++-common/task-reduction-8.c: Ditto.
	* testsuite/libgomp.c-c++-common/taskloop-reduction-1.c: Ditto.
	* testsuite/libgomp.c-c++-common/taskloop-reduction-3.c: Ditto.
	* testsuite/libgomp.c-c++-common/taskloop-reduction-4.c: Ditto.
	* testsuite/libgomp.c/affinity-1.c: Remove extraneous dg
	instruction and add suppression.
	* testsuite/libgomp.c/critical-2.c: Suppress deprecation
	warnings.
	* testsuite/libgomp.c/debug-1.c: Ditto.
	* testsuite/libgomp.c/lib-1.c: Ditto.
	* testsuite/libgomp.c/loop-24.c: Ditto.
	* testsuite/libgomp.c/nestedfn-2.c: Ditto.
	* testsuite/libgomp.c/nestedfn-3.c: Ditto.
	* testsuite/libgomp.c/pr104385.c: Ditto.
	* testsuite/libgomp.c/target-31.c: Ditto.
	* testsuite/libgomp.c/target-34.c: Ditto.
	* testsuite/libgomp.c/target-critical-1.c: Ditto.
	* testsuite/libgomp.c/task-1.c: Ditto.
	* testsuite/libgomp.c/task-3.c: Ditto.
	* testsuite/libgomp.c/task-6.c: Ditto.
	* testsuite/libgomp.c/task-reduction-1.c: Ditto.
	* testsuite/libgomp.c/task-reduction-2.c: Ditto.
	* testsuite/libgomp.c/teams-1.c: Ditto.
	* testsuite/libgomp.c/vla-1.c: Ditto.
	* testsuite/libgomp.fortran/crayptr1.f90: Ditto.
	* testsuite/libgomp.fortran/depend-inoutset-1.f90: Ditto.
	* testsuite/libgomp.fortran/is_device_ptr-1.f90: Ditto.
	* testsuite/libgomp.fortran/is_device_ptr-2.f90: Ditto.
	* testsuite/libgomp.fortran/lib1.f90: Ditto.
	* testsuite/libgomp.fortran/lib2.f: Ditto.
	* testsuite/libgomp.fortran/lib3.f: Ditto.
	* testsuite/libgomp.fortran/omp_parse2.f90: Ditto.
	* testsuite/libgomp.fortran/openmp_version-1.f: Bump OMP version.
	* testsuite/libgomp.fortran/openmp_version-2.f90: Ditto.
	* testsuite/libgomp.fortran/parallel-master.f90: Suppress
	warnings.
	* testsuite/libgomp.fortran/pointer2.f90: Ditto.
	* testsuite/libgomp.fortran/reduction6.f90: Ditto.
	* testsuite/libgomp.fortran/target-firstprivate-1.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_addr-1.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_addr-2.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_addr-3.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_addr-4.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_addr-5.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_ptr-1.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_ptr-3.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_ptr-4.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_ptr-optional-1.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Ditto.
	* testsuite/libgomp.fortran/use_device_ptr-optional-3.f90: Ditto.
	* testsuite/libgomp.c-c++-common/omp-atv-seq-dep.c: New test.
	* testsuite/libgomp.c-c++-common/omp-lock-hint-contended-dep.c:
	New test.
	* testsuite/libgomp.c-c++-common/omp-lock-hint-none-dep.c: New test.
	* testsuite/libgomp.c-c++-common/omp-lock-hint-speculative-dep.c:
	New test.
	* testsuite/libgomp.c-c++-common/omp-lock-hint-uncontended-dep.c:
	New test.
	* testsuite/libgomp.c/omp-proc-bind-master-dep.c: New test.
	* testsuite/libgomp.fortran/omp-atv-seq-dep.f90: New test.
	* testsuite/libgomp.fortran/omp-lock-hint-contended-dep.f90: New
	test.
	* testsuite/libgomp.fortran/omp-lock-hint-none-dep.f90: New test.
	* testsuite/libgomp.fortran/omp-lock-hint-speculative-dep.f90: New
	test.
	* testsuite/libgomp.fortran/omp-lock-hint-uncontended-dep.f90: New
	test.

gcc/testsuite/ChangeLog:

	* c-c++-common/cpp/openmp-define-3.c: Bump OMP version.
	* c-c++-common/gomp/Wparentheses-1.c: Suppress deprecation
	warnings.
	* c-c++-common/gomp/Wparentheses-3.c: Ditto.
	* c-c++-common/gomp/affinity-3.c: Ditto.
	* c-c++-common/gomp/allocate-18.c: Ditto.
	* c-c++-common/gomp/cancel-1.c: Ditto.
	* c-c++-common/gomp/clause-dups-1.c: Ditto.
	* c-c++-common/gomp/clauses-1.c: Suppress deprecation
	warnings and fix misspelled directive. Add
	'-Wunknown-pragmas'.
	* c-c++-common/gomp/clauses-6.c: Suppress deprecation warnings.
	* c-c++-common/gomp/declare-variant-1.c: Ditto.
	* c-c++-common/gomp/declare-variant-2.c: Ditto.
	* c-c++-common/gomp/depend-iterator-1.c: Ditto.
	* c-c++-common/gomp/lastprivate-conditional-1.c: Ditto.
	* c-c++-common/gomp/loop-1.c: Ditto.
	* c-c++-common/gomp/loop-2.c: Ditto.
	* c-c++-common/gomp/loop-3.c: Ditto.
	* c-c++-common/gomp/loop-4.c: Ditto.
	* c-c++-common/gomp/master-combined-1.c: Ditto.
	* c-c++-common/gomp/master-combined-2.c: Ditto.
	* c-c++-common/gomp/nesting-2.c: Ditto.
	* c-c++-common/gomp/pr100902-1.c: Ditto.
	* c-c++-common/gomp/pr61486-2.c: Ditto.
	* c-c++-common/gomp/pr85696.c: Ditto.
	* c-c++-common/gomp/pr85956.c: Ditto.
	* c-c++-common/gomp/pr98187.c: Ditto.
	* c-c++-common/gomp/pr99928-1.c: Ditto.
	* c-c++-common/gomp/pr99928-10.c: Ditto.
	* c-c++-common/gomp/pr99928-11.c: Ditto.
	* c-c++-common/gomp/pr99928-12.c: Ditto.
	* c-c++-common/gomp/pr99928-13.c: Ditto.
	* c-c++-common/gomp/pr99928-14.c: Ditto.
	* c-c++-common/gomp/pr99928-2.c: Ditto.
	* c-c++-common/gomp/pr99928-3.c: Ditto.
	* c-c++-common/gomp/pr99928-4.c: Ditto.
	* c-c++-common/gomp/pr99928-5.c: Ditto.
	* c-c++-common/gomp/pr99928-6.c: Ditto.
	* c-c++-common/gomp/pr99928-7.c: Ditto.
	* c-c++-common/gomp/pr99928-8.c: Ditto.
	* c-c++-common/gomp/pr99928-9.c: Ditto.
	* c-c++-common/gomp/task-detach-1.c: Ditto.
	* c-c++-common/gomp/teams-2.c: Ditto.
	* g++.dg/gomp/attrs-1.C: Ditto.
	* g++.dg/gomp/attrs-2.C: Ditto.
	* g++.dg/gomp/attrs-4.C: Ditto.
	* g++.dg/gomp/block-0.C: Ditto.
	* g++.dg/gomp/block-10.C: Ditto.
	* g++.dg/gomp/block-5.C: Ditto.
	* g++.dg/gomp/block-9.C: Ditto.
	* g++.dg/gomp/depend-iterator-1.C: Ditto.
	* g++.dg/gomp/master-1.C: Ditto.
	* g++.dg/gomp/master-2.C: Ditto.
	* g++.dg/gomp/master-3.C: Ditto.
	* g++.dg/gomp/method-1.C: Ditto.
	* g++.dg/gomp/pr29965-3.C: Ditto.
	* g++.dg/gomp/pr29965-9.C: Ditto.
	* g++.dg/gomp/pr78363-4.C: Ditto.
	* g++.dg/gomp/pr78363-6.C: Ditto.
	* g++.dg/gomp/pr79664.C: Ditto.
	* g++.dg/gomp/pr94477.C: Ditto.
	* g++.dg/gomp/pr94512.C: Ditto.
	* g++.dg/gomp/tpl-master-1.C: Ditto.
	* gcc.dg/gomp/appendix-a/a.12.1.c: Ditto.
	* gcc.dg/gomp/appendix-a/a.33.2.c: Ditto.
	* gcc.dg/gomp/attrs-1.c: Ditto.
	* gcc.dg/gomp/attrs-2.c: Ditto.
	* gcc.dg/gomp/attrs-4.c: Ditto.
	* gcc.dg/gomp/block-10.c: Ditto.
	* gcc.dg/gomp/block-5.c: Ditto.
	* gcc.dg/gomp/block-9.c: Ditto.
	* gcc.dg/gomp/master-1.c: Ditto.
	* gcc.dg/gomp/master-2.c: Ditto.
	* gcc.dg/gomp/master-3.c: Ditto.
	* gcc.dg/gomp/nesting-1.c: Ditto.
	* gcc.dg/gomp/pr104517.c: Ditto.
	* gcc.dg/gomp/pr29965-3.c: Ditto.
	* gcc.dg/gomp/pr35818.c: Ditto.
	* gcc.dg/gomp/pr91216.c: Ditto.
	* gcc.dg/gomp/sharing-2.c: Ditto.
	* gfortran.dg/gomp/adjust-args-10.f90: Ditto.
	* gfortran.dg/gomp/affinity-1.f90: Ditto.
	* gfortran.dg/gomp/allocate-clause.f90: Ditto.
	* gfortran.dg/gomp/appendix-a/a.12.1.f90: Ditto.
	* gfortran.dg/gomp/appendix-a/a.33.2.f90: Ditto.
	* gfortran.dg/gomp/c_ptr_tests_20.f90: Ditto.
	* gfortran.dg/gomp/c_ptr_tests_21.f90: Ditto.
	* gfortran.dg/gomp/cancel-1.f90: Ditto.
	* gfortran.dg/gomp/clauses-1.f90: Ditto.
	* gfortran.dg/gomp/declare-variant-1.f90: Ditto.
	* gfortran.dg/gomp/depend-iterator-1.f90: Ditto.
	* gfortran.dg/gomp/depend-iterator-2.f90: Ditto.
	* gfortran.dg/gomp/is_device_ptr-1.f90: Ditto.
	* gfortran.dg/gomp/is_device_ptr-2.f90: Ditto.
	* gfortran.dg/gomp/is_device_ptr-3.f90: Ditto.
	* gfortran.dg/gomp/lastprivate-conditional-1.f90: Ditto.
	* gfortran.dg/gomp/loop-4.f90: Ditto.
	* gfortran.dg/gomp/loop-exit.f90: Ditto.
	* gfortran.dg/gomp/map-3.f90: Ditto.
	* gfortran.dg/gomp/nesting-2.f90: Ditto.
	* gfortran.dg/gomp/nesting-3.f90: Ditto.
	* gfortran.dg/gomp/nowait-2.f90: Ditto.
	* gfortran.dg/gomp/nowait-4.f90: Ditto.
	* gfortran.dg/gomp/nowait-5.f90: Ditto.
	* gfortran.dg/gomp/openmp-simd-2.f90: Ditto.
	* gfortran.dg/gomp/openmp-simd-3.f90: Ditto.
	* gfortran.dg/gomp/parallel-master-1.f90: Ditto.
	* gfortran.dg/gomp/parallel-master-2.f90: Ditto.
	* gfortran.dg/gomp/pr107214-8.f90: Ditto.
	* gfortran.dg/gomp/pr48117.f90: Ditto.
	* gfortran.dg/gomp/pr94672.f90: Ditto.
	* gfortran.dg/gomp/pr99928-1.f90: Suppression + fix whitespace.
	* gfortran.dg/gomp/pr99928-11.f90: Suppression.
	* gfortran.dg/gomp/pr99928-2.f90: Suppression + fix whitespace.
	* gfortran.dg/gomp/pr99928-3.f90: Ditto.
	* gfortran.dg/gomp/pr99928-4.f90: Ditto.
	* gfortran.dg/gomp/pr99928-5.f90: Ditto.
	* gfortran.dg/gomp/pr99928-6.f90: Ditto.
	* gfortran.dg/gomp/pr99928-8.f90: Ditto.
	* gfortran.dg/gomp/sharing-3.f90: Suppress deprecation warnings.
	* gfortran.dg/gomp/strictly-structured-block-1.f90: Ditto.
	* gfortran.dg/gomp/strictly-structured-block-2.f90: Ditto.
	* gfortran.dg/gomp/target1.f90: Ditto.
	* gfortran.dg/gomp/taskloop-1.f90: Ditto.
	* gfortran.dg/gomp/taskloop-2.f90: Ditto.
	* gfortran.dg/openmp-define-3.f90: Bump expected version.
	* c-c++-common/gomp/master-construct-dep.c: New test.
	* gfortran.dg/gomp/master-construct-dep.f90: New test.
2025-12-11 06:38:51 -08:00
Richard Biener
bf81616040 testsuite/120167 - avoid IPA messing up with test
The following avoids cloning / IPA CP to mess up dump counting.

	PR testsuite/120167
libgomp/
	* testsuite/libgomp.graphite/force-parallel-1.c: Make parloop
	noipa.
2025-12-09 14:56:34 +01:00
Andrew Stubbs
1cf9fda493 amdgcn: Adjust failure mode for gfx908 USM
Unified Shared Memory does not appear to work well on gfx908, which is why we
disabled xnack by default.  For this reason it makes sense to inform the user
as compile time, but this is causing trouble in the testsuite which assumes
that USM only fails at runtime.

This patch changes the gfx908 compile time message to a warning only (in case
some other target does this differently), and prevents the tests from
attempting to run in host-fallback mode (given that that is not what they are
trying to test).  It also changes the existing warning to only fire once.

The patch assumes that effective target "omp_usm" also implies self-maps.

gcc/ChangeLog:

	* config/gcn/gcn.cc (gcn_init_cumulative_args): Only warn once.
	Use "required" instead of "enabled" in the warning.
	* config/gcn/mkoffload.cc (process_asm): Warn, don't error.
	Use "required" instead of "on" in the warning.

libgomp/ChangeLog:

	* testsuite/lib/libgomp.exp (check_effective_target_omp_usm): New.
	* testsuite/libgomp.c++/target-std__array-concurrent-usm.C: Require
	working Unified Shared Memory to run the test.
	* testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__list-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__map-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__set-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__span-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: Likewise.
	* testsuite/libgomp.c-c++-common/target-implicit-map-4.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-link-3.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-link-4.c: Likewise.
	* testsuite/libgomp.fortran/self_maps.f90: Likewise.
2025-12-09 11:29:40 +00:00
Andrew Stubbs
1d1d12da6d amdgcn, libgomp: improve generic device errors
Switching to use "generic" ISA variants has changed the error modes a bit.

This patch changes the runtime so that it doesn't say to use the
device-specific -march option when the real problem is not the ISA (it'll be a
mismatched xnack setting, probably).

Additionally, the testsuite effective target check needs to see if the xnack
mode is accepted by the runtime, as well as the compiler.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (generic_isa_code): New function.
	(isa_matches_agent): Use generic ISA details to help select an error
	message on ISA mismatch.
	* testsuite/lib/libgomp.exp
	(check_effective_target_offload_target_amdgcn_with_xnack): Use a
	runtime check.
2025-12-04 15:35:05 +00:00
Andrew Stubbs
72a360c780 amdgcn, libgomp: use xfail for gfx908 requires tests
Use a different way to remove the "FAIL" cases for gfx908.  It really isn't
working with fall-back, as intended, so XFAIL is appropriate.

libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/requires-4.c: Change dg-excess-errors
	to dg-xfail-if.
	* testsuite/libgomp.c-c++-common/requires-4a.c: Likewise.
	* testsuite/libgomp.c-c++-common/requires-5.c: Likewise.
2025-12-04 12:14:48 +00:00
Andrew Stubbs
1eb2aeed08 libgomp: Fix offload_target with additional sources
The offload_target_* effective target checks called libgomp_target_compile in a
way that altered global state if additional sources were configured.

This patch ignores additional sources if the compile check uses no sources (a
compiler probe, only), thus fixing the problem.

libgomp/ChangeLog:

	* testsuite/lib/libgomp.exp (libgomp_target_compile): Don't use
	additional sources if there are no primary sources.
2025-12-03 16:29:32 +00:00
Andrew Stubbs
723b18ce3d libgomp, amdgcn: Implement Managed Memory
This patch implements "managed" memory for AMD GCN GPUs in OpenMP.  It
builds on the support added to the NVPTX libgomp for CUDA Managed Memory, a
week or two ago.

These features were first posted here a few years ago, as part of a larger
Unified Shared Memory patch series, and then in a slightly changed version just
over a year ago.  Hopefully this time the controversial bits have been removed.

Since we do not use HIP we cannot use hipMallocManaged, so this patch attempts
to replicate the same effect by setting the appropriate attributes.  This works
on more devices than support proper USM, but still I cannot be sure that the
settings are correct for every device out there (I have tested on gfx900,
gfx906, gfx908, gfx90a, and gfx1100).

The HSA header file update uses the most recent files relicensed for us by AMD,
at the time of the first patch posting.  Those files have certainly moved on in
the upstream sources, but I did not ask to get those relicensed.

include/ChangeLog:

	* hsa.h: Import newer version.
	* hsa_ext_amd.h: Likewise.
	* hsa_ext_image.h: Likewise.

libgomp/ChangeLog:

	* Makefile.in: Regenerate.
	* libgomp-plugin.h (gomp_simple_alloc_init_context): New prototype.
	(gomp_simple_alloc_register_memory): New prototype.
	(gomp_simple_alloc): New prototype.
	(gomp_simple_free): New prototype.
	(gomp_simple_realloc): New prototype.
	* libgomp.h (gomp_simple_alloc_init_context): Move to libgomp-plugin.h.
	(gomp_simple_alloc_register_memory): Likewise.
	(gomp_simple_alloc): Likewise.
	(gomp_simple_free): Likewise.
	(gomp_simple_realloc): Likewise.
	* libgomp.texi: Update AMD managed memory description.
	* plugin/Makefrag.am (libgomp_plugin_gcn_la_SOURCES): Add
	simple-allocator.c and plugin/mutex.c.
	* plugin/plugin-gcn.c: Include sys/mman.h and unistd.h.
	(struct hsa_runtime_fn_info): Add hsa_amd_svm_attributes_set_fn.
	(dump_hsa_system_info): Add HSA_AMD_SYSTEM_INFO_SVM_SUPPORTED and
	HSA_AMD_SYSTEM_INFO_SVM_ACCESSIBLE_BY_DEFAULT to the GCN_DEBUG output.
	(init_hsa_runtime_functions): Add hsa_amd_svm_attributes_set.
	(isa_matches_agent): Add a new error message for the case where the
	ISA doesn't match but the name does.
	(managed_ctx): New variable.
	(managed_heap_create): New function.
	(GOMP_OFFLOAD_managed_alloc): Likewise.
	(GOMP_OFFLOAD_managed_free): Likewise.
	* simple-allocator.c (gomp_fatal): New macro.
	* testsuite/lib/libgomp.exp (check_effective_target_omp_managedmem):
	Add amdgcn support checker.
	(check_effective_target_offload_target_amdgcn_with_xnack): New.
	* testsuite/libgomp.c-c++-common/requires-4.c: Ignore xnack warning.
	* testsuite/libgomp.c-c++-common/requires-4a.c: Ignore xnack warning.
	* testsuite/libgomp.c-c++-common/requires-5.c: Ignore xnack warning.
	* testsuite/libgomp.c++/alloc-managed-1.C: Add -mxnack=on, if needed.
	* testsuite/libgomp.c/alloc-managed-1.c: Likewise.
	* testsuite/libgomp.c/alloc-managed-2.c: Likewise.
	* testsuite/libgomp.c/alloc-managed-3.c: Likewise.
	* testsuite/libgomp.c/alloc-managed-4.c: Likewise.
	* testsuite/libgomp.fortran/alloc-managed-1.f90: Likewise.
	* plugin/mutex.c: New file.
2025-12-01 12:03:35 +00:00
Paul-Antoine Arras
05c2ad4a2e OpenMP/Fortran: Allow explicit map followed by implicit deep mapping [PR120505]
Consider the following source code, assuming tiles is allocatable:

```
!$omp target enter data map(var%tiles(1)%den1, var%tiles(1)%den2) !        (1)
[...]
!$omp target ! implicitly maps var, which triggers deep mapping of tiles   (2)
```

Each omp directive causes a run-time error in libgomp:
(1) libgomp: Mapped array elements must be the same (0x14d729c0 vs 0x14d72a18)
(2) libgomp: Trying to map into device [0x3704ca50..0x3704cb00) object when
             [0x3704ca50..0x3704caa8) is already mapped

Regarding (1), the OpenMP spec has the following restriction: "If multiple list
items are explicitly mapped on the same construct and have the same containing
array or have base pointers that share original storage, and if any of the list
items do not have corresponding list items that are present in the device data
environment prior to a task encountering the construct, then the list items must
refer to *the same array elements* of either the containing array or the
implicit array of the base pointers."
Because tiles is allocatable, we cannot prove at compile time that array
elements are the same, so the check is deferred to libgomp. But there the
condition enforcing that all addresses are the same is too strict, so this patch
relaxes it to only check that addresses are sorted in increasing order.

The OpenMP spec allows (2) as long as it is implicit, without extending the
original mapping. So this patch sets the GOMP_MAP_IMPLICIT flag appropriately
on deep maps at compile time to let libgomp know that it is fine.

This patch ensures that such user code is accepted by:
(1) Setting the GOMP_MAP_IMPLICIT flag appropriately on deep maps;
(2) Relaxing the restriction on struct mapping from different containing arrays,
so that the element index need not be the same, instead addresses must be sorted
in increasing order.

This fixes the two errors currently seen when running SPEC HPC clvleaf
benchmark. However, further mapping issues prevent the benchmark from running to
completion.

	PR fortran/120505

gcc/ChangeLog:

	* omp-low.cc (lower_omp_target): Set GOMP_MAP_IMPLICIT flag.

libgomp/ChangeLog:

	* target.c (gomp_map_vars_internal): Allow struct mapping from different
	containing array elements as long as adresses are in increasing order.
	* testsuite/libgomp.c-c++-common/map-arrayofstruct-2.c: Adjust
	dg-output.
	* testsuite/libgomp.c-c++-common/map-arrayofstruct-3.c: Likewise.
	* testsuite/libgomp.fortran/map-subarray-5.f90: Likewise.
	* testsuite/libgomp.fortran/map-subarray-10.f90: New test.
	* testsuite/libgomp.fortran/map-subarray-9.f90: New test.
2025-12-01 11:35:44 +01:00
Jakub Jelinek
0044388575 Change the default C++ dialect to gnu++20
On Mon, Nov 03, 2025 at 01:34:28PM -0500, Marek Polacek via Gcc wrote:
> I would like us to declare that C++20 is no longer experimental and
> change the default dialect to gnu++20.  Last time we changed the default
> was over 5 years ago in GCC 11:
> <https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0801f419440c14f6772b28f763ad7d40f7f7a580>
> and before that in 2015 in GCC 6.1, so this happens roughly every 5 years.
>
> I had been hoping to move to C++20 in GCC 15 (see bug 113920), but at that time
> libstdc++ still had incomplete C++20 support and the compiler had issues to iron
> out (mangling of concepts, modules work, etc.).  Are we ready now?  Is anyone
> aware of any blockers?  Presumably we still wouldn't enable Modules by default.
>
> I'm willing to do the work if we decide that it's time to switch the default
> C++ dialect (that includes updating cxx-status.html and adding a new caveat to
> changes.html).

I haven't seen a patch posted for this, so just that something is posted
during stage1 if we decide to do it, here is a patch.

The patch makes -std=gnu++20 the default C++ dialect and documents that
-fmodules is still not implied by that or -std=c++20 and modules support
is still experimental.

2025-11-26  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* doc/invoke.texi (gnu++17): Remove comment about the default.
	(c++20): Remove note about experimental support, except add a note
	that modules are still experimental and need to be enabled separately.
	(gnu++20): Likewise.  Move here comment about the default.
	(fcoroutines): Mention it is enabled by default for C++20 and later.
	* doc/standards.texi: Document that the default for C++ is
	-std=gnu++20.
gcc/c-family/
	* c-opts.cc (c_common_init_options): Call set_std_cxx20 rather than
	set_std_cxx17.
	* c.opt (std=c++2a): Change description to deprecated option wording.
	(std=c++20): Remove experimental support part.
	(std=c++2b): Change description to deprecated option wording.
	(std=gnu++2a): Likewise.
	(std=gnu++20): Remove experimental support part.
	(std=gnu++2b): Change description to deprecated option wording.
gcc/testsuite/
	* lib/target-supports.exp: Set cxx_default to c++20 rather than
	c++17.
	* lib/g++-dg.exp (g++-std-flags): Reorder list to put 20 first
	and 17 after 26.
	* g++.dg/debug/pr80461.C (bar): Use v = v + 1; instead of ++v;.
	* g++.dg/debug/pr94459.C: Add -std=gnu++17 to dg-options.
	* g++.dg/diagnostic/virtual-constexpr.C: Remove dg-skip-if,
	instead use { c++11 && c++17_down } effective target instead of
	c++11.
	* g++.dg/guality/pr67192.C: Add -std=gnu++17.
	* g++.dg/torture/pr84961-1.C: Likewise.
	* g++.dg/torture/pr84961-2.C: Likewise.
	* g++.dg/torture/pr51482.C (anim_track_bez_wvect::tangent): Cast
	key_class to int before multiplying it by float.
	* g++.dg/torture/stackalign/unwind-4.C (foo): Use g_a = g_a + 1;
	instead of g_a++;.
	* g++.dg/tree-prof/partition1.C (bar): Use l = l + 1; return l;
	instead of return ++l;.
	* obj-c++.dg/exceptions-3.mm: Add -std=gnu++17.
	* obj-c++.dg/exceptions-5.mm: Likewise.
libgomp/
	* testsuite/libgomp.c++/atomic-12.C (main): Add ()s around array
	reference index.
	* testsuite/libgomp.c++/atomic-13.C: Likewise.
	* testsuite/libgomp.c++/atomic-8.C: Likewise.
	* testsuite/libgomp.c++/atomic-9.C: Likewise.
	* testsuite/libgomp.c++/loop-6.C: Use count = count + 1;
	return count > 0; instead of return ++count > 0;.
	* testsuite/libgomp.c++/pr38650.C: Add -std=gnu++17.
	* testsuite/libgomp.c++/target-lambda-1.C (merge_data_func):
	Use [=,this] instead of just [=] in lambda captures.
	* testsuite/libgomp.c-c++-common/target-40.c (f1): Use v += 1;
	instead of v++;.
	* testsuite/libgomp.c-c++-common/depend-iterator-2.c: Use v = v + 1;
	instead of v++.
2025-11-26 15:01:11 +01:00
Arsen Arsenović
2b033568b9 libgomp/oacc: fix atomic_capture-3 iteration ordering issues
In r11-3059-g8183ebcdc1c843, Julian fixed a few issues with
atomic_capture-2.c relying on iteration order guarantees that do not
exist under OpenACC parallelized loops and, notably, do not happen even
by accident on AMDGCN.

The atomic_capture-3.c testcase was made by copying it from
atomic_capture-2.c and adding additional options in commit
r12-310-g4cf3b10f27b199, but from an older version of
atomic_capture-2.c, which lacked these ordering fixes fixes, so they
resurfaced in this test.

This patch ports those fixes from atomic_capture-2.c into
atomic_capture-3.c.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-c-c++-common/atomic_capture-3.c: Copy
	changes in r11-3059-g8183ebcdc1c843 from atomic_capture-2.c.
2025-11-25 09:34:58 +01:00
Sandra Loosemore
bd6d591799 OpenMP: C/C++ common testcases for "omp begin declare variant"
gcc/testsuite/ChangeLog
	* c-c++-common/gomp/delim-declare-variant-1.c: New.
	* c-c++-common/gomp/delim-declare-variant-2.c: New.
	* c-c++-common/gomp/delim-declare-variant-3.c: New.
	* c-c++-common/gomp/delim-declare-variant-4.c: New.
	* c-c++-common/gomp/delim-declare-variant-5.c: New.
	* c-c++-common/gomp/delim-declare-variant-6.c: New.
	* c-c++-common/gomp/delim-declare-variant-7.c: New.
	* c-c++-common/gomp/delim-declare-variant-8.c: New.
	* c-c++-common/gomp/delim-declare-variant-9.c: New.

libgomp/ChangeLog
	* testsuite/libgomp.c-c++-common/delim-declare-variant-1.c: New.
	* testsuite/libgomp.c-c++-common/delim-declare-variant-2.c: New.

Co-Authored-By: Tobias Burnus <tburnus@baylibre.com>
2025-11-22 17:05:23 +00:00
Sandra Loosemore
a469cf3df2 OpenMP: C++ front end support for "begin declare variant"
This patch implements C++ support for the "begin declare variant"
construct.  The OpenMP specification is hazy on interaction of this
feature with C++ language features.  Variant functions in classes are
supported but must be defined as members in the class definition,
using an unqualified name for the base function which also must be
present in that class.  Similarly variant functions in a namespace can
only be defined in that namespace using an unqualified name for a base
function already declared in that namespace.  Variants for template
functions or inside template classes seem to (mostly) work.

gcc/c-family/ChangeLog
	* c-omp.cc (c_omp_directives): Uncomment "begin declare variant"
	and "end declare variant".

gcc/cp/ChangeLog
	* cp-tree.h (struct cp_omp_declare_variant_attr): New.
	(struct saved_scope): Add omp_declare_variant_attribute field.
	* decl.cc (omp_declare_variant_finalize_one): Add logic to inject
	"this" parameter for method calls.
	* parser.cc (cp_parser_skip_to_pragma_omp_end_declare_variant): New.
	(cp_parser_translation_unit): Handle leftover "begin declare variant"
	functions.
	(omp_start_variant_function): New.
	(omp_finish_variant_function): New.
	(omp_maybe_record_variant_base): New.
	(cp_parser_init_declarator): Handle variant functions.
	(cp_parser_class_specifier): Handle deferred lookup of base functions
	when the entire class has been seen.
	(cp_parser_member_declaration): Handle variant functions.
	(cp_finish_omp_declare_variant): Merge context selectors if in
	a "begin declare variant" block.
	(cp_parser_omp_begin): Match "omp begin declare variant".  Adjust
	error messages.
	(cp_parser_omp_end): Match "omp end declare variant".
	* parser.h (struct omp_begin_declare_variant_map_entry): New.
	(struct cp_parser): Add omp_begin_declare_variant_map field.
	* semantics.cc (finish_translation_unit): Detect unmatched
	"omp begin declare variant".

gcc/testsuite/ChangeLog
	* g++.dg/gomp/delim-declare-variant-1.C: New.
	* g++.dg/gomp/delim-declare-variant-2.C: New.
	* g++.dg/gomp/delim-declare-variant-3.C: New.
	* g++.dg/gomp/delim-declare-variant-4.C: New.
	* g++.dg/gomp/delim-declare-variant-5.C: New.
	* g++.dg/gomp/delim-declare-variant-6.C: New.
	* g++.dg/gomp/delim-declare-variant-7.C: New.
	* g++.dg/gomp/delim-declare-variant-40.C: New.
	* g++.dg/gomp/delim-declare-variant-41.C: New.
	* g++.dg/gomp/delim-declare-variant-50.C: New.
	* g++.dg/gomp/delim-declare-variant-51.C: New.
	* g++.dg/gomp/delim-declare-variant-52.C: New.
	* g++.dg/gomp/delim-declare-variant-70.C: New.
	* g++.dg/gomp/delim-declare-variant-71.C: New.

libgomp/
	* testsuite/libgomp.c++/bdv_module1.C: New.
	* testsuite/libgomp.c++/bdv_module1_main.C: New.
	* testsuite/libgomp.c++/bdv_module2.C: New.
	* testsuite/libgomp.c++/bdv_module2_impl.C: New.
	* testsuite/libgomp.c++/bdv_module2_main.C: New.
	* testsuite/libgomp.c++/bdv_module3.C: New.
	* testsuite/libgomp.c++/bdv_module3_impl.C: New.
	* testsuite/libgomp.c++/bdv_module3_main.C: New.
	* testsuite/libgomp.c++/delim-declare-variant-1.C: New.
	* testsuite/libgomp.c++/delim-declare-variant-2.C: New.
	* testsuite/libgomp.c++/delim-declare-variant-7.C: New.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: waffl3x <waffl3x@baylibre.com>
2025-11-22 17:05:22 +00:00
Arsen Arsenović
10d9df13f9 libgomp: Fix race condition data-2{,-lib}.c testcase
In the testcases, the kernels scheduled on queues 11, 12, 13, 14 have
data dependencies on, respectively, 'b', 'c', 'd', and 'e', as they
write to them.

However, they also have a data dependency on 'a' and 'N', as they read
those.

Previously, the testcases exited 'a' on queue 10 and 'N' on queue 15,
meaning that it was possible for the aforementioned kernels to execute
and to have 'a' and 'N' pulled under their feet.

This patch adds waits for each of the kernels onto queue 10 before
freeing 'a', guaranteeing that 'a' outlives the kernels, and the same on
'N'.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-c-c++-common/data-2-lib.c (explanatory
	header): Fix typo.
	(main): Insert waits on kernels reading 'a' into queue 10 before
	exiting 'a', and waits on kernels reading 'N' into queue 15
	before exiting 'N'.
	* testsuite/libgomp.oacc-c-c++-common/data-2.c: Ditto.
2025-11-21 13:24:27 +01:00
Josef Melcr
f9c01c47f8 ipa: Remove LTO requirement for builtin callback carriers.
Due to the if statement in ipa_compute_jump_functions_for_bb, callback
edges were never constructed for builtin functions unless LTO was
enabled.  This patch corrects this behavior, allowing GCC to optimize
callbacks more broadly.  It also extends our testing capabilities.

gcc/ChangeLog:

	* attr-callback.cc (callback_edge_callee_has_attr): New
	function.
	* attr-callback.h (callback_edge_callee_has_attr): New function
	decl.
	* ipa-prop.cc (ipa_compute_jump_functions_for_bb): Don't skip
	callback carriers when calculating jump functions.

libgomp/ChangeLog:

	* testsuite/libgomp.c/ipcp-cb-spec1.c: Remove LTO requirement.
	* testsuite/libgomp.c/ipcp-cb-spec2.c: Likewise.
	* testsuite/libgomp.c/ipcp-cb1.c: Likewise.

Signed-off-by: Josef Melcr <josef.melcr@suse.com>
2025-11-21 09:17:26 +01:00
Jakub Jelinek
edc821b60c OpenMP/OpenACC tests. vs C++26
OpenMP/OpenACC array sections, generally expr[expr:expr] or
expr[expr:expr:expr] can have any of the exprs between [ and ]
omitted, low-bound (first defaults to 0, last (stride) defaults to
1 and the middle (length) for some arrays defaults to
ceil((size − lower_bound)/stride).
People have been writing this for years without spaces between [ and :
and : and ] when that expr has been omitted, but guess for C++26
one needs to add a space.  I think [ :: ] isn't going to be parsed
as the same as [ : : ] either.

gcc/testsuite/
	* c-c++-common/goacc/cache-3-1.c: Add dg-skip-if for c++26.
	* g++.dg/goacc/data-clause-2.C: Likewise.
	* g++.dg/gomp/allocate-3.C: Likewise.
	* c-c++-common/gomp/affinity-2.c: Use { c || c++23_down } effective
	target.
	* c-c++-common/goacc/cache-3-2.c: Replace [: in OpenMP or OpenACC
	pragmas or attributes with [ : and :] with : ].
	* c-c++-common/goacc/data-clause-1.c: Likewise.
	* c-c++-common/goacc/data-clause-2.c: Likewise.
	* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
	* c-c++-common/goacc/mdc-2.c: Likewise.
	* c-c++-common/goacc/readonly-1.c: Likewise.
	* c-c++-common/gomp/allocate-4.c: Likewise.
	* c-c++-common/gomp/clauses-3.c: Likewise.
	* c-c++-common/gomp/declare-mapper-3.c: Likewise.
	* c-c++-common/gomp/depend-1.c: Likewise.
	* c-c++-common/gomp/depend-2.c: Likewise.
	* c-c++-common/gomp/depend-3.c: Likewise.
	* c-c++-common/gomp/depend-4.c: Likewise.
	* c-c++-common/gomp/depend-5.c: Likewise.
	* c-c++-common/gomp/depend-6.c: Likewise.
	* c-c++-common/gomp/dispatch-1.c: Likewise.
	* c-c++-common/gomp/loop-5.c: Likewise.
	* c-c++-common/gomp/map-1.c: Likewise.
	* c-c++-common/gomp/map-2.c: Likewise.
	* c-c++-common/gomp/map-4.c: Likewise.
	* c-c++-common/gomp/map-7.c: Likewise.
	* c-c++-common/gomp/pr100902-1.c: Likewise.
	* c-c++-common/gomp/pr103642.c: Likewise.
	* c-c++-common/gomp/pr120180-1.c: Likewise.
	* c-c++-common/gomp/pr61486-1.c: Likewise.
	* c-c++-common/gomp/pr81006.c: Likewise.
	* c-c++-common/gomp/pr91920.c: Likewise.
	* c-c++-common/gomp/pr96867.c: Likewise.
	* c-c++-common/gomp/pr99928-16.c: Likewise.
	* c-c++-common/gomp/reduction-1.c: Likewise.
	* c-c++-common/gomp/scan-1.c: Likewise.
	* c-c++-common/gomp/target-data-1.c: Likewise.
	* c-c++-common/gomp/target-enter-data-1.c: Likewise.
	* c-c++-common/gomp/target-has-device-addr-1.c: Likewise.
	* c-c++-common/gomp/target-implicit-map-2.c: Likewise.
	* c-c++-common/gomp/target-map-iterators-1.c: Likewise.
	* c-c++-common/gomp/target-map-iterators-3.c: Likewise.
	* c-c++-common/gomp/target-update-iterators-1.c: Likewise.
	* c-c++-common/gomp/target-update-iterators-3.c: Likewise.
	* g++.dg/goacc/cache-3-1.C: Likewise.
	* g++.dg/goacc/cache-3-2.C: Likewise.
	* g++.dg/goacc/data-clause-1.C: Likewise.
	* g++.dg/goacc/mdc.C: Likewise.
	* g++.dg/gomp/array-section-2.C: Likewise.
	* g++.dg/gomp/bad-array-section-10.C: Likewise.
	* g++.dg/gomp/bad-array-section-11.C: Likewise.
	* g++.dg/gomp/bad-array-section-9.C: Likewise.
	* g++.dg/gomp/declare-mapper-1.C: Likewise.
	* g++.dg/gomp/declare-mapper-2.C: Likewise.
	* g++.dg/gomp/depend-1.C: Likewise.
	* g++.dg/gomp/depend-2.C: Likewise.
	* g++.dg/gomp/ind-base-3.C: Likewise.
	* g++.dg/gomp/map-1.C: Likewise.
	* g++.dg/gomp/map-2.C: Likewise.
	* g++.dg/gomp/map-ptrmem-1.C: Likewise.
	* g++.dg/gomp/map-ptrmem-2.C: Likewise.
	* g++.dg/gomp/member-array-2.C: Likewise.
	* g++.dg/gomp/target-this-3.C: Likewise.
	* g++.dg/gomp/target-this-4.C: Likewise.
libgomp/
	* testsuite/libgomp.c++/allocate-1.C: Replace [: in OpenMP or OpenACC
	pragmas or attributes with [ : and :] with : ].
	* testsuite/libgomp.c++/baseptrs-3.C: Likewise.
	* testsuite/libgomp.c++/baseptrs-5.C: Likewise.
	* testsuite/libgomp.c++/class-array-1.C: Likewise.
	* testsuite/libgomp.c++/examples-4/target_data-5.C: Likewise.
	* testsuite/libgomp.c++/lvalue-tofrom-2.C: Likewise.
	* testsuite/libgomp.c++/pr101544-1.C: Likewise.
	* testsuite/libgomp.c++/pr108286.C: Likewise.
	* testsuite/libgomp.c++/reduction-10.C: Likewise.
	* testsuite/libgomp.c++/reduction-11.C: Likewise.
	* testsuite/libgomp.c++/reduction-12.C: Likewise.
	* testsuite/libgomp.c++/reduction-5.C: Likewise.
	* testsuite/libgomp.c++/reduction-6.C: Likewise.
	* testsuite/libgomp.c++/reduction-7.C: Likewise.
	* testsuite/libgomp.c++/reduction-8.C: Likewise.
	* testsuite/libgomp.c++/reduction-9.C: Likewise.
	* testsuite/libgomp.c++/target-18.C: Likewise.
	* testsuite/libgomp.c++/target-19.C: Likewise.
	* testsuite/libgomp.c++/target-2.C: Likewise.
	* testsuite/libgomp.c++/target-22.C: Likewise.
	* testsuite/libgomp.c++/target-23.C: Likewise.
	* testsuite/libgomp.c++/target-9.C: Likewise.
	* testsuite/libgomp.c++/target-flex-100.C: Likewise.
	* testsuite/libgomp.c++/target-flex-101.C: Likewise.
	* testsuite/libgomp.c++/target-flex-12.C: Likewise.
	* testsuite/libgomp.c++/target-flex-2003.C: Likewise.
	* testsuite/libgomp.c++/target-flex-30.C: Likewise.
	* testsuite/libgomp.c++/target-flex-300.C: Likewise.
	* testsuite/libgomp.c++/target-flex-32.C: Likewise.
	* testsuite/libgomp.c++/target-flex-33.C: Likewise.
	* testsuite/libgomp.c++/target-flex-41.C: Likewise.
	* testsuite/libgomp.c++/target-flex-60.C: Likewise.
	* testsuite/libgomp.c++/target-flex-61.C: Likewise.
	* testsuite/libgomp.c++/target-flex-62.C: Likewise.
	* testsuite/libgomp.c++/target-flex-80.C: Likewise.
	* testsuite/libgomp.c++/target-flex-81.C: Likewise.
	* testsuite/libgomp.c++/target-has-device-addr-7.C: Likewise.
	* testsuite/libgomp.c++/target-in-reduction-1.C: Likewise.
	* testsuite/libgomp.c++/target-in-reduction-2.C: Likewise.
	* testsuite/libgomp.c++/target-lambda-1.C: Likewise.
	* testsuite/libgomp.c++/target-lambda-3.C: Likewise.
	* testsuite/libgomp.c++/target-map-class-1.C: Likewise.
	* testsuite/libgomp.c++/target-std__array-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__bitset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__deque-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__flat_map-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__flat_set-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__forward_list-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__list-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__map-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__multiset-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__set-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__span-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__unordered_map-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__unordered_set-concurrent.C:
	Likewise.
	* testsuite/libgomp.c++/target-std__valarray-1.C: Likewise.
	* testsuite/libgomp.c++/target-std__valarray-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-std__vector-concurrent.C: Likewise.
	* testsuite/libgomp.c++/target-this-3.C: Likewise.
	* testsuite/libgomp.c++/target-this-4.C: Likewise.
	* testsuite/libgomp.c++/target-virtual-1.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-11.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-12.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-13.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-17.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-18.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-19.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-4.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-5.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-6.C: Likewise.
	* testsuite/libgomp.c++/task-reduction-7.C: Likewise.
	* testsuite/libgomp.c++/taskloop-reduction-2.C: Likewise.
	* testsuite/libgomp.c++/taskloop-reduction-3.C: Likewise.
	* testsuite/libgomp.c++/taskloop-reduction-4.C: Likewise.
	* testsuite/libgomp.c-c++-common/allocate-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/allocate-3.c: Likewise.
	* testsuite/libgomp.c-c++-common/baseptrs-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/dispatch-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/dispatch-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/interop-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/matrix-omp-target-teams-distribute-parallel-for-1.c:
	Likewise.
	* testsuite/libgomp.c-c++-common/ptr-attach-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/ptr-attach-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/refcount-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/struct-elem-4.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-has-device-addr-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-implicit-map-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-implicit-map-5.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-in-reduction-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-in-reduction-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-map-iterators-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-map-iterators-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-map-iterators-3.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-map-zlas-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-update-iterators-1.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-update-iterators-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/target-update-iterators-3.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-reduction-11.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-reduction-12.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-reduction-16.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-reduction-3.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-reduction-7.c: Likewise.
	* testsuite/libgomp.c-c++-common/task-reduction-9.c: Likewise.
	* testsuite/libgomp.c-c++-common/taskloop-reduction-2.c: Likewise.
	* testsuite/libgomp.c-c++-common/teams-nteams-icv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-16.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-3.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-5.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-6.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: Likewise.
2025-11-17 09:42:56 +01:00
Andrew Stubbs
62174ec27b openmp, nvptx: ompx_gnu_managed_mem_alloc
This adds support for using Cuda Managed Memory with omp_alloc.  AMD support
will be added in a future patch.

There is one new predefined allocator, "ompx_gnu_managed_mem_alloc", plus a
corresponding memory space, which can be used to allocate memory in the
"managed" space.

The nvptx plugin is modified to make the necessary Cuda calls, via two new
(optional) plugin interfaces.

gcc/fortran/ChangeLog:

	* openmp.cc (is_predefined_allocator): Use GOMP_OMP_PREDEF_ALLOC_MAX
	and GOMP_OMPX_PREDEF_ALLOC_MIN/MAX instead of hardcoded values in the
	comment.

include/ChangeLog:

	* cuda/cuda.h (cuMemAllocManaged): Add declaration and related
	CU_MEM_ATTACH_GLOBAL flag.
	* gomp-constants.h (GOMP_OMPX_PREDEF_ALLOC_MAX): Update to 201.
	(GOMP_OMP_PREDEF_MEMSPACE_MAX): New constant.
	(GOMP_OMPX_PREDEF_MEMSPACE_MIN): New constant.
	(GOMP_OMPX_PREDEF_MEMSPACE_MAX): New constant.

libgomp/ChangeLog:

	* allocator.c (ompx_gnu_max_predefined_alloc): Update to
	ompx_gnu_managed_mem_alloc.
	(_Static_assert): Fix assertion messages for allocators and add
	new assertions for memspace constants.
	(omp_max_predefined_mem_space): New define.
	(ompx_gnu_min_predefined_mem_space): New define.
	(ompx_gnu_max_predefined_mem_space): New define.
	(MEMSPACE_ALLOC): Add check for non-standard memspaces.
	(MEMSPACE_CALLOC): Likewise.
	(MEMSPACE_REALLOC): Likewise.
	(MEMSPACE_VALIDATE): Likewise.
	(predefined_ompx_gnu_alloc_mapping): Add ompx_gnu_managed_mem_space.
	(omp_init_allocator): Add ompx_gnu_managed_mem_space validation.
	* config/gcn/allocator.c (gcn_memspace_alloc): Add check for
	non-standard memspaces.
	(gcn_memspace_calloc): Likewise.
	(gcn_memspace_realloc): Likewise.
	(gcn_memspace_validate): Update to validate standard vs non-standard
	memspaces.
	* config/linux/allocator.c (linux_memspace_alloc): Add managed
	memory space handling.
	(linux_memspace_calloc): Likewise.
	(linux_memspace_free): Likewise.
	(linux_memspace_realloc): Likewise (returns NULL for fallback).
	* config/nvptx/allocator.c (nvptx_memspace_alloc): Add check for
	non-standard memspaces.
	(nvptx_memspace_calloc): Likewise.
	(nvptx_memspace_realloc): Likewise.
	(nvptx_memspace_validate): Update to validate standard vs non-standard
	memspaces.
	* env.c (parse_allocator): Add ompx_gnu_managed_mem_alloc,
	ompx_gnu_managed_mem_space, and some static asserts so I don't forget
	them again.
	* libgomp-plugin.h (GOMP_OFFLOAD_managed_alloc): New declaration.
	(GOMP_OFFLOAD_managed_free): New declaration.
	* libgomp.h (gomp_managed_alloc): New declaration.
	(gomp_managed_free): New declaration.
	(struct gomp_device_descr): Add managed_alloc_func and
	managed_free_func fields.
	* libgomp.texi: Document ompx_gnu_managed_mem_alloc and
	ompx_gnu_managed_mem_space, add C++ template documentation, and
	describe NVPTX and AMD support.
	* omp.h.in: Add ompx_gnu_managed_mem_space and
	ompx_gnu_managed_mem_alloc enumerators, and gnu_managed_mem C++
	allocator template.
	* omp_lib.f90.in: Add Fortran bindings for new allocator and
	memory space.
	* omp_lib.h.in: Likewise.
	* plugin/cuda-lib.def: Add cuMemAllocManaged.
	* plugin/plugin-nvptx.c (nvptx_alloc): Add managed parameter to
	support cuMemAllocManaged.
	(GOMP_OFFLOAD_alloc): Move contents to ...
	(cleanup_and_alloc): ... this new function, and add managed support.
	(GOMP_OFFLOAD_managed_alloc): New function.
	(GOMP_OFFLOAD_managed_free): New function.
	* target.c (gomp_managed_alloc): New function.
	(gomp_managed_free): New function.
	(gomp_load_plugin_for_device): Load optional managed_alloc
	and managed_free plugin APIs.
	* testsuite/lib/libgomp.exp: Add check_effective_target_omp_managedmem.
	* testsuite/libgomp.c++/alloc-managed-1.C: New test.
	* testsuite/libgomp.c/alloc-managed-1.c: New test.
	* testsuite/libgomp.c/alloc-managed-2.c: New test.
	* testsuite/libgomp.c/alloc-managed-3.c: New test.
	* testsuite/libgomp.c/alloc-managed-4.c: New test.
	* testsuite/libgomp.fortran/alloc-managed-1.f90: New test.

Co-authored-by: Kwok Cheung Yeung <kcyeung@baylibre.com>
Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
2025-11-13 14:16:09 +00:00
Tobias Burnus
2de6462c38 libgomp.{c-c++-common,fortran}/target-is-accessible-1.c: Fix testcases for omp_default_device [P119677]
Commit r16-5188-g5da963d988e8ea added omp_default_device such that -5
became a conforming device number, but the tests used them to test
for as non-conforming number; now -6 is used.

libgomp/ChangeLog:

	PR libgomp/119677

	* testsuite/libgomp.c-c++-common/target-is-accessible-1.c: Modify
	test as -5 is now a conforming device number.
	* testsuite/libgomp.fortran/target-is-accessible-1.f90: Likewise.
2025-11-12 14:15:43 +01:00
Tobias Burnus
5da963d988 OpenMP: Add omp_default_device named constant [PR119677]
OpenMP TR 14 (OpenMP 6.1) adds omp_default_device < -1 as
named constant alongside omp_initial_device and omp_default_device.

GCC supports it already internally via GOMP_DEVICE_DEFAULT_OMP_61,
but this patch now adds the omp_default_device enum/PARAMETER to
omp.h / omp_lib.

Note that PR119677 requests some cleanups, which still have to be
done.

	PR libgomp/119677

gcc/fortran/ChangeLog:

	* intrinsic.texi (OpenMP Modules): Add omp_default_device.
	* openmp.cc (gfc_resolve_omp_context_selector): Accept
	omp_default_device as conforming device number.

libgomp/ChangeLog:

	* omp.h.in (omp_default_device): New enum value.
	* omp_lib.f90.in: New parameter.
	* omp_lib.h.in: Likewise
	* target.c (gomp_get_default_device): New. Split off from ...
	(resolve_device): ... here; call it.
	(omp_target_alloc, omp_target_free, omp_target_is_present,
	omp_target_memcpy_check, omp_target_memset, omp_target_memset_async,
	omp_target_associate_ptr, omp_get_mapped_ptr,
	omp_target_is_accessible, omp_pause_resource,
	omp_get_uid_from_device): Handle omp_default_device.
	* testsuite/libgomp.c/device_uid.c: Likewise.
	* testsuite/libgomp.fortran/device_uid.f90: Likewise.
	* testsuite/libgomp.c-c++-common/omp-default-device.c: New test.
	* testsuite/libgomp.fortran/omp-default-device.f90: New test.
2025-11-12 10:18:18 +01:00
Tobias Burnus
90f2ab4b6e libgomp.c++/target-std__multimap-concurrent.C: Fix USM memory freeing
Fix the unified-shared memory test,
   libgomp.c++/target-std__multimap-concurrent-usm.C
added in commit r16-1010-g83ca283853f195
   libgomp: Add testcases for concurrent access to standard C++ containers
   on offload targets, a number of USM variants
This tests includes the actual code of target-std__multimap-concurrent.C.

The issue is that multimap.insert allocates memory – which is freed by
the destructor. However, if the memory is allocated on a device
('insert'), it also needs to be freed there ('clear') as in general
freeing device-allocated memory is not possible on the host.

libgomp/ChangeLog:

	* testsuite/libgomp.c++/target-std__multimap-concurrent.C: Fix memory
	freeing of device allocated memory with USM.
2025-11-05 16:25:54 +01:00
Tobias Burnus
28d20a591d libgomp.fortran/omp_target_memset.f90 - Avoid implicit mapping by an uninit size [PR122543]
In OpenMP, pointers are implicitly mapped - which means for Fortran that
their pointer target is also mapped. However, for uninitialized memory,
this means that some random pointee with some random amount of memory is
copied - in the good case, size == 0, but if not, odd things can happen.

Solution: Use 'fptr => null()' before the target mapping or - as done here -
declare the pointer inside the region.

libgomp/ChangeLog:

	PR libgomp/122543
	* testsuite/libgomp.fortran/omp_target_memset.f90: Move fptr inside
	the target to avoid implicit mapping of its uninit pointee.
	* testsuite/libgomp.fortran/omp_target_memset-2.f90: Likewise.
2025-11-03 18:30:07 +01:00
Thomas Schwinge
7a25badc5d Fix 'libgomp.c/pr122281.c' for non-USM offloading execution [PR122281]
... where it currently runs into:

    libgomp: cuCtxSynchronize error: an illegal memory access was encountered

... for nvptx, or similarly for GCN:

    Memory access fault by GPU node-1 (Agent handle: 0x34d77290) on address 0x7fff3c553000. Reason: Page not present or supervisor privilege.

Fix-up for commit r16-4961-ge2cbcd1b27c0da92bdcd96664064d3d0c1d44e6f
"Fix gimple_copy for OpenMP atomic load/store [PR122281, PR105001]".

	PR libgomp/122281
	libgomp/
	* testsuite/libgomp.c/pr122281.c: Fix for non-USM offloading
	execution.
2025-11-03 15:29:11 +01:00
Tobias Burnus
e2cbcd1b27 Fix gimple_copy for OpenMP atomic load/store [PR122281, PR105001]
PR libgomp/122281
	PR middle-end/105001

gcc/ChangeLog:

	* gimple.cc (gimple_copy): Add missing unshare_expr for
	GIMPLE_OMP_ATOMIC_LOAD and GIMPLE_OMP_ATOMIC_STORE.
2025-11-03 12:21:30 +01:00
Andrew Stubbs
9e5a9aa490 libgomp: fine-grained pinned memory allocator
This patch introduces a new custom memory allocator for use with pinned
memory (in the case where the Cuda allocator isn't available).  In future,
this allocator will also be used for Managed Memory.  Both memories are
incompatible with the system malloc because allocated memory cannot share a
page with memory allocated for other purposes.

This means that small allocations will no longer consume an entire page of
pinned memory.  Unfortunately, it also means that pinned memory pages will
never be unmapped (although they may be reused).  This isn't a technical
limitation; the "free" algorithm could be extended in future, if needed.

The implementation is not perfect; there are various corner cases (especially
related to extending onto new pages) where allocations and reallocations may
be sub-optimal, but it should still be a step forward in support for small
allocations.

I have considered using libmemkind's "fixed" memory but rejected it for three
reasons: 1) libmemkind may not always be present at runtime, 2) there's no
currently documented means to extend a "fixed" kind one page at a time
(although the code appears to have an undocumented function that may do the
job, and/or extending libmemkind to support the MAP_LOCKED mmap flag with its
regular kinds would be straight-forward), 3) Managed Memory benefits from
having the metadata located in different memory and using an external
implementation makes it hard to guarantee this.

libgomp/ChangeLog:

	* Makefile.am (libgomp_la_SOURCES): Add simple-allocator.c.
	* Makefile.in: Regenerate.
	* basic-allocator.c: Mention simple-allocator in the comment.
	* config/linux/allocator.c: Include unistd.h.
	(pin_ctx): New variable.
	(ctxlock): New variable.
	(linux_init_pin_ctx): New function.
	(linux_memspace_alloc): Use simple-allocator for pinned memory.
	(linux_memspace_free): Likewise.
	(linux_memspace_realloc): Likewise.
	* libgomp.h (gomp_simple_alloc_init_context): New prototype.
	(gomp_simple_alloc_register_memory): New prototype.
	(gomp_simple_alloc): New prototype.
	(gomp_simple_free): New prototype.
	(gomp_simple_realloc): New prototype.
	* libgomp.texi: Update pinned memory trait documentation.
	* testsuite/libgomp.c/alloc-pinned-8.c: New test.
	* simple-allocator.c: New file.
2025-10-23 11:08:07 +00:00
Andrew Stubbs
3b8d9d579c libgomp, nvptx: Cuda pinned memory
Use Cuda to pin memory, instead of Linux mlock, when available.

There are two advantages: firstly, this gives a significant speed boost for
NVPTX offloading, and secondly, it side-steps the usual OS ulimit/rlimit
setting.

The design adds a device independent plugin API for allocating pinned memory,
and then implements it for NVPTX.  At present, the other supported devices do
not have equivalent capabilities (or requirements).

libgomp/ChangeLog:

	* config/linux/allocator.c: Include assert.h.
	(using_device_for_page_locked): New variable.
	(linux_memspace_alloc): Add init0 parameter. Support device pinning.
	(linux_memspace_calloc): Set init0 to true.
	(linux_memspace_free): Support device pinning.
	(linux_memspace_realloc): Support device pinning.
	(MEMSPACE_ALLOC): Set init0 to false.
	* libgomp-plugin.h
	(GOMP_OFFLOAD_page_locked_host_alloc): New prototype.
	(GOMP_OFFLOAD_page_locked_host_free): Likewise.
	* libgomp.h (gomp_page_locked_host_alloc): Likewise.
	(gomp_page_locked_host_free): Likewise.
	(struct gomp_device_descr): Add page_locked_host_alloc_func and
	page_locked_host_free_func.
	* libgomp.texi: Adjust the docs for the pinned trait.
	* plugin/plugin-nvptx.c
	(GOMP_OFFLOAD_page_locked_host_alloc): New function.
	(GOMP_OFFLOAD_page_locked_host_free): Likewise.
	* target.c (device_for_page_locked): New variable.
	(get_device_for_page_locked): New function.
	(gomp_page_locked_host_alloc): Likewise.
	(gomp_page_locked_host_free): Likewise.
	(gomp_load_plugin_for_device): Add page_locked_host_alloc and
	page_locked_host_free.
	* testsuite/libgomp.c/alloc-pinned-1.c: Change expectations for NVPTX
	devices.
	* testsuite/libgomp.c/alloc-pinned-2.c: Likewise.
	* testsuite/libgomp.c/alloc-pinned-3.c: Likewise.
	* testsuite/libgomp.c/alloc-pinned-4.c: Likewise.
	* testsuite/libgomp.c/alloc-pinned-5.c: Likewise.
	* testsuite/libgomp.c/alloc-pinned-6.c: Likewise.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
2025-10-23 11:08:06 +00:00
Josef Melcr
7292780932 testsuite: Move ipcp-cb* from ipa to libgomp
This patch addresses the incorrectly placed tests, which fail if the
testsuite is ran and gcc has not been installed yet, as discussed
here:
https://gcc.gnu.org/pipermail/gcc-patches/2025-October/698095.html.

gcc/testsuite/ChangeLog:
	* gcc.dg/ipa/ipcp-cb-spec1.c: Moved to libgomp/testsuite/libgomp.c/.
	* gcc.dg/ipa/ipcp-cb-spec2.c: Likewise.
	* gcc.dg/ipa/ipcp-cb1.c: Likewise.
libgomp/ChangeLog:
	* testsuite/libgomp.c/ipcp-cb-spec1.c: Moved from
	gcc/testsuite/gcc.dg/ipa/.
	* testsuite/libgomp.c/ipcp-cb-spec2.c: Likewise.
	* testsuite/libgomp.c/ipcp-cb1.c: Likewise.

Signed-off-by: Josef Melcr <jmelcr02@gmail.com>
2025-10-21 00:05:22 +02:00
Thomas Schwinge
651df6b43e c++, gimplify: Implement C++26 P2795R5 - Erroneous behavior for uninitialized reads: Adjust 'libgomp.c++/{target-flex-101.C,target-std__flat_map-concurrent.C,target-std__flat_multimap-concurrent.C}' [PR114457, PR122268, PR120450]
With commit r16-4212-gf256a13f8aed833fe964a2ba541b7b30ad9b4a76
"c++, gimplify: Implement C++26 P2795R5 - Erroneous behavior for uninitialized reads [PR114457]",
we acquired:

    {+FAIL: libgomp.c++/target-flex-101.C (internal compiler error: in assign_temp, at function.cc:990)+}
    [-PASS:-]{+FAIL:+} libgomp.c++/target-flex-101.C (test for excess errors)
    [-PASS:-]{+UNRESOLVED:+} libgomp.c++/target-flex-101.C [-execution test-]{+compilation failed to produce executable+}

... for GCN, nvptx offloading compilation, and on the other hand:

    [-XFAIL:-]{+XPASS:+} libgomp.c++/target-std__flat_map-concurrent.C (internal compiler error[-: in assign_temp, at function.cc:990)-]
    [-XFAIL:-]{+XPASS:+} libgomp.c++/target-std__flat_map-concurrent.C (test for excess errors)
    [-UNRESOLVED:-]{+PASS:+} libgomp.c++/target-std__flat_map-concurrent.C [-compilation failed to produce executable-]{+execution test+}

    [-XFAIL:-]{+XPASS:+} libgomp.c++/target-std__flat_multimap-concurrent.C (internal compiler error[-: in assign_temp, at function.cc:990)-]
    [-XFAIL:-]{+XPASS:+} libgomp.c++/target-std__flat_multimap-concurrent.C (test for excess errors)
    [-UNRESOLVED:-]{+PASS:+} libgomp.c++/target-std__flat_multimap-concurrent.C [-compilation failed to produce executable-]{+execution test+}

... for GCN offloading compilation (already PASSed for nvptx).

Note that these test cases explicitly use '-std=c++23', so don't undergo the
new C++26 P2795R5 functionality.  Yet, comparing before vs. after that commit,
in the 'gimple' dumps (that is, early host compilation), there are a lot of
changes where 'gimple_assign <constructor, [...], {CLOBBER(bob)}, NULL, NULL>'s
and relatedly 'gimple_bind's newly appear/no longer appear elsewhere.  This
leads to correspondingly different code at the beginning of offloading
compilation.  Why/how that now ('libgomp.c++/target-flex-101.C') vs. before
('libgomp.c++/{target-std__flat_map-concurrent.C,target-std__flat_multimap-concurrent.C}')
translates into 'expand' ICEs, I can't tell.

	PR c++/114457
	PR c++/122268
	PR c++/120450
	libgomp/
	* testsuite/libgomp.c++/target-flex-101.C: XFAIL GCN, nvptx
	offloading compilation.
	* testsuite/libgomp.c++/target-std__flat_map-concurrent.C:
	Un-XFAIL GCN offloading compilation.
	* testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C:
	Likewise.
2025-10-20 21:28:34 +02:00
Tobias Burnus
e1e5444ff2 libgomp.c/declare-variant-4-gfx*: Add missing archs + dg-excess-errors
Add missing tests for gfx* context selectors; mark all but the
default-arch declare-variant-4.c with 'dg-excess-errors' to
silence libgomp not-found errors (still passing the
scan-offload-tree-dump check) - or at least causing just
UNRESOLVED errors if the error is
  "built without library support ... consider compiling for
   the associated generic architecture".

In case the multilib is configured, the result will be
an XPASS.

libgomp/ChangeLog:

	* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c: Add
	dg-excess-errors to handle possible missing libgomp multi lib.
	* testsuite/libgomp.c/declare-variant-4-gfx1030.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1036.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1100.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1103.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx900.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx906.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx908.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90a.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx90c.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx942.c: Likewise.
	* testsuite/libgomp.c/declare-variant-4-gfx1031.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1032.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1033.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1034.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1035.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1101.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1102.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1150.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1151.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1152.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx1153.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx902.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx904.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx909.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx950.c: New test.
2025-10-16 11:11:39 +02:00
Tobias Burnus
b3c0e9aadb gcn: Add missing GFX9_4_GENERIC, OpenMP context-selector update
The definition for gfx942 and gfx950 missed the GFX9_4_GENERIC
family flag.

For OpenMP context selectors: The t-omp-device file missed the
generic selectors.

Additionally, there is now a note in the OpenMP documentation that
there is a one-to-one match for ISA names, ignoring any compatibility.
For instance, for Nvidia GPUs 'isa("sm_70")' is only true when compiling
for 'sm_70', even though sm < 7.0 code also runs on sm_70 hardware.
And, for AMD GPUs, gfx9-4-generic neither matches 'gfx942'
(even though such generic code runs on gfx942) - nor the reverse
(although all gfx9-4-generic code runs on gfx942).

gcc/ChangeLog:

	* config/gcn/gcn-devices.def (gfx942, gfx950): Set generic name
	to GFX9_4_GENERIC.
	* config/gcn/t-omp-device: Include generic names for OpenMP's
	ISA trait.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP Context Selectors): Add note that there is
	currently an exact match between ISA and compilation, ignoring
	compatibilities in both ways.
	* testsuite/libgomp.c/declare-variant-4.h: Add missing variant
	functions for specific and generic AMD GPUs.
	* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c: New test.
	* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: New test.
2025-10-15 19:15:15 +02:00
Sam James
ac273977ad *: regenerate autotools
libatomic/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libcc1/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.

libffi/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* include/Makefile.in: Regenerate.
	* man/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libgcobol/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libgfortran/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libgm2/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* libm2cor/Makefile.in: Regenerate.
	* libm2iso/Makefile.in: Regenerate.
	* libm2log/Makefile.in: Regenerate.
	* libm2min/Makefile.in: Regenerate.
	* libm2pim/Makefile.in: Regenerate.

libgomp/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libgrust/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* libformat_parser/Makefile.in: Regenerate.
	* libproc_macro_internal/Makefile.in: Regenerate.

libitm/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libobjc/ChangeLog:

	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libphobos/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libquadmath/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libsanitizer/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* asan/Makefile.in: Regenerate.
	* configure: Regenerate.
	* hwasan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

libssp/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++23/Makefile.in: Regenerate.
	* src/c++26/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/experimental/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* src/libbacktrace/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

libvtv/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

lto-plugin/ChangeLog:

	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
2025-10-05 17:14:49 +01:00
Tobias Burnus
97c1d2fa97 OpenMP: Unshare expr in context-selector condition [PR121922]
As the testcase shows, a missing unshare_expr caused that the condition
was only evaluated once instead of every time when a 'declare variant'
was resolved.

	PR middle-end/121922

gcc/ChangeLog:

	* omp-general.cc (omp_dynamic_cond): Use 'unshare_expr' for
	the user condition.

libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/declare-variant-1.c: New test.

Co-authored-by: Sandra Loosemore <sloosemore@baylibre.com>
2025-09-18 11:07:50 +02:00
Tobias Burnus
16d2b8881c libgomp: Add Fortran version of acc_copyout_finalize_async and acc_delete_finalize_async
OpenACC 2.5 added several functions for C and Fortran; while
acc_{copyout,delete}{,_finalize,_async} exist for both, for some
reasons only the C version of acc_{copyout,delete}_finalize_async
was actually added, even though the documentation (.texi) and
the .map file listed also the auxiliar Fortran functions!

OpenACC 2.5 added the Fortran version with the following odd
interface:  'type, dimension(:[,:]...)'. In OpenACC 2.6, it
was then updated to the Fortran 2018 syntax:
'type(*), dimension(..)', which is also used in openacc.f90
internally.
This commit now also updates the documentation to the newer
syntax - plus fixes a function-name typo: acc_delete_async_finalize
should have the _async at the end not in the middle!

libgomp/ChangeLog:

	* libgomp.map (OACC_2.5): Move previously unimplemented
	acc_{copyout,delete}_finalize_async_{32,64,array}_h_ to ...
	(OACC_2.6.1): ... here.
	* libgomp.texi (acc_copyin, acc_present_or_copyin, acc_create,
	acc_present_or_create, acc_copyout, acc_update_device,
	acc_update_self, acc_is_present): Use 'type(*), dimension(..)'
	instead of 'type, dimension(:[,:]...)' for Fortran.
	(acc_delete): Likewise; change acc_delete_async_finalize to
	acc_delete_finalize_async.
	* openacc.f90 (openacc_internal): Add interfaces for
	acc_{copyout,delete}_finalize_async_{{32,64,array}_h,_l}.
	(openacc): Add generic interfaces for
	acc_copyout_finalize_async and acc_delete_finalize_async.
	(acc_{copyout,delete}_finalize_async_{32,64,array}_h): New.
	* openacc_lib.h: Add generic interfaces for
	acc_copyout_finalize_async and acc_delete_finalize_async.
	* testsuite/libgomp.oacc-fortran/pr92970-1.f90: New test.
2025-09-17 08:43:58 +02:00