JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Debian with FP operations (but softfloat ABI)?

Wed Mar 13, 2013 1:11 pm

Please forgive me if this has been discussed before — but I don't think it has, quite.

Early in the branch that has come to be known as Raspbian, there were binaries compiled with hardware floating-point operations, but still using the soft-float ABI. (It was discussed here.)

Then, of course, it was decided in that branch to go all the way to hard-float ABI. Enough said about that.

But in the main Debian distro, as I understand it, we're not using hardware floating-point operations at all. We're using the soft-float ABI, which is great for compatibility, but also using software FP operations, which hurts performance. So my questions are:

1. Is my understanding of the current Debian distro correct?

2. How hard would it be to change key binaries to use hardware FP operations (while still using the softfloat ABI)?

3. How can I help?

Thank you,
- Joe

User avatar
jojopi
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: Debian with FP operations (but softfloat ABI)?

Wed Mar 13, 2013 3:05 pm

JoeStrout wrote:Early in the branch that has come to be known as Raspbian, there were binaries compiled with hardware floating-point operations, but still using the soft-float ABI. (It was discussed here.)
That is not what the link says. It says that before Raspbian existed (and before almost any Pies had been delivered) and before the ARM-side VideoCore libraries were open-sourced, the first attempt at building hard-float ABI versions of those libraries by the Foundation's volunteers at Broadcom was not successful. That was corrected within two days.

If you actually want to use VFP instructions with the soft-float ABI, just compile on Debian armel with:

Code: Select all

gcc -march=armv6 -mfpu=vfp -mfloat-abi=softfp
However, copying arguments in and out of integer registers can still be a noticeable overhead. So you want to avoid passing floating-point arguments in simple or deeply recursive functions.

A better solution, where you have the source code at all, is to patch it so that it works with the hard float ABI.

JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Re: Debian with FP operations (but softfloat ABI)?

Sat Mar 16, 2013 1:37 pm

jojopi wrote:If you actually want to use VFP instructions with the soft-float ABI, just compile on Debian armel with:

Code: Select all

gcc -march=armv6 -mfpu=vfp -mfloat-abi=softfp
Right. I understand anyone can do this for C code they're compiling. My question is whether the libraries (and apps) that come already compiled on Debian armel were built this way. (And if not, wouldn't that be a good thing to do.)

Forgive me if I'm missing something fundamental here... I'm still pretty new when it comes to Linux.

Thanks,
- Joe

User avatar
jojopi
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: Debian with FP operations (but softfloat ABI)?

Sat Mar 16, 2013 5:27 pm

JoeStrout wrote:My question is whether the libraries (and apps) that come already compiled on Debian armel were built this way. (And if not, wouldn't that be a good thing to do.)
Both you and I indicated in one of your other threads, "Linux distro with softfloat ABI and hardware FP?" that Debian armel does not use FP. It still targets processors that may not have FP hardware, and emulating in software is much faster than trapping to kernel and emulating there.

In theory they could provide alternate versions of certain key libraries such as glibc, as used to happen with i386/i586/i686 optimized packages on some x86 distributions. But I see no evidence of this. There is nothing to stop you doing it. It may be less work just to fix Mono.

JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 4:35 am

jojopi wrote:Both you and I indicated in one of your other threads, "Linux distro with softfloat ABI and hardware FP?" that Debian armel does not use FP. It still targets processors that may not have FP hardware, and emulating in software is much faster than trapping to kernel and emulating there.
Thanks for your patience — I'm still learning. I was only guessing before; here I was looking for a certain answer. Thank you for providing that.

I was under the impression that all the distros on the downloads page were specifically prepared for the Raspberry Pi. So there would be no need for any of them to target processors other than what's in the RPi, as far as I can see.

Your comment here suggests that this is not the case — that Debian armel is a general distro used on the RPi, but also on other ARM-based machines. Can you (or someone) just confirm that I've understood this correctly?
In theory they could provide alternate versions of certain key libraries such as glibc, as used to happen with i386/i586/i686 optimized packages on some x86 distributions. But I see no evidence of this.
OK. Who's the "they" in charge of this distro? And how would I get in touch with them (if this forum isn't the right means for that)?
There is nothing to stop you doing it.
Well, nothing except ignorance (which is curable, in part through the kindness of folks like you) and time constraints (which is a bit harder). But yes, that is certainly one avenue I'm considering.
It may be less work just to fix Mono.
My research so far suggests that that's not the case. The patch available is quite extensive, involves a lot of hairy ARM machine language, and apparently is for armv7, so would need to be changed in ways I don't understand for armv6. I think I'd probably have an easier time making a distro with appropriate build flags.

Besides, while Mono is the main reason I care about this, it's not the only reason to do it — others may care about Java (see the folks running Minecraft or Blocky, for example), and there may be other JIT compilers I haven't thought of. (For example, I wouldn't be surprised if some emulators do some JIT compiling for performance.) Changing Mono wouldn't help with those.

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 7:45 am

Link in another of your threads, they have no intention of fixing MONO version 2 on ARMF http://packages.qa.debian.org/m/mono.html

amd64 armel i386 ia64 kfreebsd-amd64 kfreebsd-i386 powerpc ppc64 s390x sparc


http://wiki.debian.org/ArmHardFloatTodo

Mono 2.10 X , Mono 3.0 IN PROGRESS


Taking into consideration Debian Wheezy is in testing then likely Mono 3 will be worked on eventually
as they are officially at Release Candidate 1. So by the time Mono2 is pactched by you it will of been
superseded. As an aside the Pi was created as Learning Tool first and foremost ! :shock:
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

JoeStrout
Posts: 43
Joined: Sun Oct 09, 2011 12:11 pm
Contact: Website

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 1:02 pm

Spid wrote:Link in another of your threads, they have no intention of fixing MONO version 2 on ARMF http://packages.qa.debian.org/m/mono.html
Right.
amd64 armel i386 ia64 kfreebsd-amd64 kfreebsd-i386 powerpc ppc64 s390x sparc
I'm sorry, I'm not sure what you are trying to say with this list of acronyms. Perhaps these are the architectures Debian runs on?
http://wiki.debian.org/ArmHardFloatTodo
Mono 2.10 X , Mono 3.0 IN PROGRESS
This is interesting info! I wonder what the "and a dozen more languages" are that also don't work on hardfloat (and probably don't work on Raspian either)?
Taking into consideration Debian Wheezy is in testing then likely Mono 3 will be worked on eventually as they are officially at Release Candidate 1. So by the time Mono2 is pactched by you it will of been superseded.
Certainly, since as noted above, I have no intention of trying to patch Mono2.
As an aside the Pi was created as Learning Tool first and foremost ! :shock:
Yes, which is why it seems crazy to me that, using the recommended installation, you have no way of learning two of the top five programming languages (C# and Java). Fortunately, there is this distro (Debian armel), on which these and everything else just works. The Raspberry Pi foundation really should be recommending this one over the hardfloat distros, for maximum learning opportunities.

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 1:24 pm

amd64 armel i386 ia64 kfreebsd-amd64 kfreebsd-i386 powerpc ppc64 s390x sparc

these are acrhitectures that Debian Wheezy run on and are applicable to Mono2 developement, ARMHF is conspicuous by its absence.


The Pi was designed as a modern BBC Beeb Computer to encourage children and teens to understand that pointy clicky Windows was not the be all of IT

C++ Jave etal I not would try and teach a 7 year old................


Regards your ARMEL Distro, you may run into software issues unless you ensure it is compatible with ARMEL and has been ported to ARMv6

As a self-confessed newbie you seem to feel you know best, but fotunately many of us have been around a long time and sometimes just know that patience is a virtue !
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

ghans
Posts: 7878
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 1:59 pm

Doesn't the OpenJDK work on Raspbian ?


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 2:51 pm

Yes Java

http://www.raspberrypi.org/phpBB3/viewt ... fx#p309832

http://jdk8.java.net/fxarmpreview/javaf ... eview.html

http://www.raspberrypi.org/phpBB3/viewt ... 81&t=26110


Regards MONO have solved the issue install ARCH Linux Arm aka alarmpi

armv6 extra mono 2.10.8-2 Free implementation of the .NET platform including runtime and compiler

pacman -Syu
pacman -S momo
pacman -S mono-basic

https://wiki.archlinux.org/index.php/Mono
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

User avatar
jojopi
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 3:44 pm

JoeStrout wrote:I was under the impression that all the distros on the downloads page were specifically prepared for the Raspberry Pi. So there would be no need for any of them to target processors other than what's in the RPi, as far as I can see. Your comment here suggests that this is not the case — that Debian armel is a general distro used on the RPi, but also on other ARM-based machines.
Images are prepared specifically for the Pi in that they must include the Pi boot firmware, almost always include support for the Pi-specific framebuffer, and usually include a few applications built for the Pi, such as omxplayer. They are not necessarily built from scratch for the Pi.

Some distributions, such as OpenELEC, can easily be compiled completely from source, targeted to a specific CPU. But most larger distributions are intended to be installed from repositories of binary packages pre-compiled for a limited selection of architectures.

Debian is one of the oldest GNU+Linux distributions still widely used, started in 1993. Its first port to ARM was "Debian arm" for ARMv3 with hardware FPA (in practice emulated very slowly in kernel, because the FPU was almost never present) and using the now obsolete arm-linux-gnu ABI. Its second port to ARM is "Debian armel" for ARMv4t without FPU using gnueabi. Its third port is "Debian armhf" for ARMv7 with VFP. A fourth port is expected for future 64bit ARMv8.

Raspbian is effectively an unofficial extra port, compatible with Debian armhf, but using ARMv6 instructions only. (Also see: http://wiki.debian.org/ArmPorts)

So, not only does Debian armel target lesser CPUs, but users of Pi or APC IO and above have better targeted architectures available. armel is on the road to obsolescence and some distros have already dropped support in favour of armhf only.

It is unlikely that any major distro would waste the compilation time and mirror space to carry a port requiring floating-point hardware but using the soft-float ABI. On machines without VFP that would be slower than armel (if kernel emulation is even available), and on machines with VFP it would be slower than armhf.

If you can profile your use, you can recompile specific programs or libraries using VFP. I doubt it would be worth the effort to recompile the whole system that way.

By the way, have you tried OtherCrashOverride's experimental hard-float build of Mono? http://www.raspberrypi.org/phpBB3/viewt ... 16#p310016
JoeStrout wrote:Fortunately, there is this distro (Debian armel), on which these and everything else just works. The Raspberry Pi foundation really should be recommending this one over the hardfloat distros, for maximum learning opportunities.
Absolutely not.

Firstly, you are recommending a suboptimal ABI to work around technical or proprietary issues. (Mono is not very portable, or Oracle do not see the need to compile a specific version of Java, and ARM do not release open specifications for their Jazelle technology.) Secondly, portable and non-proprietary languages should always be preferred, especially for education. (But also for any commercial activity where an alleged proprietor might sue.)

Thirdly, I do not think anyone becomes a good programmer until they have learned several languages. It does not really matter exactly what languages are supported on Pi, only that several are and that some of them are common. Or preferably, standard.

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Debian with FP operations (but softfloat ABI)?

Sun Mar 17, 2013 9:33 pm

I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

Return to “Debian”