linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Mixing hard and soft floating point?
@ 2009-10-17 12:14 Joakim Tjernlund
  2009-10-17 18:12 ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2009-10-17 12:14 UTC (permalink / raw)
  To: linuxppc-dev


Anyone tried mixing hard and soft FP in on soft float CPU such as 83xx?

Been trying to figure out if this is a good idea or not.
Any combinations that will or won't work?

Generally I got soft FP in all system libs but there might be
an binary application which will use hard FP.
Is the MATH_EMU option in the kernel reliable(for 8xx too)?

 Jocke

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Mixing hard and soft floating point?
  2009-10-17 12:14 Mixing hard and soft floating point? Joakim Tjernlund
@ 2009-10-17 18:12 ` Wolfgang Denk
  2009-10-17 18:24   ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2009-10-17 18:12 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev

Dear Joakim Tjernlund,

In message <OFC920E57F.DFABC29F-ONC1257652.00421E11-C1257652.0043478A@transmode.se> you wrote:
> 
> Anyone tried mixing hard and soft FP in on soft float CPU such as 83xx?

Hm... most 83xx have a FPU.

> Been trying to figure out if this is a good idea or not.
> Any combinations that will or won't work?

What exactly do you mean by "mixing"? You cannot (at least not with
any reasonable effort) mix hard and soft FP in the same application /
linked object. And it would be pretty difficult to setup separate
libraries for and all that stuff for both hard and soft FP binaries
in one system.

I doubt if such a setup makes sense at all.

> Generally I got soft FP in all system libs but there might be
> an binary application which will use hard FP.

Recompile and relink it with soft-fp as well. Or ask the provider to
do that.

> Is the MATH_EMU option in the kernel reliable(for 8xx too)?

It's reliable enough to install and run standard  distributions  like
Debian, Ubuntu, or Fedora, but I have to admit that we haven't stress
tested any special FP test suites in such an environment. In everyday
use I didn't see any real issues, though.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
If I can have honesty, it's easier to overlook mistakes.
	-- Kirk, "Space Seed", stardate 3141.9

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Mixing hard and soft floating point?
  2009-10-17 18:12 ` Wolfgang Denk
@ 2009-10-17 18:24   ` Joakim Tjernlund
  2009-10-17 19:34     ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2009-10-17 18:24 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev

Wolfgang Denk <wd@denx.de> wrote on 17/10/2009 20:12:24:
>
> Dear Joakim Tjernlund,
>
> In message <OFC920E57F.DFABC29F-ONC1257652.00421E11-C1257652.
> 0043478A@transmode.se> you wrote:
> >
> > Anyone tried mixing hard and soft FP in on soft float CPU such as 83xx?
>
> Hm... most 83xx have a FPU.

Yeah, I meant 832x. These don't have a FPU

>
> > Been trying to figure out if this is a good idea or not.
> > Any combinations that will or won't work?
>
> What exactly do you mean by "mixing"? You cannot (at least not with
> any reasonable effort) mix hard and soft FP in the same application /
> linked object. And it would be pretty difficult to setup separate
> libraries for and all that stuff for both hard and soft FP binaries
> in one system.

I meant on per app or per lib basis, not within the same
app/lib.

>
> I doubt if such a setup makes sense at all.
>
> > Generally I got soft FP in all system libs but there might be
> > an binary application which will use hard FP.
>
> Recompile and relink it with soft-fp as well. Or ask the provider to
> do that.

That is what I am trying do/find out. The supplier claims that
it should not be a problem and is ATM unwilling to recompile the app/libs.
I am not convinced won't cause problems, not to mention performance degradation.

>
> > Is the MATH_EMU option in the kernel reliable(for 8xx too)?
>
> It's reliable enough to install and run standard  distributions  like
> Debian, Ubuntu, or Fedora, but I have to admit that we haven't stress
> tested any special FP test suites in such an environment. In everyday
> use I didn't see any real issues, though.

OK, but then you don't mix some libs/apps with soft and other
apps/libs with hard FP?

  Jocke

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Mixing hard and soft floating point?
  2009-10-17 18:24   ` Joakim Tjernlund
@ 2009-10-17 19:34     ` Wolfgang Denk
  2009-10-18 11:28       ` Joakim Tjernlund
  2009-10-19  0:57       ` Peter Bergner
  0 siblings, 2 replies; 7+ messages in thread
From: Wolfgang Denk @ 2009-10-17 19:34 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev

Dear Joakim Tjernlund,

In message <OFEC00B9FB.B03AA854-ONC1257652.00644350-C1257652.00651551@transmode.se> you wrote:
>
> > Recompile and relink it with soft-fp as well. Or ask the provider to
> > do that.
> 
> That is what I am trying do/find out. The supplier claims that
> it should not be a problem and is ATM unwilling to recompile the app/libs.
> I am not convinced won't cause problems, not to mention performance degradation.

If the application is really using FP instructions a lot, then there
is a huge difference between using soft-float and MATH_EMU; I
remember test cases where soft-float was faster by factors of
500...1000.

> OK, but then you don't mix some libs/apps with soft and other
> apps/libs with hard FP?

No, we never tried that. Sounds scary to me.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The connection between the language in which we think/program and the
problems and solutions we can imagine is very close. For this  reason
restricting  language  features  with  the intent of eliminating pro-
grammer errors is at best dangerous.
               - Bjarne Stroustrup in "The  C++ Programming Language"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Mixing hard and soft floating point?
  2009-10-17 19:34     ` Wolfgang Denk
@ 2009-10-18 11:28       ` Joakim Tjernlund
  2009-10-18 13:10         ` Wolfgang Denk
  2009-10-19  0:57       ` Peter Bergner
  1 sibling, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2009-10-18 11:28 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev

Wolfgang Denk <wd@denx.de> wrote on 17/10/2009 21:34:54:
>
> Dear Joakim Tjernlund,
>
> In message <OFEC00B9FB.B03AA854-ONC1257652.00644350-C1257652.
> 00651551@transmode.se> you wrote:
> >
> > > Recompile and relink it with soft-fp as well. Or ask the provider to
> > > do that.
> >
> > That is what I am trying do/find out. The supplier claims that
> > it should not be a problem and is ATM unwilling to recompile the app/libs.
> > I am not convinced won't cause problems, not to mention performance degradation.
>
> If the application is really using FP instructions a lot, then there
> is a huge difference between using soft-float and MATH_EMU; I
> remember test cases where soft-float was faster by factors of
> 500...1000.

Ouch, I had no idea that it could be that much.

>
> > OK, but then you don't mix some libs/apps with soft and other
> > apps/libs with hard FP?
>
> No, we never tried that. Sounds scary to me.

Yes, it did to me too. That is why I figured I should ask on the
list.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Mixing hard and soft floating point?
  2009-10-18 11:28       ` Joakim Tjernlund
@ 2009-10-18 13:10         ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2009-10-18 13:10 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev

Dear Joakim Tjernlund,

In message <OFEFBDE7C9.DA9D5B8B-ONC1257653.003E3DC6-C1257653.003F0B37@transmode.se> you wrote:
>
> > If the application is really using FP instructions a lot, then there
> > is a huge difference between using soft-float and MATH_EMU; I
> > remember test cases where soft-float was faster by factors of
> > 500...1000.
> 
> Ouch, I had no idea that it could be that much.

Well, consider really simple operations, like FP add or similar, and
compare the library code for the soft-FP implementationagainst the
cost for a trap into the kernel. Or even worse - a consider simple
assignment ("float x, foo; x = foo"); with soft-float: "lis 9,x@ha;
stw 3,x@l(9)" = 2 instructions, with MATH_EMU "lis 9,x@ha; stfs
1,x@l(9)" = 1 insn plus a kernel trap.

For real numbers, run a benchmark that models your real use case.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Little known fact about Middle Earth:   The Hobbits had a very sophi-
sticated computer network!   It was a Tolkien Ring...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Mixing hard and soft floating point?
  2009-10-17 19:34     ` Wolfgang Denk
  2009-10-18 11:28       ` Joakim Tjernlund
@ 2009-10-19  0:57       ` Peter Bergner
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Bergner @ 2009-10-19  0:57 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev

On Sat, 2009-10-17 at 21:34 +0200, Wolfgang Denk wrote:
> Dear Joakim Tjernlund,
> > OK, but then you don't mix some libs/apps with soft and other
> > apps/libs with hard FP?
> 
> No, we never tried that. Sounds scary to me.

And dangerous.  Hard-float and soft-float are ABI incompatible, so you
cannot mix and match obj files and libs compiled with those two options.
They all have to be hard-float or they all have to be soft-float.
Think about a function compiled with hard-float calling a soft-float
libm routine.  The hard-float routine will pass its args in via FP
regs and the soft-float lib routine will be looking for them in the
integer registers.

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-10-19  0:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-17 12:14 Mixing hard and soft floating point? Joakim Tjernlund
2009-10-17 18:12 ` Wolfgang Denk
2009-10-17 18:24   ` Joakim Tjernlund
2009-10-17 19:34     ` Wolfgang Denk
2009-10-18 11:28       ` Joakim Tjernlund
2009-10-18 13:10         ` Wolfgang Denk
2009-10-19  0:57       ` Peter Bergner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).