[PATCH] [LLVMdev] More FMA folding opportunities

Hal Finkel hfinkel at anl.gov
Tue Jan 13 00:55:27 PST 2015


----- Original Message -----
> From: "Olivier H Sallenave" <ohsallen at us.ibm.com>
> To: "Owen Anderson" <resistor at mac.com>
> Cc: "Hal Finkel" <hfinkel at anl.gov>, llvm-commits at cs.uiuc.edu
> Sent: Monday, January 12, 2015 2:01:28 PM
> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> 
> Hi,
> 
> 
> Attached is the suggested patch.

LGTM.

 -Hal

> 
> 
> Thanks,
> Olivier
> 
> 
> 
> -----Owen Anderson <resistor at mac.com> wrote: -----
> 
> To: Hal Finkel <hfinkel at anl.gov>
> From: Owen Anderson <resistor at mac.com>
> Date: 01/11/2015 10:50PM
> Cc: Olivier H Sallenave/Watson/IBM at IBMUS, llvm-commits at cs.uiuc.edu
> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> 
> 
> > On Jan 9, 2015, at 11:19 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> > 
> > ----- Original Message -----
> >> From: "Olivier H Sallenave" <ohsallen at us.ibm.com>
> >> To: "Hal Finkel" <hfinkel at anl.gov>
> >> Cc: llvm-commits at cs.uiuc.edu
> >> Sent: Friday, January 9, 2015 11:59:07 AM
> >> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> >> 
> >> Hi Hal,
> >> 
> >> I am wondering if we should move the FP_EXTEND cases to the
> >> PPC-specific combiner:
> >> 
> >> (fadd (fpext (fmul x, y)), z) -> (fma (fpext x), (fpext y), z)
> >> 
> >> We know that for PPC the FPEXT nodes will be removed, but it'll
> >> likely not be the case for other architectures. For those, you end
> >> up with one FMADD rather than one FMUL and one FADD, but also have
> >> two FPEXT nodes rather than one. I would not expect this to take
> >> more cycles to run, but there's no way to systematically check
> >> that
> >> since the cost models are not necessarily accurate.
> >> 
> >> In the end, the "aggressive" flag only ensures that you can
> >> combine
> >> one FMUL node with many FADD nodes.
> >> 
> >> What do you think?
> > 
> > I think we already have too much code in the PPCISelLowering that
> > could be in the target-independent combiner, appropriately
> > guarded. We already have TLI hooks for isTruncateFree, isZExtFree,
> > isFNegFree, isFAbsFree, and we could certainly add an isFPExtFree
> > hook at well.
> 
> That would make a lot of sense to me.
> 
> —Owen
> 
> > -Hal
> > 
> >> 
> >> Olivier
> >> 
> >> Inactive hide details for Hal Finkel ---01/08/2015 08:36:56
> >> PM-------- Original Message ----- > From: "Hal Finkel"
> >> <hfinkel at anlHal Finkel ---01/08/2015 08:36:56 PM-------- Original
> >> Message ----- > From: "Hal Finkel" <hfinkel at anl.gov>
> >> 
> >> From: Hal Finkel <hfinkel at anl.gov>
> >> To: Owen Anderson <resistor at mac.com>
> >> Cc: Olivier H Sallenave/Watson/IBM at IBMUS,
> >> <llvm-commits at cs.uiuc.edu>
> >> Date: 01/08/2015 08:36 PM
> >> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> >> 
> >> 
> >> 
> >> 
> >> ----- Original Message -----
> >>> From: "Hal Finkel" <hfinkel at anl.gov>
> >>> To: "Owen Anderson" <resistor at mac.com>
> >>> Cc: "Olivier H Sallenave" <ohsallen at us.ibm.com>,
> >>> llvm-commits at cs.uiuc.edu
> >>> Sent: Thursday, January 8, 2015 6:48:34 PM
> >>> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> >>> 
> >>> ----- Original Message -----
> >>>> From: "Hal Finkel" <hfinkel at anl.gov>
> >>>> To: "Owen Anderson" <resistor at mac.com>
> >>>> Cc: "Olivier H Sallenave" <ohsallen at us.ibm.com>,
> >>>> llvm-commits at cs.uiuc.edu
> >>>> Sent: Thursday, January 8, 2015 6:19:14 PM
> >>>> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> >>>> 
> >>>> ----- Original Message -----
> >>>>> From: "Owen Anderson" <resistor at mac.com>
> >>>>> To: "Hal Finkel" <hfinkel at anl.gov>
> >>>>> Cc: "Olivier H Sallenave" <ohsallen at us.ibm.com>,
> >>>>> llvm-commits at cs.uiuc.edu
> >>>>> Sent: Thursday, January 8, 2015 6:16:57 PM
> >>>>> Subject: Re: [PATCH] [LLVMdev] More FMA folding opportunities
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>> On Jan 8, 2015, at 6:06 PM, Hal Finkel < hfinkel at anl.gov >
> >>>>> wrote:
> >>>>> 
> >>>>> Olivier, Aditya is right. You need to add the FP_EXTEND to the
> >>>>> operands of the resulting FMA as appropriate. Can you please
> >>>>> fix
> >>>>> that? We can also move those under the "aggressive" flag for
> >>>>> now.
> >>>>> 
> >>>>> 
> >>>>> Can you fix or revert this ASAP, please? The missing extends
> >>>>> are
> >>>>> breaking our branches pretty badly.
> >>>> 
> >>>> Yep, will do in a few minutes.
> >>> 
> >>> I moved the transformations behind the aggressive flag in r225485
> >>> --
> >>> that should unbreak your builds while I fix the extends.
> >> 
> >> FP_EXTEND nodes added as of r225492. Thanks for pointing this out!
> >> 
> >> -Hal
> >> 
> >>> 
> >>> -Hal
> >>> 
> >>>> 
> >>>> -Hal
> >>>> 
> >>>>> 
> >>>>> 
> >>>>> —Owen
> >>>> 
> >>>> --
> >>>> Hal Finkel
> >>>> Assistant Computational Scientist
> >>>> Leadership Computing Facility
> >>>> Argonne National Laboratory
> >>>> 
> >>>> _______________________________________________
> >>>> llvm-commits mailing list
> >>>> llvm-commits at cs.uiuc.edu
> >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >>>> 
> >>> 
> >>> --
> >>> Hal Finkel
> >>> Assistant Computational Scientist
> >>> Leadership Computing Facility
> >>> Argonne National Laboratory
> >>> 
> >>> _______________________________________________
> >>> llvm-commits mailing list
> >>> llvm-commits at cs.uiuc.edu
> >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >>> 
> >> 
> >> --
> >> Hal Finkel
> >> Assistant Computational Scientist
> >> Leadership Computing Facility
> >> Argonne National Laboratory
> >> 
> >> 
> >> 
> > 
> > --
> > Hal Finkel
> > Assistant Computational Scientist
> > Leadership Computing Facility
> > Argonne National Laboratory
> > 
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-commits mailing list