Force inline functions withgcc version 4.4.3

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Force inline functions withgcc version 4.4.3

Postby Julio Jerez » Mon Apr 09, 2012 10:54 am

The old simd class was not a class, it was bas on macros,
this makes it difficult to use with high level language, so I made a class.

to make sure that the function are issued inline in VS I us ethe extended keyword __forceinline
and this work very well.

with GCC is difcult to see what is inline and what is not, in fact almost all function are isse as funtion call, so I nee to use a similart funtion

the have this attibute for that:
Code: Select all
   #define DG_INLINE    __attribute__((always_inline))
   //#define DG_INLINE    inline


however when I try to compile I get this error message

In file included from ../../source/core/dgSphere.cpp:25:
../../source/core/dgTypes.h:657: sorry, unimplemented: inlining failed in call to ‘dgFloat32 dgAbsf(dgFloat32)’: function not inlinable
../../source/core/dgSphere.h:94: sorry, unimplemented: called from here
../../source/core/dgTypes.h:657: sorry, unimplemented: inlining failed in call to ‘dgFloat32 dgAbsf(dgFloat32)’: function not inlinable
../../source/core/dgSphere.h:94: sorry, unimplemented: called from here
../../source/core/dgTypes.h:657: sorry, unimplemented: inlining failed in call to ‘dgFloat32 dgAbsf(dgFloat32)’: function not inlinable
../../source/core/dgSphere.h:94: sorry, unimplemented: called from here
make: *** [../../source/core/dgSphere.o] Error 1


an error at the very function that uses the modifier DG_INLINE

has anyone try using __attribute__((always_inline)) with GCC.
I have being looking in teh net for peopel with similar error, and they are ton of then, but every one solve by Not using it
Only in one site I read someone say it as a but with GCC 4 but only for template inline, they say it was fixe and no more comment.

I do not know what to do form here, the class require those functions to be inline.

I also saw the teh ARM commplie make thier own __inline__ extension to GCC like Microsoft and Intell, but that doe no work on nor arm mode for GCC.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Force inline functions with gcc version 4.4.3

Postby d.l.i.w » Mon Apr 09, 2012 4:22 pm

There are some compiler switches that can influence inlining behaviour:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

(Just search for inline :D)
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Force inline functions withgcc version 4.4.3

Postby Julio Jerez » Sat Apr 14, 2012 11:53 pm

Now I chekc in Linux32 and 64 make file that compile the complete libraries.

I have not tested and I have no try to compile with force inline, so I beleiev that the code genertade for teh Simd Class will be poor
if anyone wnat to give it a try this is the macro that define force inline. in file dgType.cpp

#if (defined (_WIN_32_VER) || defined (_WIN_64_VER))
#define DG_INLINE __forceinline
#else
#define DG_INLINE inline
//#define DG_INLINE __attribute__((always_inline))
#endif

Anyway the engine now fully compile and it have the thread core engine, for all modes: stager with teh main thread the default, concurrent, and both mode also work with morco thread Jobs
The new thread libary is very, very efficient in windows, It lirarli scale lineally wiot teh numbe of cores in eh system, and when adding more thread than core it even yeeld a marninal improvement.
I asume in linux should be equal or better since Posix Semaphores are more efficient than window semaphores. but as usual we will not knowo until we test it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests