https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122077
Bug ID: 122077
Summary: inscan reduction modifier does not compile on nvptx
target with gcc 15.2
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: schulz.benjamin at googlemail dot com
CC: jakub at gcc dot gnu.org
Target Milestone: ---
openmp inscan reduction modifier does not compile on nvptx target with gcc 15.2
According to the openmp standard, the #pragma omp target parallel clause
supports the following clauses:
https://www.openmp.org/spec-html/5.0/openmpsu78.html
#pragma omp target parallel [clause[ [,] clause] ... ] new-line
where clause can be any! of the clauses accepted by the target or! parallel
directives
The parallel directive supports the following clauses:
https://www.openmp.org/spec-html/5.0/openmpse14.html
reduction([reduction-modifier ,] reduction-identifier : list)
reduction-modifier can be
https://www.openmp.org/spec-html/5.0/openmpsu107.html#x140-5810002.19.5.1
inscan
task
default
So lets make a test
#include <omp.h>
int main()
{
int N=20;
int a[N], b[N];
int x = 0;
// initialization
for (int k = 0; k < N; k++)
a[k] = k + 1;
// a[k] is included in the computation of producing results in b[k]
#pragma omp target data map(tofrom:a[0:N],b[0:N])
#pragma omp target parallel for reduction(inscan,+: x)
for (int k = 0; k < N; k++) {
x += a[k];
#pragma omp scan inclusive(x)
b[k] = x;
}
return 0;
}
and compile with
-fopenmp -foffload=nvptx-none -fcf-protection=none -fno-stack-protector
Error: »inscan«-»reduction«-clause with constructions except »for«, »simd«,
»for simd«, »parallel for«, »parallel for simd«
15 | #pragma omp target parallel for reduction(inscan,+: x)
| ^
Error: »#pragma omp scan« is only allowed to be used together with a loop
construct with an inscan reduction
18 | #pragma omp scan inclusive(x)
| ^~~
the reduction modifier task would work as reduction clause by the way.