On Fri, Sep 23, 2016 at 06:02:32PM +0200, Bernd Schmidt wrote: > While trying to get the following benchmarks to run: > https://codesign.llnl.gov/lulesh.php > > I came across some cases where the code and the compiler differed in its > interpretation of the OpenACC spec. Specifically, this occurs for acc data > clauses with arrays, like: > > #pragma acc data copyin(a[N][M]) copyout(b[N][M]) > > Here, gcc expects an entire array to be specified as a[0:N][0:M], while the > benchmark uses a[N][M]. The latter is interpreted by gcc as a single array > element (low bound N, length 1), and produces an error. > > As usual, the "spec" isn't super clear but my reading of it tends to agree > with gcc's. However, I suspect compatibility with other compilers is more > important than what's in that document. I don't have any to test against > unfortunately. > > In any case, the following patch changes gcc's behaviour, if we think it > should be changed. Not fully tested yet, in particular I have some issues > with timeouts while running OpenACC offload tests.
I haven't studied OpenACC in this case, but a[N][M] in OpenMP array section syntax is certainly the same thing as in C/C++ without any extensions, i.e. an array element, to cover the whole array one needs to use e.g. a[:N][:M] or a[0:N][0:M]. So your patch would certainly break OpenMP. E.g. in https://github.com/EPCCed/epcc-openacc-benchmarks/blob/master/level0.c I see even in OpenACC the [0:len1][0:len2] syntax being used when they mean the whole array. Jakub