https://gcc.gnu.org/g:b2de4da929500001c56cc17e5ec26bc2a9459b27
commit b2de4da929500001c56cc17e5ec26bc2a9459b27 Author: Thomas Schwinge <tschwi...@baylibre.com> Date: Tue Jul 16 17:09:38 2024 +0200 libgomp: Document 'GOMP_teams4' For reference: - <https://inbox.sourceware.org/20211111190313.GV2710@tucnak> "[PATCH] openmp: Honor OpenMP 5.1 num_teams lower bound" - <https://inbox.sourceware.org/20211112132023.GC2710@tucnak> "[PATCH] libgomp, nvptx: Honor OpenMP 5.1 num_teams lower bound" libgomp/ * config/gcn/target.c (GOMP_teams4): Document. * config/nvptx/target.c (GOMP_teams4): Likewise. * target.c (GOMP_teams4): Likewise. (cherry picked from commit a95c1911d8e8fd0c76fc67232ebc1176162ec8d7) Diff: --- libgomp/ChangeLog.omp | 7 +++++++ libgomp/config/gcn/target.c | 8 ++++++++ libgomp/config/nvptx/target.c | 8 ++++++++ libgomp/target.c | 9 +++++++++ 4 files changed, 32 insertions(+) diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 37be690a7b7a..469c6c1f1887 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -3,6 +3,13 @@ Backported from trunk: 2024-07-19 Thomas Schwinge <tschwi...@baylibre.com> + * config/gcn/target.c (GOMP_teams4): Document. + * config/nvptx/target.c (GOMP_teams4): Likewise. + * target.c (GOMP_teams4): Likewise. + + Backported from trunk: + 2024-07-19 Thomas Schwinge <tschwi...@baylibre.com> + * config/gcn/libgomp-gcn.h (GOMP_TEAM_NUM): Inject. * config/gcn/target.c (GOMP_teams4): Handle. * config/gcn/team.c (gomp_gcn_enter_kernel): Initialize. diff --git a/libgomp/config/gcn/target.c b/libgomp/config/gcn/target.c index 2d8bde625d81..f648866b13bb 100644 --- a/libgomp/config/gcn/target.c +++ b/libgomp/config/gcn/target.c @@ -29,6 +29,14 @@ extern volatile struct gomp_offload_icvs GOMP_ADDITIONAL_ICVS; +/* Implement OpenMP 'teams' construct. + + Initialize upon FIRST call. Return whether this invocation is active. + Depending on whether NUM_TEAMS_LOWER asks for more teams than are provided + in hardware, we may need to loop multiple times; in that case make sure to + update the team-level variable used by 'omp_get_team_num', as we then can't + just use '__builtin_gcn_dim_pos (0)'. */ + bool GOMP_teams4 (unsigned int num_teams_lower, unsigned int num_teams_upper, unsigned int thread_limit, bool first) diff --git a/libgomp/config/nvptx/target.c b/libgomp/config/nvptx/target.c index 3db29d4af311..b5c270f3c9cf 100644 --- a/libgomp/config/nvptx/target.c +++ b/libgomp/config/nvptx/target.c @@ -31,6 +31,14 @@ extern int __gomp_team_num __attribute__((shared)); extern volatile struct gomp_offload_icvs GOMP_ADDITIONAL_ICVS; volatile struct rev_offload *GOMP_REV_OFFLOAD_VAR; +/* Implement OpenMP 'teams' construct. + + Initialize upon FIRST call. Return whether this invocation is active. + Depending on whether NUM_TEAMS_LOWER asks for more teams than are provided + in hardware, we may need to loop multiple times; in that case make sure to + update the team-level variable used by 'omp_get_team_num', as we then can't + just use '%ctaid.x'. */ + bool GOMP_teams4 (unsigned int num_teams_lower, unsigned int num_teams_upper, unsigned int thread_limit, bool first) diff --git a/libgomp/target.c b/libgomp/target.c index d381a1315391..caa501c27acb 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -4692,6 +4692,8 @@ gomp_target_task_fn (void *data) return false; } +/* Implement OpenMP 'teams' construct, legacy entry point. */ + void GOMP_teams (unsigned int num_teams, unsigned int thread_limit) { @@ -4704,6 +4706,13 @@ GOMP_teams (unsigned int num_teams, unsigned int thread_limit) (void) num_teams; } +/* Implement OpenMP 'teams' construct. + + Initialize upon FIRST call. Return whether this invocation is active. + Depending on whether NUM_TEAMS_LOW asks for more teams than are provided + in hardware, we may need to loop multiple times; in that case make sure to + update the team-level variable used by 'omp_get_team_num'. */ + bool GOMP_teams4 (unsigned int num_teams_low, unsigned int num_teams_high, unsigned int thread_limit, bool first)