Re: [Gc] [PATCH] Implement the basic atomic primitives for the tilegx/tilepro cpus.

Chris Metcalf <cmetcalf-VPRAkNaXOzVWk0Htik3J/[email protected]> Mon, 2 May 2016 18:48:29 -0400
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <[email protected]>
--===============0843897165==
Content-Type: multipart/alternative;
	boundary="------------69C6305304801B7DA149E995"

--------------69C6305304801B7DA149E995
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: 7bit

I tested with gcc 4.4 and 4.8.  My rationale for including the earlier compiler is that it is the shipped compiler with CentOS 6, which we currently support.

On 5/2/2016 6:42 PM, Ivan Maidanski wrote:
> Hello,
>
> Which gcc/clang have you tested with?
> Can we remove everything except include generic.h from tile.h?
>
> Regards,
> Ivan
>
>
>     Mon, 2 May 2016, 18:41 +03:00 from Chris Metcalf <cmetcalf-VPRAkNaXOzVWk0Htik3J/[email protected]>:
>
>     * src/Makefile.am (nobase_private_HEADERS): Add tile.h.
>     * src/atomic_ops.h: Include tile.h file.
>     * src/atomic_ops/sysdeps/gcc/tile.h: New file.
>     ---
>     For libatomic_ops:
>
>     This patch is an updated version of the CentOS 6 patch that we have
>     been carrying as part of our own CentOS-like distribution since 2012.
>
>      src/Makefile.am | 1 +
>      src/atomic_ops.h | 3 ++
>      src/atomic_ops/sysdeps/gcc/tile.h | 52 +++++++++++++++++++++++++++++++++++++
>      3 files changed, 56 insertions(+), 0 deletions(-)
>      create mode 100644 src/atomic_ops/sysdeps/gcc/tile.h
>
>     diff --git a/src/Makefile.am b/src/Makefile.am
>     index d463427..8971370 100644
>     --- a/src/Makefile.am
>     +++ b/src/Makefile.am
>     @@ -84,6 +84,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
>                atomic_ops/sysdeps/gcc/s390.h \
>                atomic_ops/sysdeps/gcc/sh.h \
>                atomic_ops/sysdeps/gcc/sparc.h \
>     + atomic_ops/sysdeps/gcc/tile.h \
>                atomic_ops/sysdeps/gcc/x86.h \
>              \
>                atomic_ops/sysdeps/hpc/hppa.h \
>     diff --git a/src/atomic_ops.h b/src/atomic_ops.h
>     index ec02ba4..59f04ef 100644
>     --- a/src/atomic_ops.h
>     +++ b/src/atomic_ops.h
>     @@ -294,6 +294,9 @@
>      # if defined(__hexagon__)
>      # include "atomic_ops/sysdeps/gcc/hexagon.h"
>      # endif
>     +# if defined(__tile__)
>     +# include "atomic_ops/sysdeps/gcc/tile.h"
>     +# endif /* __tile__ */
>      #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
>
>      #if (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(__GNUC__) \
>     diff --git a/src/atomic_ops/sysdeps/gcc/tile.h b/src/atomic_ops/sysdeps/gcc/tile.h
>     new file mode 100644
>     index 0000000..28dc083
>     --- /dev/null
>     +++ b/src/atomic_ops/sysdeps/gcc/tile.h
>     @@ -0,0 +1,52 @@
>     +/*
>     + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
>     + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
>     + *
>     + * Permission is hereby granted to use or copy this program
>     + * for any purpose, provided the above notices are retained on all copies.
>     + * Permission to modify the code and to distribute modified code is granted,
>     + * provided the above notices are retained, and a notice that the code was
>     + * modified is included with the above copyright notice.
>     + */
>     +
>     +/* Minimal support for tile. */
>     +
>     +#if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) \
>     + || __clang_major__ > 3 \
>     + || (__clang_major__ == 3 && __clang_minor__ >= 4)) \
>     + && !defined(AO_DISABLE_GCC_ATOMICS))
>     +
>     +# include "generic.h"
>     +
>     +#else /* AO_DISABLE_GCC_ATOMICS */
>     +
>     +#include "../all_atomic_load_store.h"
>     +
>     +#include "../test_and_set_t_is_ao_t.h"
>     +
>     +
>     +AO_INLINE void
>     +AO_nop_full()
>     +{
>     + __sync_synchronize();
>     +}
>     +#define AO_HAVE_nop_full
>     +
>     +
>     +AO_INLINE AO_t
>     +AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
>     +{
>     + return __sync_fetch_and_add(p, incr);
>     +}
>     +#define AO_HAVE_fetch_and_add_full
>     +
>     +
>     +AO_INLINE int
>     +AO_compare_and_swap_full(volatile AO_t *addr,
>     + AO_t old, AO_t new_val)
>     +{
>     + return __sync_val_compare_and_swap(addr, old, new_val) == old;
>     +}
>     +#define AO_HAVE_compare_and_swap_full
>     +
>     +#endif
>     -- 
>     1.7.1
>     _______________________________________________
>     bdwgc mailing list
>     [email protected] <mailto:[email protected]>
>     https://lists.opendylan.org/mailman/listinfo/bdwgc
>
>

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com


--------------69C6305304801B7DA149E995
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Ty=
pe">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p>I tested with gcc 4.4 and 4.8.=C2=A0 My rationale for including th=
e
      earlier compiler is that it is the shipped compiler with CentOS 6,
      which we currently support.<br>
    </p>
    On 5/2/2016 6:42 PM, Ivan Maidanski wrote:<br>
    <blockquote cite=3D"mid:[email protected]"
      type=3D"cite">
      <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Du=
tf-8">
      Hello,<br>
      <br>
      Which gcc/clang have you tested with?<br>
      Can we remove everything except include generic.h=C2=A0from tile.h?=
<br>
      <br>
      Regards,<br>
      Ivan<br>
      <br>
      <br>
      <blockquote style=3D"border-left:1px solid #0857A6; margin:10px;
        padding:0 0 0 10px;"> Mon, 2 May 2016, 18:41 +03:00 from Chris
        Metcalf <a class=3D"moz-txt-link-rfc2396E" href=3D"mailto:cmetcal=
[email protected]">&lt;cmetcalf-VPRAkNaXOzVWk0Htik3J/[email protected]&gt;</a>:<br>
        <br>
        <div id=3D"">
          <div class=3D"js-helper js-readmsg-msg">
            <style type=3D"text/css"></style>
            <div> <base target=3D"_self" href=3D"https://e.mail.ru/">
              <div id=3D"style_14622057490000000708_BODY">*
                src/Makefile.am (nobase_private_HEADERS): Add tile.h.<br>
                * src/atomic_ops.h: Include tile.h file.<br>
                * src/atomic_ops/sysdeps/gcc/tile.h: New file.<br>
                ---<br>
                For libatomic_ops:<br>
                <br>
                This patch is an updated version of the CentOS 6 patch
                that we have<br>
                been carrying as part of our own CentOS-like
                distribution since 2012.<br>
                <br>
                =C2=A0src/Makefile.am | 1 +<br>
                =C2=A0src/atomic_ops.h | 3 ++<br>
                =C2=A0src/atomic_ops/sysdeps/gcc/tile.h | 52
                +++++++++++++++++++++++++++++++++++++<br>
                =C2=A03 files changed, 56 insertions(+), 0 deletions(-)<b=
r>
                =C2=A0create mode 100644 src/atomic_ops/sysdeps/gcc/tile.=
h<br>
                <br>
                diff --git a/src/Makefile.am b/src/Makefile.am<br>
                index d463427..8971370 100644<br>
                --- a/src/Makefile.am<br>
                +++ b/src/Makefile.am<br>
                @@ -84,6 +84,7 @@ nobase_private_HEADERS =3D
                atomic_ops/ao_version.h \<br>
                =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0atomic_ops/sysdeps/gcc/s390.h \<br>
                =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0atomic_ops/sysdeps/gcc/sh.h \<br>
                =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0atomic_ops/sysdeps/gcc/sparc.h \<br>
                + atomic_ops/sysdeps/gcc/tile.h \<br>
                =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0atomic_ops/sysdeps/gcc/x86.h \<br>
                =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0\<b=
r>
                =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0atomic_ops/sysdeps/hpc/hppa.h \<br>
                diff --git a/src/atomic_ops.h b/src/atomic_ops.h<br>
                index ec02ba4..59f04ef 100644<br>
                --- a/src/atomic_ops.h<br>
                +++ b/src/atomic_ops.h<br>
                @@ -294,6 +294,9 @@<br>
                =C2=A0# if defined(__hexagon__)<br>
                =C2=A0# include "atomic_ops/sysdeps/gcc/hexagon.h"<br>
                =C2=A0# endif<br>
                +# if defined(__tile__)<br>
                +# include "atomic_ops/sysdeps/gcc/tile.h"<br>
                +# endif /* __tile__ */<br>
                =C2=A0#endif /* __GNUC__ &amp;&amp; !AO_USE_PTHREAD_DEFS =
*/<br>
                =C2=A0<br>
                =C2=A0#if (defined(__IBMC__) || defined(__IBMCPP__))
                &amp;&amp; !defined(__GNUC__) \<br>
                diff --git a/src/atomic_ops/sysdeps/gcc/tile.h
                b/src/atomic_ops/sysdeps/gcc/tile.h<br>
                new file mode 100644<br>
                index 0000000..28dc083<br>
                --- /dev/null<br>
                +++ b/src/atomic_ops/sysdeps/gcc/tile.h<br>
                @@ -0,0 +1,52 @@<br>
                +/*<br>
                + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO
                WARRANTY EXPRESSED<br>
                + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.<br>
                + *<br>
                + * Permission is hereby granted to use or copy this
                program<br>
                + * for any purpose, provided the above notices are
                retained on all copies.<br>
                + * Permission to modify the code and to distribute
                modified code is granted,<br>
                + * provided the above notices are retained, and a
                notice that the code was<br>
                + * modified is included with the above copyright
                notice.<br>
                + */<br>
                +<br>
                +/* Minimal support for tile. */<br>
                +<br>
                +#if (((__GNUC__ &gt; 4 || (__GNUC__ =3D=3D 4 &amp;&amp;
                __GNUC_MINOR__ &gt;=3D 8)) \<br>
                + || __clang_major__ &gt; 3 \<br>
                + || (__clang_major__ =3D=3D 3 &amp;&amp; __clang_minor__
                &gt;=3D 4)) \<br>
                + &amp;&amp; !defined(AO_DISABLE_GCC_ATOMICS))<br>
                +<br>
                +# include "generic.h"<br>
                +<br>
                +#else /* AO_DISABLE_GCC_ATOMICS */<br>
                +<br>
                +#include "../all_atomic_load_store.h"<br>
                +<br>
                +#include "../test_and_set_t_is_ao_t.h"<br>
                +<br>
                +<br>
                +AO_INLINE void<br>
                +AO_nop_full()<br>
                +{<br>
                + __sync_synchronize();<br>
                +}<br>
                +#define AO_HAVE_nop_full<br>
                +<br>
                +<br>
                +AO_INLINE AO_t<br>
                +AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)<br>
                +{<br>
                + return __sync_fetch_and_add(p, incr);<br>
                +}<br>
                +#define AO_HAVE_fetch_and_add_full<br>
                +<br>
                +<br>
                +AO_INLINE int<br>
                +AO_compare_and_swap_full(volatile AO_t *addr,<br>
                + AO_t old, AO_t new_val) <br>
                +{<br>
                + return __sync_val_compare_and_swap(addr, old, new_val)
                =3D=3D old;<br>
                +}<br>
                +#define AO_HAVE_compare_and_swap_full<br>
                +<br>
                +#endif<br>
                -- <br>
                1.7.1<br>
                _______________________________________________<br>
                bdwgc mailing list<br>
                <a moz-do-not-send=3D"true"
                  href=3D"mailto:[email protected]">[email protected]=
pendylan.org</a><br>
                <a moz-do-not-send=3D"true"
                  href=3D"https://lists.opendylan.org/mailman/listinfo/bd=
wgc"
                  target=3D"_blank">https://lists.opendylan.org/mailman/l=
istinfo/bdwgc</a><br>
              </div>
              <base target=3D"_self" href=3D"https://e.mail.ru/"> </div>
          </div>
        </div>
      </blockquote>
      <br>
    </blockquote>
    <br>
    <pre class=3D"moz-signature" cols=3D"1000000">--=20
Chris Metcalf, Mellanox Technologies
<a class=3D"moz-txt-link-freetext" href=3D"http://www.mellanox.com">http:=
//www.mellanox.com</a></pre>
  </body>
</html>

--------------69C6305304801B7DA149E995--

--===============0843897165==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
bdwgc mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/bdwgc
--===============0843897165==--