[PATCH][openmp, simt] Error out for user-defined reduction

Jakub Jelinek jakub@redhat.com
Mon May 3 17:14:25 GMT 2021


On Mon, May 03, 2021 at 07:03:24PM +0200, Tom de Vries wrote:
> +      if (sctx->is_simt && !known_eq (sctx->max_vf, 1U))
> +	{
> +	  tree c = omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
> +				    OMP_CLAUSE_REDUCTION);
> +	  if (c && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
> +	    /* UDR reductions are not supported yet for SIMT, disable SIMT.  */
> +	    sctx->max_vf = 1;

This isn't sufficient, you could have e.g. 2 reductions, the first non-UDR
one and the second one with UDR.
So it needs to be a for loop like:
	  for (tree c = gimple_omp_for_clauses (ctx->stmt); c;
	       c = OMP_CLAUSE_CHAIN (c))
	    if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
		&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
	      {
		/* UDR reductions are not supported yet for SIMT,
		   disable SIMT.  */
		sctx->max_vf = 1;
		break;
	      }
(or with omp_find_clause used in two spots).

	Jakub



More information about the Gcc-patches mailing list