https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100321
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tom de Vries <vr...@gcc.gnu.org>: https://gcc.gnu.org/g:f87990a2a8fc9e20d30462a0a4c9047582af0cd9 commit r12-395-gf87990a2a8fc9e20d30462a0a4c9047582af0cd9 Author: Tom de Vries <tdevr...@suse.de> Date: Mon May 3 11:36:14 2021 +0200 [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 <tdevr...@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 <tdevr...@suse.de> PR target/100321 * testsuite/libgomp.c/target-44.c: New test.