public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] openacc id builtin
@ 2015-06-26 12:40 Nathan Sidwell
  2015-07-07 13:31 ` [gomp4] libgomp: Remove C-only XFAILs added in "Tune XFAILs" (was: openacc id builtin) Thomas Schwinge
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2015-06-26 12:40 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

I discovered a latent bug in the openacc thread id builtin and associated 
unspec.  They should not be treated as constant functions, because that causes 
the compiler to consider them constant across threads.  Which of course they are 
not.

Applied to gomp4 branch

nathan

[-- Attachment #2: id.patch --]
[-- Type: text/x-patch, Size: 1898 bytes --]

2015-06-26  Nathan Sidwell  <nathan@codesourcery.com>

	* config/nvptx/nvptx.md (UNSPEC_ID): Rename to ...
	(UNSPECV_ID): ... here.
	(oacc_id): Make volatile.
	* omp-builtins.def (BUILT_IN_GOACC_ID): Not a constant function.

@@ -2802,3 +2809,8 @@ Copyright (C) 2013-2015 Free Software Fo
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
 notice and this notice are preserved.
+
+Local Variables:
+mode: change-log
+change-log-default-name: "ChangeLog.gomp"
+End:
Index: config/nvptx/nvptx.md
===================================================================
--- config/nvptx/nvptx.md	(revision 224987)
+++ config/nvptx/nvptx.md	(working copy)
@@ -50,7 +50,6 @@
    UNSPEC_ALLOCA
 
    UNSPEC_NID
-   UNSPEC_ID
 
    UNSPEC_SHARED_DATA
 ])
@@ -61,6 +60,7 @@
    UNSPECV_XCHG
    UNSPECV_WARP_BCAST
    UNSPECV_BARSYNC
+   UNSPECV_ID
 ])
 
 (define_attr "subregs_ok" "false,true"
@@ -1313,7 +1313,8 @@
 
 (define_insn "oacc_id"
   [(set (match_operand:SI 0 "nvptx_register_operand" "")
-	(unspec:SI [(match_operand:SI 1 "const_int_operand" "")] UNSPEC_ID))]
+	(unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "")]
+			UNSPECV_ID))]
   ""
 {
   static const char *const asms[] =
Index: omp-builtins.def
===================================================================
--- omp-builtins.def	(revision 224987)
+++ omp-builtins.def	(working copy)
@@ -62,7 +62,7 @@ DEF_GOACC_BUILTIN (BUILT_IN_GOACC_WAIT,
 		   BT_FN_VOID_INT_INT_VAR,
 		   ATTR_NOTHROW_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_ID, "GOACC_id",
-		   BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
+		   BT_FN_UINT_UINT, ATTR_NOTHROW_LEAF_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_NID, "GOACC_nid",
 		   BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_GET_GANGLOCAL_PTR, "GOACC_get_ganglocal_ptr",

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gomp4] libgomp: Remove C-only XFAILs added in "Tune XFAILs" (was: openacc id builtin)
  2015-06-26 12:40 [gomp4] openacc id builtin Nathan Sidwell
@ 2015-07-07 13:31 ` Thomas Schwinge
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Schwinge @ 2015-07-07 13:31 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches
  Cc: Julian Brown, Cesar Philippidis, Bernd Schmidt

[-- Attachment #1: Type: text/plain, Size: 11097 bytes --]

Hi!

On Fri, 26 Jun 2015 08:39:41 -0400, Nathan Sidwell <nathan@acm.org> wrote:
> I discovered a latent bug in the openacc thread id builtin and associated 
> unspec.  They should not be treated as constant functions, because that causes 
> the compiler to consider them constant across threads.  Which of course they are 
> not.
> 
> Applied to gomp4 branch

Apparently, your change:

> 	* config/nvptx/nvptx.md (UNSPEC_ID): Rename to ...
> 	(UNSPECV_ID): ... here.
> 	(oacc_id): Make volatile.
> 	* omp-builtins.def (BUILT_IN_GOACC_ID): Not a constant function.

> --- config/nvptx/nvptx.md	(revision 224987)
> +++ config/nvptx/nvptx.md	(working copy)
> @@ -50,7 +50,6 @@
>     UNSPEC_ALLOCA
>  
>     UNSPEC_NID
> -   UNSPEC_ID
>  
>     UNSPEC_SHARED_DATA
>  ])
> @@ -61,6 +60,7 @@
>     UNSPECV_XCHG
>     UNSPECV_WARP_BCAST
>     UNSPECV_BARSYNC
> +   UNSPECV_ID
>  ])
>  
>  (define_attr "subregs_ok" "false,true"
> @@ -1313,7 +1313,8 @@
>  
>  (define_insn "oacc_id"
>    [(set (match_operand:SI 0 "nvptx_register_operand" "")
> -	(unspec:SI [(match_operand:SI 1 "const_int_operand" "")] UNSPEC_ID))]
> +	(unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "")]
> +			UNSPECV_ID))]
>    ""
>  {
>    static const char *const asms[] =

> --- omp-builtins.def	(revision 224987)
> +++ omp-builtins.def	(working copy)
> @@ -62,7 +62,7 @@ DEF_GOACC_BUILTIN (BUILT_IN_GOACC_WAIT,
>  		   BT_FN_VOID_INT_INT_VAR,
>  		   ATTR_NOTHROW_LIST)
>  DEF_GOACC_BUILTIN (BUILT_IN_GOACC_ID, "GOACC_id",
> -		   BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
> +		   BT_FN_UINT_UINT, ATTR_NOTHROW_LEAF_LIST)
>  DEF_GOACC_BUILTIN (BUILT_IN_GOACC_NID, "GOACC_nid",
>  		   BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
>  DEF_GOACC_BUILTIN (BUILT_IN_GOACC_GET_GANGLOCAL_PTR, "GOACC_get_ganglocal_ptr",

... was not just to fix »a latent bug«, but instead I found your changes
to cure the C-only XFAILs that we had applied earlier,
<http://news.gmane.org/find-root.php?message_id=%3C87zj3xccqv.fsf%40kepler.schwinge.homeip.net%3E>,
so I removed the XFAILs in r225515 -- but I have not made an attempt to
understand why C and C++ did behave differently, what's (been) going
on...  :-/

commit 72e6113ce537cdaaf562b579becaada5e91f4fea
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Jul 7 13:27:34 2015 +0000

    libgomp: Remove C-only XFAILs added in "Tune XFAILs"
    
    This removes the C-only XFAILs of r224614, which disappeared as of r225010.
    
    	libgomp/
    	* testsuite/libgomp.oacc-c++/c++.exp (check_effective_target_c):
    	Remove procedure.
    	* testsuite/libgomp.oacc-c/c.exp (check_effective_target_c):
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-1.c:
    	Remove/tune XFAILs.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-2.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-4.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-gang-3.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-2.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-3.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-4.c:
    	Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-3.c:
    	Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@225515 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                              | 21 +++++++++++++++++++++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp          |  4 ----
 .../private-vars-local-worker-1.c                   |  2 --
 .../private-vars-local-worker-2.c                   |  2 --
 .../private-vars-local-worker-4.c                   |  1 -
 .../private-vars-loop-gang-3.c                      |  6 ------
 .../private-vars-loop-worker-2.c                    |  2 --
 .../private-vars-loop-worker-3.c                    |  2 --
 .../private-vars-loop-worker-4.c                    |  2 --
 .../private-vars-par-gang-3.c                       |  2 --
 libgomp/testsuite/libgomp.oacc-c/c.exp              |  4 ----
 11 files changed, 21 insertions(+), 27 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 5f3dfaf..418474d 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,26 @@
 2015-07-07  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* testsuite/libgomp.oacc-c++/c++.exp (check_effective_target_c):
+	Remove procedure.
+	* testsuite/libgomp.oacc-c/c.exp (check_effective_target_c):
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-1.c:
+	Remove/tune XFAILs.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-2.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-4.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-gang-3.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-2.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-3.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-4.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-3.c:
+	Likewise.
+
 	* testsuite/libgomp.oacc-c-c++-common/reduction-4.c:
 	dg-xfail-run-if openacc_nvidia_accel_selected.
 
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 80cb317..60f582b 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -14,10 +14,6 @@ if [info exists lang_include_flags] then {
     unset lang_include_flags
 }
 
-proc check_effective_target_c { } {
-    return 0
-}
-
 # If a testcase doesn't have special options, use these.
 if ![info exists DEFAULT_CFLAGS] then {
     set DEFAULT_CFLAGS "-O2"
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-1.c
index 957f827..67a1518 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-1.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-2.c
index 5bf3e16..0ee87be 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-2.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-4.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-4.c
index 118dae8..4cec00e 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-4.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-worker-4.c
@@ -1,4 +1,3 @@
-/* { dg-xfail-if "TODO" { c } } */
 /* { dg-xfail-run-if "TODO" { openacc_nvidia_accel_selected } { "*" } { "" } } */
 
 #include <assert.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-gang-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-gang-3.c
index bc96f0d..0a77869 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-gang-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-gang-3.c
@@ -1,9 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-/* Fails as of gomp-4_0-branch r224586, but for C only:
-
-   private-vars-loop-gang-3.exe: [...]/private-vars-loop-gang-3.c:28: main: Assertion `arr[i] == i + (i / 32) * 2' failed.
-*/
-
 #include <assert.h>
 
 /* Test of gang-private variables declared on loop directive, with broadcasting
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-2.c
index a5f16d8..3227700 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-2.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-3.c
index 5c75f4d..65d5d4f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-3.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-4.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-4.c
index f0d1309..42a12b2 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-4.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-loop-worker-4.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-3.c
index c580d68..e5cd6fa 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-3.c
@@ -1,5 +1,3 @@
-/* { dg-xfail-run-if "TODO" { c && openacc_nvidia_accel_selected } { "*" } { "" } } */
-
 #include <assert.h>
 
 /* Test of gang-private array variable declared on the parallel directive.  */
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 15e8f81..8d54815 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -19,10 +19,6 @@ if ![info exists DEFAULT_CFLAGS] then {
     set DEFAULT_CFLAGS "-O2"
 }
 
-proc check_effective_target_c { } {
-    return 1
-}
-
 # Initialize dg.
 dg-init
 


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-07 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 12:40 [gomp4] openacc id builtin Nathan Sidwell
2015-07-07 13:31 ` [gomp4] libgomp: Remove C-only XFAILs added in "Tune XFAILs" (was: openacc id builtin) Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).