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

Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 4:51 pm

I've been through an emotional rollercoaster lately... pleased when I got my Raspberry Pi working (using the recommended Raspian distro); happy when I saw how nicely it boots up and has all the basics, including a nice clean X environment; absolutely thrilled when it appeared to be so easy to apt-get install mono-complete and start hacking in C#; concerned when I learned about the hard-float problem; and despondent when, after digging more deeply, I found that there appears to be no good solution to it.

I'm stuck in despondent, and hoping for a lifeline.

My belief is that C# (via Mono) is a great language for everyone, from kids to part-time hackers to professional developers, to learn. It runs on a huge variety of devices, including all major platforms, consoles, and handhelds. It's also the primary language of Unity, which has become probably the most popular and powerful game development environment in the world.

I also believe that Raspberry Pi is a great computer, especially for kids, but also for hackers in general. I assume I don't need to explain why in this forum.

But, alas, the two do not go together, because of the hard-float ABI problem. Mono for ARM assumes the soft-float ABI that's used by iPhone and Android, and does not work properly on Raspbian or most other RPi distros. (This problem also affects Java, though I've heard Oracle has a new build of Java in testing that might fix this).

Now, you can certainly make a sensible argument that this is Mono's problem, and it should be fixed in Mono (much as Oracle is fixing it in Java). And if there are other JIT compilers out there, they should be fixed too (dunno if there are, but it seems likely).

On the other hand, we want to make the RPi easy to use, and in particular, easy to program for. Yes, I know it has Python, but there will certainly be some people who, like me, would prefer to use and teach C#. And that is NOT currently easy. If we can get fixed Mono and Java runtimes, and there are no other tools out there suffering from the same problem, then great. But in the meantime, I propose the following:

Change Raspbian to use the softfloat ABI (that is, pass floating point parameters just like integers), but still use hardware floating-point operations. This would be, as I understand it, just like iOS and Android, which are certainly the 900-pound gorillas in the embedded Linux/Unix space. We gain the benefits of following the big guys who set de facto convention, and don't have to fight tool vendors to provide special support for our little corner of the universe. Yet we still get the performance advantage of doing most floating-point operations in hardware.

I propose doing this in Raspbian, rather than just telling people to use Arch or Squeeze or whatever, because new Raspberry Pi users are going to overwhelmingly be running Raspbian. It's got "Raspb" in the name. ;) No other distro will ever get the adoption that Raspbian does.

So. What do y'all think?

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

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 5:08 pm

How would that work ?
Do you have any link which shows how iOS and Android do this ? (i.e. being "softfloat" and still
profit from hardware floating point ) ?
Do you know if the Debian project itself does not adress this ?

ghans
Last edited by ghans on Mon Mar 11, 2013 5:13 pm, edited 3 times in total.
• 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

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 5:08 pm

If you like pedalling backwards to achieve retrograde, I prefer pedalling forward to achieve future. :twisted:
I know everything about nothing"

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

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 5:19 pm

ghans wrote:How would that work ?
Do you have any link which shows how iOS and Android do this ? (i.e. being "softfloat" and still
profit from hardware floating point ) ?
Well it appears that very early in the Raspbian project (before it was even called such), there were binaries built exactly this way. You can read about it here.

There was much concern at the time about being inclusive, and whether switching to the hardfloat ABI would break compatibility with things. Unfortunately, JIT compilers didn't occur to anyone at the time.

(I should point out that this issue affects not just those developing in Mono, but anybody wanting to run anything written in Mono, too. There are something like 250 thousand Mono developers today; the amount of software written in Mono is just going to keep increasing.)
ghans wrote:Do you know if the Debian project itself does not adress this ?
As far as I can tell, that distro uses the softfloat ABI, but also doesn't use FP instructions at all. So it is unlikely to perform as well as Raspian on FP calculations (which I believe was the whole point of the Raspian branch in the first place).

plugwash
Forum Moderator
Forum Moderator
Posts: 3476
Joined: Wed Dec 28, 2011 11:45 pm

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 6:49 pm

Short answer: no

Long answer:
As well as the overhead of unnesaacerally pusing stuff arround between integer and floating point registers going back to the softfloat ABI would mean basically restarting the raspbian project from scratch. It would also break all the third party stuff that is now being built for the hard float ABI (including all the pi store stuff). In short it's not going to happen.

I'm fairly sure we will have a working hardfloat version of mono in raspbian eventually but unfortunately i can't give you a timescale as to when.

On the java side all the open vms i'm aware of that support arm (zero, avian, jamvm and cacao) now have an armv6 hardfloat version in raspbian. The oracle propietary vm also has an armv6 hardfloat version but so-far it's only been included in a preview release (which comes with more draconian licensing terms than a regular release).

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24149
Joined: Sat Jul 30, 2011 7:41 pm

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 7:27 pm

Indeed - the correct fix is a HF version of Mono, not a retrograde step to SF Raspbian.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 7:30 pm

jamesh wrote:Indeed - the correct fix is a HF version of Mono, not a retrograde step to SF Raspbian.
+1
I know everything about nothing"

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

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 8:17 pm

jamesh wrote:Indeed - the correct fix is a HF version of Mono, not a retrograde step to SF Raspbian.
+2
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

User avatar
rpdom
Posts: 15584
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 9:37 pm

jamesh wrote:Indeed - the correct fix is a HF version of Mono, not a retrograde step to SF Raspbian.
+3.14

Gomoto
Posts: 126
Joined: Tue Feb 12, 2013 1:21 am

Re: Can we reconsider the hardfloat ABI?

Mon Mar 11, 2013 9:57 pm

You could always use C, a much more portable language than C# it seems to me after reading your post. Gtk is a good alternative to Mono.

And now a more serious answer, lets stick to hardfloat, hope that there will be hardfloat options for your choice of language soon!

dr_d_gee
Posts: 84
Joined: Fri Jan 04, 2013 1:30 pm

Re: Can we reconsider the hardfloat ABI?

Tue Mar 12, 2013 2:19 pm

If it's available for Raspbian (I can't check at the moment) Vala may be a possible alternative to C# -- a very C#-like syntax, but compiling to native code via C (which is the reason for most of the modifications). See https://live.gnome.org/Vala (you MUST have the 'https' part!) for documentation including guides for C# programmers and lots of examples.

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

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 1:03 pm

OK, thank you for all the responses. In reality, no matter how many +numbers we give the idea, I doubt a HF version of mono is going to happen. I do find it ironic that the primary distro for a platform positioned for education excludes 3 of the top 5 programming languages -- and 2 of those, unnecessarily so (to expect Objective-C would be unreasonable).

But I do see that changing Raspbian would be a major chore, and I know it's all volunteer-driven, so I'll say no more about it.

Best wishes,
- Joe

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

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 1:17 pm

Which ones are missing on Raspbian ? I can only think of C#.


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

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24149
Joined: Sat Jul 30, 2011 7:41 pm

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 2:37 pm

JoeStrout wrote:OK, thank you for all the responses. In reality, no matter how many +numbers we give the idea, I doubt a HF version of mono is going to happen. I do find it ironic that the primary distro for a platform positioned for education excludes 3 of the top 5 programming languages -- and 2 of those, unnecessarily so (to expect Objective-C would be unreasonable).

But I do see that changing Raspbian would be a major chore, and I know it's all volunteer-driven, so I'll say no more about it.

Best wishes,
- Joe
On the other hand, of the top 20, only C# doesn't run on the Raspi HF (in any form, given Java is on the way, and there are versions of the others). I think that really shows where the problem is. I don't know why you think there cannot be a HF version of Mono - but if anyone knows what the problems are I'd be interested to know them.

Interesting the Raspi also support the majority of languages in the top 50 as well...
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

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

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 2:50 pm

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

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 3:38 pm

Last edited by xranby on Wed Mar 13, 2013 3:43 pm, edited 1 time in total.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24149
Joined: Sat Jul 30, 2011 7:41 pm

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 3:40 pm

Looks like the Mono JIT compiler doesn't support HF. Sort of what i suspected. Probably not that easy to fix either, but not impossible.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

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

Re: Can we reconsider the hardfloat ABI?

Wed Mar 13, 2013 5:05 pm

Looking around seems that Mono version 2 http://packages.qa.debian.org/m/mono.html

..will be left alone and they will work on version 3 (Mono 2.10 X, Mono 3.0 IN PROGRESS) http://wiki.debian.org/ArmHardFloatTodo
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

Return to “Raspbian”