This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,openacc] use firstprivate pointers for subarrays in c and c++


On Mon, May 23, 2016 at 07:31:53PM -0700, Cesar Philippidis wrote:
> @@ -12559,7 +12560,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
>  	  t = OMP_CLAUSE_DECL (c);
>  	  if (TREE_CODE (t) == TREE_LIST)
>  	    {
> -	      if (handle_omp_array_sections (c, ort & C_ORT_OMP))
> +	      if (handle_omp_array_sections (c, ort & (C_ORT_OMP | C_ORT_ACC)))
>  		{
>  		  remove = true;
>  		  break;

You haven't touched the /c/ handle_omp_array_sections{,_1}.  As I said, I believe
you can just drop the is_omp argument altogether (unlike C++), or, pass for
consistency ort itself there as well.  But I bet the argument will be
unused.

> --- a/gcc/cp/semantics.c
> +++ b/gcc/cp/semantics.c
> @@ -4472,7 +4472,7 @@ omp_privatize_field (tree t, bool shared)
>  static tree
>  handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
>  			     bool &maybe_zero_len, unsigned int &first_non_one,
> -			     bool is_omp)
> +			     enum c_omp_region_type ort)
>  {
>    tree ret, low_bound, length, type;
>    if (TREE_CODE (t) != TREE_LIST)
> @@ -4484,7 +4484,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
>  	t = TREE_OPERAND (t, 0);
>        ret = t;
>        if (TREE_CODE (t) == COMPONENT_REF
> -	  && is_omp
> +	  && ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP || ort == C_ORT_ACC)
>  	  && (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
>  	      || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TO
>  	      || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FROM)

This hunk looks wrong, I'd expect just && ort == C_ORT_OMP.
OpenACC to my knowledge doesn't have mapping of fields,
at least you reject copy(var.field) so it would surprise me
if you wanted to allow copy(var.field[:]).
And #pragma omp declare simd doesn't have any clauses for which it would
call handle_omp_array_sections* at all.

> @@ -4545,11 +4545,12 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
>        return ret;
>      }
>  
> -  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
> +  if ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP
> +      && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION

ort == C_ORT_OMP is enough.

> @@ -4988,7 +4989,7 @@ handle_omp_array_sections (tree c, bool is_omp)
>  	      || (TREE_CODE (t) == COMPONENT_REF
>  		  && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE))
>  	    return false;
> -	  if (is_omp)
> +	  if ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP || ort == C_ORT_ACC)

if (ort == C_ORT_OMP || ort == C_ORT_ACC)

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]