Define 'OMP_REQUIRES_[...]', 'GOMP_REQUIRES_[...]' in a single place (was: [Patch] OpenMP: Move omp requires checks to libgomp)

Message ID 87wncq4joo.fsf@euler.schwinge.homeip.net
State Committed
Headers
Series Define 'OMP_REQUIRES_[...]', 'GOMP_REQUIRES_[...]' in a single place (was: [Patch] OpenMP: Move omp requires checks to libgomp) |

Commit Message

Thomas Schwinge July 6, 2022, 10:30 a.m. UTC
  Hi!

On 2022-06-08T05:56:02+0200, Tobias Burnus <Tobias_Burnus@mentor.com> wrote:
> This is based on Chung-Lin's patch at https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563393.html

> --- a/include/gomp-constants.h
> +++ b/include/gomp-constants.h

> +/* Flag values for requires-directive features, must match corresponding
> +   OMP_REQUIRES_* values in gcc/omp-general.h.  */
> +#define GOMP_REQUIRES_UNIFIED_ADDRESS       0x10
> +#define GOMP_REQUIRES_UNIFIED_SHARED_MEMORY 0x20
> +#define GOMP_REQUIRES_REVERSE_OFFLOAD       0x80

To make things more failure proof, OK to push the attached
"Define 'OMP_REQUIRES_[...]', 'GOMP_REQUIRES_[...]' in a single place"?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Comments

Tobias Burnus July 6, 2022, 1:40 p.m. UTC | #1
Hi Thomas,

On 06.07.22 12:30, Thomas Schwinge wrote:
> On 2022-06-08T05:56:02+0200, Tobias Burnus <Tobias_Burnus@mentor.com>
> wrote:
>> [..]
> To make things more failure proof, OK to push the attached
> "Define 'OMP_REQUIRES_[...]', 'GOMP_REQUIRES_[...]' in a single place"?

I concur that it makes sense to avoid having multiple definitions,
especially as I can imagine that we might want to use this flag to
pass other options to the library - e.g. some of the command-line
pinning flags, proposed (and used in the OG11/OG12 branch).

Thus, the following is ok/makes sense from my point of view.

> diff --git a/gcc/omp-general.h b/gcc/omp-general.h
> index 7a94831e8f5..74e90e1a71a 100644
> --- a/gcc/omp-general.h
> +++ b/gcc/omp-general.h
> @@ -126,12 +126,12 @@ extern int oacc_get_ifn_dim_arg (const gimple *stmt);
>
>   enum omp_requires {
>     OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER = 0xf,
> -  OMP_REQUIRES_UNIFIED_ADDRESS = 0x10,
> -  OMP_REQUIRES_UNIFIED_SHARED_MEMORY = 0x20,
> +  OMP_REQUIRES_UNIFIED_ADDRESS = GOMP_REQUIRES_UNIFIED_ADDRESS,
> +  OMP_REQUIRES_UNIFIED_SHARED_MEMORY = GOMP_REQUIRES_UNIFIED_SHARED_MEMORY,
>     OMP_REQUIRES_DYNAMIC_ALLOCATORS = 0x40,
> -  OMP_REQUIRES_REVERSE_OFFLOAD = 0x80,
> +  OMP_REQUIRES_REVERSE_OFFLOAD = GOMP_REQUIRES_REVERSE_OFFLOAD,
>     OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER_USED = 0x100,
> -  OMP_REQUIRES_TARGET_USED = 0x200
> +  OMP_REQUIRES_TARGET_USED = GOMP_REQUIRES_TARGET_USED,
>   };
>
>   extern GTY(()) enum omp_requires omp_requires_mask;
> diff --git a/include/gomp-constants.h b/include/gomp-constants.h
> index 3e3078f082e..84316f953d0 100644
> --- a/include/gomp-constants.h
> +++ b/include/gomp-constants.h
> @@ -341,8 +341,7 @@ enum gomp_map_kind
>   #define GOMP_DEPEND_MUTEXINOUTSET   4
>   #define GOMP_DEPEND_INOUTSET                5
>
> -/* Flag values for requires-directive features, must match corresponding
> -   OMP_REQUIRES_* values in gcc/omp-general.h.  */
> +/* Flag values for OpenMP 'requires' directive features.  */
>   #define GOMP_REQUIRES_UNIFIED_ADDRESS       0x10
>   #define GOMP_REQUIRES_UNIFIED_SHARED_MEMORY 0x20
>   #define GOMP_REQUIRES_REVERSE_OFFLOAD       0x80
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Patch

From bd1aa5bc96e141a85bb53d61a5c7531e09ea3cf6 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 5 Jul 2022 11:04:46 +0200
Subject: [PATCH] Define 'OMP_REQUIRES_[...]', 'GOMP_REQUIRES_[...]' in a
 single place

Clean up for recent commit 683f11843974f0bdf42f79cdcbb0c2b43c7b81b0
"OpenMP: Move omp requires checks to libgomp".

	gcc/
	* omp-general.h (enum omp_requires): Use 'GOMP_REQUIRES_[...]'.
	include/
	* gomp-constants.h (OMP_REQUIRES_[...]): Update comment.
---
 gcc/omp-general.h        | 8 ++++----
 include/gomp-constants.h | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gcc/omp-general.h b/gcc/omp-general.h
index 7a94831e8f5..74e90e1a71a 100644
--- a/gcc/omp-general.h
+++ b/gcc/omp-general.h
@@ -126,12 +126,12 @@  extern int oacc_get_ifn_dim_arg (const gimple *stmt);
 
 enum omp_requires {
   OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER = 0xf,
-  OMP_REQUIRES_UNIFIED_ADDRESS = 0x10,
-  OMP_REQUIRES_UNIFIED_SHARED_MEMORY = 0x20,
+  OMP_REQUIRES_UNIFIED_ADDRESS = GOMP_REQUIRES_UNIFIED_ADDRESS,
+  OMP_REQUIRES_UNIFIED_SHARED_MEMORY = GOMP_REQUIRES_UNIFIED_SHARED_MEMORY,
   OMP_REQUIRES_DYNAMIC_ALLOCATORS = 0x40,
-  OMP_REQUIRES_REVERSE_OFFLOAD = 0x80,
+  OMP_REQUIRES_REVERSE_OFFLOAD = GOMP_REQUIRES_REVERSE_OFFLOAD,
   OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER_USED = 0x100,
-  OMP_REQUIRES_TARGET_USED = 0x200
+  OMP_REQUIRES_TARGET_USED = GOMP_REQUIRES_TARGET_USED,
 };
 
 extern GTY(()) enum omp_requires omp_requires_mask;
diff --git a/include/gomp-constants.h b/include/gomp-constants.h
index 3e3078f082e..84316f953d0 100644
--- a/include/gomp-constants.h
+++ b/include/gomp-constants.h
@@ -341,8 +341,7 @@  enum gomp_map_kind
 #define GOMP_DEPEND_MUTEXINOUTSET	4
 #define GOMP_DEPEND_INOUTSET		5
 
-/* Flag values for requires-directive features, must match corresponding
-   OMP_REQUIRES_* values in gcc/omp-general.h.  */
+/* Flag values for OpenMP 'requires' directive features.  */
 #define GOMP_REQUIRES_UNIFIED_ADDRESS       0x10
 #define GOMP_REQUIRES_UNIFIED_SHARED_MEMORY 0x20
 #define GOMP_REQUIRES_REVERSE_OFFLOAD       0x80
-- 
2.35.1