
Hello, I would like to port GHC to Arm so that I can compile Haskell programs for use on my Zaurus or in Debian's ARM port. I have talked to Ian Lynagh about this, and he believes that there was some sort of problems with floats. I don't know exactly that was, if it was in gcc or ghc, or if it has been fixed. Does anybody have some light to shed on this? Also, does anybody have any ARM binaries of ghc to ease the bootstrapping pain? Thanks!

I recently did a port of linux to ARM, and the floating point issue came up. What happens is that if you don't do anything other than the default gcc build, then every floating point call is converted to an O/S trap which then does the floating point computation with the fixed point hardware (because there is no floating point hardware). There is a much more efficient floating point library that can be built and used with gcc; I'm sorry that I don't have the specifics at hand but hopefully a web search will find it; if not, email me and I'll dig out the info. Along with this extra code (which is quite short), there are one or two flags required for the initial ./configure for gcc. Again, if these are not apparent I can go through my absurdly disorganized filing system (known as "the box") and find the flags as well. Actually, I'm exaggerating; I have a complete gcc build procedure written that describes building for arm with the separate floating point code and specifies all the flags; I just have to retrieve it from a backup disk. I'm in the midst of moving but I think I can get at the appropriate CD without unpacking anything. The performance difference, if your application is in any way floating point intensive, is dramatic. The project for which I did the port involved scaling and panning of geographical (map) data, which is floating point intensive. If your issue is floating point functionality rather than floating point performance, the standard gcc build and linux software emulation of floating point hardware works fine. You only need to do the more complex procedure if your concern is performance. It is not necessary if your use of floating point is light. Note that while the entire cross compilation is time consuming (fortunately, mostly machine time consuming), changing it from the default o/s trap floating point to the more efficient floating point library is not difficult and is quick. You don't have to start from scratch. So it is perfectly reasonable to take the default behavior, do performance testing and profiling of the specific application, and add in the more efficient floating point library if profiling shows that you actually need it. Note also that the main reason for the increase in performance is not that the kernel's floating point implementation is not good; the library I downloaded and built was only (based on somewhat rough calculation) about 15% faster. The performance killer is the extra context switches that occur each time a floating point instruction causes an O/S trap. What I mean is that even though the downloaded library is only 15% faster than the kernel library, the performance increase is closer to an order of magnitude because of the higher costs of calls to the kernel vs. a simple call to a function within a library that is already linked into your application. Seth John Goerzen wrote:
Hello,
I would like to port GHC to Arm so that I can compile Haskell programs for use on my Zaurus or in Debian's ARM port.
I have talked to Ian Lynagh about this, and he believes that there was some sort of problems with floats. I don't know exactly that was, if it was in gcc or ghc, or if it has been fixed. Does anybody have some light to shed on this?
Also, does anybody have any ARM binaries of ghc to ease the bootstrapping pain?
Thanks! _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
!DSPAM:41f13d7e187601466359710!

On Mon, Jan 24, 2005 at 05:03:47PM -0700, Seth Kurtzberg wrote:
I recently did a port of linux to ARM, and the floating point issue came up.
Thank you for the detailed reply, Seth. I've been discussing this with Ian Lynagh, who maintains ghc for Debian, and has encountered trouble before. Presently, we do not have a working ARM ghc package, so my first priority is basic floating point support, even if it is slow. [ snip ]
If your issue is floating point functionality rather than floating point performance, the standard gcc build and linux software emulation of floating point hardware works fine. You only need to do the more
Ian told me that the standard build would die with errors relatnig to decodeFloat. He's also written up a little illustration that ARM's internal floating point representation is different than on other platforms. On Debian, our standard procedure appears to be, from what I can tell, using the kernel trap for floating point. Also, from what I understand from gcc docs, if the software library is to be used instead, the entire system must be recompiled starting with libc. It seems that you have found a way around that... correct? We can't really rebuild the entire system, but it sounds like the library is the way to go. My own efforts are complicated a bit because my only piece of ARM hardware is my Zaurus PDA. It's powerful enough to run binaries that GHC builds, or even GHC itself in some instances, but not powerful enough to build GHC. So I have to rely on various other ARM machines, where I have little control over the kernel or libc environment. In any case, your build instructions and/or code would be most helpful. Also, if you happen to have ghc binaries ready-made on ARM, that would speed up my porting work, of course :-) Thanks again for your help. -- John
participants (2)
-
John Goerzen
-
Seth Kurtzberg