Commit graph

129 commits

Author SHA1 Message Date
Tobias Burnus
2e3dd14dd2 libgomp.texi: Mention GCN_STACK_SIZE in Offload-Target Specifics
libgomp/ChangeLog:

	* libgomp.texi (Offload-Target Specifics): Mention GCN_STACK_SIZE.
2023-03-08 14:55:49 +01:00
Jakub Jelinek
0b9bd33d69 libgomp: Fix up some typos in libgomp.texi
I decided to check for repeated the the in libgomp and noticed
there are several occurrences of a typo theads rather than threads
in libgomp.texi.

2023-02-16  Jakub Jelinek  <jakub@redhat.com>

	* libgomp.texi: Fix typos - theads -> threads.
2023-02-16 12:15:03 +01:00
Tobias Burnus
f84fdb134d libgomp: enable reverse offload for AMDGCN
libgomp/ChangeLog:

	* libgomp.texi (5.0 Impl. Status, gcn specifics): Update for
	reverse offload.
	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Accept
	reverse-offload requirement.
2023-02-03 08:33:17 +01:00
Tobias Burnus
8da7476c5f libgomp.texi (OpenMP TR11 impl. status): Fix 'strict' item
Fix the 'strict' modifier status: it is already listed (as 'Y') for OpenMP
5.1 for num_task and grainsize; only strict on num_threads is new with TR11.

libgomp/
	* libgomp.texi (OpenMP TR11): Fix item for 'strict' modifier.
2023-02-02 12:05:58 +01:00
Tobias Burnus
eda38850a7 libgomp.texi: Reverse-offload updates
libgomp/
	* libgomp.texi (5.0 Impl. Status): Update 'requires' and 'ancestor'.
	(GCN): Add item about 'omp requires'.
	(nvptx): Likewise; add item about reverse offload.
2023-02-01 12:19:27 +01:00
Tobias Burnus
20552407ae libgomp.texi: Impl. status - non-rect loop nest only partial
libgomp/
	* libgomp.texi (OpenMP 5.0): Set non-rectangular
	loop nest back to 'P' as Fortran support is incomplete.
2023-01-23 09:40:41 +01:00
Jakub Jelinek
74d5206fb6 Update copyright dates.
Manual part of copyright year updates.

2023-01-02  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* gcc.cc (process_command): Update copyright notice dates.
	* gcov-dump.cc (print_version): Ditto.
	* gcov.cc (print_version): Ditto.
	* gcov-tool.cc (print_version): Ditto.
	* gengtype.cc (create_file): Ditto.
	* doc/cpp.texi: Bump @copying's copyright year.
	* doc/cppinternals.texi: Ditto.
	* doc/gcc.texi: Ditto.
	* doc/gccint.texi: Ditto.
	* doc/gcov.texi: Ditto.
	* doc/install.texi: Ditto.
	* doc/invoke.texi: Ditto.
gcc/ada/
	* gnat_ugn.texi: Bump @copying's copyright year.
	* gnat_rm.texi: Likewise.
gcc/d/
	* gdc.texi: Bump @copyrights-d year.
gcc/fortran/
	* gfortranspec.cc (lang_specific_driver): Update copyright notice
	dates.
	* gfc-internals.texi: Bump @copying's copyright year.
	* gfortran.texi: Ditto.
	* intrinsic.texi: Ditto.
	* invoke.texi: Ditto.
gcc/go/
	* gccgo.texi: Bump @copyrights-go year.
libgomp/
	* libgomp.texi: Bump @copying's copyright year.
libitm/
	* libitm.texi: Bump @copying's copyright year.
libquadmath/
	* libquadmath.texi: Bump @copying's copyright year.
2023-01-02 09:26:59 +01:00
Tobias Burnus
b2e1c49b4a Fortran/OpenMP: align/allocator modifiers to the allocate clause
gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_namelist): Improve OMP_LIST_ALLOCATE
	output.
	* gfortran.h (struct gfc_omp_namelist): Add 'align' to 'u'.
	(gfc_free_omp_namelist): Add bool arg.
	* match.cc (gfc_free_omp_namelist): Likewise; free 'u.align'.
	* openmp.cc (gfc_free_omp_clauses, gfc_match_omp_clause_reduction,
	gfc_match_omp_flush): Update call.
	(gfc_match_omp_clauses): Match 'align/allocate modifers in
	'allocate' clause.
	(resolve_omp_clauses): Resolve align.
	* st.cc (gfc_free_statement): Update call
	* trans-openmp.cc (gfc_trans_omp_clauses): Handle 'align'.

libgomp/ChangeLog:

	* libgomp.texi (5.1 Impl. Status): Split allocate clause/directive
	item about 'align'; mark clause as 'Y' and directive as 'N'.
	* testsuite/libgomp.fortran/allocate-2.f90: New test.
	* testsuite/libgomp.fortran/allocate-3.f90: New test.
2022-12-09 21:45:37 +01:00
Marcel Vollweiler
81476bc4f4 OpenMP: omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices
This patch adds support for omp_get_max_teams, omp_set_num_teams, and
omp_{gs}et_teams_thread_limit on offload devices. That includes the usage of
device-specific ICV values (specified as environment variables or changed on a
device). In order to reuse device-specific ICV values, a copy back mechanism is
implemented that copies ICV values back from device to the host.

Additionally, a limitation of the number of teams on gcn offload devices is
implemented.  The number of teams is limited by twice the number of compute
units (one team is executed on one compute unit).  This avoids queueing
unnessecary many teams and a corresponding allocation of large amounts of
memory.  Without that limitation the memory allocation for a large number of
user-specified teams can result in an "memory access fault".
A limitation of the number of teams is already also implemented for nvptx
devices (see nvptx_adjust_launch_bounds in libgomp/plugin/plugin-nvptx.c).

gcc/ChangeLog:

	* gimplify.cc (optimize_target_teams): Set initial num_teams_upper
	to "-2" instead of "1" for non-existing num_teams clause in order to
	disambiguate from the case of an existing num_teams clause with value 1.

libgomp/ChangeLog:

	* config/gcn/icv-device.c (omp_get_teams_thread_limit): Added to
	allow processing of device-specific values.
	(omp_set_teams_thread_limit): Likewise.
	(ialias): Likewise.
	* config/nvptx/icv-device.c (omp_get_teams_thread_limit): Likewise.
	(omp_set_teams_thread_limit): Likewise.
	(ialias): Likewise.
	* icv-device.c (omp_get_teams_thread_limit): Likewise.
	(ialias): Likewise.
	(omp_set_teams_thread_limit): Likewise.
	* icv.c (omp_set_teams_thread_limit): Removed.
	(omp_get_teams_thread_limit): Likewise.
	(ialias): Likewise.
	* libgomp.texi: Updated documentation for nvptx and gcn corresponding
	to the limitation of the number of teams.
	* plugin/plugin-gcn.c (limit_teams): New helper function that limits
	the number of teams by twice the number of compute units.
	(parse_target_attributes): Limit the number of teams on gcn offload
	devices.
	* target.c (get_gomp_offload_icvs): Added teams_thread_limit_var
	handling.
	(gomp_load_image_to_device): Added a size check for the ICVs struct
	variable.
	(gomp_copy_back_icvs): New function that is used in GOMP_target_ext to
	copy back the ICV values from device to host.
	(GOMP_target_ext): Update the number of teams and threads in the kernel
	args also considering device-specific values.
	* testsuite/libgomp.c-c++-common/icv-4.c: Fixed an error in the reading
	of OMP_TEAMS_THREAD_LIMIT from the environment.
	* testsuite/libgomp.c-c++-common/icv-5.c: Extended.
	* testsuite/libgomp.c-c++-common/icv-6.c: Extended.
	* testsuite/libgomp.c-c++-common/icv-7.c: Extended.
	* testsuite/libgomp.c-c++-common/icv-9.c: New test.
	* testsuite/libgomp.fortran/icv-5.f90: New test.
	* testsuite/libgomp.fortran/icv-6.f90: New test.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/target-teams-1.c: Adapt expected values for
	num_teams from "1" to "-2" in cases without num_teams clause.
	* g++.dg/gomp/target-teams-1.C: Likewise.
	* gfortran.dg/gomp/defaultmap-4.f90: Likewise.
	* gfortran.dg/gomp/defaultmap-5.f90: Likewise.
	* gfortran.dg/gomp/defaultmap-6.f90: Likewise.
2022-12-06 06:03:50 -08:00
Tobias Burnus
9f80367e53 libgomp.texi: Fix a OpenMP 5.2 and a TR11 impl-status item
libgomp/
	* libgomp.texi (OpenMP 5.2): Add missing 'the'.
	(TR11): Add missing '@tab N @tab'.
2022-12-06 09:51:12 +01:00
Tobias Burnus
e0b95c2e8b libgomp.texi: List GCN's 'gfx803' under OpenMP Context Selectors
libgomp/ChangeLog:

	* libgomp.texi (OpenMP Context Selectors): Add 'gfx803' to gcn's isa.
2022-11-30 11:23:41 +01:00
Tobias Burnus
091b6dbc48 OpenMP/Fortran: Permit end-clause on directive
gcc/fortran/ChangeLog:

	* openmp.cc (OMP_DO_CLAUSES, OMP_SCOPE_CLAUSES,
	OMP_SECTIONS_CLAUSES): Add 'nowait'.
	(OMP_SINGLE_CLAUSES): Add 'nowait' and 'copyprivate'.
	(gfc_match_omp_distribute_parallel_do,
	gfc_match_omp_distribute_parallel_do_simd,
	gfc_match_omp_parallel_do,
	gfc_match_omp_parallel_do_simd,
	gfc_match_omp_parallel_sections,
	gfc_match_omp_teams_distribute_parallel_do,
	gfc_match_omp_teams_distribute_parallel_do_simd): Disallow 'nowait'.
	(gfc_match_omp_workshare): Match 'nowait' clause.
	(gfc_match_omp_end_single): Use clause matcher for 'nowait'.
	(resolve_omp_clauses): Reject 'nowait' + 'copyprivate'.
	* parse.cc (decode_omp_directive): Break too long line.
	(parse_omp_do, parse_omp_structured_block): Diagnose duplicated
	'nowait' clause.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Mark end-directive as Y.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/copyprivate-1.f90: New test.
	* gfortran.dg/gomp/copyprivate-2.f90: New test.
	* gfortran.dg/gomp/nowait-2.f90: Move dg-error tests ...
	* gfortran.dg/gomp/nowait-4.f90: ... to this new file.
	* gfortran.dg/gomp/nowait-5.f90: New test.
	* gfortran.dg/gomp/nowait-6.f90: New test.
	* gfortran.dg/gomp/nowait-7.f90: New test.
	* gfortran.dg/gomp/nowait-8.f90: New test.
2022-11-28 11:10:31 +01:00
Tobias Burnus
c16e85d726 libgomp.texi: OpenMP Impl Status 5.1 additions + TR11
libgomp/ChangeLog:

	* libgomp.texi (OpenMP Implementation Status): Add three 5.1 items
	and status for Technical Report (TR) 11.
2022-11-25 11:54:42 +01:00
Martin Liska
d77de73829 Revert "sphinx: remove texinfo files"
This reverts commit 54ca4eef58.
2022-11-14 09:35:06 +01:00
Martin Liska
54ca4eef58 sphinx: remove texinfo files
gcc/d/ChangeLog:

	* gdc.texi: Removed.

gcc/ChangeLog:

	* doc/analyzer.texi: Removed.
	* doc/avr-mmcu.texi: Removed.
	* doc/bugreport.texi: Removed.
	* doc/cfg.texi: Removed.
	* doc/collect2.texi: Removed.
	* doc/compat.texi: Removed.
	* doc/configfiles.texi: Removed.
	* doc/configterms.texi: Removed.
	* doc/contrib.texi: Removed.
	* doc/contribute.texi: Removed.
	* doc/cpp.texi: Removed.
	* doc/cppdiropts.texi: Removed.
	* doc/cppenv.texi: Removed.
	* doc/cppinternals.texi: Removed.
	* doc/cppopts.texi: Removed.
	* doc/cppwarnopts.texi: Removed.
	* doc/extend.texi: Removed.
	* doc/fragments.texi: Removed.
	* doc/frontends.texi: Removed.
	* doc/gcc.texi: Removed.
	* doc/gccint.texi: Removed.
	* doc/gcov-dump.texi: Removed.
	* doc/gcov-tool.texi: Removed.
	* doc/gcov.texi: Removed.
	* doc/generic.texi: Removed.
	* doc/gimple.texi: Removed.
	* doc/gnu.texi: Removed.
	* doc/gty.texi: Removed.
	* doc/headerdirs.texi: Removed.
	* doc/hostconfig.texi: Removed.
	* doc/implement-c.texi: Removed.
	* doc/implement-cxx.texi: Removed.
	* doc/include/fdl.texi: Removed.
	* doc/include/funding.texi: Removed.
	* doc/include/gcc-common.texi: Removed.
	* doc/include/gpl_v3.texi: Removed.
	* doc/install.texi: Removed.
	* doc/interface.texi: Removed.
	* doc/invoke.texi: Removed.
	* doc/languages.texi: Removed.
	* doc/libgcc.texi: Removed.
	* doc/loop.texi: Removed.
	* doc/lto-dump.texi: Removed.
	* doc/lto.texi: Removed.
	* doc/makefile.texi: Removed.
	* doc/match-and-simplify.texi: Removed.
	* doc/md.texi: Removed.
	* doc/objc.texi: Removed.
	* doc/optinfo.texi: Removed.
	* doc/options.texi: Removed.
	* doc/passes.texi: Removed.
	* doc/plugins.texi: Removed.
	* doc/poly-int.texi: Removed.
	* doc/portability.texi: Removed.
	* doc/rtl.texi: Removed.
	* doc/service.texi: Removed.
	* doc/sourcebuild.texi: Removed.
	* doc/standards.texi: Removed.
	* doc/tm.texi: Removed.
	* doc/tree-ssa.texi: Removed.
	* doc/trouble.texi: Removed.
	* doc/ux.texi: Removed.
	* doc/tm.texi.in: Removed.

gcc/fortran/ChangeLog:

	* gfc-internals.texi: Removed.
	* gfortran.texi: Removed.
	* intrinsic.texi: Removed.
	* invoke.texi: Removed.

gcc/go/ChangeLog:

	* gccgo.texi: Removed.

libgomp/ChangeLog:

	* libgomp.texi: Removed.

libiberty/ChangeLog:

	* at-file.texi: Removed.
	* copying-lib.texi: Removed.
	* functions.texi: Removed.
	* libiberty.texi: Removed.
	* obstacks.texi: Removed.

libitm/ChangeLog:

	* libitm.texi: Removed.

libquadmath/ChangeLog:

	* libquadmath.texi: Removed.
2022-11-09 09:00:35 +01:00
Thomas Schwinge
e4cba49413 Remove support for Intel MIC offloading
... after its deprecation in GCC 12.

	* Makefile.def: Remove module 'liboffloadmic'.
	* Makefile.in: Regenerate.
	* configure.ac: Remove 'liboffloadmic' handling.
	* configure: Regenerate.
	contrib/
	* gcc-changelog/git_commit.py (default_changelog_locations):
	Remove 'liboffloadmic'.
	* gcc_update (files_and_dependencies): Remove 'liboffloadmic'
	files.
	* update-copyright.py (GCCCmdLine): Remove 'liboffloadmic'
	comment.
	gcc/
	* config.gcc [target *-intelmic-* | *-intelmicemul-*]: Remove.
	* config/i386/i386-options.cc (ix86_omp_device_kind_arch_isa)
	[ACCEL_COMPILER]: Remove.
	* config/i386/intelmic-mkoffload.cc: Remove.
	* config/i386/intelmic-offload.h: Likewise.
	* config/i386/t-intelmic: Likewise.
	* config/i386/t-omp-device: Likewise.
	* configure.ac [target *-intelmic-* | *-intelmicemul-*]: Remove.
	* configure: Regenerate.
	* doc/install.texi (--enable-offload-targets=[...]): Update.
	* doc/sourcebuild.texi: Remove 'liboffloadmic' documentation.
	include/
	* gomp-constants.h (GOMP_DEVICE_INTEL_MIC): Comment out.
	(GOMP_VERSION_INTEL_MIC): Remove.
	libgomp/
	* libgomp-plugin.h (OFFLOAD_TARGET_TYPE_INTEL_MIC): Remove.
	* libgomp.texi (OpenMP Context Selectors): Remove Intel MIC
	documentation.
	* plugin/configfrag.ac <enable_offload_targets>
	[*-intelmic-* | *-intelmicemul-*]: Remove.
	* configure: Regenerate.
	* testsuite/lib/libgomp.exp (libgomp_init): Remove 'liboffloadmic'
	handling.
	(offload_target_to_openacc_device_type)
	[$offload_target = *-intelmic*]: Remove.
	(check_effective_target_offload_device_intel_mic)
	(check_effective_target_offload_device_any_intel_mic): Remove.
	* testsuite/libgomp.c-c++-common/on_device_arch.h
	(device_arch_intel_mic, on_device_arch_intel_mic, any_device_arch)
	(any_device_arch_intel_mic): Remove.
	* testsuite/libgomp.c-c++-common/target-45.c: Remove
	'offload_device_any_intel_mic' XFAIL.
	* testsuite/libgomp.fortran/target10.f90: Likewise.
	liboffloadmic/
	* ChangeLog: Remove.
	* Makefile.am: Likewise.
	* Makefile.in: Likewise.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* configure.ac: Likewise.
	* configure.tgt: Likewise.
	* doc/doxygen/config: Likewise.
	* doc/doxygen/header.tex: Likewise.
	* include/coi/common/COIEngine_common.h: Likewise.
	* include/coi/common/COIEvent_common.h: Likewise.
	* include/coi/common/COIMacros_common.h: Likewise.
	* include/coi/common/COIPerf_common.h: Likewise.
	* include/coi/common/COIResult_common.h: Likewise.
	* include/coi/common/COISysInfo_common.h: Likewise.
	* include/coi/common/COITypes_common.h: Likewise.
	* include/coi/sink/COIBuffer_sink.h: Likewise.
	* include/coi/sink/COIPipeline_sink.h: Likewise.
	* include/coi/sink/COIProcess_sink.h: Likewise.
	* include/coi/source/COIBuffer_source.h: Likewise.
	* include/coi/source/COIEngine_source.h: Likewise.
	* include/coi/source/COIEvent_source.h: Likewise.
	* include/coi/source/COIPipeline_source.h: Likewise.
	* include/coi/source/COIProcess_source.h: Likewise.
	* liboffloadmic_host.spec.in: Likewise.
	* liboffloadmic_target.spec.in: Likewise.
	* plugin/Makefile.am: Likewise.
	* plugin/Makefile.in: Likewise.
	* plugin/aclocal.m4: Likewise.
	* plugin/configure: Likewise.
	* plugin/configure.ac: Likewise.
	* plugin/libgomp-plugin-intelmic.cpp: Likewise.
	* plugin/offload_target_main.cpp: Likewise.
	* runtime/cean_util.cpp: Likewise.
	* runtime/cean_util.h: Likewise.
	* runtime/coi/coi_client.cpp: Likewise.
	* runtime/coi/coi_client.h: Likewise.
	* runtime/coi/coi_server.cpp: Likewise.
	* runtime/coi/coi_server.h: Likewise.
	* runtime/compiler_if_host.cpp: Likewise.
	* runtime/compiler_if_host.h: Likewise.
	* runtime/compiler_if_target.cpp: Likewise.
	* runtime/compiler_if_target.h: Likewise.
	* runtime/dv_util.cpp: Likewise.
	* runtime/dv_util.h: Likewise.
	* runtime/emulator/coi_common.h: Likewise.
	* runtime/emulator/coi_device.cpp: Likewise.
	* runtime/emulator/coi_device.h: Likewise.
	* runtime/emulator/coi_host.cpp: Likewise.
	* runtime/emulator/coi_host.h: Likewise.
	* runtime/emulator/coi_version_asm.h: Likewise.
	* runtime/emulator/coi_version_linker_script.map: Likewise.
	* runtime/liboffload_error.c: Likewise.
	* runtime/liboffload_error_codes.h: Likewise.
	* runtime/liboffload_msg.c: Likewise.
	* runtime/liboffload_msg.h: Likewise.
	* runtime/mic_lib.f90: Likewise.
	* runtime/offload.h: Likewise.
	* runtime/offload_common.cpp: Likewise.
	* runtime/offload_common.h: Likewise.
	* runtime/offload_engine.cpp: Likewise.
	* runtime/offload_engine.h: Likewise.
	* runtime/offload_env.cpp: Likewise.
	* runtime/offload_env.h: Likewise.
	* runtime/offload_host.cpp: Likewise.
	* runtime/offload_host.h: Likewise.
	* runtime/offload_iterator.h: Likewise.
	* runtime/offload_omp_host.cpp: Likewise.
	* runtime/offload_omp_target.cpp: Likewise.
	* runtime/offload_orsl.cpp: Likewise.
	* runtime/offload_orsl.h: Likewise.
	* runtime/offload_table.cpp: Likewise.
	* runtime/offload_table.h: Likewise.
	* runtime/offload_target.cpp: Likewise.
	* runtime/offload_target.h: Likewise.
	* runtime/offload_target_main.cpp: Likewise.
	* runtime/offload_timer.h: Likewise.
	* runtime/offload_timer_host.cpp: Likewise.
	* runtime/offload_timer_target.cpp: Likewise.
	* runtime/offload_trace.cpp: Likewise.
	* runtime/offload_trace.h: Likewise.
	* runtime/offload_util.cpp: Likewise.
	* runtime/offload_util.h: Likewise.
	* runtime/ofldbegin.cpp: Likewise.
	* runtime/ofldend.cpp: Likewise.
	* runtime/orsl-lite/include/orsl-lite.h: Likewise.
	* runtime/orsl-lite/lib/orsl-lite.c: Likewise.
	* runtime/orsl-lite/version.txt: Likewise.
2022-11-04 10:51:01 +01:00
Jakub Jelinek
caf9db5a7f libgomp: Fix up OpenMP 5.2 feature bullet
The previous bullet correctly mentions 5.2 added for Fortran
allocators directive which is a replacement of allocate directive
associated with ALLOCATE statement to differentiate it at parse time
from allocate directive as declarative one not associated with ALLOCATE
statement, but the deprecation bullet talks about non-existing allocator
directive.

2022-10-12  Jakub Jelinek  <jakub@redhat.com>

	* libgomp.texi (OpenMP 5.2): Fix up allocator -> allocate directive
	in deprecation bullet.
2022-10-12 18:49:22 +02:00
Jakub Jelinek
0ec4e93fb9 libgomp: Add omp_in_explicit_task support
This is pretty straightforward, if gomp_thread ()->task is NULL,
it can't be explicit task, otherwise if
gomp_thread ()->task->kind == GOMP_TASK_IMPLICIT, it is an implicit
task, otherwise explicit task.

2022-10-12  Jakub Jelinek  <jakub@redhat.com>

	* omp.h.in (omp_in_explicit_task): Declare.
	* omp_lib.h.in (omp_in_explicit_task): Likewise.
	* omp_lib.f90.in (omp_in_explicit_task): New interface.
	* libgomp.map (OMP_5.2): New symbol version, export
	omp_in_explicit_task and omp_in_explicit_task_.
	* task.c (omp_in_explicit_task): New function.
	* fortran.c (omp_in_explicit_task): Add ialias_redirect.
	(omp_in_explicit_task_): New function.
	* libgomp.texi (OpenMP 5.2): Mark omp_in_explicit_task as implemented.
	* testsuite/libgomp.c-c++-common/task-in-explicit-1.c: New test.
	* testsuite/libgomp.c-c++-common/task-in-explicit-2.c: New test.
	* testsuite/libgomp.c-c++-common/task-in-explicit-3.c: New test.
2022-10-12 18:39:20 +02:00
Tobias Burnus
e2a2284389 Fortran: Add OpenMP's assume(s) directives
libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1 Impl. Status): Mark 'assume' as 'Y'.

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_assumes): New.
	(show_omp_clauses, show_namespace): Call it.
	(show_omp_node, show_code_node): Handle OpenMP ASSUME.
	* gfortran.h (enum gfc_statement): Add ST_OMP_ASSUME,
	ST_OMP_END_ASSUME, ST_OMP_ASSUMES and ST_NOTHING.
	(gfc_exec_op): Add EXEC_OMP_ASSUME.
	(gfc_omp_assumptions): New struct.
	(gfc_get_omp_assumptions): New XCNEW #define.
	(gfc_omp_clauses, gfc_namespace): Add assume member.
	(gfc_resolve_omp_assumptions): New prototype.
	* match.h (gfc_match_omp_assume, gfc_match_omp_assumes): New.
	* openmp.cc (omp_code_to_statement): Forward declare.
	(enum gfc_omp_directive_kind, struct gfc_omp_directive): New.
	(gfc_free_omp_clauses): Free assume member and its struct data.
	(enum omp_mask2): Add OMP_CLAUSE_ASSUMPTIONS.
	(gfc_omp_absent_contains_clause): New.
	(gfc_match_omp_clauses): Call it; optionally use passed
	omp_clauses argument.
	(omp_verify_merge_absent_contains, gfc_match_omp_assume,
	 gfc_match_omp_assumes, gfc_resolve_omp_assumptions): New.
	(resolve_omp_clauses): Call the latter.
	(gfc_resolve_omp_directive, omp_code_to_statement): Handle
	EXEC_OMP_ASSUME.
	* parse.cc (decode_omp_directive): Parse OpenMP ASSUME(S).
	(next_statement, parse_executable, parse_omp_structured_block):
	Handle ST_OMP_ASSUME.
	(case_omp_decl): Add ST_OMP_ASSUMES.
	(gfc_ascii_statement): Handle Assumes, optional return
	string without '!$OMP '/'!$ACC ' prefix.
	* parse.h (gfc_ascii_statement): Add optional bool arg to prototype.
	* resolve.cc (gfc_resolve_blocks, gfc_resolve_code): Add
	EXEC_OMP_ASSUME.
	(gfc_resolve): Resolve ASSUMES directive.
	* symbol.cc (gfc_free_namespace): Free omp_assumes member.
	* st.cc (gfc_free_statement): Handle EXEC_OMP_ASSUME.
	* trans-openmp.cc (gfc_trans_omp_directive): Likewise.
	* trans.cc (trans_code): Likewise.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/assume-1.f90: New test.
	* gfortran.dg/gomp/assume-2.f90: New test.
	* gfortran.dg/gomp/assumes-1.f90: New test.
	* gfortran.dg/gomp/assumes-2.f90: New test.
2022-10-05 19:25:27 +02:00
Jakub Jelinek
b6d5d72bd0 openmp: Add begin declare target support
The following patch adds support for the begin declare target construct,
which is another spelling for declare target construct without clauses
(where it needs paired end declare target), but unlike that one accepts
clauses.

This is an OpenMP 5.1 feature, implemented with 5.2 clarification because
in 5.1 we had a restriction in the declare target chapter shared by
declare target and begin declare target that if there are any clauses
specified at least one of them needs to be to or link.  But that
was of course meant just for declare target and not begin declare target,
because begin declare target doesn't even allow to/link/enter clauses.
In addition to that, the patch also makes device_type clause duplication
an error (as stated in 5.1) and similarly makes declare target with
just device_type clause an error rather than warning.

What this patch doesn't do is:
1) OpenMP 5.1 also added an indirect clause, we don't support that
   neither on declare target nor begin declare target
   and I couldn't find it in our features pages (neither libgomp.texi
   nor web)
2) I think device_type(nohost)/device_type(host) support can't work for
   variables (in 5.0 it only talked about procedures so this could be
   also thought as 5.1 feature that we should just add to the list
   and implement)
3) I don't see any use of the "omp declare target nohost" attribute, so
   I'm not sure if device_type(nohost) works at all

2022-10-04  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
	* c-omp.cc (c_omp_directives): Uncomment begin declare target
	entry.
gcc/c/
	* c-lang.h (struct c_omp_declare_target_attr): New type.
	(current_omp_declare_target_attribute): Change type from
	int to vec<c_omp_declare_target_attr, va_gc> *.
	* c-parser.cc (c_parser_translation_unit): Adjust for that change.
	If last pushed directive was begin declare target, use different
	wording and simplify format strings for easier translations.
	(c_parser_omp_clause_device_type): Uncomment
	check_no_duplicate_clause call.
	(c_parser_omp_declare_target): Adjust for the
	current_omp_declare_target_attribute type change, push { -1 }.
	Use error_at rather than warning_at for declare target with
	only device_type clauses.
	(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define.
	(c_parser_omp_begin): Add begin declare target support.
	(c_parser_omp_end): Adjust for the
	current_omp_declare_target_attribute type change, adjust
	diagnostics wording and simplify format strings for easier
	translations.
	* c-decl.cc (current_omp_declare_target_attribute): Change type from
	int to vec<c_omp_declare_target_attr, va_gc> *.
	(c_decl_attributes): Adjust for the
	current_omp_declare_target_attribute type change.  If device_type
	was present on begin declare target, add "omp declare target host"
	and/or "omp declare target nohost" attributes.
gcc/cp/
	* cp-tree.h (struct omp_declare_target_attr): Rename to ...
	(cp_omp_declare_target_attr): ... this.  Add device_type member.
	(omp_begin_assumes_data): Rename to ...
	(cp_omp_begin_assumes_data): ... this.
	(struct saved_scope): Change types of omp_declare_target_attribute
	and omp_begin_assumes.
	* parser.cc (cp_parser_omp_clause_device_type): Uncomment
	check_no_duplicate_clause call.
	(cp_parser_omp_all_clauses): Fix up pasto, c_name for OMP_CLAUSE_LINK
	should be "link" rather than "to".
	(cp_parser_omp_declare_target): Adjust for omp_declare_target_attr
	to cp_omp_declare_target_attr changes, push -1 as device_type.  Use
	error_at rather than warning_at for declare target with only
	device_type clauses.
	(OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Define.
	(cp_parser_omp_begin): Add begin declare target support.  Adjust
	for omp_begin_assumes_data to cp_omp_begin_assumes_data change.
	(cp_parser_omp_end): Adjust for the
	omp_declare_target_attr to cp_omp_declare_target_attr and
	omp_begin_assumes_data to cp_omp_begin_assumes_data type changes,
	adjust diagnostics wording and simplify format strings for easier
	translations.
	* semantics.cc (finish_translation_unit): Likewise.
	* decl2.cc (cplus_decl_attributes): If device_type was present on
	begin declare target, add "omp declare target host" and/or
	"omp declare target nohost" attributes.
gcc/testsuite/
	* c-c++-common/gomp/declare-target-4.c: Move tests that are now
	rejected into declare-target-7.c.
	* c-c++-common/gomp/declare-target-6.c: Adjust expected diagnostics.
	* c-c++-common/gomp/declare-target-7.c: New test.
	* c-c++-common/gomp/begin-declare-target-1.c: New test.
	* c-c++-common/gomp/begin-declare-target-2.c: New test.
	* c-c++-common/gomp/begin-declare-target-3.c: New test.
	* c-c++-common/gomp/begin-declare-target-4.c: New test.
	* g++.dg/gomp/attrs-9.C: Add begin declare target tests.
	* g++.dg/gomp/attrs-18.C: New test.
libgomp/
	* libgomp.texi (Support begin/end declare target syntax in C/C++):
	Mark as implemented.
2022-10-04 10:37:14 +02:00
Tobias Burnus
175a89d123 libgomp.texi: Status 'P' for 'assume', remove duplicated line
libgomp/
	* libgomp.texi (OpenMP 5.1): Mark 'assume' as implemented
	for C/C++. Remove duplicated 'begin declare target' entry.
2022-09-28 10:24:58 +02:00
Tobias Burnus
eec36f27c3 libgomp.texi: move item from gcn to nvptx
I misplaced one remark into 'gcn' instead of 'nvptx' in
commit r13-2625-g6b43f556f392a7165582aca36a19fe7389d995b2

libgomp/ChangeLog:

	* libgomp.texi (gcn): Move misplaced -march=sm_30 remark to ...
	(nvptx): ... here.
2022-09-13 09:08:57 +02:00
Tobias Burnus
6b43f556f3 nvptx/mkoffload.cc: Warn instead of error when reverse offload is not possible
Reverse offload requests at least -misa=sm_35; with this patch, a warning
instead of an error is shown, still permitting reverse offload for all
other configured device types. This is achieved by not calling
GOMP_offload_register_ver (and stopping generating pointless 'static const char'
variables, once known.)

The tool_name as progname changes adds "nvptx " and "gcn " to the
"mkoffload: warning/error:" diagnostic.

gcc/ChangeLog:

	* config/nvptx/mkoffload.cc (process): Replace a fatal_error by
	a warning + not enabling offloading if -misa=sm_30 prevents
	reverse offload.
	(main): Use tool_name as progname for diagnostic.
	* config/gcn/mkoffload.cc (main): Likewise.

libgomp/ChangeLog:

	* libgomp.texi (Offload-Target Specifics: nvptx): Document
	that reverse offload requires >= -march=sm_35.
	* testsuite/libgomp.c-c++-common/requires-4.c: Build for nvptx
	with -misa=sm_35.
	* testsuite/libgomp.c-c++-common/requires-5.c: Likewise.
	* testsuite/libgomp.c-c++-common/requires-6.c: Likewise.
	* testsuite/libgomp.c-c++-common/reverse-offload-1.c: Likewise.
	* testsuite/libgomp.fortran/reverse-offload-1.f90: Likewise.
	* testsuite/libgomp.c/reverse-offload-sm30.c: New test.
2022-09-12 15:25:13 +02:00
Tobias Burnus
9983ab16d5 libgomp.texi: Impl. status fix/addition
libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1 Impl. Status): Add two new minor items.
	(OpenMP 5.2 Impl. Status): Improve omp/omx/ompx wording.
2022-09-12 12:30:04 +02:00
Tobias Burnus
264deecb16 OpenMP: Document ompx warnings + add Fortran omx warning [PR106670]
omp/ompx sentinels are for vendor extensions; as they might be required for
the correctness of the program, a warning should be printable. This patch
documents in the OpenMP 5.2 table the existing warnings, including the new
warning for for fixed source form Fortran.

	PR fortran/106670

gcc/fortran/ChangeLog:

	* scanner.cc (skip_fixed_omp_sentinel): Add -Wsurprising warning
	for 'omx' sentinels with -fopenmp.
	* invoke.texi (-Wsurprising): Document additional warning case.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Add comment to ompx/omx entry.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/ompx-1.c: New test.
	* c-c++-common/gomp/ompx-2.c: New test.
	* g++.dg/gomp/ompx-attrs-1.C: New test.
	* gfortran.dg/gomp/ompx-1.f90: New test.
	* gfortran.dg/gomp/omx-1.f: New test.
	* gfortran.dg/gomp/omx-2.f: New test.
2022-09-08 21:03:21 +02:00
Tobias Burnus
4f05ff34d6 libgomp.texi: Document libmemkind + nvptx/gcn specifics
libgomp/ChangeLog:

	* libgomp.texi (OpenMP-Implementation Specifics): New; add libmemkind
	section; move OpenMP Context Selectors from ...
	(Offload-Target Specifics): ... here; add 'AMD Radeo (GCN)' and
	'nvptx' sections.
2022-09-08 20:56:49 +02:00
Marcel Vollweiler
9f2fca5659 OpenMP, libgomp: Environment variable syntax extension
This patch considers the environment variable syntax extension for
device-specific variants of environment variables from OpenMP 5.1 (see
OpenMP 5.1 specification, p. 75 and p. 639).  An environment variable (e.g.
OMP_NUM_TEAMS) can have different suffixes:

_DEV (e.g. OMP_NUM_TEAMS_DEV): affects all devices but not the host.
_DEV_<device> (e.g. OMP_NUM_TEAMS_DEV_42): affects only device with
number <device>.
no suffix (e.g. OMP_NUM_TEAMS): affects only the host.

In future OpenMP versions also suffix _ALL will be introduced (see discussion
https://github.com/OpenMP/spec/issues/3179). This is also considered in this
patch:

_ALL (e.g. OMP_NUM_TEAMS_ALL): affects all devices and the host.

The precedence is as follows (descending). For the host:

	1. no suffix
	2. _ALL

For devices:

	1. _DEV_<device>
	2. _DEV
	3. _ALL

That means, _DEV_<device> is used whenever available. Otherwise _DEV is used if
available, and at last _ALL.  If there is no value for any of the variable
variants, default values are used as already implemented before.

This patch concerns parsing (a), storing (b), output (c) and transmission to the
device (d):

(a) The actual number of devices and the numbering are not known when parsing
the environment variables.  Thus all environment variables are iterated and
searched for device-specific ones.
(b) Only configured device-specific variables are stored.  Thus, a linked list
is used.
(c) The output is done in omp_display_env (see specification p. 468f).  Global
ICVs are tagged with [all], see https://github.com/OpenMP/spec/issues/3179.
ICVs which are not global but aren't handled device-specific yet are tagged
with [host].  omp_display_env outputs the initial values of the ICVs.  That is
why a dedicated data structure is introduced for the inital values only
(gomp_initial_icv_list).
(d) Device-specific ICVs are transmitted to the device via GOMP_ADDITIONAL_ICVS.

libgomp/ChangeLog:

	* config/gcn/icv-device.c (omp_get_default_device): Return device-
	specific ICV.
	(omp_get_max_teams): Added for GCN devices.
	(omp_set_num_teams): Likewise.
	(ialias): Likewise.
	* config/nvptx/icv-device.c (omp_get_default_device): Return device-
	specific ICV.
	(omp_get_max_teams): Added for NVPTX devices.
	(omp_set_num_teams): Likewise.
	(ialias): Likewise.
	* env.c (struct gomp_icv_list): New struct to store entries of initial
	ICV values.
	(struct gomp_offload_icv_list): New struct to store entries of device-
	specific ICV values that are copied to the device and back.
	(struct gomp_default_icv_values): New struct to store default values of
	ICVs according to the OpenMP standard.
	(parse_schedule): Generalized for different variants of OMP_SCHEDULE.
	(print_env_var_error): Function that prints an error for invalid values
	for ICVs.
	(parse_unsigned_long_1): Removed getenv.  Generalized.
	(parse_unsigned_long): Likewise.
	(parse_int_1): Likewise.
	(parse_int): Likewise.
	(parse_int_secure): Likewise.
	(parse_unsigned_long_list): Likewise.
	(parse_target_offload): Likewise.
	(parse_bind_var): Likewise.
	(parse_stacksize): Likewise.
	(parse_boolean): Likewise.
	(parse_wait_policy): Likewise.
	(parse_allocator): Likewise.
	(omp_display_env): Extended to output different variants of environment
	variables.
	(print_schedule): New helper function for omp_display_env which prints
	the values of run_sched_var.
	(print_proc_bind): New helper function for omp_display_env which prints
	the values of proc_bind_var.
	(enum gomp_parse_type): Collection of types used for parsing environment
	variables.
	(ENTRY): Preprocess string lengths of environment variables.
	(OMP_VAR_CNT): Preprocess table size.
	(OMP_HOST_VAR_CNT): Likewise.
	(INT_MAX_STR_LEN): Constant for the maximal number of digits of a device
	number.
	(gomp_get_icv_flag): Returns if a flag for a particular ICV is set.
	(gomp_set_icv_flag): Sets a flag for a particular ICV.
	(print_device_specific_icvs): New helper function for omp_display_env to
	print device specific ICV values.
	(get_device_num): New helper function for parse_device_specific.
	Extracts the device number from an environment variable name.
	(get_icv_member_addr): Gets the memory address for a particular member
	of an ICV struct.
	(gomp_get_initial_icv_item): Get a list item of gomp_initial_icv_list.
	(initialize_icvs): New function to initialize a gomp_initial_icvs
	struct.
	(add_initial_icv_to_list): Adds an ICV struct to gomp_initial_icv_list.
	(startswith): Checks if a string starts with a given prefix.
	(initialize_env): Extended to parse the new syntax of environment
	variables.
	* icv-device.c (omp_get_max_teams): Added.
	(ialias): Likewise.
	(omp_set_num_teams): Likewise.
	* icv.c (omp_set_num_teams): Moved to icv-device.c.
	(omp_get_max_teams): Likewise.
	(ialias): Likewise.
	* libgomp-plugin.h (GOMP_DEVICE_NUM_VAR): Removed.
	(GOMP_ADDITIONAL_ICVS): New target-side struct that
	holds the designated ICVs of the target device.
	* libgomp.h (enum gomp_icvs): Collection of ICVs.
	(enum gomp_device_num): Definition of device numbers for _ALL, _DEV, and
	no suffix.
	(enum gomp_env_suffix): Collection of possible suffixes of environment
	variables.
	(struct gomp_initial_icvs): Contains all ICVs for which we need to store
	initial values.
	(struct gomp_default_icv):New struct to hold ICVs for which we need
	to store initial values.
	(struct gomp_icv_list): Definition of a linked list that is used for
	storing ICVs for the devices and also for _DEV, _ALL, and without
	suffix.
	(struct gomp_offload_icvs): New struct to hold ICVs that are copied to
	a device.
	(struct gomp_offload_icv_list): Definition of a linked list that holds
	device-specific ICVs that are copied to devices.
	(gomp_get_initial_icv_item): Get a list item of gomp_initial_icv_list.
	(gomp_get_icv_flag): Returns if a flag for a particular ICV is set.
	* libgomp.texi: Updated.
	* plugin/plugin-gcn.c (GOMP_OFFLOAD_load_image): Extended to read
	further ICVs from the offload image.
	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_load_image): Likewise.
	* target.c (gomp_get_offload_icv_item): Get a list item of
	gomp_offload_icv_list.
	(get_gomp_offload_icvs): New. Returns the ICV values
	depending on the device num and the variable hierarchy.
	(gomp_load_image_to_device): Extended to copy further ICVs to a device.
	* testsuite/libgomp.c-c++-common/icv-5.c: New test.
	* testsuite/libgomp.c-c++-common/icv-6.c: New test.
	* testsuite/libgomp.c-c++-common/icv-7.c: New test.
	* testsuite/libgomp.c-c++-common/icv-8.c: New test.
	* testsuite/libgomp.c-c++-common/omp-display-env-1.c: New test.
	* testsuite/libgomp.c-c++-common/omp-display-env-2.c: New test.
2022-09-08 10:19:37 -07:00
Jakub Jelinek
f25a6767ec openmp: Implement doacross(sink: omp_cur_iteration - 1)
This patch implements doacross(sink: omp_cur_iteration - 1) that the
previous patchset emitted a sorry on during omp expansion.
It can be implemented with existing library functions.

To recap, depend(source)/doacross(source:)/doacross(source:omp_cur_iteration)
is implemented calling GOMP_doacross_post or GOMP_doacross_ull_post,
called with an array of long or unsigned long long elements, one for
all collapsed loops together and one for each further ordered loop if any.
We initialize that array in each thread when grabbing further set of iterations
and update it at the end of loops, so that it represents the current iteration
(as 0 based counters).  When the worksharing loop is created, we tell the
library through another similar array the counts (the loop needs to be
rectangular) in each dimension, first element is count of all logical iterations
in the collapsed loops.

depend(sink:v1 op N1, v2 op N2, ...) is then implemented by conditionally calling
GOMP_doacross_wait/GOMP_doacross_ull_wait.  For N? of 0 there is no check,
otherwise if it wants to wait in a particular dimension for a previous iteration,
we check that the corresponding iterator isn't the first one (or first few),
where the previous iterator in that dimension would be out of range, and similarly
for checking of next iteration in a dimension that it isn't the last one (or last few)
where it would be similarly out of bounds.  Then the collapsed loop counters are
folded into a single 0 based counter (first argument) and then other 0 based
iterations counters on what iteration it should wait for.

Now, doacross(sink: omp_cur_iteration - 1) is supposed to wait for the previous
logical iteration in the combined iteration space of all ordered loops.
For the very first iteration in that combined iteration space it does nothing,
there is no previous iteration.  And similarly it does nothing if there
are more ordered loops than collapsed loop and it isn't the first logical
iteration of the combined loops inside of the collapsed loops, because as implemented
we know the previous iteration in that case is always executed by the same thread
as the current one.
In the implementation, we use the same value as is stored in the first element
of the array for GOMP_doacross_post/GOMP_doacross_ull_post, if that value is 0,
we do nothing.  The rest is different based on if ordered argument is equal to
collapse or not.  If it is, then we otherwise call
GOMP_doacross_wait/GOMP_doacross_ull_wait with a single argument, one less than
that counter we compare against 0.
If ordered argument is bigger than collapse, we add a per-thread boolean variable
.first.N, which we set to true at the start of the outermost ordered loop inside
of the collapsed set of loops and set to false at the end of the innermost
ordered loop.  If .first.N is false, we don't do anything (we know the previous
iteration was handled by the current thread and by my reading of the spec we don't
need to emit even a memory barrier in that case, because it is just synchronization
with the same thread), otherwise we call GOMP_doacross_wait/GOMP_doacross_ull_wait
with the first argument one less than the counter we compare against 0, and then
one less than 2nd and following counts if iterations we pass to the workshare
initialization.  If say .counts.N passed to the workshare initialization is
{ 256, 13, 5, 2 } for collapse(3) ordered(6) loop, then
GOMP_doacross_post/GOMP_doacross_ull_post is called with arguments equal to
.ordereda.N[0] - 1, 12, 4, 1.

2022-09-08  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* omp-expand.cc (expand_omp_ordered_sink): Add CONT_BB argument.
	Add doacross(sink:omp_cur_iteration-1) support.
	(expand_omp_ordered_source_sink): Clear counts[fd->ordered + 1].
	Adjust expand_omp_ordered_sink caller.
	(expand_omp_for_ordered_loops): If counts[fd->ordered + 1] is
	non-NULL, set that variable to true at the start of outermost
	non-collapsed loop and set it to false at the end of innermost
	ordered loop.
	(expand_omp_for_generic): If fd->ordered, allocate
	1 + (fd->ordered - fd->collapse) further elements in counts array.
	Copy to counts + 2 + fd->ordered the counts of fd->collapse ..
	fd->ordered - 1 loop if any.
gcc/testsuite/
	* c-c++-common/gomp/doacross-7.c: New test.
libgomp/
	* libgomp.texi (OpenMP 5.2): Mention that omp_cur_iteration is now
	fully supported.
	* testsuite/libgomp.c/doacross-4.c: New test.
	* testsuite/libgomp.c/doacross-5.c: New test.
	* testsuite/libgomp.c/doacross-6.c: New test.
	* testsuite/libgomp.c/doacross-7.c: New test.
2022-09-08 13:32:51 +02:00
Tobias Burnus
938cda5360 Fortran/openmp: Partial OpenMP 5.2 doacross and omp_cur_iteration support
Add the Fortran support to the ME/C/C++ commit
r13-2388-ga651e6d59188da8992f8bfae2df1cb4e6316f9e6

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_namelist, show_omp_clauses): Handle
	omp_cur_iteration and distinguish doacross/depend.
	* gfortran.h (enum gfc_omp_depend_doacross_op): Renamed from
	gfc_omp_depend_op.
	(enum gfc_omp_depend_doacross_op): Add OMP_DOACROSS_SINK_FIRST,
	Rename OMP_DEPEND_SINK to OMP_DOACROSS_SINK.
	(gfc_omp_namelist) Handle renaming, rename depend_op to
	depend_doacross_op.
	(struct gfc_omp_clauses): Add doacross_source.
	* openmp.cc (gfc_match_omp_depend_sink): Renamed to ...
	(gfc_match_omp_doacross_sink): ... this; handle omp_all_memory.
	(enum omp_mask2): Add OMP_CLAUSE_DOACROSS.
	(gfc_match_omp_clauses): Handle 'doacross' and syntax changes to
	depend.
	(gfc_match_omp_depobj): Simplify as sink/source are now impossible.
	(gfc_match_omp_ordered_depend): Request OMP_CLAUSE_DOACROSS.
	(resolve_omp_clauses): Update sink/source checks.
	(gfc_resolve_omp_directive): Resolve EXEC_OMP_ORDERED clauses.
	* parse.cc (decode_omp_directive): Handle 'ordered doacross'.
	* trans-openmp.cc (gfc_trans_omp_clauses): Handle doacross.
	(gfc_trans_omp_do): Fix OMP_FOR_ORIG_DECLS handling if 'ordered'
	clause is present.
	(gfc_trans_omp_depobj): Update for member name change.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Update doacross/omp_cur_iteration status.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/all-memory-1.f90: Update dg-error.
	* gfortran.dg/gomp/depend-iterator-2.f90: Likewise.
	* gfortran.dg/gomp/depobj-2.f90: Likewise.
	* gfortran.dg/gomp/doacross-5.f90: New test.
	* gfortran.dg/gomp/doacross-6.f90: New test.
2022-09-05 18:06:06 +02:00
Tobias Burnus
d6621a2f31 OpenMP: Support reverse offload (middle end part)
gcc/ChangeLog:

	* internal-fn.cc (expand_GOMP_TARGET_REV): New.
	* internal-fn.def (GOMP_TARGET_REV): New.
	* lto-cgraph.cc (lto_output_node, verify_node_partition): Mark
	'omp target device_ancestor_host' as in_other_partition and don't
	error if absent.
	* omp-low.cc (create_omp_child_function): Mark as 'noclone'.
	* omp-expand.cc (expand_omp_target): For reverse offload, remove
	sorry, use device = GOMP_DEVICE_HOST_FALLBACK and create
	empty-body nohost function.
	* omp-offload.cc (execute_omp_device_lower): Handle
	IFN_GOMP_TARGET_REV.
	(pass_omp_target_link::execute): For ACCEL_COMPILER, don't
	nullify fn argument for reverse offload

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.0): Mark 'ancestor' as implemented but
	refer to 'requires'.
	* testsuite/libgomp.c-c++-common/reverse-offload-1-aux.c: New test.
	* testsuite/libgomp.c-c++-common/reverse-offload-1.c: New test.
	* testsuite/libgomp.fortran/reverse-offload-1-aux.f90: New test.
	* testsuite/libgomp.fortran/reverse-offload-1.f90: New test.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/reverse-offload-1.c: Remove dg-sorry.
	* c-c++-common/gomp/target-device-ancestor-4.c: Likewise.
	* gfortran.dg/gomp/target-device-ancestor-4.f90: Likewise.
	* gfortran.dg/gomp/target-device-ancestor-5.f90: Likewise.
	* c-c++-common/goacc/classify-kernels-parloops.c: Add 'noclone' to
	scan-tree-dump-times.
	* c-c++-common/goacc/classify-kernels-unparallelized-parloops.c:
	Likewise.
	* c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise.
	* c-c++-common/goacc/classify-kernels.c: Likewise.
	* c-c++-common/goacc/classify-parallel.c: Likewise.
	* c-c++-common/goacc/classify-serial.c: Likewise.
	* c-c++-common/goacc/kernels-counter-vars-function-scope.c: Likewise.
	* c-c++-common/goacc/kernels-loop-2.c: Likewise.
	* c-c++-common/goacc/kernels-loop-3.c: Likewise.
	* c-c++-common/goacc/kernels-loop-data-2.c: Likewise.
	* c-c++-common/goacc/kernels-loop-data-enter-exit-2.c: Likewise.
	* c-c++-common/goacc/kernels-loop-data-enter-exit.c: Likewise.
	* c-c++-common/goacc/kernels-loop-data-update.c: Likewise.
	* c-c++-common/goacc/kernels-loop-data.c: Likewise.
	* c-c++-common/goacc/kernels-loop-g.c: Likewise.
	* c-c++-common/goacc/kernels-loop-mod-not-zero.c: Likewise.
	* c-c++-common/goacc/kernels-loop-n.c: Likewise.
	* c-c++-common/goacc/kernels-loop-nest.c: Likewise.
	* c-c++-common/goacc/kernels-loop.c: Likewise.
	* c-c++-common/goacc/kernels-one-counter-var.c: Likewise.
	* c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c: Likewise.
	* gfortran.dg/goacc/classify-kernels-parloops.f95: Likewise.
	* gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95:
	Likewise.
	* gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
	* gfortran.dg/goacc/classify-kernels.f95: Likewise.
	* gfortran.dg/goacc/classify-parallel.f95: Likewise.
	* gfortran.dg/goacc/classify-serial.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-2.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-data-2.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-data-enter-exit.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-data-update.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-data.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop-n.f95: Likewise.
	* gfortran.dg/goacc/kernels-loop.f95: Likewise.
	* gfortran.dg/goacc/kernels-parallel-loop-data-enter-exit.f95: Likewise.
2022-08-26 12:12:25 +02:00
Tobias Burnus
c3297044f0 OpenMP/Fortran: Add support for OpenMP 5.2 linear clause syntax
Fortran part to C/C++
commit r13-1002-g03b71406323ddc065b1d7837d8b43b17e4b048b5

gcc/fortran/ChangeLog:

	* gfortran.h (gfc_omp_namelist): Update by creating 'linear' struct,
	move 'linear_op' as 'op' to id and add 'old_modifier' to it.
	* dump-parse-tree.cc (show_omp_namelist): Update accordingly.
	* module.cc (mio_omp_declare_simd): Likewise.
	* trans-openmp.cc (gfc_trans_omp_clauses): Likewise.
	* openmp.cc (resolve_omp_clauses): Likewise; accept new-style
	'val' modifier with do/simd.
	(gfc_match_omp_clauses): Handle OpenMP 5.2 linear clause syntax.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Mark linear-clause change as 'Y'.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/linear-4.c: New test.
	* gfortran.dg/gomp/linear-2.f90: New test.
	* gfortran.dg/gomp/linear-3.f90: New test.
	* gfortran.dg/gomp/linear-4.f90: New test.
	* gfortran.dg/gomp/linear-5.f90: New test.
	* gfortran.dg/gomp/linear-6.f90: New test.
	* gfortran.dg/gomp/linear-7.f90: New test.
	* gfortran.dg/gomp/linear-8.f90: New test.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
2022-07-04 21:50:23 +02:00
Tobias Burnus
683f118439 OpenMP: Move omp requires checks to libgomp
Handle reverse_offload, unified_address, and unified_shared_memory
requirements in libgomp by saving them alongside the offload table.
When the device lto1 runs, it extracts the data for mkoffload. The
latter than passes the value on to GOMP_offload_register_ver.

lto1 (either the host one, with -flto [+ ENABLE_OFFLOADING], or in the
offload-device lto1) also does the the consistency check is done,
erroring out when the 'omp requires' clause use is inconsistent.

For all in-principle supported devices, if a requirement cannot be fulfilled,
the device is excluded from the (supported) devices list. Currently, none of
those requirements are marked as supported for any of the non-host devices.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_target_data, c_parser_omp_target_update,
	c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): Set
	OMP_REQUIRES_TARGET_USED.
	(c_parser_omp_requires): Remove sorry.

gcc/ChangeLog:

	* config/gcn/mkoffload.cc (process_asm): Write '#include <stdint.h>'.
	(process_obj): Pass omp_requires_mask to GOMP_offload_register_ver.
	(main): Ask lto1 to obtain omp_requires_mask and pass it on.
	* config/nvptx/mkoffload.cc (process, main): Likewise.
	* lto-cgraph.cc (omp_requires_to_name): New.
	(input_offload_tables): Save omp_requires_mask.
	(output_offload_tables): Read it, check for consistency,
	save value for mkoffload.
	* omp-low.cc (lower_omp_target): Force output_offloadtables
	call for OMP_REQUIRES_TARGET_USED.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_target_data,
	cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
	cp_parser_omp_target_update): Set OMP_REQUIRES_TARGET_USED.
	(cp_parser_omp_requires): Remove sorry.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_requires): Remove sorry.
	* parse.cc (decode_omp_directive): Don't regard 'declare target'
	as target usage for 'omp requires'; add more flags to
	omp_requires_mask.

include/ChangeLog:

	* gomp-constants.h (GOMP_VERSION): Bump to 2.
	(GOMP_REQUIRES_UNIFIED_ADDRESS, GOMP_REQUIRES_UNIFIED_SHARED_MEMORY,
	GOMP_REQUIRES_REVERSE_OFFLOAD, GOMP_REQUIRES_TARGET_USED):
	New defines.

libgomp/ChangeLog:

	* libgomp-plugin.h (GOMP_OFFLOAD_get_num_devices): Add
	omp_requires_mask arg.
	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Likewise;
	return -1 when device available but omp_requires_mask != 0.
	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_num_devices): Likewise.
	* oacc-host.c (host_get_num_devices, host_openacc_get_property):
	Update call.
	* oacc-init.c (resolve_device, acc_init_1, acc_shutdown_1,
	goacc_attach_host_thread_to_device, acc_get_num_devices,
	acc_set_device_num, get_property_any): Likewise.
	* target.c (omp_requires_mask): New global var.
	(gomp_requires_to_name): New.
	(GOMP_offload_register_ver): Handle passed omp_requires_mask.
	(gomp_target_init): Handle omp_requires_mask.
	* libgomp.texi (OpenMP 5.0): Update requires impl. status.
	(OpenMP 5.1): Add a missed item.
	(OpenMP 5.2): Mark linear-clause change as supported in C/C++.
	* testsuite/libgomp.c-c++-common/requires-1-aux.c: New test.
	* testsuite/libgomp.c-c++-common/requires-1.c: New test.
	* testsuite/libgomp.c-c++-common/requires-2-aux.c: New test.
	* testsuite/libgomp.c-c++-common/requires-2.c: New test.
	* testsuite/libgomp.c-c++-common/requires-3-aux.c: New test.
	* testsuite/libgomp.c-c++-common/requires-3.c: New test.
	* testsuite/libgomp.c-c++-common/requires-4-aux.c: New test.
	* testsuite/libgomp.c-c++-common/requires-4.c: New test.
	* testsuite/libgomp.c-c++-common/requires-5-aux.c: New test.
	* testsuite/libgomp.c-c++-common/requires-5.c: New test.
	* testsuite/libgomp.c-c++-common/requires-6.c: New test.
	* testsuite/libgomp.c-c++-common/requires-7-aux.c: New test.
	* testsuite/libgomp.c-c++-common/requires-7.c: New test.
	* testsuite/libgomp.fortran/requires-1-aux.f90: New test.
	* testsuite/libgomp.fortran/requires-1.f90: New test.

liboffloadmic/ChangeLog:

	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_num_devices):
	Return -1 when device available but omp_requires_mask != 0.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/requires-4.c: Update dg-*.
	* c-c++-common/gomp/reverse-offload-1.c: Likewise.
	* c-c++-common/gomp/target-device-ancestor-2.c: Likewise.
	* c-c++-common/gomp/target-device-ancestor-3.c: Likewise.
	* c-c++-common/gomp/target-device-ancestor-4.c: Likewise.
	* c-c++-common/gomp/target-device-ancestor-5.c: Likewise.
	* gfortran.dg/gomp/target-device-ancestor-3.f90: Likewise.
	* gfortran.dg/gomp/target-device-ancestor-4.f90: Likewise.
	* gfortran.dg/gomp/target-device-ancestor-5.f90: Likewise.
	* gfortran.dg/gomp/target-device-ancestor-2.f90: Likewise. Move
	post-FE checks to ...
	* gfortran.dg/gomp/target-device-ancestor-2a.f90: ... this new file.
	* gfortran.dg/gomp/requires-8.f90: Update as we don't regard
	'declare target' for the 'requires' usage requirement.

Co-authored-by: Chung-Lin Tang <cltang@codesourcery.com>
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
2022-07-04 13:52:02 +02:00
Tobias Burnus
9a668532fb OpenMP: Handle tofrom with target enter/exit data
In 5.2, a map clause can be map-entering or map-exiting,
either containing 'tofrom'. The main reason for this is
permit 'map(x)' with 'omp target enter/exit data',
avoiding to specify 'to:/from:' explicitly. (OpenMP
defaults to 'tofrom'.)

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_target_enter_data,
	c_parser_omp_target_exit_data): Accept tofrom
	map-type modifier but use 'to' / 'from' internally.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_target_enter_data,
	cp_parser_omp_target_exit_data): Accept tofrom
	map-type modifier but use 'to' / 'from' internally.

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_namelist): For the map-type,
	also handle the always modifer and release/delete.
	* openmp.cc (resolve_omp_clauses): Accept tofrom
	map-type modifier for target enter/exit data,
	but use 'to' / 'from' internally.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Mark target enter/exit data
	with fromto as implemented.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/target-data-2.c: New test.
	* c-c++-common/gomp/target-data-3.c: New test.
	* gfortran.dg/gomp/target-data-1.f90: New test.
	* gfortran.dg/gomp/target-data-2.f90: New test.
2022-07-01 17:52:03 +02:00
Martin Liska
c524d860a7 docs: add missing table header
libgomp/ChangeLog:

	* libgomp.texi: Add table header for new features of
	OpenMP 5.2.
2022-06-17 13:33:35 +02:00
Jakub Jelinek
1158fe4340 openmp: Conforming device numbers and omp_{initial,invalid}_device
OpenMP 5.2 changed once more what device numbers are allowed.
In 5.1, valid device numbers were [0, omp_get_num_devices()].
5.2 makes also -1 valid (calls it omp_initial_device), which is equivalent
in behavior to omp_get_num_devices() number but has the advantage that it
is a constant.  And it also introduces omp_invalid_device which is
also a constant with implementation defined value < -1.  That value should
act like sNaN, any time any device construct (GOMP_target*) or OpenMP runtime
API routine is asked for such a device, the program is terminated.
And if OMP_TARGET_OFFLOAD=mandatory, all non-conforming device numbers (which
is all but [-1, omp_get_num_devices()] other than omp_invalid_device)
must be treated like omp_invalid_device.

For device constructs, we have a compatibility problem, we've historically
used 2 magic negative values to mean something special.
GOMP_DEVICE_ICV (-1) means device clause wasn't present, pick the
		     omp_get_default_device () number
GOMP_DEVICE_FALLBACK (-2) means the host device (this is used e.g. for
			  #pragma omp target if (cond)
			  where if cond is false, we pass -2
But 5.2 requires that omp_initial_device is -1 (there were discussions
about it, advantage of -1 is that one can say iterate over the
[-1, omp_get_num_devices()-1] range to get all devices starting with
the host/initial one.
And also, if user passes -2, unless it is omp_invalid_device, we need to
treat it like non-conforming with OMP_TARGET_OFFLOAD=mandatory.

So, the patch does on the compiler side some number remapping,
user_device_num >= -2U ? user_device_num - 1 : user_device_num.
This remapping is done at compile time if device clause has constant
argument, otherwise at runtime, and means that for user -1 (omp_initial_device)
we pass -2 to GOMP_* in the runtime library where it treats it like host
fallback, while -2 is remapped to -3 (one of the non-conforming device numbers,
for those it doesn't matter which one is which).
omp_invalid_device is then -4.
For the OpenMP device runtime APIs, no remapping is done.

This patch doesn't deal with the initial default-device-var for
OMP_TARGET_OFFLOAD=mandatory , the spec says that the inital ICV value
for that should in that case depend on whether there are any offloading
devices or not (if not, should be omp_invalid_device), but that means
we can't determine the number of devices lazily (and let libraries have the
possibility to register their offloading data etc.).

2022-06-13  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* omp-expand.cc (expand_omp_target): Remap user provided
	device clause arguments, -1 to -2 and -2 to -3, either
	at compile time if constant, or at runtime.
include/
	* gomp-constants.h (GOMP_DEVICE_INVALID): Define.
libgomp/
	* omp.h.in (omp_initial_device, omp_invalid_device): New enumerators.
	* omp_lib.f90.in (omp_initial_device, omp_invalid_device): New
	parameters.
	* omp_lib.h.in (omp_initial_device, omp_invalid_device): Likewise.
	* target.c (resolve_device): Add remapped argument, handle
	GOMP_DEVICE_ICV only if remapped is true (and clear remapped),
	for negative values, treat GOMP_DEVICE_FALLBACK as fallback only
	if remapped, otherwise treat omp_initial_device that way.  For
	omp_invalid_device, always emit gomp_fatal, even when
	OMP_TARGET_OFFLOAD isn't mandatory.
	(GOMP_target, GOMP_target_ext, GOMP_target_data, GOMP_target_data_ext,
	GOMP_target_update, GOMP_target_update_ext,
	GOMP_target_enter_exit_data): Pass true as remapped argument to
	resolve_device.
	(omp_target_alloc, omp_target_free, omp_target_is_present,
	omp_target_memcpy_check, omp_target_associate_ptr,
	omp_target_disassociate_ptr, omp_get_mapped_ptr,
	omp_target_is_accessible): Pass false as remapped argument to
	resolve_device.  Treat omp_initial_device the same as
	gomp_get_num_devices ().  Don't bypass resolve_device calls if
	device_num is negative.
	(omp_pause_resource): Treat omp_initial_device the same as
	gomp_get_num_devices ().  Call resolve_device.
	* icv-device.c (omp_set_default_device): Always set to device_num
	even when it is negative.
	* libgomp.texi: Document that Conforming device numbers,
	omp_initial_device and omp_invalid_device is implemented.
	* testsuite/libgomp.c/target-41.c (main): Add test with
	omp_initial_device.
	* testsuite/libgomp.c/target-45.c: New test.
	* testsuite/libgomp.c/target-46.c: New test.
	* testsuite/libgomp.c/target-47.c: New test.
	* testsuite/libgomp.c-c++-common/target-is-accessible-1.c (main): Add
	test with omp_initial_device.  Use -5 instead of -1 for negative value
	test.
	* testsuite/libgomp.fortran/target-is-accessible-1.f90 (main):
	Likewise.  Reorder stop numbers.
2022-06-13 14:02:37 +02:00
Tobias Burnus
ff35a75473 OpenMP/Fortran: Add support for firstprivate and allocate clauses on scope construct
Fortran commit to C/C++/backend commit
r13-862-gf38b20d68fade5a922b9f68c4c3841e653d1b83c

gcc/fortran/ChangeLog:

	* openmp.cc (OMP_SCOPE_CLAUSES): Add firstprivate and allocate.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Mark scope w/ firstprivate/allocate as Y.
	* testsuite/libgomp.fortran/scope-2.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/scope-5.f90: New test.
	* gfortran.dg/gomp/scope-6.f90: New test.
2022-06-03 15:54:02 +02:00
Tobias Burnus
e3803f9cbb OpenMP/Fortran: Add support for enter clause on declare target
Fortran version to C/C++ commit r13-797-g0ccba4ed8571c18c7015413441e971

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_clauses): Handle OMP_LIST_ENTER.
	* gfortran.h: Add OMP_LIST_ENTER.
	* openmp.cc (enum omp_mask2, OMP_DECLARE_TARGET_CLAUSES): Add
	OMP_CLAUSE_ENTER.
	(gfc_match_omp_clauses, gfc_match_omp_declare_target,
	resolve_omp_clauses): Handle 'enter' clause.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.2): Mark 'enter' clause as supported.
	* testsuite/libgomp.fortran/declare-target-1.f90: Extend to test
	explicit 'to' and 'enter' clause.
	* testsuite/libgomp.fortran/declare-target-2.f90: Update accordingly.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/declare-target-2.f90: Add 'enter' clause test.
	* gfortran.dg/gomp/declare-target-4.f90: Likewise.
2022-05-28 20:42:38 +02:00
Tobias Burnus
8255b49ed8 libgomp.texi: Add more to-be-implemented OpenMP 5.2 features
libgomp/
	* libgomp.texi (Other new OpenMP 5.1 features): Add
	'begin declare target'.
	(Other new OpenMP 5.2 features): New.
2022-05-27 10:19:45 +02:00
Tobias Burnus
4fb2b4f7ea OpenMP: Support nowait with Fortran [PR105378]
Fortran part to C/C++/libgomp
commit r13-724-gb43836914bdc2a37563cf31359b2c4803bfe4374

gcc/fortran/

	PR c/105378
	* openmp.cc (gfc_match_omp_taskwait): Accept nowait.

gcc/testsuite/

	PR c/105378
	* gfortran.dg/gomp/taskwait-depend-nowait-1.f90: New.

libgomp/

	PR c/105378
	* libgomp.texi (OpenMP 5.1): Set 'taskwait nowait' to 'Y'.
	* testsuite/libgomp.fortran/taskwait-depend-nowait-1.f90: New.
2022-05-24 10:45:26 +02:00
Marcel Vollweiler
6c420193e8 libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async
This patch adds two new OpenMP runtime routines: omp_target_memcpy_async and
omp_target_memcpy_rect_async. Both functions are introduced in OpenMP 5.1 as
asynchronous variants of omp_target_memcpy and omp_target_memcpy_rect.

In contrast to the synchronous variants, the asynchronous functions have two
additional function parameters to allow the specification of task dependences:

	int depobj_count
	omp_depend_t *depobj_list

	integer(c_int), value :: depobj_count
	integer(omp_depend_kind), optional :: depobj_list(*)

The implementation splits the synchronous functions into two parts: (a) check
and (b) copy. Then (a) is used in the asynchronous functions for the sequential
part, and the actual copy process (b) is executed in a new created task. The
sequential part (a) takes into account the requirements for the return values:

"The routine returns zero if successful. Otherwise, it returns a non-zero
value." (omp_target_memcpy_async, OpenMP 5.1 spec, section 3.8.7)

"An application can determine the number of inclusive dimensions supported by an
implementation by passing NULL pointers (or C_NULL_PTR, for Fortran) for both
dst and src. The routine returns the number of dimensions supported by the
implementation for the specified device numbers. No copy operation is
performed." (omp_target_memcpy_rect_async, OpenMP 5.1 spec, section 3.8.8)

Due to asynchronicity an error is thrown if the asynchronous memcpy is not
successful (in contrast to the synchronous functions which use a return
value unequal to zero).

gcc/ChangeLog:

	* omp-low.cc (omp_runtime_api_call): Added target_memcpy_async and
	target_memcpy_rect_async to omp_runtime_apis array.

libgomp/ChangeLog:

	* libgomp.map: Added omp_target_memcpy_async and
	omp_target_memcpy_rect_async.
	* libgomp.texi: Both functions are now supported.
	* omp.h.in: Added omp_target_memcpy_async and
	omp_target_memcpy_rect_async.
	* omp_lib.f90.in: Added interfaces for both new functions.
	* omp_lib.h.in: Likewise.
	* target.c (ialias_redirect): Added for GOMP_task.
	(omp_target_memcpy): Restructured into check and copy part.
	(omp_target_memcpy_check): New helper function for omp_target_memcpy and
	omp_target_memcpy_async that checks requirements.
	(omp_target_memcpy_copy): New helper function for omp_target_memcpy and
	omp_target_memcpy_async that performs the memcpy.
	(omp_target_memcpy_async_helper): New helper function that is used in
	omp_target_memcpy_async for the asynchronous task.
	(omp_target_memcpy_async): Added.
	(omp_target_memcpy_rect): Restructured into check and copy part.
	(omp_target_memcpy_rect_check): New helper function for
	omp_target_memcpy_rect and omp_target_memcpy_rect_async that checks
	requirements.
	(omp_target_memcpy_rect_copy): New helper function for
	omp_target_memcpy_rect and omp_target_memcpy_rect_async that performs
	the memcpy.
	(omp_target_memcpy_rect_async_helper): New helper function that is used
	in omp_target_memcpy_rect_async for the asynchronous task.
	(omp_target_memcpy_rect_async): Added.
	* task.c (ialias): Added for GOMP_task.
	* testsuite/libgomp.c-c++-common/target-memcpy-async-1.c: New test.
	* testsuite/libgomp.c-c++-common/target-memcpy-async-2.c: New test.
	* testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c: New test.
	* testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c: New test.
	* testsuite/libgomp.fortran/target-memcpy-async-1.f90: New test.
	* testsuite/libgomp.fortran/target-memcpy-async-2.f90: New test.
	* testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90: New test.
	* testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90: New test.
2022-05-20 02:29:32 -07:00
Tobias Burnus
ba8563693f OpenMP: Add Fortran support for inoutset depend-kind
Fortran additions to the C/C++ + ME/libgomp commit
r13-556-g2c16eb3157f86ae561468c540caf8eb326106b5f

gcc/fortran/ChangeLog:

	* gfortran.h (enum gfc_omp_depend_op): Add OMP_DEPEND_INOUTSET.
	(gfc_omp_clauses): Enlarge ENUM_BITFIELD.
	* dump-parse-tree.cc (show_omp_namelist, show_omp_clauses): Handle
	'inoutset' depend modifier.
	* openmp.cc (gfc_match_omp_clauses, gfc_match_omp_depobj): Likewise.
	* trans-openmp.cc (gfc_trans_omp_clauses, gfc_trans_omp_depobj):
	Likewise.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1): Set 'inoutset' to Y.
	(OpenMP Context Selectors): Add missing comma.
	* testsuite/libgomp.fortran/depend-5.f90: Add inoutset test.
	* testsuite/libgomp.fortran/depend-6.f90: Likewise.
	* testsuite/libgomp.fortran/depend-7.f90: Likewise.
	* testsuite/libgomp.fortran/depend-inoutset-1.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/all-memory-1.f90: Add inoutset test.
	* gfortran.dg/gomp/all-memory-2.f90: Likewise.
	* gfortran.dg/gomp/depobj-1.f90: Likewise.
	* gfortran.dg/gomp/depobj-2.f90: Likewise.
2022-05-18 12:04:21 +02:00
Jakub Jelinek
741478ed3e libgomp: Clarify that omp_display_env is fully implemented
OpenMP 5.2 added
"When called from within a target region the effect is unspecified."
restriction to omp_display_env, so it is ok not to support it in
target regions (worst case we could add an empty implementation
or one with __builtin_trap in there).

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

	* libgomp.texi (OpenMP 5.1): Remove "Not inside target regions"
	comment for omp_display_env feature.
2022-05-17 16:58:26 +02:00
Tobias Burnus
61fe7b7d46 libgomp.texi: Document OpenMP context selectors
libgomp/
	* libgomp.texi (Offload-Target Specifics): New chapter; add section
	to document OpenMP context selectors.
2022-05-17 15:54:24 +02:00
Tobias Burnus
472aecb789 libgomp.texi: Add OpenMP 5.2 implementation status
libgomp/
	* libgomp.texi (OpenMP Implementation Status): Add 5.2 table.
2022-05-17 12:31:35 +02:00
Tobias Burnus
4f94c38a92 OpenMP: Add omp_all_memory support to Fortran
Fortran part to the C/C++/backend implementation
r13-337-g7f78783dbedca0183d193e475262ca3c489fd365

gcc/fortran/ChangeLog:

	* dump-parse-tree.cc (show_omp_namelist): Handle omp_all_memory.
	* openmp.cc (gfc_match_omp_variable_list, gfc_match_omp_depend_sink,
	gfc_match_omp_clauses, resolve_omp_clauses): Likewise.
	* trans-openmp.cc (gfc_trans_omp_clauses, gfc_trans_omp_depobj):
	Likewise.
	* resolve.cc (resolve_symbol): Reject it as symbol.

libgomp/ChangeLog:

	* libgomp.texi (OpenMP 5.1): Set omp_all_memory to 'Y'.
	* testsuite/libgomp.fortran/depend-5.f90: New test.
	* testsuite/libgomp.fortran/depend-6.f90: New test.
	* testsuite/libgomp.fortran/depend-7.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/all-memory-1.f90: New test.
	* gfortran.dg/gomp/all-memory-2.f90: New test.
	* gfortran.dg/gomp/all-memory-3.f90: New test.
2022-05-17 11:01:04 +02:00
Marcel Vollweiler
4043f53cb4 OpenMP, libgomp: Add new runtime routine omp_target_is_accessible.
gcc/ChangeLog:

	* omp-low.cc (omp_runtime_api_call): Added target_is_accessible to
	omp_runtime_apis array.

libgomp/ChangeLog:

	* libgomp.map: Added omp_target_is_accessible.
	* libgomp.texi: Tagged omp_target_is_accessible as supported.
	* omp.h.in: Added omp_target_is_accessible.
	* omp_lib.f90.in: Added interface for omp_target_is_accessible.
	* omp_lib.h.in: Likewise.
	* target.c (omp_target_is_accessible): Added implementation of
	omp_target_is_accessible.
	* testsuite/libgomp.c-c++-common/target-is-accessible-1.c: New test.
	* testsuite/libgomp.fortran/target-is-accessible-1.f90: New test.
2022-05-06 07:28:26 -07:00
Sandra Loosemore
2d8752c592 libgomp: Update docs to reflect Fortran support for non-rectangular loops
libgomp/
	* libgomp.texi (OpenMP 5.0): Feature is now fully supported.
2022-05-05 14:48:57 -07:00
Marcel Vollweiler
941cdc8b6d OpenMP, libgomp: Add new runtime routine omp_get_mapped_ptr.
This patch adds the OpenMP runtime routine "omp_get_mapped_ptr" which was
introduced in OpenMP 5.1.

gcc/ChangeLog:

	* omp-low.cc (omp_runtime_api_call): Added get_mapped_ptr to
	omp_runtime_apis array.

libgomp/ChangeLog:

	* libgomp.map: Added omp_get_mapped_ptr.
	* libgomp.texi: Tagged omp_get_mapped_ptr as supported.
	* omp.h.in: Added omp_get_mapped_ptr.
	* omp_lib.f90.in: Added interface for omp_get_mapped_ptr.
	* omp_lib.h.in: Likewise.
	* target.c (omp_get_mapped_ptr): Added implementation of
	omp_get_mapped_ptr.
	* testsuite/libgomp.c-c++-common/get-mapped-ptr-1.c: New test.
	* testsuite/libgomp.c-c++-common/get-mapped-ptr-2.c: New test.
	* testsuite/libgomp.c-c++-common/get-mapped-ptr-3.c: New test.
	* testsuite/libgomp.c-c++-common/get-mapped-ptr-4.c: New test.
	* testsuite/libgomp.fortran/get-mapped-ptr-1.f90: New test.
	* testsuite/libgomp.fortran/get-mapped-ptr-2.f90: New test.
	* testsuite/libgomp.fortran/get-mapped-ptr-3.f90: New test.
	* testsuite/libgomp.fortran/get-mapped-ptr-4.f90: New test.
2022-05-02 23:56:44 -07:00
Jakub Jelinek
db14bb4c6b libgomp: Fix a documentation typo
This fixes a typo in the 5.0 feature support table.

2022-04-13  Jakub Jelinek  <jakub@redhat.com>

	* libgomp.texi: Fix a typo - mutexinouset -> mutexinoutset.
2022-04-13 09:46:53 +02:00
Tobias Burnus
1b85638aff texi + c-target.def: Fix typos
gcc/c-family/ChangeLog:

	* c-target.def (check_string_object_format_arg): Fix description typo.

gcc/ChangeLog:

	* doc/invoke.texi: Fix typos.
	* doc/tm.texi.in: Remove duplicated word.
	* doc/tm.texi: Regenerate.

libgomp/ChangeLog:

	* libgomp.texi: Fix typo.
2022-03-13 10:23:07 +01:00