Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Does TBB support Alpha ISA

chenxuhao
Beginner
1,756 Views
I try to cross-compile TBB version of blackscholes (PARSEC benchmark)for Alpha ISA, butthere is an error: root@gem5-desktop:/home/parsec-2.1#parsecmgmt-abuild-calpha-gcc-tbb-pblackscholes [PARSEC]Packagestobuild:blackscholes [PARSEC][==========Buildingpackageblackscholes==========] [PARSEC][----------Analyzingpackageblackscholes----------] [PARSEC]blackscholesdependson:tbblib [PARSEC][----------Analyzingpackagetbblib----------] [PARSEC]Packagetbblibalreadyexists,proceeding. [PARSEC][----------Buildingpackageblackscholes----------] [PARSEC]Removingoldbuilddirectory. [PARSEC]Copyingsourcecodeofpackageblackscholes. [PARSEC]Running'envversion=tbb/usr/bin/make': rm-fblackscholes /home/alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-g++-O3-funroll-loops-fprefetch-loop-arrays-fpermissive-fno-exceptions-static-libgcc-Wl,--hash-style=both,--as-needed-DPARSEC_VERSION=2.1-I/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include-DTBB_VERSION-DN=960-DNCO=4blackscholes.tbb.cpp-L/usr/lib64-L/usr/lib-L/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/lib-ltbb-ldl-lrt-lpthread-oblackscholes Infileincludedfrom/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/aligned_space.h:33, from/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/parallel_reduce.h:33, fromblackscholes.tbb.cpp:15: /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:91:2:error:#errorMinimalrequirementsfortbb_machine.hnotsatisfied Infileincludedfrom/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/aligned_space.h:33, from/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/parallel_reduce.h:33, fromblackscholes.tbb.cpp:15: /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Infunction'void__TBB_Pause(int32_t)': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:119:error:'__TBB_Yield'wasnotdeclaredinthisscope /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Inmemberfunction'voidtbb::internal::AtomicBackoff::pause()': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:145:error:'__TBB_Yield'wasnotdeclaredinthisscope /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Infunction'Ttbb::internal::__TBB_CompareAndSwapGeneric(volatilevoid*,T,T)[withlongunsignedintS=4ul,T=unsignedint]': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:215:error:'__TBB_CompareAndSwap4'wasnotdeclaredinthisscope /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Infunction'Ttbb::internal::__TBB_CompareAndSwapGeneric(volatilevoid*,T,T)[withlongunsignedintS=8ul,T=longunsignedint]': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:220:error:'__TBB_CompareAndSwap8'wasnotdeclaredinthisscope /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Infunction'intptr_ttbb::internal::__TBB_MaskedCompareAndSwap(volatileint32_t*,T,T)[withlongunsignedintS=1ul,T=unsignedchar]': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:200:instantiatedfromhere /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:182:error:'__TBB_CompareAndSwap4'wasnotdeclaredinthisscope /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Infunction'intptr_ttbb::internal::__TBB_MaskedCompareAndSwap(volatileint32_t*,T,T)[withlongunsignedintS=2ul,T=shortunsignedint]': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:209:instantiatedfromhere /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:182:error:'__TBB_CompareAndSwap4'wasnotdeclaredinthisscope /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:Infunction'Ttbb::internal::__TBB_CompareAndSwapGeneric(volatilevoid*,T,T)[withlongunsignedintS=8ul,T=longint]': /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:525:instantiatedfromhere /home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/tbb_machine.h:192:error:'__TBB_CompareAndSwapW'wasnotdeclaredinthisscope make:***[blackscholes]Error1 [PARSEC]Error:'envversion=tbb/usr/bin/make'failed. root@gem5-desktop:/home/parsec-2.1# Does this mean thatTBBdoesnotsupportalphaarchitecture? Because TBBrequiressomeatomicprimitiveswhichALPHAdoes nothave,the"minialrequirements...notsatisfied"? If I try towritemyown__TBB_CompareAndSwap4()and __TBB_CompareAndSwap8()forALPHAarchitecture, andthendefiningthetwomacro""_TBB_CompareAndSwap4"and"_TBB_CompareAndSwap8", will it work?

0 Kudos
42 Replies
RafSchietekat
Valued Contributor III
961 Views
Do you mean Alpha as in DEC Alpha, the late architecture? I don't have high hopes for it to ever be supported, even though Intel apparently bought the intellectual property for it from Compaq in 2001 (according to Wikipedia), but trying to port TBB to it would at least be interesting, because it is the most wild and wacky architecture out there in terms of memory semantics, and probably the only one you could use to really verify correctness of a C++11 program by straightforward testing as opposed to advanced static analysis or simulated dynamic analysis (assuming that somebody has ported or will port a C++11 compiler to it?), since any other architecture I know of has implicit "consume" semantics... unless one would completely disregard "consume" as a non-issue and leave it at that, no longer using any Alpha machines still out there.

You may not have a recent enough g++ compiler to use built-in atomics (it's not clear what version of TBB you have or whether it supports any available built-in atomics yet, but it doesn't seem to be the most recent one), so you may have to provide definitions for those macros for best performance or if the compiler really doesn't have built-in atomics. Start with a more recent TBB version to try the built-in atomics. Then, if the compiler doesn't have them, you can't upgrade the compiler to a version that does, you feel up to the challenge and don't mind ultimate disappointment, follow the porting directions in build/index.html (even if they are not quite complete). (I might be tempted to join your efforts at some point, without promising anything.)

BTW, how does "amd64" get in there? And if you don't know because this just came in the Linux distribution on such a system, somebody must have missed similar problems building the library.
0 Kudos
Vladimir_P_1234567890
961 Views
hello,
The simplest instructions to port to new architecture you can find atbuild/index.html file.
As Raf wrote above if there is gcc 4.5 and above with intrinsic atomics a port will be simpler.
--Vladimir
0 Kudos
SergeyKostrov
Valued Contributor II
961 Views

I think that a root cause of all compilation errors is:

...
error: #error Minimal requirements for tbb_machine.h not satisfied In file included from
/home/parsec-2.1/pkgs/libs/tbblib/inst/amd64-linux.alpha-gcc-tbb/include/tbb/aligned_space.h:33
...

There is a statement in 'tbb_machine.h' header file that:

...
/** This header provides basic platform abstraction layer by hooking up appropriate
architecture/OS/compiler specific headers from the /include/tbb/machine directory.
If a plug-in header does not implement all the required APIs, it must specify
the missing ones by setting one or more of the following macros:

__TBB_USE_GENERIC_PART_WORD_CAS
__TBB_USE_GENERIC_PART_WORD_FETCH_ADD
__TBB_USE_GENERIC_PART_WORD_FETCH_STORE
__TBB_USE_GENERIC_FETCH_ADD
...

0 Kudos
RafSchietekat
Valued Contributor III
961 Views
"I think that a root cause of all compilation errors is:"
Well, yes, but it seemed more helpful to go straight to sketching out an appropriate course of action.

BTW, those built-in atomics are only a stopgap measure (they're more expensive than they should be), so a native port may still be a good idea later on. But, as already implied, the Alpha is also likely to require an unpredictable amount of extra porting work beyond getting the atomics right.
0 Kudos
Anton_P_Intel
Employee
961 Views

chenxuhao,
As has been previously mentioned the shortest way you can take is possibly to try Generic GCC* Atomics Support . For that you need :
- the minimal tbb version is : TBB 3.0 Update 7
- the gcc version is 4.3.6 (4.1.2 might also work, but probably require some hacking)

during a build the port should be enabled automatically. For sure macro TBB_USE_GCC_BUILTINS should be defined in the build command. E.g. like this:

make compiler=gcc CXXFLAGS="-DTBB_USE_GCC_BUILTINS"

Once the tbb is built it is a good idea to run tbb unit tests, as the Alpha is greatly differ in memory semantics from all other platform TBB is able working on.


0 Kudos
chenxuhao
Beginner
961 Views
Thank you for your reply.
I tried to cross compile TBB 4.0, but there is stillerror that '__TBB_machine_load8' was not declared. My alpha gcc compiler version is 4.3.2, so it may be due to this. I will try it again using 4.3.6.
root@gem5-desktop:/home/tbb40_233oss/src# make tbb_release arch=alpha
Created ../build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_release directory
make -C "../build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_release" -r -f ../../build/Makefile.tbb cfg=release tbb_root=../..
make[1]: Entering directory `/home/tbb40_233oss/build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_release'
../../build/Makefile.tbb:39: CONFIG: cfg=release arch=alpha compiler=gcc os=linux runtime=cc4.4.3_libc2.11.1_kernel2.6.32
/home/alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-g++ -c -MMD -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD -fPIC -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-non-virtual-dtor -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp
In file included from ../../include/tbb/spin_rw_mutex.h:33,
from ../../include/tbb/concurrent_hash_map.h:50,
from ../../src/tbb/concurrent_hash_map.cpp:29:
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store::load_with_acquire(const volatile T&)':
../../include/tbb/tbb_machine.h:525: error: there are no arguments to '__TBB_machine_load8' that depend on a template parameter, so a declaration of '__TBB_machine_load8' must be available
../../include/tbb/tbb_machine.h:525: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store::store_with_release(volatile T&, T)':
../../include/tbb/tbb_machine.h:528: error: there are no arguments to '__TBB_machine_store8' that depend on a template parameter, so a declaration of '__TBB_machine_store8' must be available
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store_relaxed::load(const volatile T&)':
../../include/tbb/tbb_machine.h:590: error: there are no arguments to '__TBB_machine_load8' that depend on a template parameter, so a declaration of '__TBB_machine_load8' must be available
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store_relaxed::store(volatile T&, T)':
../../include/tbb/tbb_machine.h:593: error: there are no arguments to '__TBB_machine_store8' that depend on a template parameter, so a declaration of '__TBB_machine_store8' must be available
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store::store_with_release(volatile T&, T) [with T = long unsigned int]':
../../include/tbb/tbb_machine.h:609: instantiated from here
../../include/tbb/tbb_machine.h:528: error: '__TBB_machine_store8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store_relaxed::store(volatile T&, T) [with T = long unsigned int]':
../../include/tbb/tbb_machine.h:635: instantiated from here
../../include/tbb/tbb_machine.h:593: error: '__TBB_machine_store8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store::store_with_release(volatile T&, T) [with T = long int]':
../../include/tbb/tbb_machine.h:605: instantiated from 'void tbb::internal::__TBB_store_with_release(volatile T&, V) [with T = int64_t, V = long int]'
../../include/tbb/atomic.h:263: instantiated from 'T tbb::internal::atomic_impl::store_with_release(T) [with T = long long int]'
../../include/tbb/atomic.h:354: instantiated from here
../../include/tbb/tbb_machine.h:528: error: '__TBB_machine_store8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store::load_with_acquire(const volatile T&) [with T = long int]':
../../include/tbb/tbb_machine.h:601: instantiated from 'T tbb::internal::__TBB_load_with_acquire(const volatile T&) [with T = int64_t]'
../../include/tbb/atomic.h:233: instantiated from 'tbb::internal::atomic_impl::operator T() const volatile [with T = long long int]'
../../include/tbb/atomic.h:354: instantiated from here
../../include/tbb/tbb_machine.h:525: error: '__TBB_machine_load8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store::load_with_acquire(const volatile T&) [with T = tbb::interface5::internal::hash_map_node_base*]':
../../include/tbb/tbb_machine.h:601: instantiated from 'T tbb::internal::__TBB_load_with_acquire(const volatile T&) [with T = tbb::interface5::internal::hash_map_node_base*]'
../../include/tbb/tbb_profiling.h:168: instantiated from 'T tbb::internal::itt_load_word_with_acquire(const T&) [with T = tbb::interface5::internal::hash_map_node_base*]'
../../include/tbb/concurrent_hash_map.h:269: instantiated from here
../../include/tbb/tbb_machine.h:525: error: '__TBB_machine_load8' was not declared in this scope
make[1]: *** [concurrent_hash_map.o] Error 1
make[1]: Leaving directory `/home/tbb40_233oss/build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_release'
make: *** [tbb_release] Error 2
0 Kudos
chenxuhao
Beginner
961 Views
Thank you for your reply.
Yes, I mean DEC Alpha. I usedtbb30_131oss when I observed this error. I will try to use the most recent TBB and GCC.
I have no idea about the "amd64", this may be the information from PARSEC benchmark suite.
0 Kudos
chenxuhao
Beginner
961 Views
Thank you very much for your advise. I will try it again.
0 Kudos
chenxuhao
Beginner
961 Views
Thank you for your reply.
I just don't know how to implement these atomics currently. So I will firstly try to use the more recent gcc.
0 Kudos
SergeyKostrov
Valued Contributor II
961 Views
Quoting chenxuhao
Thank you for your reply.
I tried to cross compile TBB 4.0, but there is stillerror that '__TBB_machine_load8' was not declared. My alpha gcc compiler
version is 4.3.2, so it may be due to this. I will try it again using 4.3.6...


A port of some library to a different platform is a complex process and it consists of many phases. Currently,
you're trying to solve some low level problem.A different approach could be more eficient:

- Phase 1 - If there is a compilation problem(s),due to some piece of code,comment it out or replace itwith
an empty piece of code. For example, a '__TBB_machine_load8' causes some compilation
problems because it is not declared.In that case, declare it as follows, or something like this:
( Note: don't spend time on internals and continue with another compilation problem )

#ifdef _PLATFORM_DEC_ALPHA
...
#define _TBB_machine_load8( ... ) //???
...
#endif

and mark it with '//???' label. After first a couple of hours of porting you could have lots of
commented pieces of code withlabels '//???'. The most important thing is thatin Phase 1
the source codes have to be compiled. A total number of detected issues or problems
is unpredictable.

- Phase 2 - Review all cases marked with '//???' and start fixing them. It is recommended that all easy
cases are fixed first, and more complex cases are fixedlast. But, it is really hard to predict what has to
be fixed first.Then a Phase 3 comes ahead.

- Phase 3 - Create some set of simpletests.Tests for all fixedcases (previously marked with '//???' ) also
have to be done.

and so on.

In overall, the process I just desribed is a 'Top-to-Down' process. From my point of view your current
approach is opposite, that is 'Down-to-Top'. Also, I don't think thatyour currentcompilation problems are
related to an older version ofGCC compiler.

Best regards,
Sergey

0 Kudos
RafSchietekat
Valued Contributor III
961 Views
"Also, I don't think thatyour currentcompilation problems are related to an older version ofGCC compiler."
Please see #5. We're not guessing.
0 Kudos
SergeyKostrov
Valued Contributor II
961 Views
"Also, I don't think thatyour currentcompilation problems are related to an older version ofGCC compiler."
Please see #5. We're not guessing.


Thanks for the note. I missed that.

0 Kudos
chenxuhao
Beginner
961 Views
I use gcc 4.4.2 and tbb 4.0, it still doesn't work:
root@gem5-desktop:/home/tbb40_233oss# make arch=alpha compiler=gcc CXXFLAGS="-DTBB_USE_GCC_BUILTINS"
Created ./build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_release and ..._debug directories
make -C "./build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_debug" -r -f ../../build/Makefile.tbb cfg=debug tbb_root=../..
make[1]: Entering directory `/home/tbb40_233oss/build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_debug'
../../build/Makefile.tbb:39: CONFIG: cfg=debug arch=alpha compiler=gcc os=linux runtime=cc4.4.3_libc2.11.1_kernel2.6.32
/root/x-tools/alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-g++ -c -MMD -DTBB_USE_DEBUG -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD -fPIC -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-non-virtual-dtor -DTBB_USE_GCC_BUILTINS -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp
In file included from ../../include/tbb/spin_rw_mutex.h:33,
from ../../include/tbb/concurrent_hash_map.h:50,
from ../../src/tbb/concurrent_hash_map.cpp:29:
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store::load_with_acquire(const volatile T&)':
../../include/tbb/tbb_machine.h:525: error: there are no arguments to '__TBB_machine_load8' that depend on a template parameter, so a declaration of '__TBB_machine_load8' must be available
../../include/tbb/tbb_machine.h:525: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store::store_with_release(volatile T&, T)':
../../include/tbb/tbb_machine.h:528: error: there are no arguments to '__TBB_machine_store8' that depend on a template parameter, so a declaration of '__TBB_machine_store8' must be available
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store_relaxed::load(const volatile T&)':
../../include/tbb/tbb_machine.h:590: error: there are no arguments to '__TBB_machine_load8' that depend on a template parameter, so a declaration of '__TBB_machine_load8' must be available
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store_relaxed::store(volatile T&, T)':
../../include/tbb/tbb_machine.h:593: error: there are no arguments to '__TBB_machine_store8' that depend on a template parameter, so a declaration of '__TBB_machine_store8' must be available
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store::store_with_release(volatile T&, T) [with T = long unsigned int]':
../../include/tbb/tbb_machine.h:609: instantiated from here
../../include/tbb/tbb_machine.h:528: error: '__TBB_machine_store8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store_relaxed::store(volatile T&, T) [with T = long unsigned int]':
../../include/tbb/tbb_machine.h:635: instantiated from here
../../include/tbb/tbb_machine.h:593: error: '__TBB_machine_store8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static void tbb::internal::machine_load_store::store_with_release(volatile T&, T) [with T = long int]':
../../include/tbb/tbb_machine.h:605: instantiated from 'void tbb::internal::__TBB_store_with_release(volatile T&, V) [with T = int64_t, V = long int]'
../../include/tbb/atomic.h:263: instantiated from 'T tbb::internal::atomic_impl::store_with_release(T) [with T = long long int]'
../../include/tbb/atomic.h:354: instantiated from here
../../include/tbb/tbb_machine.h:528: error: '__TBB_machine_store8' was not declared in this scope
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store::load_with_acquire(const volatile T&) [with T = long int]':
../../include/tbb/tbb_machine.h:601: instantiated from 'T tbb::internal::__TBB_load_with_acquire(const volatile T&) [with T = int64_t]'
../../include/tbb/atomic.h:233: instantiated from 'tbb::internal::atomic_impl::operator T() const volatile [with T = long long int]'
../../include/tbb/atomic.h:354: instantiated from here
../../include/tbb/tbb_machine.h:525: error: '__TBB_machine_load8' was not declared in this scope
make[1]: *** [concurrent_hash_map.o] Error 1
make[1]: Leaving directory `/home/tbb40_233oss/build/linux_alpha_gcc_cc4.4.3_libc2.11.1_kernel2.6.32_debug'
make: *** [tbb] Error 2
it seems like the GCC BUILTINS doesn't take effect, and the compiler still thinks that '__TBB_machine_store8' was not declared.
0 Kudos
RafSchietekat
Valued Contributor III
961 Views
To get a little further, insert "#define __TBB_64BIT_ATOMICS 0" somewhere in include/tbb/machine/gcc_generic.h.

0 Kudos
SergeyKostrov
Valued Contributor II
961 Views
To get a little further, insert "#define __TBB_64BIT_ATOMICS 0" somewhere in include/tbb/machine/gcc_generic.h.


I'm not confident that it could resolve all these compilation errors because in 'tbb_machine.h' header file
there is a piece of code:

...
#ifndef __TBB_64BIT_ATOMICS
#define __TBB_64BIT_ATOMICS 1
#endif
...

and it defines that macro again. Anyway, you could try and please post results of your attempt.

0 Kudos
chenxuhao
Beginner
961 Views
What does this mean? I add this at the end ofinclude/tbb/machine/gcc_generic.h, and there are errors aboutincomplete type:
root@gem5-desktop:/home/tbb40_233oss# make arch=alpha compiler=gcc CXXFLAGS="-DTBB_USE_GCC_BUILTINS" runtime=cc4.3.6_libc2.9
Created ./build/linux_alpha_gcc_cc4.3.6_libc2.9_release and ..._debug directories
make -C "./build/linux_alpha_gcc_cc4.3.6_libc2.9_debug" -r -f ../../build/Makefile.tbb cfg=debug tbb_root=../..
make[1]: Entering directory `/home/tbb40_233oss/build/linux_alpha_gcc_cc4.3.6_libc2.9_debug'
../../build/Makefile.tbb:39: CONFIG: cfg=debug arch=alpha compiler=gcc os=linux runtime=cc4.3.6_libc2.9
/root/x-tools/alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-g++ -c -MMD -DTBB_USE_DEBUG -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD -fPIC -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-non-virtual-dtor -DTBB_USE_GCC_BUILTINS -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp
In file included from ../../include/tbb/tbb_profiling.h:105,
from ../../include/tbb/spin_rw_mutex.h:34,
from ../../include/tbb/concurrent_hash_map.h:50,
from ../../src/tbb/concurrent_hash_map.cpp:29:
../../include/tbb/atomic.h: In instantiation of 'tbb::internal::atomic_impl':
../../include/tbb/atomic.h:273: instantiated from 'tbb::internal::atomic_impl_with_arithmetic'
../../include/tbb/atomic.h:359: instantiated from here
../../include/tbb/atomic.h:196: error: 'tbb::internal::atomic_impl::rep' has incomplete type
../../include/tbb/atomic.h:75: error: declaration of 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h: In instantiation of 'tbb::internal::atomic_impl':
../../include/tbb/atomic.h:273: instantiated from 'tbb::internal::atomic_impl_with_arithmetic'
../../include/tbb/atomic.h:360: instantiated from here
../../include/tbb/atomic.h:196: error: 'tbb::internal::atomic_impl::rep' has incomplete type
../../include/tbb/atomic.h:75: error: declaration of 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h: In instantiation of 'tbb::internal::atomic_impl':
../../include/tbb/atomic.h:405: instantiated from here
../../include/tbb/atomic.h:196: error: 'tbb::internal::atomic_impl::rep' has incomplete type
../../include/tbb/atomic.h:75: error: declaration of 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h: In instantiation of 'tbb::internal::atomic_impl::converter':
../../include/tbb/atomic.h:261: instantiated from 'T tbb::internal::atomic_impl::store_with_release(T) [with T = long int]'
../../include/tbb/atomic.h:359: instantiated from here
../../include/tbb/atomic.h:201: error: invalid use of incomplete type 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h:75: error: declaration of 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h: In member function 'T tbb::internal::atomic_impl::store_with_release(T) [with T = long int]':
../../include/tbb/atomic.h:359: instantiated from here
../../include/tbb/atomic.h:263: error: using invalid field 'tbb::internal::atomic_impl::rep'
../../include/tbb/atomic.h:263: error: 'union tbb::internal::atomic_impl::converter' has no member named 'bits'
../../include/tbb/atomic.h: In member function 'tbb::internal::atomic_impl::operator T() const volatile [with T = long int]':
../../include/tbb/atomic.h:359: instantiated from here
../../include/tbb/atomic.h:233: error: using invalid field 'tbb::internal::atomic_impl::rep'
../../include/tbb/atomic.h:233: error: 'union tbb::internal::atomic_impl::converter' has no member named 'bits'
../../include/tbb/atomic.h: At global scope:
../../include/tbb/atomic.h: In instantiation of 'tbb::internal::atomic_impl::converter':
../../include/tbb/atomic.h:261: instantiated from 'T tbb::internal::atomic_impl::store_with_release(T) [with T = long unsigned int]'
../../include/tbb/atomic.h:360: instantiated from here
../../include/tbb/atomic.h:201: error: invalid use of incomplete type 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h:75: error: declaration of 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h: In member function 'T tbb::internal::atomic_impl::store_with_release(T) [with T = long unsigned int]':
../../include/tbb/atomic.h:360: instantiated from here
../../include/tbb/atomic.h:263: error: using invalid field 'tbb::internal::atomic_impl::rep'
../../include/tbb/atomic.h:263: error: 'union tbb::internal::atomic_impl::converter' has no member named 'bits'
../../include/tbb/atomic.h: In member function 'tbb::internal::atomic_impl::operator T() const volatile [with T = long unsigned int]':
../../include/tbb/atomic.h:360: instantiated from here
../../include/tbb/atomic.h:233: error: using invalid field 'tbb::internal::atomic_impl::rep'
../../include/tbb/atomic.h:233: error: 'union tbb::internal::atomic_impl::converter' has no member named 'bits'
../../include/tbb/atomic.h: At global scope:
../../include/tbb/atomic.h: In instantiation of 'tbb::internal::atomic_impl::converter':
../../include/tbb/atomic.h:261: instantiated from 'T tbb::internal::atomic_impl::store_with_release(T) [with T = void*]'
../../include/tbb/atomic.h:408: instantiated from here
../../include/tbb/atomic.h:201: error: invalid use of incomplete type 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h:75: error: declaration of 'struct tbb::internal::atomic_rep<8ul>'
../../include/tbb/atomic.h: In member function 'T tbb::internal::atomic_impl::store_with_release(T) [with T = void*]':
../../include/tbb/atomic.h:408: instantiated from here
../../include/tbb/atomic.h:263: error: using invalid field 'tbb::internal::atomic_impl::rep'
../../include/tbb/atomic.h:263: error: 'union tbb::internal::atomic_impl::converter' has no member named 'bits'
../../include/tbb/atomic.h: In member function 'tbb::internal::atomic_impl::operator T() const volatile [with T = void*]':
../../include/tbb/atomic.h:411: instantiated from here
../../include/tbb/atomic.h:233: error: using invalid field 'tbb::internal::atomic_impl::rep'
../../include/tbb/atomic.h:233: error: 'union tbb::internal::atomic_impl::converter' has no member named 'bits'
../../include/tbb/atomic.h: In member function 'I tbb::internal::atomic_impl_with_arithmetic::fetch_and_add(D) [with tbb::memory_semantics M = full_fence, I = long unsigned int, D = long unsigned int, StepType = char]':
../../include/tbb/atomic.h:283: instantiated from 'I tbb::internal::atomic_impl_with_arithmetic::fetch_and_add(D) [with I = long unsigned int, D = long unsigned int, StepType = char]'
../../include/tbb/atomic.h:316: instantiated from 'I tbb::internal::atomic_impl_with_arithmetic::operator++() [with I = long unsigned int, D = long unsigned int, StepType = char]'
../../include/tbb/concurrent_hash_map.h:282: instantiated from here
../../include/tbb/atomic.h:279: error: incomplete type 'tbb::internal::atomic_traits<8ul, full_fence>' used in nested name specifier
../../include/tbb/atomic.h:279: error: 'struct tbb::internal::atomic_impl_with_arithmetic' has no member named 'rep'
make[1]: *** [concurrent_hash_map.o] Error 1
make[1]: Leaving directory `/home/tbb40_233oss/build/linux_alpha_gcc_cc4.3.6_libc2.9_debug'
make: *** [tbb] Error 2
0 Kudos
SergeyKostrov
Valued Contributor II
961 Views
Quoting chenxuhao
I use gcc 4.4.2 and tbb 4.0, it still doesn't work:
...
../../include/tbb/tbb_machine.h: In static member function 'static T tbb::internal::machine_load_store::load_with_acquire(const volatile T&)':
../../include/tbb/tbb_machine.h:525: error: there are no arguments to '__TBB_machine_load8' that ...

it seems like the GCC BUILTINS doesn't take effect, and the compiler still thinks that '__TBB_machine_store8' was not declared.


First compilation errors are related to 'tbb::internal::machine_load_store' template classand
'__TBB_machine_load8' function. The second error recommends you to look at a line 525 in
'tbb_machine.h' header file. A couple of lines above there is a piece of codes:

...
#if __TBB_USE_GENERIC_DWORD_LOAD_STORE

inline void __TBB_machine_store8 (volatile void *ptr, int64_t value) {
for(;;) {
int64_t result = *(int64_t *)ptr;
if( __TBB_machine_cmpswp8(ptr,value,result)==result ) break;
}
}

inline int64_t __TBB_machine_load8 (const volatile void *ptr) {
// Comparand and new value may be anything, they only must be equal, and
// the value should have a low probability to be actually found in 'location'.
const int64_t anyvalue = 2305843009213693951;
return __TBB_machine_cmpswp8(const_cast(ptr),anyvalue,anyvalue);
}

#endif /* __TBB_USE_GENERIC_DWORD_LOAD_STORE */
...

If the macro __TBB_USE_GENERIC_DWORD_LOAD_STORE is not defined there will be a compilation error(s).

What is a state of that macro? Is that defined or not in your build environment?

0 Kudos
Alexey-Kukanov
Employee
961 Views
If the macro __TBB_USE_GENERIC_DWORD_LOAD_STORE is not defined there will be a compilation error(s).

What is a state of that macro? Is that defined or not in your build environment?


That's a good catch. Actually, the most recent TBB update fixed a bug in previous versions that do not have this macro defined in gcc_generic.h. Sochenxuhaoneeds to make sure the latest TBB release (4.0 Update 3)is used.

0 Kudos
SergeyKostrov
Valued Contributor II
961 Views
I see that there is some kind of "escalation" of compilation errors. Every time something else is "broken".

So, please set __TBB_64BIT_ATOMICS to 0, or comment, or undefine itand please try to concentrate
your efforts on resolving first two compilation errors related to my comments in Post #17.

Best regards,
Sergey

PS: Could you verify a complete version of TBB installed on your computer? Look at 'tbb_stddef.h' header file.
0 Kudos
SergeyKostrov
Valued Contributor II
962 Views

1. There are many cases when __TBB_64BIT_ATOMICS is used with __TBB_WORDSIZE, like:

...
#if __TBB_WORDSIZE==4 && __TBB_64BIT_ATOMICS
...

2. For 32-bit Windows platforms '__TBB_machine_store8' and '__TBB_machine_load8' functionsare
declared in 'windows_ia32.h' header file( not applicable in your case ) as follows:

...
extern "C" {
...
void __TBB_EXPORTED_FUNC __TBB_machine_store8 (volatile void *ptr, __int64 value );
__int64 __TBB_EXPORTED_FUNC __TBB_machine_load8 (const volatile void *ptr);
}
...

and when I commented these two lines I had these compilation errors:

------ Build started: Project: tbb, Configuration: Debug Win32 ------
Compiling...
concurrent_hash_map.cpp
c:\worklib\tbb40\include\tbb\tbb_machine.h(525) : error C3861: '__TBB_machine_load8': identifier not found
c:\worklib\tbb40\include\tbb\tbb_machine.h(524) : while compiling class template member function
'tbb::internal::int64_t tbb::internal::machine_load_store::load_with_acquire(volatile const T &)'
with
[
T=tbb::internal::int64_t,
S=8
]
...

It also "breaks" on line 525 and it partially reproduces your compilation errors.

As you can see they are similar to your compilation errors. Also, implementations for both functions are
in 'atomic_support.asm' file.

3. I think it makes sense to try a simple test with declaration of these two functions in some header file, like:

...
void __TBB_EXPORTED_FUNC __TBB_machine_store8 (volatile void *ptr, __int64 value );
__int64 __TBB_EXPORTED_FUNC __TBB_machine_load8 (const volatile void *ptr);
...

and implementation for these two functions in some C/C++ file, like:

...
void __TBB_EXPORTED_FUNC __TBB_machine_store8 (volatile void *ptr, __int64 value )
{
}

__int64 __TBB_EXPORTED_FUNC __TBB_machine_load8 (const volatile void *ptr)
{
return ( __int64 )0;
}
...

0 Kudos
Reply