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

            Bug ID: 84570
           Summary: [og7, openacc, nvptx] Unused offloaded function
                    parameters
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider the following openacc program:
...
static
void foo(int n, int p[N][N])
{
  int i, j, k;
  #pragma acc parallel copy(p[0:N][0:N])
  for (k = 0; k < n; k++)
    {
      #pragma acc loop gang
      for (i = 0; i < n; i++)
        for (j = 0; j < n; j++)
          p[i][j] = ...;
    }
}
...

The variables that are copied from host to accelerator are: n, i, j, k and *p.

The variables i, j and k are not initialized before the parallel region, nor is
the uninitialized value read in the parallel region, so the copy of these
variables is superfluous.

With the old approach where offloading functions where called with a single
pointer-to-struct argument, we wasted some global memory with this.

With the new "Use functional parameters for data mappings in OpenACC child
functions" approach in the og7 branch, we waste .param space with this.
Depending on the implementation, this may be global memory, but also something
else, which may make the wasting more costly.

Either way, the fact that all the arguments are now individually listed in the
function prototype makes it much easier to spot unused parameters.

Reply via email to