1

I have an ARM based platform with a Linux OS. Even though its gcc-based toolchain supports both hardfp and softfp, the vendor recommends using softfp and the platform is shipped with a set of standard and platform-related libraries which have only softfp version.

I'm making a computation-intensive (NEON) AI code based on OpenCV and tensorflow lite. Following the vendor guide, I have built these with softfp option. However, I have a feeling that my code is underperformed compared to other somewhat alike hardfp platforms.

Does the code performance depend on softfp/hardfp setting? Do I understand it right that all .o and .a files the compiler makes to build my program are also using softfp convention, which is less effective? If it does, are there any tricky ways to use hardfp calling convention internally but softfp for external libraries?

Roman Maltsev
  • 307
  • 1
  • 3
  • 9
  • softfp would obviously be considerably slower. but has the portability advantage. how much slower depends specifically on your software on a specific platform you would have to do that benchmark, nothing that can be done here. – old_timer Oct 15 '19 at 14:41
  • softfp vs hardfp is not just about parameter passing, it is about using hardware vs software, the hardware (hardfp) is going to be significantly faster, how much faster depends on the application. 10 times? 100 times? 1000 times faster? depends on the application. – old_timer Nov 20 '19 at 12:48
  • parameter passing only affects you with respect to building the project you need everything to be one way or the other, cant mix. that is separate from performance. – old_timer Nov 20 '19 at 12:48

2 Answers2

0

Normally, all objects that are linked together need to have the same float ABI. So if you need to use this softfp only library, i'm afraid you have to compile your own software in softfp too.

I had the same question about mixing ABIs. See here

Regarding the performance: the performance lost with softfp compared to hardfp is that you will pass (floating point) function parameters through usual registers instead of using FPU registers. This requires some additional copy between registers. As old_timer said it is impossible to evaluate the performance lost. If you have a single huge function with many float operations, the performance will be the same. If you have many small function calls with many floating variables and few operations, the performance will be dramatically slower.

Guillaume Petitjean
  • 2,408
  • 1
  • 21
  • 47
  • [Here](https://web.archive.org/web/20120226084817/http://www.powerdeveloper.org/forums/viewtopic.php?p=13609) [are](https://groups.google.com/forum/#!topic/beagleboard/igI4h3Kh0Xc) [some](https://elinux.org/RPi_Performance#Results) [examples](https://github.com/android/ndk/issues/1096#issuecomment-541105923). To me, it seems like the only big difference happens when people forget to use `-mfpu` with softfp. Otherwise the perf impact is barely noticeable. Also to note, as mentioned by google in their [justification](https://stackoverflow.com/a/43481640/5994170) to drop hardfp, inlining matters. – mirh Jan 31 '20 at 16:49
-3

The softfp option only affects the parameter passing.

In other words, unless you are passing lots of float type arguments while calling functions, there won't be any measurable performance hit compared to hardfp.

And since well designed projects heavily rely on passing pointer to structures instead of many single values, I would stick to softfp.

Jake 'Alquimista' LEE
  • 6,197
  • 2
  • 17
  • 25