[openmp, simt] Disable SIMT for user-defined reduction
authorTom de Vries <tdevries@suse.de>
Mon, 3 May 2021 09:36:14 +0000 (11:36 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 3 May 2021 21:13:59 +0000 (23:13 +0200)
commitf87990a2a8fc9e20d30462a0a4c9047582af0cd9
tree4775d4d8ac3746f76f1bd94beeee8f9d412ba3c6
parent49e6bb44ff9487832335369974630a5c7073fa7b
[openmp, simt] Disable SIMT for user-defined reduction

The test-case included in this patch contains this target region:
...
  for (int i0 = 0 ; i0 < N0 ; i0++ )
    counter_N0.i += 1;
...

When running with nvptx accelerator, the counter variable is expected to
be N0 after the region, but instead is N0 / 32.  The problem is that rather
than getting the result for all warp lanes, we get it for just one lane.

This is caused by the implementation of SIMT being incomplete.  It handles
regular reductions, but appearantly not user-defined reductions.

For now, handle this by disabling SIMT in this case, specifically by setting
sctx->max_vf to 1.

Tested libgomp on x86_64-linux with nvptx accelerator.

gcc/ChangeLog:

2021-05-03  Tom de Vries  <tdevries@suse.de>

PR target/100321
* omp-low.c (lower_rec_input_clauses): Disable SIMT for user-defined
reduction.

libgomp/ChangeLog:

2021-05-03  Tom de Vries  <tdevries@suse.de>

PR target/100321
* testsuite/libgomp.c/target-44.c: New test.
gcc/omp-low.c
libgomp/testsuite/libgomp.c/target-44.c [new file with mode: 0644]