]> git.ipfire.org Git - thirdparty/gcc.git/commit - libgomp/config/nvptx/team.c
libgomp, nvptx: Honor OpenMP 5.1 num_teams lower bound
authorJakub Jelinek <jakub@redhat.com>
Mon, 15 Nov 2021 08:20:52 +0000 (09:20 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 15 Nov 2021 08:20:52 +0000 (09:20 +0100)
commit9fa72756d90e0d9edadf6e6f5f56476029925788
treee55e4082ec01a42cebfba273a060db50d3fd53c1
parentd29445972065f54566402b255d76b2567e23d445
libgomp, nvptx: Honor OpenMP 5.1 num_teams lower bound

Here is a PTX implementation of what I was talking about, that for
num_teams_upper 0 or whenever num_teams_lower <= num_blocks, the current
implementation is fine but if the user explicitly asks for more
teams than we can provide in hardware, we need to stop assuming that
omp_get_team_num () is equal to the hw team id, but instead need to use some
team specific memory (it is .shared for PTX), or if none is
provided, array indexed by the hw team id and run some teams serially within
the same hw thread.

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

* config/nvptx/team.c (__gomp_team_num): Define as
__attribute__((shared)) var.
(gomp_nvptx_main): Initialize __gomp_team_num to 0.
* config/nvptx/target.c (__gomp_team_num): Declare as
extern __attribute__((shared)) var.
(GOMP_teams4): Use __gomp_team_num as the team number instead of
%ctaid.x.  If first, initialize it to %ctaid.x.  If num_teams_lower
is bigger than num_blocks, use num_teams_lower teams and arrange for
bumping of __gomp_team_num if !first and returning false once we run
out of teams.
* config/nvptx/teams.c (__gomp_team_num): Declare as
extern __attribute__((shared)) var.
(omp_get_team_num): Return __gomp_team_num value instead of %ctaid.x.
libgomp/config/nvptx/target.c
libgomp/config/nvptx/team.c
libgomp/config/nvptx/teams.c