gcc/libgomp
Jakub Jelinek 6665382c0e openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit
OpenMP 5.1 adds env vars and functions to set and query new ICVs used
as fallback if thread_limit or num_teams clauses aren't specified on
teams construct.

The following patch implements those, though further work will be needed:
1) OpenMP 5.1 also changed the num_teams clause, so that it can specify
   both lower and upper limit for how many teams should be created and
   changed the meaning when only one expression is provided, instead of
   num_teams(expr) in 5.0 meaning num_teams(1:expr) in 5.1, it now means
   num_teams(expr:expr), i.e. while previously we could create 1 to expr
   teams, in 5.1 we have some low limit by default equal to the single
   expression provided and may not create fewer teams.
   For host teams (which we don't currently implement efficiently for
   NUMA hosts) we trivially satisfy it now by always honoring what the
   user asked for, but for the offloading teams I think we'll need to
   rethink the APIs; currently teams construct is just a call that returns
   and possibly lowers the number of teams; and whenever possible we try
   to evaluate num_teams/thread_limit already on the target construct
   and the GOMP_teams call just sets the number of teams to the minimum
   of provided and requested teams; for some cases e.g. where target
   is not combined with teams and num_teams expression calls some functions
   etc., we need to call those functions in the target region and so it is
   late to figure number of teams, but also hw could just limit what it
   is willing to create; in that case I'm afraid we need to run the target
   body multiple times and arrange for omp_get_team_num () returning the
   right values
2) we need to finally implement the NUMA handling for GOMP_teams_reg
3) I now realize I haven't added some testcase coverage, will do that
   incrementally
4) libgomp.texi needs updates for these new APIs, but also others like
   the allocator

2021-10-11  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* omp-low.c (omp_runtime_api_call): Handle omp_get_max_teams,
	omp_[sg]et_teams_thread_limit and omp_set_num_teams.
libgomp/
	* omp.h.in (omp_set_num_teams, omp_get_max_teams,
	omp_set_teams_thread_limit, omp_get_teams_thread_limit): Declare.
	* omp_lib.f90.in (omp_set_num_teams, omp_get_max_teams,
	omp_set_teams_thread_limit, omp_get_teams_thread_limit): Declare.
	* omp_lib.h.in (omp_set_num_teams, omp_get_max_teams,
	omp_set_teams_thread_limit, omp_get_teams_thread_limit): Declare.
	* libgomp.h (gomp_nteams_var, gomp_teams_thread_limit_var): Declare.
	* libgomp.map (OMP_5.1): Export omp_get_max_teams{,_},
	omp_get_teams_thread_limit{,_}, omp_set_num_teams{,_,_8_} and
	omp_set_teams_thread_limit{,_,_8_}.
	* icv.c (omp_set_num_teams, omp_get_max_teams,
	omp_set_teams_thread_limit, omp_get_teams_thread_limit): New
	functions.
	* env.c (gomp_nteams_var, gomp_teams_thread_limit_var): Define.
	(omp_display_env): Print OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT.
	(initialize_env): Handle OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT env
	vars.
	* teams.c (GOMP_teams_reg): If thread_limit is not specified, use
	gomp_teams_thread_limit_var as fallback if not zero.  If num_teams
	is not specified, use gomp_nteams_var.
	* fortran.c (omp_set_num_teams, omp_get_max_teams,
	omp_set_teams_thread_limit, omp_get_teams_thread_limit): Add
	ialias_redirect.
	(omp_set_num_teams_, omp_set_num_teams_8_, omp_get_max_teams_,
	omp_set_teams_thread_limit_, omp_set_teams_thread_limit_8_,
	omp_get_teams_thread_limit_): New functions.

(cherry picked from commit 07dd3bcda1)
2021-10-11 13:06:27 +02:00
..
config Make the OpenMP 'error' directive work for nvptx offloading 2021-08-23 15:22:38 +02:00
plugin openmp: Implement omp_get_device_num routine 2021-08-09 08:58:45 +02:00
testsuite Add libgomp.fortran/order-reproducible-*.f90 2021-10-02 11:32:22 +02:00
.gitattributes
acc_prof.h
acinclude.m4
aclocal.m4
affinity-fmt.c openmp: Avoid PLT relocations for omp_* symbols in libgomp 2021-10-01 19:55:06 +02:00
affinity.c
alloc.c
allocator.c openmp: Add omp_aligned_{,c}alloc and omp_{c,re}alloc 2021-09-30 09:50:07 +02:00
atomic.c
barrier.c
ChangeLog Daily bump. 2021-09-29 00:18:07 +00:00
ChangeLog.graphite
ChangeLog.omp openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
config.h.in
configure libgomp: Only check for 2*sizeof(void*) int type with Fortran [PR96661] 2021-09-28 15:17:07 +02:00
configure.ac libgomp: Only check for 2*sizeof(void*) int type with Fortran [PR96661] 2021-09-28 15:17:07 +02:00
configure.tgt
critical.c
env.c openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
error.c openmp: Implement the error directive 2021-08-20 14:19:07 +02:00
fortran.c openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
hashtab.h OpenMP 5.0 Structure element mapping 2021-04-22 10:14:32 -07:00
icv-device.c openmp: Avoid PLT relocations for omp_* symbols in libgomp 2021-10-01 19:55:06 +02:00
icv.c openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
iter_ull.c
iter.c
libgomp_f.h.in
libgomp_g.h openmp: Implement the error directive 2021-08-20 14:19:07 +02:00
libgomp-plugin.c
libgomp-plugin.h openmp: Implement omp_get_device_num routine 2021-08-09 08:58:45 +02:00
libgomp.h openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
libgomp.map openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
libgomp.spec.in
libgomp.texi openmp: Add support for OpenMP 5.1 structured-block-sequences 2021-10-09 11:23:46 +02:00
lock.c
loop_ull.c
loop.c
Makefile.am openmp: Implement OpenMP 5.1 scope construct 2021-08-17 15:44:56 +02:00
Makefile.in openmp: Implement OpenMP 5.1 scope construct 2021-08-17 15:44:56 +02:00
oacc-async.c
oacc-cuda.c Tweak error return value for acc_set_cuda_stream. 2021-04-20 11:49:30 -07:00
oacc-host.c OpenMP 5.0: requires directive 2021-04-22 10:14:32 -07:00
oacc-init.c Add changes to profiling interface from OG8 branch 2021-04-21 09:33:50 -07:00
oacc-int.h
oacc-mem.c OpenMP 5.0: Improve OpenMP target support for C++ (includes PR92120 v3) 2021-05-30 05:00:19 +08:00
oacc-parallel.c OpenMP 5.0 Structure element mapping 2021-04-22 10:14:32 -07:00
oacc-plugin.c
oacc-plugin.h
oacc-profiling-acc_register_library.c Add changes to profiling interface from OG8 branch 2021-04-21 09:33:50 -07:00
oacc-profiling.c Add changes to profiling interface from OG8 branch 2021-04-21 09:33:50 -07:00
oacc-target.c
omp_lib.f90.in openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
omp_lib.h.in openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
omp.h.in openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
openacc_lib.h
openacc.f90
openacc.h
ordered.c
parallel.c
priority_queue.c
priority_queue.h
scope.c openmp: Implement OpenMP 5.1 scope construct 2021-08-17 15:44:56 +02:00
sections.c
secure_getenv.h
single.c
splay-tree.c
splay-tree.h
target.c openmp: Implement omp_get_device_num routine 2021-08-09 08:58:45 +02:00
task.c openmp: Notify team barrier of pending tasks in omp_fulfill_event 2021-05-17 14:20:08 -07:00
taskloop.c openmp: Add support for strict modifier on grainsize/num_tasks clauses 2021-08-23 15:25:24 +02:00
team.c
teams.c openmp: Add omp_set_num_teams, omp_get_max_teams, omp_[gs]et_teams_thread_limit 2021-10-11 13:06:27 +02:00
work.c