<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libgomp/testsuite, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>OpenMP: C/C++ common testcases for "omp begin declare variant"</title>
<updated>2025-11-22T17:05:23+00:00</updated>
<author>
<name>Sandra Loosemore</name>
<email>sloosemore@baylibre.com</email>
</author>
<published>2025-11-20T21:45:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=bd6d591799385b326b3589071b8cfa0bb61a9d19'/>
<id>bd6d591799385b326b3589071b8cfa0bb61a9d19</id>
<content type='text'>
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 &lt;tburnus@baylibre.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;tburnus@baylibre.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>OpenMP: C++ front end support for "begin declare variant"</title>
<updated>2025-11-22T17:05:22+00:00</updated>
<author>
<name>Sandra Loosemore</name>
<email>sloosemore@baylibre.com</email>
</author>
<published>2025-11-20T21:45:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=a469cf3df2ac97944a44948891e9fe22ba2f1d10'/>
<id>a469cf3df2ac97944a44948891e9fe22ba2f1d10</id>
<content type='text'>
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 &lt;julian@codesourcery.com&gt;
Co-Authored-By: waffl3x &lt;waffl3x@baylibre.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;julian@codesourcery.com&gt;
Co-Authored-By: waffl3x &lt;waffl3x@baylibre.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libgomp: Fix race condition data-2{,-lib}.c testcase</title>
<updated>2025-11-21T12:24:27+00:00</updated>
<author>
<name>Arsen Arsenović</name>
<email>aarsenovic@baylibre.com</email>
</author>
<published>2025-11-21T11:17:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=10d9df13f99471702e4d4c7d59096b803dc01e6d'/>
<id>10d9df13f99471702e4d4c7d59096b803dc01e6d</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>ipa: Remove LTO requirement for builtin callback carriers.</title>
<updated>2025-11-21T08:17:26+00:00</updated>
<author>
<name>Josef Melcr</name>
<email>josef.melcr@suse.com</email>
</author>
<published>2025-11-20T22:57:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f9c01c47f8e5451e41a5df78f044d7b1e7b3d5d6'/>
<id>f9c01c47f8e5451e41a5df78f044d7b1e7b3d5d6</id>
<content type='text'>
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 &lt;josef.melcr@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;josef.melcr@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>OpenMP/OpenACC tests. vs C++26</title>
<updated>2025-11-17T08:42:56+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2025-11-17T08:42:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=edc821b60ce94b8ddb5d0b9ccdb9a0a4691371c7'/>
<id>edc821b60ce94b8ddb5d0b9ccdb9a0a4691371c7</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>openmp, nvptx: ompx_gnu_managed_mem_alloc</title>
<updated>2025-11-13T14:16:09+00:00</updated>
<author>
<name>Andrew Stubbs</name>
<email>ams@codesourcery.com</email>
</author>
<published>2024-06-28T10:24:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=62174ec27b686bb9656c62a3b53d6cc08c9addb4'/>
<id>62174ec27b686bb9656c62a3b53d6cc08c9addb4</id>
<content type='text'>
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 &lt;kcyeung@baylibre.com&gt;
Co-authored-by: Thomas Schwinge &lt;tschwinge@baylibre.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;kcyeung@baylibre.com&gt;
Co-authored-by: Thomas Schwinge &lt;tschwinge@baylibre.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libgomp.{c-c++-common,fortran}/target-is-accessible-1.c: Fix testcases for omp_default_device [P119677]</title>
<updated>2025-11-12T13:15:43+00:00</updated>
<author>
<name>Tobias Burnus</name>
<email>tburnus@baylibre.com</email>
</author>
<published>2025-11-12T13:15:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=2de6462c3800ff6a56e3d5ef4108a5de7f0f3757'/>
<id>2de6462c3800ff6a56e3d5ef4108a5de7f0f3757</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>OpenMP: Add omp_default_device named constant [PR119677]</title>
<updated>2025-11-12T09:18:18+00:00</updated>
<author>
<name>Tobias Burnus</name>
<email>tburnus@baylibre.com</email>
</author>
<published>2025-11-12T09:18:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=5da963d988e8ea3a13bd8dca87c6cec943af7b56'/>
<id>5da963d988e8ea3a13bd8dca87c6cec943af7b56</id>
<content type='text'>
OpenMP TR 14 (OpenMP 6.1) adds omp_default_device &lt; -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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
OpenMP TR 14 (OpenMP 6.1) adds omp_default_device &lt; -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.
</pre>
</div>
</content>
</entry>
<entry>
<title>libgomp.c++/target-std__multimap-concurrent.C: Fix USM memory freeing</title>
<updated>2025-11-05T15:25:54+00:00</updated>
<author>
<name>Tobias Burnus</name>
<email>tburnus@baylibre.com</email>
</author>
<published>2025-11-05T15:25:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=90f2ab4b6e1463d8cb89c70585e19987a58f3de1'/>
<id>90f2ab4b6e1463d8cb89c70585e19987a58f3de1</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>libgomp.fortran/omp_target_memset.f90 - Avoid implicit mapping by an uninit size [PR122543]</title>
<updated>2025-11-03T17:30:07+00:00</updated>
<author>
<name>Tobias Burnus</name>
<email>tburnus@baylibre.com</email>
</author>
<published>2025-11-03T17:30:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=28d20a591ddf1618d75f2b8261ba85bf15a49876'/>
<id>28d20a591ddf1618d75f2b8261ba85bf15a49876</id>
<content type='text'>
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 =&gt; 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 =&gt; 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.
</pre>
</div>
</content>
</entry>
</feed>
