Here is a small example on which I can reproduce the problem:
#include <stdio.h>
#include <stdlib.h>
void foo(char* buffer, int count)
{
int i;
for(i=0; i<count; i++)
buffer[i]++;
}
int main(int argc, char* argv[])
{
char* buffer = NULL;
int i, count=atoi(argv[1]);
buffer = (char*) malloc (sizeof(char) * count);
if (!buffer)
return 1;
#pragma acc region copy(buffer[:count])
foo(buffer, count);
free(buffer);
return 0;
}
Here’s the compiler message:
$ pgcc -ta=nvidia -Minfo source.c -c -Minline
PGC-W-0155-Accelerator region ignored; see -Minfo messages (source.c: 21)
main:
21, Accelerator restriction: size of the GPU copy of an array depends on values computed in this loop
Accelerator region ignored
22, foo inlined, size=5, file source.c (6)
8, Accelerator restriction: size of the GPU copy of ‘…inline’ is unknown
Accelerator restriction: one or more arrays have unknown size$
I believe the error is from the compiler not being able to determine the size of buffer/loop inside function foo(). It looks like the compiler renames the symbols from the function (…inline) when the ‘-Minline’ flag is used. Is it possible to indicate the size of the buffer in the pragma statement for the arrays used in the inlined loop?
Thanks!
Ashay