https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85129

            Bug ID: 85129
           Summary: [openacc] Document GOMP_OPENACC_DIM
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

I. trunk

The GOMP_OPENACC_DIM environment variable is not documented (it should have an
entry in libgomp.texi at 'OpenACC Environment Variables').

The plugin-nvptx.c source code shows:
...
  /* ... .  The syntax  is the same as for the -fopenacc-dim compilation
     option.  */
...

The documentation of fopenacc-dim is:
...
@item -fopenacc-dim=@var{geom}
@opindex fopenacc-dim
@cindex OpenACC accelerator programming
Specify default compute dimensions for parallel offload regions that do
not explicitly specify.  The @var{geom} value is a triple of
':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
can be omitted, to use a target-specific default value.
...

The documentation of fopenacc-dim shows no examples.

If we grep through the testsuite, we find a couple of examples of fopenacc-dim
usage:
...
libgomp.oacc-c-c++-common/loop-dim-default.c:
  /* { dg-additional-options "-fopenacc-dim=16:16" } */

libgomp.oacc-c-c++-common/tile-1.c:
  /* { dg-additional-options "-fopenacc-dim=32" } */

libgomp.oacc-c-c++-common/loop-auto-1.c:
  /* { dg-additional-options "-fopenacc-dim=32" } */
...

There is no test-case exercising omission at the start, f.i. ":16:" to use a
target-specific number of gangs, 16 workers, and a target-specific vector
length.

There are no testcases exercising GOMP_OPENACC_DIM.


II. og7

If we move over to branch og7, we find a different syntax for -fopenacc-dim,
allowing a '-' to force the corresponding dimension to be chosen at runtime:
...
@item -fopenacc-dim=@var{geom}
@opindex fopenacc-dim
@cindex OpenACC accelerator programming
Specify default compute dimensions for parallel offload regions that do
not explicitly specify.  The @var{geom} value is a triple of
':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  If a size
is to be deferred until execution '-' can be used, alternatively a size
can be omitted to use a target-specific default value.  When deferring
to runtime, the environment variable @var{GOMP_OPENACC_DIM} can be set.
It has the same format as the option value, except that '-' is not
permitted.
...

The last line excludes the usage of '-' in GOMP_OPENACC_DIM, but the comment in
plugin-nvptx still claims that syntax for GOMP_OPENACC_DIM and -fopenacc-dim is
the same.

The examples of '-' fopenacc-dim usage in og7:
...
libgomp.oacc-c-c++-common/loop-default-runtime.c:
  /* { dg-additional-options "-fopenacc-dim=-:-" } */

libgomp.oacc-fortran/gemm.f90:
  ! { dg-additional-options "-fopenacc-dim=-:-:128" }
...

There are two test-cases excercising GOMP_OPENACC_DIM (using setenv rather than
dg-set-target-env-var, to allow remote testing setups to work where
dg-set-target-env-var is broken):
...
libgomp.oacc-c-c++-common/loop-default-compile.c:
  setenv ("GOMP_OPENACC_DIM", "8:8",  1);

libgomp.oacc-c-c++-common/loop-default-runtime.c:
  setenv ("GOMP_OPENACC_DIM", "8:16", 1);
...

Reply via email to