Commit Graph

2657 Commits

Author SHA1 Message Date
GCC Administrator
68de3c4b89 Daily bump. 2025-12-02 09:47:45 +00:00
Andrew Stubbs
fe5c59ea99 libgomp, amdgcn: document HSA_XNACK
Mention that the HSA_XNACK variable is automatically set by the toolchain.

libgomp/ChangeLog:

	* libgomp.texi (AMD GCN): Mention HSA_XNACK is set automatically.
2025-12-01 14:44:55 +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
GCC Administrator
2593a24241 Daily bump. 2025-11-27 00:20:22 +00: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
GCC Administrator
3c62023d05 Daily bump. 2025-11-26 00:20:39 +00:00
Frank Scheiner
9c9d3aef2f [PATCH] libgomp: Fix GCC build after glibc@cd748a6
The toolchain autobuilds for ia64 failed ([1]) yesterday with:

```
libtool: compile:  /usr/src/t2-src/src.gcc.ia64-toolchain.251121.040147.278918/gcc-16-20251116/objs/gcc/xgcc-wrapper /usr/src/t2-src/src.gcc.ia64-toolchain.251121.040147.278918/gcc-16-20251116/objs/./gcc/xgcc -B/usr/src/t2-src/src.gcc.ia64-toolchain.251121.040147.278918/gcc-16-20251116/objs/./gcc/ -B/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/usr/ia64-t2-linux-gnu/bin/ -B/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/usr/ia64-t2-linux-gnu/lib/ -isystem /usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/usr/ia64-t2-linux-gnu/include -isystem /usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux/TOOLCHAIN/cross/usr/ia64-t2-linux-gnu/sys-include --sysroot=/usr/src/t2-src/build/ia64-toolchain-24-svn-generic-ia64-itanium2-cross-linux -DHAVE_CONFIG_H -I. -I../../../libgomp -I../../../libgomp/config/linux/ia64 -I../../../libgomp/config/linux -I../../../libgomp/config/posix -I../../../libgomp -I../../../libgomp/../include -Wall -Werror -ftls-model=initial-exec -pthread -DUSING_INITIAL_EXEC_TLS -g -O2 -MT oacc-cuda.lo -MD -MP -MF .deps/oacc-cuda.Tpo -c ../../../libgomp/oacc-cuda.c -o oacc-cuda.o >/dev/null 2>&1
../../../libgomp/affinity-fmt.c: In function 'gomp_display_affinity':
../../../libgomp/affinity-fmt.c:330:25: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  330 |               char *q = strchr (p + 1, '}');
      |                         ^~~~~~
```

[1]: https://github.com/johnny-mnemonic/toolchain-autobuilds/actions/runs/19559235881

This is not ia64-specific but due to the changes in the recent glibc
commit "Implement C23 const-preserving standard library macros" (i.e.
[2]) now requiring "char *q" to be a pointer to a const char to compile
w/o error because of the return value of strchr() .

[2]: https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

Also see the related discussion at [3] for details.

[3]: https://sourceware.org/pipermail/libc-alpha/2025-November/172809.html

The GCC build is fixed by the attached patch, see [4] for a successful
build with the then latest snapshots of binutils, glibc and GCC.

[4]: https://github.com/johnny-mnemonic/toolchain-autobuilds/actions/runs/19585045571

Idea from Tomas, attached patch from me.

Cheers,
Frank

0001-libgomp-Fix-GCC-build-after-glibc-cd748a6.patch

From 80af9c233c694904174b54a59404d311378f41f8 Mon Sep 17 00:00:00 2001
From: Frank Scheiner <frank.scheiner@web.de>
Date: Sat, 22 Nov 2025 14:58:10 +0100
Subject: [PATCH] libgomp: Fix GCC build after glibc@cd748a6

char *q needs to be a pointer to a const char for the return value of
strchr() with glibc after "Implement C23 const-preserving standard library
macros".

[glibc@cd748a6]: https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690

libgomp/ChangeLog:
	* affinity-fmt.c: Make char *q a pointer to a const char.
2025-11-25 16:58:23 -07: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
GCC Administrator
c4e28a43f3 Daily bump. 2025-11-23 00:19:38 +00:00
Sandra Loosemore
f28f1c519d OpenMP: Update docs for "begin declare variant" implementation status
libgomp/ChangeLog
	* libgomp.texi (OpenMP 5.1): Update "begin declare variant" status.
2025-11-22 17:05:23 +00: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
GCC Administrator
10e987956f Daily bump. 2025-11-22 00:20:52 +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
GCC Administrator
cb8c1f7c07 Daily bump. 2025-11-20 00:19:40 +00:00
Martin Liska
27450916cd support Wild linker
gcc/ChangeLog:

	* collect2.cc (main): Add wild linker to -fuse-ld.
	* common.opt: Likewise.
	* configure: Regenerate.
	* configure.ac: Add detection for wild linker.
	* doc/invoke.texi: Document -fuse-ld=wild.
	* gcc.cc (driver_handle_option): Support -fuse-ld=wild.
	* opts.cc (common_handle_option): Likewise.

libatomic/ChangeLog:

	* acinclude.m4: Add detection for wild linker.
	* configure: Regenerate.

libgomp/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libitm/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

Signed-off-by: Martin Liška <martin.liska@hey.com>
2025-11-19 16:07:57 +01:00
GCC Administrator
608420810f Daily bump. 2025-11-19 00:19:58 +00:00
Tobias Burnus
a286685f63 libgomp.texi: Update MASTER/MASKED entry in the libgomp ABI section
libgomp/
	* libgomp.texi (The libgomp ABI): Update MASTER section by
	also covering MASKED.
2025-11-18 23:10:21 +01:00
GCC Administrator
0aac01bfa6 Daily bump. 2025-11-18 00:21:51 +00: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
GCC Administrator
890dff609d Daily bump. 2025-11-14 00:20:34 +00: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
GCC Administrator
a784ed8dad Daily bump. 2025-11-13 00:20:50 +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
845fb3b4a9 libgomp.texi: Add OpenMP TR14 implementation status
libgomp/ChangeLog:

	* libgomp.texi (OpenMP Implementation Status): Add TR14.
2025-11-12 10:20:02 +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
GCC Administrator
20ddfc95a1 Daily bump. 2025-11-06 00:22:22 +00: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
GCC Administrator
0e9ccae269 Daily bump. 2025-11-04 00:20:26 +00:00
Sam James
f8bb20167f gcc: sync top-level with binutils-gdb
This just pulls in Alan's:

commit 87b6078fc212ccba5f043399c6370ee20f6b355a
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Mon Nov 3 10:59:50 2025 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Mon Nov 3 10:59:50 2025 +1030

    tidy m4 plugin config support

    ...

It tidies up the configure test output.

config/ChangeLog:

	* clang-plugin.m4: Sync with binutils.
	* gcc-plugin.m4: Ditto.

ChangeLog:

	* configure: Regenerate.

gcc/ChangeLog:

	* configure: Regenerate.

libatomic/ChangeLog:

	* configure: Regenerate.

libbacktrace/ChangeLog:

	* configure: Regenerate.

libcc1/ChangeLog:

	* configure: Regenerate.

libffi/ChangeLog:

	* configure: Regenerate.

libgcobol/ChangeLog:

	* configure: Regenerate.

libgfortran/ChangeLog:

	* configure: Regenerate.

libgm2/ChangeLog:

	* configure: Regenerate.

libgomp/ChangeLog:

	* configure: Regenerate.

libgrust/ChangeLog:

	* configure: Regenerate.

libiberty/ChangeLog:

	* configure: Regenerate.

libitm/ChangeLog:

	* configure: Regenerate.

libobjc/ChangeLog:

	* configure: Regenerate.

libphobos/ChangeLog:

	* configure: Regenerate.

libquadmath/ChangeLog:

	* configure: Regenerate.

libsanitizer/ChangeLog:

	* configure: Regenerate.

libssp/ChangeLog:

	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.

libvtv/ChangeLog:

	* configure: Regenerate.

lto-plugin/ChangeLog:

	* configure: Regenerate.

zlib/ChangeLog:

	* configure: Regenerate.
2025-11-03 20:25:00 +00: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
GCC Administrator
4d26a60894 Daily bump. 2025-10-29 00:19:49 +00:00
Thomas Schwinge
41e2077fa2 libgomp: Simplify 'parse_stacksize' call in 'libgomp/env.c:initialize_env'
Minor fix-up for commit r13-2545-g9f2fca56593a2b87026b399d26adcdca90705685
"OpenMP, libgomp: Environment variable syntax extension".  Supplying an array
of three elements is misleading: 'parse_stacksize' only looks at 'params[0]'.
Just let the compiler figure out the array size (..., as done elsewhere, too).

	libgomp/
	* env.c (initialize_env): Simplify 'parse_stacksize' call.
2025-10-28 09:54:29 +01:00
GCC Administrator
5abeecf68e Daily bump. 2025-10-24 00:19:11 +00: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
GCC Administrator
1ea18259a9 Daily bump. 2025-10-21 00:20:03 +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
GCC Administrator
03fed2a80b Daily bump. 2025-10-17 00:18:48 +00: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
GCC Administrator
b9c253795e Daily bump. 2025-10-16 00:21:56 +00: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
GCC Administrator
ddd6dff0ba Daily bump. 2025-10-11 00:21:09 +00:00
Tobias Burnus
d2ad7e9083 libgomp: Add is_integrated_apu function to plugin/plugin-{gcn,nvptx}.c
The added function is currently '#if 0' but is planned to be used to enable
self mapping automatically. Prerequisite for auto self maps is still mapping
'declare target' variables (if any, in libgomp) or converting all
'declare target' variables to 'declare target link' in the compiler
(as required for 'omp requires self_maps').

include/ChangeLog:

	* hsa_ext_amd.h (enum hsa_amd_agent_info_s): Add
	HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES.
	(enum): Add HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (is_integrated_apu): New; currently '#if 0'.
	* plugin/plugin-nvptx.c (is_integrated_apu): Likewise.
2025-10-10 09:48:37 +02:00
GCC Administrator
7f57e04ce4 Daily bump. 2025-10-05 16:50:51 +00:00