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

Helmut Grohne <[email protected]> Wed, 2 Nov 2016 06:07:19 +0100
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <[email protected]>
Hi Chris,

On Thu, May 12, 2016 at 01:49:08AM +0300, Ivan Maidanski wrote:
> I've committed these 2 patches (with small modifications) to master:
> *=A0 https://github.com/ivmai/bdwgc/commit/1240658b92c0827ace6f9ac52b3425=
070eed948f =A0
> *=A0 https://github.com/ivmai/libatomic_ops/commit/04a286421802a503b58d80=
4d0d673dd5a28c9e9b =A0

The version of libatomic_ops in Debian has finally been updated to 7.4.4
and cherry-picks 04a86642180 (https://tracker.debian.org/news/808756).
Of course, I went a head and tried to build it, but that fails
(https://jenkins.debian.net/job/rebootstrap_tilegx_gcc6_supported/10/consol=
e):

| make[3]: Entering directory '/tmp/buildd/libatomic-ops/libatomic-ops-7.4.=
4/src'
| /bin/bash ../libtool  --tag=3DCC   --mode=3Dcompile tilegx-linux-gnu-gcc =
-DHAVE_CONFIG_H   -I../src -I../src -Wdate-time -D_FORTIFY_SOURCE=3D2 -fPIC=
 -Wall -Wextra -g -O2 -fdebug-prefix-map=3D/tmp/buildd/libatomic-ops/libato=
mic-ops-7.4.4=3D. -fstack-protector-strong -Wformat -Werror=3Dformat-securi=
ty -c -o atomic_ops.lo atomic_ops.c
| libtool: compile:  tilegx-linux-gnu-gcc -DHAVE_CONFIG_H -I../src -I../src=
 -Wdate-time -D_FORTIFY_SOURCE=3D2 -fPIC -Wall -Wextra -g -O2 -fdebug-prefi=
x-map=3D/tmp/buildd/libatomic-ops/libatomic-ops-7.4.4=3D. -fstack-protector=
-strong -Wformat -Werror=3Dformat-security -c atomic_ops.c -o atomic_ops.o
| In file included from atomic_ops/sysdeps/gcc/tile.h:19:0,
|                  from atomic_ops.h:295,
|                  from atomic_ops.c:47:
| atomic_ops/sysdeps/gcc/generic.h:65:13: error: unknown type name 'AO_TS_V=
AL_t'
|    AO_INLINE AO_TS_VAL_t
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:66:28: error: unknown type name 'AO_TS_t'
|    AO_test_and_set(volatile AO_TS_t *addr)
|                             ^~~~~~~
| atomic_ops/sysdeps/gcc/generic.h: In function 'AO_test_and_set':
| atomic_ops/sysdeps/gcc/generic.h:68:13: error: 'AO_TS_VAL_t' undeclared (=
first use in this function)
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_RELAXED);
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:68:13: note: each undeclared identifier =
is reported only once for each function it appears in
| atomic_ops/sysdeps/gcc/generic.h:68:25: error: expected ';' before '__ato=
mic_test_and_set'
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_RELAXED);
|                          ^~~~~~~~~~~~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:66:37: warning: unused parameter 'addr' =
[-Wunused-parameter]
|    AO_test_and_set(volatile AO_TS_t *addr)
|                                      ^~~~
| atomic_ops/sysdeps/gcc/generic.h: At top level:
| atomic_ops/sysdeps/gcc/generic.h:72:13: error: unknown type name 'AO_TS_V=
AL_t'
|    AO_INLINE AO_TS_VAL_t
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:73:36: error: unknown type name 'AO_TS_t'
|    AO_test_and_set_acquire(volatile AO_TS_t *addr)
|                                     ^~~~~~~
| atomic_ops/sysdeps/gcc/generic.h: In function 'AO_test_and_set_acquire':
| atomic_ops/sysdeps/gcc/generic.h:75:13: error: 'AO_TS_VAL_t' undeclared (=
first use in this function)
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_ACQUIRE);
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:75:25: error: expected ';' before '__ato=
mic_test_and_set'
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_ACQUIRE);
|                          ^~~~~~~~~~~~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:73:45: warning: unused parameter 'addr' =
[-Wunused-parameter]
|    AO_test_and_set_acquire(volatile AO_TS_t *addr)
|                                              ^~~~
| atomic_ops/sysdeps/gcc/generic.h: At top level:
| atomic_ops/sysdeps/gcc/generic.h:79:13: error: unknown type name 'AO_TS_V=
AL_t'
|    AO_INLINE AO_TS_VAL_t
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:80:36: error: unknown type name 'AO_TS_t'
|    AO_test_and_set_release(volatile AO_TS_t *addr)
|                                     ^~~~~~~
| atomic_ops/sysdeps/gcc/generic.h: In function 'AO_test_and_set_release':
| atomic_ops/sysdeps/gcc/generic.h:82:13: error: 'AO_TS_VAL_t' undeclared (=
first use in this function)
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_RELEASE);
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:82:25: error: expected ';' before '__ato=
mic_test_and_set'
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_RELEASE);
|                          ^~~~~~~~~~~~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:80:45: warning: unused parameter 'addr' =
[-Wunused-parameter]
|    AO_test_and_set_release(volatile AO_TS_t *addr)
|                                              ^~~~
| atomic_ops/sysdeps/gcc/generic.h: At top level:
| atomic_ops/sysdeps/gcc/generic.h:86:13: error: unknown type name 'AO_TS_V=
AL_t'
|    AO_INLINE AO_TS_VAL_t
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:87:33: error: unknown type name 'AO_TS_t'
|    AO_test_and_set_full(volatile AO_TS_t *addr)
|                                  ^~~~~~~
| atomic_ops/sysdeps/gcc/generic.h: In function 'AO_test_and_set_full':
| atomic_ops/sysdeps/gcc/generic.h:89:13: error: 'AO_TS_VAL_t' undeclared (=
first use in this function)
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_SEQ_CST);
|              ^~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:89:25: error: expected ';' before '__ato=
mic_test_and_set'
|      return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_SEQ_CST);
|                          ^~~~~~~~~~~~~~~~~~~~~
| atomic_ops/sysdeps/gcc/generic.h:87:42: warning: unused parameter 'addr' =
[-Wunused-parameter]
|    AO_test_and_set_full(volatile AO_TS_t *addr)
|                                           ^~~~
| atomic_ops.c: At top level:
| atomic_ops.c:97:1: error: unknown type name 'AO_TS_t'
|  AO_TS_t AO_locks[AO_HASH_SIZE] =3D {
|  ^~~~~~~
| In file included from atomic_ops.c:47:0:
| atomic_ops.h:160:33: error: 'AO_TS_CLEAR' undeclared here (not in a funct=
ion)
|  #define AO_TS_INITIALIZER (AO_t)AO_TS_CLEAR
|                                  ^
| atomic_ops.c:98:3: note: in expansion of macro 'AO_TS_INITIALIZER'
|    AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIAL=
IZER,
|    ^~~~~~~~~~~~~~~~~
| atomic_ops.c:106:31: error: unknown type name 'AO_TS_t'
|  static void lock_ool(volatile AO_TS_t *l)
|                                ^~~~~~~
| atomic_ops.c: In function 'lock_ool':
| atomic_ops.c:110:40: error: 'AO_TS_SET' undeclared (first use in this fun=
ction)
|    while (AO_test_and_set_acquire(l) =3D=3D AO_TS_SET)
|                                         ^~~~~~~~~
| atomic_ops.c: At top level:
| atomic_ops.c:114:30: error: unknown type name 'AO_TS_t'
|  AO_INLINE void lock(volatile AO_TS_t *l)
|                               ^~~~~~~
| In file included from atomic_ops.c:47:0:
| atomic_ops.c: In function 'lock':
| atomic_ops.c:116:53: error: 'AO_TS_SET' undeclared (first use in this fun=
ction)
|    if (AO_EXPECT_FALSE(AO_test_and_set_acquire(l) =3D=3D AO_TS_SET))
|                                                      ^
| atomic_ops.h:173:49: note: in definition of macro 'AO_EXPECT_FALSE'
|  # define AO_EXPECT_FALSE(expr) __builtin_expect(expr, 0)
|                                                  ^~~~
| atomic_ops.c: At top level:
| atomic_ops.c:120:32: error: unknown type name 'AO_TS_t'
|  AO_INLINE void unlock(volatile AO_TS_t *l)
|                                 ^~~~~~~
| atomic_ops.c: In function 'unlock':
| atomic_ops.c:122:3: warning: implicit declaration of function 'AO_CLEAR' =
[-Wimplicit-function-declaration]
|    AO_CLEAR(l);
|    ^~~~~~~~
| atomic_ops.c: At top level:
| atomic_ops.c:128:19: error: unknown type name 'AO_TS_t'
|    static volatile AO_TS_t init_lock =3D AO_TS_INITIALIZER;
|                    ^~~~~~~
| atomic_ops.c: In function 'AO_fetch_compare_and_swap_emulation':
| atomic_ops.c:154:3: error: unknown type name 'AO_TS_t'
|    AO_TS_t *my_lock =3D AO_locks + AO_HASH(addr);
|    ^~~~~~~
| atomic_ops.c: In function 'AO_compare_double_and_swap_double_emulation':
| atomic_ops.c:176:3: error: unknown type name 'AO_TS_t'
|    AO_TS_t *my_lock =3D AO_locks + AO_HASH(addr);
|    ^~~~~~~
| atomic_ops.c: In function 'AO_store_full_emulation':
| atomic_ops.c:201:3: error: unknown type name 'AO_TS_t'
|    AO_TS_t *my_lock =3D AO_locks + AO_HASH(addr);
|    ^~~~~~~
| Makefile:603: recipe for target 'atomic_ops.lo' failed
| make[3]: Leaving directory '/tmp/buildd/libatomic-ops/libatomic-ops-7.4.4=
/src'
| make[3]: *** [atomic_ops.lo] Error 1
| Makefile:462: recipe for target 'all' failed
| make[2]: Leaving directory '/tmp/buildd/libatomic-ops/libatomic-ops-7.4.4=
/src'
| Makefile:474: recipe for target 'all-recursive' failed
| make[1]: Leaving directory '/tmp/buildd/libatomic-ops/libatomic-ops-7.4.4'

I'm not sure what went wrong here. Could you maybe look into it?

Maybe tile.h needs to #include "../test_and_set_t_is_ao_t.h" before
including "generic.h"?

Other than this, the tilegx bootstrap in Debian is slowly progressing
well. The toolchain appears to just work and it builds some 12 packages
already. More to come after libatomic_ops.

Helmut