> On Jan 28, 2015, at 3:47 PM, Hal Finkel <hfinkel at anl.gov> wrote: > > ----- Original Message ----- >> From: "Matt Arsenault" <Matthew.Arsenault at amd.com> >> To: "llvmdev at cs.uiuc.edu" <LLVMdev at cs.uiuc.edu> >> Sent: Wednesday, January 28, 2015 1:52:59 PM >> Subject: [LLVMdev] RFC: Add ISD nodes for mad >> >> Hi, >> >> I would like to add an ISD node for an fmad operation (named either >> FMAD >> or FMULADD). It will have the semantics of returning the same result >> as >> the separate multiply and add with the intermediate rounding step, >> and >> not a differently rounded result. The motivation is to share code >> with >> the various FMA forming DAG combines, but will be generally more >> useful >> on targets that support it since it is OK to form without non-default >> -fp-contract modes. > > Why not just reuse the existing FMA node, but add an additional parameter to indicate whether enhanced intermediate precision is required?Because that would break a lot of existing backends? —Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150128/5f0f9370/attachment.html>
> On Jan 28, 2015, at 4:54 PM, Owen Anderson <resistor at mac.com> wrote: > >> >> On Jan 28, 2015, at 3:47 PM, Hal Finkel <hfinkel at anl.gov <mailto:hfinkel at anl.gov>> wrote: >> >> ----- Original Message ----- >>> From: "Matt Arsenault" <Matthew.Arsenault at amd.com <mailto:Matthew.Arsenault at amd.com>> >>> To: "llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>" <LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>> >>> Sent: Wednesday, January 28, 2015 1:52:59 PM >>> Subject: [LLVMdev] RFC: Add ISD nodes for mad >>> >>> Hi, >>> >>> I would like to add an ISD node for an fmad operation (named either >>> FMAD >>> or FMULADD). It will have the semantics of returning the same result >>> as >>> the separate multiply and add with the intermediate rounding step, >>> and >>> not a differently rounded result. The motivation is to share code >>> with >>> the various FMA forming DAG combines, but will be generally more >>> useful >>> on targets that support it since it is OK to form without non-default >>> -fp-contract modes. >> >> Why not just reuse the existing FMA node, but add an additional parameter to indicate whether enhanced intermediate precision is required? > > Because that would break a lot of existing backends?Can’t you have “optional” parameters? I mean the number of parameter you can add to a node is never checked or defined, it is implicit from the ISD OpCode AFAIK. If you add a parameter to FMA, wouldn’t it just be ignored by the existing backends? — Mehdi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150128/4630c7ef/attachment.html>
On 01/28/2015 05:15 PM, Mehdi Amini wrote:> > Can’t you have “optional” parameters? I mean the number of parameter > you can add to a node is never checked or defined, it is implicit from > the ISD OpCode AFAIK. > If you add a parameter to FMA, wouldn’t it just be ignored by the > existing backends?You can have variadic nodes, but they are difficult to work with. It wouldn't be worth it for this.
----- Original Message -----> From: "Owen Anderson" <resistor at mac.com> > To: "Hal Finkel" <hfinkel at anl.gov> > Cc: "Matt Arsenault" <Matthew.Arsenault at amd.com>, "llvmdev at cs.uiuc.edu" <LLVMdev at cs.uiuc.edu> > Sent: Wednesday, January 28, 2015 6:54:23 PM > Subject: Re: [LLVMdev] RFC: Add ISD nodes for mad > > On Jan 28, 2015, at 3:47 PM, Hal Finkel < hfinkel at anl.gov > wrote: > > ----- Original Message ----- > > > From: "Matt Arsenault" < Matthew.Arsenault at amd.com > > To: " llvmdev at cs.uiuc.edu " < LLVMdev at cs.uiuc.edu > > Sent: Wednesday, January 28, 2015 1:52:59 PM > Subject: [LLVMdev] RFC: Add ISD nodes for mad > > Hi, > > I would like to add an ISD node for an fmad operation (named either > FMAD > or FMULADD). It will have the semantics of returning the same result > as > the separate multiply and add with the intermediate rounding step, > and > not a differently rounded result. The motivation is to share code > with > the various FMA forming DAG combines, but will be generally more > useful > on targets that support it since it is OK to form without non-default > -fp-contract modes. > > Why not just reuse the existing FMA node, but add an additional > parameter to indicate whether enhanced intermediate precision is > required? > > Because that would break a lot of existing backends?Fair enough. Generally speaking, I think that having some mechanism to share the DAGCombines between the two kinds of FMAs is a good idea (I took a quick look through the existing DAGCombine code, and it seems worth sharing and most of them (except for the combines including fpext nodes) won't be affected by the precision changes). I'd need to see a patch to be sure, however. -Hal> > > —Owen-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory
On 01/28/2015 07:06 PM, Hal Finkel wrote:> ----- Original Message ----- >> From: "Owen Anderson" <resistor at mac.com> >> To: "Hal Finkel" <hfinkel at anl.gov> >> Cc: "Matt Arsenault" <Matthew.Arsenault at amd.com>, "llvmdev at cs.uiuc.edu" <LLVMdev at cs.uiuc.edu> >> Sent: Wednesday, January 28, 2015 6:54:23 PM >> Subject: Re: [LLVMdev] RFC: Add ISD nodes for mad >> >> On Jan 28, 2015, at 3:47 PM, Hal Finkel < hfinkel at anl.gov > wrote: >> >> ----- Original Message ----- >> >> >> From: "Matt Arsenault" < Matthew.Arsenault at amd.com > >> To: " llvmdev at cs.uiuc.edu " < LLVMdev at cs.uiuc.edu > >> Sent: Wednesday, January 28, 2015 1:52:59 PM >> Subject: [LLVMdev] RFC: Add ISD nodes for mad >> >> Hi, >> >> I would like to add an ISD node for an fmad operation (named either >> FMAD >> or FMULADD). It will have the semantics of returning the same result >> as >> the separate multiply and add with the intermediate rounding step, >> and >> not a differently rounded result. The motivation is to share code >> with >> the various FMA forming DAG combines, but will be generally more >> useful >> on targets that support it since it is OK to form without non-default >> -fp-contract modes. >> >> Why not just reuse the existing FMA node, but add an additional >> parameter to indicate whether enhanced intermediate precision is >> required? >> >> Because that would break a lot of existing backends? > Fair enough. > > Generally speaking, I think that having some mechanism to share the DAGCombines between the two kinds of FMAs is a good idea (I took a quick look through the existing DAGCombine code, and it seems worth sharing and most of them (except for the combines including fpext nodes) won't be affected by the precision changes). I'd need to see a patch to be sure, however. > > -HalSo do you think I should attempt to write a patch that adds this node, or find some other method for sharing these? Would something analogous to TLI.getRecipEstimate() be preferrable? -Matt