diff mbox series

[openmp] Fix openmp 5.0 builtin function types

Message ID 7637b38b-4107-08f3-9037-9a34a92b8e69@suse.de
State New
Headers show
Series [openmp] Fix openmp 5.0 builtin function types | expand

Commit Message

Tom de Vries Dec. 12, 2018, 8:25 a.m. UTC
[ was: Re: [committed 1a/4] (Partial) OpenMP 5.0 support for GCC 9 (gcc
middle-end) ]

On 08-11-18 18:24, Jakub Jelinek wrote:
> 	* omp-builtins.def (BUILT_IN_GOMP_TASKWAIT_DEPEND,
> 	BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_START, BUILT_IN_GOMP_LOOP_ORDERED_START,
> 	BUILT_IN_GOMP_LOOP_DOACROSS_START,
> 	BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT,
> 	BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
> 	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_ULL_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_START,
> 	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_START,
> 	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT,
> 	BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
> 	BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
> 	BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
> 	BUILT_IN_GOMP_PARALLEL_REDUCTIONS, BUILT_IN_GOMP_SECTIONS2_START,
> 	BUILT_IN_GOMP_TEAMS_REG, BUILT_IN_GOMP_TASKGROUP_REDUCTION_REGISTER,
> 	BUILT_IN_GOMP_TASKGROUP_REDUCTION_UNREGISTER,
> 	BUILT_IN_GOMP_TASK_REDUCTION_REMAP,
> 	BUILT_IN_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER): New builtins.

Hi,

OK for trunk?

Thanks,
- Tom

Comments

Jakub Jelinek Dec. 12, 2018, 9:27 a.m. UTC | #1
On Wed, Dec 12, 2018 at 09:25:06AM +0100, Tom de Vries wrote:
> [openmp] Fix openmp 5.0 builtin function types
> 
> Fix some openmp 5.0 builtin functions to match the type used in the
> implementation of those functions.
> 
> This fixes some libgomp testsuite failures for x86_64 with nvptx accelerator.
> 
> Build on x86_64 with nvptx accelerator, tested libgomp.
> 
> 2018-12-12  Tom de Vries  <tdevries@suse.de>
> 
> 	* omp-builtins.def
> 	(BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START)
> 	(BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START)
> 	(BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): Fix
> 	function type.

Good catch, but it looks insufficient, the builtins without _maybe have the
same bug (copy and paste from the preceding dynamic/guided calls that do
have that extra argument - chunk_size), so if you've caught only these,
it seems we have insufficient testsuite covergate in the target regions.

Does the following testcase show also the remaining three bugs on unpatched
nvptx offloading (sorry, don't have nvptx offloading set up right now,
should fix that soon)?

2018-12-12  Tom de Vries  <tdevries@suse.de>
	    Jakub Jelinek  <jakub@redhat.com>

	* omp-builtins.def (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
	BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): Fix up
	function types - remove one argument.

	* testsuite/libgomp.c-c++-common/for-16.c: New test.

--- gcc/omp-builtins.def.jj	2018-11-08 18:07:56.345070635 +0100
+++ gcc/omp-builtins.def	2018-12-12 10:03:14.355354282 +0100
@@ -126,11 +126,11 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NON
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
 		  "GOMP_loop_nonmonotonic_runtime_start",
-		  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+		  BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
 		  "GOMP_loop_maybe_nonmonotonic_runtime_start",
-		  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+		  BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
 		  "GOMP_loop_ordered_static_start",
@@ -234,11 +234,11 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
 		  "GOMP_loop_ull_nonmonotonic_runtime_start",
-		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
+		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
 		  "GOMP_loop_ull_maybe_nonmonotonic_runtime_start",
-		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
+		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START,
 		  "GOMP_loop_ull_ordered_static_start",
@@ -349,11 +349,11 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL
 		  ATTR_NOTHROW_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
 		  "GOMP_parallel_loop_nonmonotonic_runtime",
-		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
+		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
 		  ATTR_NOTHROW_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
 		  "GOMP_parallel_loop_maybe_nonmonotonic_runtime",
-		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
+		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
 		  ATTR_NOTHROW_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END, "GOMP_loop_end",
 		  BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
--- libgomp/testsuite/libgomp.c-c++-common/for-16.c.jj	2018-12-12 10:19:50.640074341 +0100
+++ libgomp/testsuite/libgomp.c-c++-common/for-16.c	2018-12-12 10:19:22.100540708 +0100
@@ -0,0 +1,114 @@
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+unsigned long long int k = 16;
+#pragma omp declare target to (k)
+
+int
+main ()
+{
+  unsigned char a[144], b[144], c[144];
+  int l;
+  #pragma omp target map(from:a, b, c)
+  {
+    int i;
+    unsigned long long int j;
+    #pragma omp parallel for schedule (runtime)
+    for (i = 0; i < 16; i++)
+      a[i] = i;
+    #pragma omp parallel for schedule (monotonic: runtime)
+    for (i = 0; i < 16; i++)
+      a[i + 16] = i + 16;
+    #pragma omp parallel for schedule (nonmonotonic: runtime)
+    for (i = 0; i < 16; i++)
+      a[i + 32] = i + 32;
+    #pragma omp parallel
+    {
+      #pragma omp for schedule (runtime)
+      for (i = 0; i < 16; i++)
+        a[i + 48] = i + 48;
+      #pragma omp for schedule (monotonic: runtime)
+      for (i = 0; i < 16; i++)
+        a[i + 64] = i + 64;
+      #pragma omp for schedule (nonmonotonic: runtime)
+      for (i = 0; i < 16; i++)
+        a[i + 80] = i + 80;
+      #pragma omp for schedule (runtime)
+      for (j = 0; j < k; j++)
+        a[j + 96] = j + 96;
+      #pragma omp for schedule (monotonic: runtime)
+      for (j = 0; j < k; j++)
+        a[j + 112] = j + 112;
+      #pragma omp for schedule (nonmonotonic: runtime)
+      for (j = 0; j < k; j++)
+        a[j + 128] = j + 128;
+    }
+    #pragma omp parallel for schedule (dynamic)
+    for (i = 0; i < 16; i++)
+      b[i] = i;
+    #pragma omp parallel for schedule (monotonic: dynamic)
+    for (i = 0; i < 16; i++)
+      b[i + 16] = i + 16;
+    #pragma omp parallel for schedule (nonmonotonic: dynamic)
+    for (i = 0; i < 16; i++)
+      b[i + 32] = i + 32;
+    #pragma omp parallel
+    {
+      #pragma omp for schedule (dynamic)
+      for (i = 0; i < 16; i++)
+        b[i + 48] = i + 48;
+      #pragma omp for schedule (monotonic: dynamic)
+      for (i = 0; i < 16; i++)
+        b[i + 64] = i + 64;
+      #pragma omp for schedule (nonmonotonic: dynamic)
+      for (i = 0; i < 16; i++)
+        b[i + 80] = i + 80;
+      #pragma omp for schedule (dynamic)
+      for (j = 0; j < k; j++)
+        b[j + 96] = j + 96;
+      #pragma omp for schedule (monotonic: dynamic)
+      for (j = 0; j < k; j++)
+        b[j + 112] = j + 112;
+      #pragma omp for schedule (nonmonotonic: dynamic)
+      for (j = 0; j < k; j++)
+        b[j + 128] = j + 128;
+    }
+    #pragma omp parallel for schedule (guided)
+    for (i = 0; i < 16; i++)
+      c[i] = i;
+    #pragma omp parallel for schedule (monotonic: guided)
+    for (i = 0; i < 16; i++)
+      c[i + 16] = i + 16;
+    #pragma omp parallel for schedule (nonmonotonic: guided)
+    for (i = 0; i < 16; i++)
+      c[i + 32] = i + 32;
+    #pragma omp parallel
+    {
+      #pragma omp for schedule (guided)
+      for (i = 0; i < 16; i++)
+        c[i + 48] = i + 48;
+      #pragma omp for schedule (monotonic: guided)
+      for (i = 0; i < 16; i++)
+        c[i + 64] = i + 64;
+      #pragma omp for schedule (nonmonotonic: guided)
+      for (i = 0; i < 16; i++)
+        c[i + 80] = i + 80;
+      #pragma omp for schedule (guided)
+      for (j = 0; j < k; j++)
+        c[j + 96] = j + 96;
+      #pragma omp for schedule (monotonic: guided)
+      for (j = 0; j < k; j++)
+        c[j + 112] = j + 112;
+      #pragma omp for schedule (nonmonotonic: guided)
+      for (j = 0; j < k; j++)
+        c[j + 128] = j + 128;
+    }
+  }
+  for (l = 0; l < 144; ++l)
+    if (a[l] != l || b[l] != l || c[l] != l)
+      abort ();
+  return 0;
+}


	Jakub
Tom de Vries Dec. 12, 2018, 10:22 a.m. UTC | #2
On 12-12-18 10:27, Jakub Jelinek wrote:
> On Wed, Dec 12, 2018 at 09:25:06AM +0100, Tom de Vries wrote:
>> [openmp] Fix openmp 5.0 builtin function types
>>
>> Fix some openmp 5.0 builtin functions to match the type used in the
>> implementation of those functions.
>>
>> This fixes some libgomp testsuite failures for x86_64 with nvptx accelerator.
>>
>> Build on x86_64 with nvptx accelerator, tested libgomp.
>>
>> 2018-12-12  Tom de Vries  <tdevries@suse.de>
>>
>> 	* omp-builtins.def
>> 	(BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START)
>> 	(BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START)
>> 	(BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): Fix
>> 	function type.
> 
> Good catch, but it looks insufficient, the builtins without _maybe have the
> same bug (copy and paste from the preceding dynamic/guided calls that do
> have that extra argument - chunk_size), so if you've caught only these,
> it seems we have insufficient testsuite covergate in the target regions.
> 
> Does the following testcase show also the remaining three bugs on unpatched
> nvptx offloading 

It does, I get "Call has wrong number of parameters" errors for these 3
mismatches:
...
.extern .func (.param .u32 %value_out)
GOMP_loop_nonmonotonic_runtime_start (.param .u64 %in_ar0, .param .u64
%in_ar1, .param .u64 %in_ar2, .param .u64 %in_ar3, .param .u64 %in_ar4,
.param .u64 %in_ar5);

call
(%value_in),GOMP_loop_nonmonotonic_runtime_start,(%out_arg1,%out_arg2,%out_arg3,%out_arg4,%out_arg5);

.extern .func (.param .u32 %value_out)
GOMP_loop_ull_nonmonotonic_runtime_start (.param .u32 %in_ar0, .param
.u64 %in_ar1, .param .u64 %in_ar2, .param .u64 %in_ar3, .param .u64
%in_ar4, .param .u64 %in_ar5, .param .u64 %in_ar6);

call
(%value_in),GOMP_loop_ull_nonmonotonic_runtime_start,(%out_arg1,%out_arg2,%out_arg3,%out_arg4,%out_arg5,%out_arg6);

.extern .func GOMP_parallel_loop_nonmonotonic_runtime (.param .u64
%in_ar0, .param .u64 %in_ar1, .param .u32 %in_ar2, .param .u64 %in_ar3,
.param .u64 %in_ar4, .param .u64 %in_ar5, .param .u64 %in_ar6, .param
.u32 %in_ar7);

call
GOMP_parallel_loop_nonmonotonic_runtime,(%out_arg1,%out_arg2,%out_arg3,%out_arg4,%out_arg5,%out_arg6,%out_arg7);
...

and after rebuilding the test passes.

> (sorry, don't have nvptx offloading set up right now,
> should fix that soon)?
> 

Np.

Thanks,
- Tom


> 2018-12-12  Tom de Vries  <tdevries@suse.de>
> 	    Jakub Jelinek  <jakub@redhat.com>
> 
> 	* omp-builtins.def (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
> 	BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
> 	BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): Fix up
> 	function types - remove one argument.
> 
> 	* testsuite/libgomp.c-c++-common/for-16.c: New test.
> 
> --- gcc/omp-builtins.def.jj	2018-11-08 18:07:56.345070635 +0100
> +++ gcc/omp-builtins.def	2018-12-12 10:03:14.355354282 +0100
> @@ -126,11 +126,11 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NON
>  		  ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
>  		  "GOMP_loop_nonmonotonic_runtime_start",
> -		  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
> +		  BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
>  		  ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
>  		  "GOMP_loop_maybe_nonmonotonic_runtime_start",
> -		  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
> +		  BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
>  		  ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
>  		  "GOMP_loop_ordered_static_start",
> @@ -234,11 +234,11 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL
>  		  ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
>  		  "GOMP_loop_ull_nonmonotonic_runtime_start",
> -		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
> +		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
>  		  ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
>  		  "GOMP_loop_ull_maybe_nonmonotonic_runtime_start",
> -		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
> +		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
>  		  ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START,
>  		  "GOMP_loop_ull_ordered_static_start",
> @@ -349,11 +349,11 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL
>  		  ATTR_NOTHROW_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
>  		  "GOMP_parallel_loop_nonmonotonic_runtime",
> -		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
> +		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
>  		  ATTR_NOTHROW_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
>  		  "GOMP_parallel_loop_maybe_nonmonotonic_runtime",
> -		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
> +		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
>  		  ATTR_NOTHROW_LIST)
>  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END, "GOMP_loop_end",
>  		  BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
> --- libgomp/testsuite/libgomp.c-c++-common/for-16.c.jj	2018-12-12 10:19:50.640074341 +0100
> +++ libgomp/testsuite/libgomp.c-c++-common/for-16.c	2018-12-12 10:19:22.100540708 +0100
> @@ -0,0 +1,114 @@
> +extern
> +#ifdef __cplusplus
> +"C"
> +#endif
> +void abort (void);
> +
> +unsigned long long int k = 16;
> +#pragma omp declare target to (k)
> +
> +int
> +main ()
> +{
> +  unsigned char a[144], b[144], c[144];
> +  int l;
> +  #pragma omp target map(from:a, b, c)
> +  {
> +    int i;
> +    unsigned long long int j;
> +    #pragma omp parallel for schedule (runtime)
> +    for (i = 0; i < 16; i++)
> +      a[i] = i;
> +    #pragma omp parallel for schedule (monotonic: runtime)
> +    for (i = 0; i < 16; i++)
> +      a[i + 16] = i + 16;
> +    #pragma omp parallel for schedule (nonmonotonic: runtime)
> +    for (i = 0; i < 16; i++)
> +      a[i + 32] = i + 32;
> +    #pragma omp parallel
> +    {
> +      #pragma omp for schedule (runtime)
> +      for (i = 0; i < 16; i++)
> +        a[i + 48] = i + 48;
> +      #pragma omp for schedule (monotonic: runtime)
> +      for (i = 0; i < 16; i++)
> +        a[i + 64] = i + 64;
> +      #pragma omp for schedule (nonmonotonic: runtime)
> +      for (i = 0; i < 16; i++)
> +        a[i + 80] = i + 80;
> +      #pragma omp for schedule (runtime)
> +      for (j = 0; j < k; j++)
> +        a[j + 96] = j + 96;
> +      #pragma omp for schedule (monotonic: runtime)
> +      for (j = 0; j < k; j++)
> +        a[j + 112] = j + 112;
> +      #pragma omp for schedule (nonmonotonic: runtime)
> +      for (j = 0; j < k; j++)
> +        a[j + 128] = j + 128;
> +    }
> +    #pragma omp parallel for schedule (dynamic)
> +    for (i = 0; i < 16; i++)
> +      b[i] = i;
> +    #pragma omp parallel for schedule (monotonic: dynamic)
> +    for (i = 0; i < 16; i++)
> +      b[i + 16] = i + 16;
> +    #pragma omp parallel for schedule (nonmonotonic: dynamic)
> +    for (i = 0; i < 16; i++)
> +      b[i + 32] = i + 32;
> +    #pragma omp parallel
> +    {
> +      #pragma omp for schedule (dynamic)
> +      for (i = 0; i < 16; i++)
> +        b[i + 48] = i + 48;
> +      #pragma omp for schedule (monotonic: dynamic)
> +      for (i = 0; i < 16; i++)
> +        b[i + 64] = i + 64;
> +      #pragma omp for schedule (nonmonotonic: dynamic)
> +      for (i = 0; i < 16; i++)
> +        b[i + 80] = i + 80;
> +      #pragma omp for schedule (dynamic)
> +      for (j = 0; j < k; j++)
> +        b[j + 96] = j + 96;
> +      #pragma omp for schedule (monotonic: dynamic)
> +      for (j = 0; j < k; j++)
> +        b[j + 112] = j + 112;
> +      #pragma omp for schedule (nonmonotonic: dynamic)
> +      for (j = 0; j < k; j++)
> +        b[j + 128] = j + 128;
> +    }
> +    #pragma omp parallel for schedule (guided)
> +    for (i = 0; i < 16; i++)
> +      c[i] = i;
> +    #pragma omp parallel for schedule (monotonic: guided)
> +    for (i = 0; i < 16; i++)
> +      c[i + 16] = i + 16;
> +    #pragma omp parallel for schedule (nonmonotonic: guided)
> +    for (i = 0; i < 16; i++)
> +      c[i + 32] = i + 32;
> +    #pragma omp parallel
> +    {
> +      #pragma omp for schedule (guided)
> +      for (i = 0; i < 16; i++)
> +        c[i + 48] = i + 48;
> +      #pragma omp for schedule (monotonic: guided)
> +      for (i = 0; i < 16; i++)
> +        c[i + 64] = i + 64;
> +      #pragma omp for schedule (nonmonotonic: guided)
> +      for (i = 0; i < 16; i++)
> +        c[i + 80] = i + 80;
> +      #pragma omp for schedule (guided)
> +      for (j = 0; j < k; j++)
> +        c[j + 96] = j + 96;
> +      #pragma omp for schedule (monotonic: guided)
> +      for (j = 0; j < k; j++)
> +        c[j + 112] = j + 112;
> +      #pragma omp for schedule (nonmonotonic: guided)
> +      for (j = 0; j < k; j++)
> +        c[j + 128] = j + 128;
> +    }
> +  }
> +  for (l = 0; l < 144; ++l)
> +    if (a[l] != l || b[l] != l || c[l] != l)
> +      abort ();
> +  return 0;
> +}
> 
> 
> 	Jakub
>
Jakub Jelinek Dec. 12, 2018, 10:33 a.m. UTC | #3
On Wed, Dec 12, 2018 at 11:22:22AM +0100, Tom de Vries wrote:
> .extern .func GOMP_parallel_loop_nonmonotonic_runtime (.param .u64
> %in_ar0, .param .u64 %in_ar1, .param .u32 %in_ar2, .param .u64 %in_ar3,
> .param .u64 %in_ar4, .param .u64 %in_ar5, .param .u64 %in_ar6, .param
> .u32 %in_ar7);
> 
> call
> GOMP_parallel_loop_nonmonotonic_runtime,(%out_arg1,%out_arg2,%out_arg3,%out_arg4,%out_arg5,%out_arg6,%out_arg7);
> ...
> 
> and after rebuilding the test passes.

Thanks for testing.  I'll commit it after bootstrap/regtest tonight,
perhaps I'll try to add further testsuite coverage later on to verify
all other OpenMP builtins are covered in target regions.

	Jakub
diff mbox series

Patch

[openmp] Fix openmp 5.0 builtin function types

Fix some openmp 5.0 builtin functions to match the type used in the
implementation of those functions.

This fixes some libgomp testsuite failures for x86_64 with nvptx accelerator.

Build on x86_64 with nvptx accelerator, tested libgomp.

2018-12-12  Tom de Vries  <tdevries@suse.de>

	* omp-builtins.def
	(BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START)
	(BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START)
	(BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): Fix
	function type.

---
 gcc/omp-builtins.def | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/omp-builtins.def b/gcc/omp-builtins.def
index 70051635fa0..6e22065461a 100644
--- a/gcc/omp-builtins.def
+++ b/gcc/omp-builtins.def
@@ -130,7 +130,7 @@  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
 		  "GOMP_loop_maybe_nonmonotonic_runtime_start",
-		  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+		  BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
 		  "GOMP_loop_ordered_static_start",
@@ -238,7 +238,7 @@  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
 		  "GOMP_loop_ull_maybe_nonmonotonic_runtime_start",
-		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
+		  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULLPTR_ULLPTR,
 		  ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START,
 		  "GOMP_loop_ull_ordered_static_start",
@@ -353,7 +353,7 @@  DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
 		  ATTR_NOTHROW_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
 		  "GOMP_parallel_loop_maybe_nonmonotonic_runtime",
-		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
+		  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
 		  ATTR_NOTHROW_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END, "GOMP_loop_end",
 		  BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)