qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: R: [RFC PATCH v2] target/ppc: Enable hardfloat for PPC


From: Aleksandar Markovic
Subject: Re: R: [RFC PATCH v2] target/ppc: Enable hardfloat for PPC
Date: Wed, 26 Feb 2020 19:51:33 +0100

On Wed, Feb 26, 2020 at 7:14 PM Dino Papararo <address@hidden> wrote:
>
> I think we all agree the best solution is to resolve powerpc issues about 
> hardfloat current implementation.
> I think also powerpc is an important branch of qemu, for hystorical, present 
> and (why not?) future reasons, and it must NOT be left behind.
> So I would invite best Qemu community's skilled programmers to work on this 
> and solve the issue maybe in few days.
> The same group who worked on recent altivec optimizations is able to make a 
> good patch even for this.
>
> In a subordinate way I'd like to implement anyway hardfloat support for 
> powerpc, advising users about inaccurancy of results/flags and letting them 
> choose.

Just to be clear, concluding from your surrounding sentences, you don't
mean here to implement "hardfloat support for powerpc", but something
like "improve performance of ppc FPU emulation by misusing hardfloat
support and giving up accuracy". I think we have to be honest between
ourselves.

Regards,
Aleksandar

> Of course I understand, and in part agree, on all your objections.
> Simply I prefer have always a choice.
>
> Best Regards,
> Dino Papararo
>
> -----Messaggio originale-----
> Da: Aleksandar Markovic <address@hidden>
> Inviato: mercoledì 26 febbraio 2020 18:27
> A: G 3 <address@hidden>
> Cc: Alex Bennée <address@hidden>; Dino Papararo <address@hidden>; QEMU 
> Developers <address@hidden>; address@hidden; Howard Spoelstra 
> <address@hidden>; luigi burdo <address@hidden>; David Gibson <address@hidden>
> Oggetto: Re: R: [RFC PATCH v2] target/ppc: Enable hardfloat for PPC
>
> On Wed, Feb 26, 2020 at 6:04 PM G 3 <address@hidden> wrote:
> >
> > Accuracy is an important part of the IEEE 754 floating point standard. The 
> > whole purpose of this standard is to ensure floating point calculations are 
> > consistent across multiple CPUs. I believe referring to this patch as 
> > inaccurate is itself inaccurate. That gives the impression that this patch 
> > produces calculations that are not inline with established standards. This 
> > is not true. The only part of this patch that will produce incorrect values 
> > are the flags. There *may* be a program or two out there that depend on 
> > these flags, but for the majority of programs that only care about basic 
> > floating point arithmetic this patch will produce correct values. Currently 
> > the emulated PowerPC's FPU already produces wrong values for the flags. 
> > This patch does set the Inexact flag (which I don't like), but since I have 
> > never encountered any source code that cares for this flag, I can let it 
> > go. I think giving the user the ability to decide which option to use is 
> > the best thing to do.
> >
>
> From the experiments described above, the patch in question changes the 
> behavior of applications (for example, sound is different with and without 
> the patch), which is in contradiction with your claim that you "never 
> encountered any source code that cares for this flag" and that "the only part 
> of this patch that will produce incorrect values are the flags".
>
> In other words, and playing further with them:
>
> The claim that "referring to this patch as inaccurate is itself inaccurate" 
> is itself inaccurate.
>
> Best regards,
> Aleksandar
>
>
> > On Wed, Feb 26, 2020 at 10:51 AM Aleksandar Markovic <address@hidden> wrote:
> >>
> >>
> >>
> >> On Wed, Feb 26, 2020 at 3:29 PM Alex Bennée <address@hidden> wrote:
> >> >
> >> >
> >> > Dino Papararo <address@hidden> writes:
> >> >
> >> > > Please let's go with hardfloat pps support, it's really a good feature 
> >> > > to implement.
> >> > > Even if in a first step it could lead to inaccuracy results,
> >> > > later it could solved with other patches.
> >> >
> >> > That's the wrong way around. We have regression tests for a reason.
> >>
> >> I tend to agree with Alex here, and additionally want to expand more
> >> on this topic.
> >>
> >> In my view: (that I think is at least very close to the community
> >> consensus)
> >>
> >> This is *not* a ppc-specific issue. There exist a principle across
> >> all targets that QEMU FPU calculation must be accurate - exactly as
> >> specified in any applicable particular ISA document. Any discrepancy is an 
> >> outright bug.
> >>
> >> We even recently had several patches for FPU in ppc target that
> >> handled some fairly obscure cases of inaccuracies, I believe they
> >> were authored by Paul Clarke, so there are people in ppc community
> >> that care about FPU accuracy (as I guess is the case for any target).
> >>
> >> There shouldn't be a target that decides by itself and within itself
> >> "ok, we don't need accuracy, let's trade it for speed". This violates
> >> the architecture of QEMU. Please allow that for any given software
> >> project, there is an architecture that should be respected.
> >>
> >> This doesn't mean that anybody's experimentation is discouraged.
> >> No-one can stop anybody from forking from QEMU upstream tree and do
> >> whatever is wanted.
> >>
> >> But, this doesn't mean such experimentation will be upstreamed. QEMU
> >> upstream should be collecting place for the best ideas and
> >> implementations, not for arbitrary experimentations.
> >>
> >> Best regards,
> >> Aleksandar
> >>
> >>
> >> > I'll happily accept patches to turn on hardfloat for PPC if:
> >> >
> >> >  a) they don't cause regressions in our fairly extensive floating
> >> > point  tests
> >> >  b) the PPC maintainers are happy with the new performance profile
> >> >
> >> > The way forward would be to:
> >> >
> >> >  1. patch to drop #if defined(TARGET_PPC) || defined(__FAST_MATH__)
> >> > 2. audit target/ppc/fpu_helper.c w.r.t chip manual and fix any
> >> > unneeded  splatting of flags (if any)  3. measure the before/after
> >> > performance effect and decide if on balance  it's worth keeping
> >> >
> >> > > I think it's important for qemu to as global as possible and
> >> > > don't target only recent hardware.
> >> >
> >> > Are you referring to guests or hosts? For guests we will always
> >> > favour accuracy of speed of emulation. For hosts we need to have
> >> > IEEE compliant FPU HW to even stand a chance of using hardfloat.
> >> >
> >> > --
> >> > Alex Bennée
> >> >



reply via email to

[Prev in Thread] Current Thread [Next in Thread]