[Patch] Fortran: Add 'device_type' clause to OpenMP's declare target

Andre Vehreschild vehre@gmx.de
Tue Aug 18 17:33:49 GMT 2020


Hi Tobias,

I am not deep in OMP dev, i.e., not at all, but this does not make sense to me:

@@ -2397,6 +2401,22 @@ mio_symbol_attribute (symbol_attribute *attr)
 	      == OMP_REQ_ATOMIC_MEM_ORDER_RELAXED)
 	    MIO_NAME (ab_attribute) (AB_OMP_REQ_MEM_ORDER_RELAXED, attr_bits);
 	}
+      switch (attr->omp_device_type)
+	{
+	case OMP_DEVICE_TYPE_UNSET:
+	  break;
+	case OMP_DEVICE_TYPE_HOST:
+	  MIO_NAME (ab_attribute) (AB_OMP_DEVICE_TYPE_NOHOST, attr_bits);
                                                                                                                                            ^
Why also NOHOST here? If this intentional please comment.

+	  break;
+	case OMP_DEVICE_TYPE_NOHOST:
+	  MIO_NAME (ab_attribute) (AB_OMP_DEVICE_TYPE_NOHOST, attr_bits);
+	  break;

<snipp>
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index c6383fc2352..1be5e51b67d 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -426,6 +426,8 @@ build_common_decl (gfc_common_head *com, tree union_type,
bool is_init) /* If there is no backend_decl for the common block, build it.  */
   if (decl == NULL_TREE)
     {
+      tree clauses = NULL_TREE;

Would you mind using "omp_clauses" or the like here?

The reminder looks good to my omp-unexperienced eye.

Regards,
	Andre

On Fri, 7 Aug 2020 17:03:34 +0200
Tobias Burnus <tobias@codesourcery.com> wrote:

> This patch adds the device_type(any|nohost|host)
> clause for 'omp declare target' to Fortran.
> 
> In OpenMP 5.0, it has no effect on variables but
> only on procedures – in TR8 (and later), it also
> affects variables.
> 
> This patch adds this clause to either – except that
> the middle end does not seem to like 'target link'
> with that clause – for normal variables, common
> blocks are accepted. (In line with OpenMP 5, the
> middle end ignores the clause for variables.)
> 
> OK?
> 
> Tobias
> 
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
> Alexander Walter


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 


More information about the Gcc-patches mailing list