[patch] Add OpenACC Fortran support for deviceptr and variable in common blocks

Chung-Lin Tang chunglin_tang@mentor.com
Tue Dec 4 13:50:00 GMT 2018


On 2018/12/4 9:30 PM, Jakub Jelinek wrote:
>>   	      && gfc_match_omp_map_clause (&c->lists[OMP_LIST_MAP],
>> -					   OMP_MAP_TOFROM))
>> +					   OMP_MAP_TOFROM, openacc))
> Why?  OpenMP doesn't have a copy clause, so I'd expect true here.

I guess Cesar was just being specific to OpenACC behavior.

>>   	    continue;
>>   	  if (mask & OMP_CLAUSE_COPYIN)
>>   	    {
>> @@ -1047,7 +1048,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
>>   		{
>>   		  if (gfc_match ("copyin ( ") == MATCH_YES
>>   		      && gfc_match_omp_map_clause (&c->lists[OMP_LIST_MAP],
>> -						   OMP_MAP_TO))
>> +						   OMP_MAP_TO, true))
>>   		    continue;
> OpenMP does have a copyin clause, but it is handled below, so this one is ok.
> 
>> @@ -1156,12 +1157,12 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
>>   	      && openacc
>>   	      && gfc_match ("device ( ") == MATCH_YES
>>   	      && gfc_match_omp_map_clause (&c->lists[OMP_LIST_MAP],
>> -					   OMP_MAP_FORCE_TO))
>> +					   OMP_MAP_FORCE_TO, false))
>>   	    continue;
>>   	  if ((mask & OMP_CLAUSE_DEVICEPTR)
>>   	      && gfc_match ("deviceptr ( ") == MATCH_YES
>>   	      && gfc_match_omp_map_clause (&c->lists[OMP_LIST_MAP],
>> -					   OMP_MAP_FORCE_DEVICEPTR))
>> +					   OMP_MAP_FORCE_DEVICEPTR, false))
>>   	    continue;
> Not sure about these, your call.  deviceptr is OpenACC specific clause,
> device is in both, but means something different in OpenMP.  In any case,
> haven't looked if OpenACC allows common blocks in these clauses.

Common block support and the deviceptr changes were originally separate patches.

Also, I think above changes probably could be greatly shortened if a C++ default
argument were used for gfc_match_omp_map_clause().

>> @@ -3718,8 +3719,8 @@ resolve_positive_int_expr (gfc_expr *expr, const char *clause)
>>     if (expr->expr_type == EXPR_CONSTANT
>>         && expr->ts.type == BT_INTEGER
>>         && mpz_sgn (expr->value.integer) <= 0)
>> -    gfc_warning (0, "INTEGER expression of %s clause at %L must be positive",
>> -		 clause, &expr->where);
>> +    gfc_error ("INTEGER expression of %s clause at %L must be positive",
>> +	       clause, &expr->where);
>>   }
> This affects OpenMP too and makes it inconsistent with C/C++.  Why?
> If you need it for OpenACC clauses, then we need two routines.

We'll update this.

>> --- a/gcc/gimplify.c
>> +++ b/gcc/gimplify.c
>> @@ -105,6 +105,9 @@ enum gimplify_omp_var_data
>>     /* Flag for GOVD_MAP: must be present already.  */
>>     GOVD_MAP_FORCE_PRESENT = 524288,
>>   
>> +  /* Flag for OpenACC deviceptrs.  */
>> +  GOVD_DEVICEPTR = (1<<21),
> Please use the same style of constants as in the rest (and, you need
> to adjust anyway for current trunk).

This will be updated too.

Thanks,
Chung-Lin



More information about the Gcc-patches mailing list