Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
NiCoX
Posts: 11
Registered: ‎10-29-2011
My Device: PlayBook
My Carrier: None

NEON

Hi,

 

I know the PlayBook is using an OMAP 4 chipset, that embedds a NEON coprocessor. I would like to know if we can use it with the current version of the NDK. If yes, what is the preferred way: compile time assumption (as on iOS), or runtime detection (as on Android), and if the latter is there a detection API?

 

Thanks in advance.

Please use plain text.
Regular Contributor
xsacha
Posts: 55
Registered: ‎10-30-2011
My Device: Blackberry Playbook
My Carrier: Telstra LTE

Re: NEON

[ Edited ]

Playbook allows compiling directly in C++ using a compiler such as gcc. As such, when you compile for a target such as march=arm7-le, gcc already knows that the device supports NEON instructions and then enables this (-mfpu neon).

So it is done on compile time.

 

All QNX devices will support NEON. If this is cross-platform code your NEON code should already be wrapped around the proper #ifdef/#endif.

 

I see that a lot of people use:

#ifdef _ARM_ARCH_7
#include <arm_neon.h>
...
#endif 

However, as you've probably discovered on Android, some devices use Tegra 2 which is Armv7 but does not have NEON.

To get around this, developer will usually add this after the #ifdef:

 



 flags = arm_cpu_caps();
 if (flags & HAS_NEON)
{
....

 While this is not necessary for Playbook. This *is* necessarily if one of your targets is Android where some Armv7 devices may or may not support NEON (eg. Tegra 2).

 

Hope that helps.

Please use plain text.
Contributor
NiCoX
Posts: 11
Registered: ‎10-29-2011
My Device: PlayBook
My Carrier: None

Re: NEON

Hi xsacha, thanks for your reply :smileyhappy:

 

I just made a quick test, adding "-mfloat-abi=softfp -mfpu=neon" to the compile flags (else arm_neon.h is complaining) and adding my NEON files to the Makefile (I keep them in separate files to properly handle the VFP/Tegra case on Android), and all compiles well... but unfortunately half of the NEON routines do not work, though do not crash: I just cannot see my characters (I'm using NEON for vertex skinning). And the routines that work do not give any performance improvement (on Android and iOS I have a 50% gain). I'll make deeper tests and let you know if that works. For info I'm using assembly (so not intrinsics), don't know if that can be a problem.

 

Thanks again for your time.

Please use plain text.
Regular Contributor
xsacha
Posts: 55
Registered: ‎10-30-2011
My Device: Blackberry Playbook
My Carrier: Telstra LTE

Re: NEON

[ Edited ]

It's likely the flags were already there if you're using an IDE like the native SDK. If you're comparing from when you added the flags you'll probably not notice the difference then.

 

Not sure why you can't see the characters :\

Please use plain text.