Coder Social home page Coder Social logo

Comments (12)

mysoreanoop avatar mysoreanoop commented on July 25, 2024 1

@nibrunieAtSi5 Ah, yes, that makes sense, thank you for the explanation (typo in the 4th case for posterity).
@aamartin0000 I agree, that makes sense, thanks.

from berkeley-hardfloat.

nibrunieAtSi5 avatar nibrunieAtSi5 commented on July 25, 2024

I think this is a well known issue when using a FMA to execute FMUL only and is generally handled by an external wrapper. (Some people do not need / want to handle FMUL in an FMA and so the extra input should be optional and it makes more sense to have a proper FMA with the extra complexity and let people handle FMUL during the integration).

from berkeley-hardfloat.

mysoreanoop avatar mysoreanoop commented on July 25, 2024

Thanks for the reply, that makes sense. I'll close the issue.

from berkeley-hardfloat.

nibrunieAtSi5 avatar nibrunieAtSi5 commented on July 25, 2024

You may want to wait for others to chip in (I don't pretend to have the definitive answer on your relevant question).

from berkeley-hardfloat.

aamartin0000 avatar aamartin0000 commented on July 25, 2024

In my wrapper code that steers/modifies the source operands, the C operand can be a signed zero, the sign bit modified as needed. Determining the use of negative zero is not much logic, and has minimal impact to the timing.

An extra input, or any modification of mulAddRecFN, for this case is not needed.

from berkeley-hardfloat.

mysoreanoop avatar mysoreanoop commented on July 25, 2024

I see. So, you determine C based on the sign of A * B (and the rounding mode) that you recompute in your wrapper?
We ended up going with the HardFloat modification -- do you see any obvious issue with it?

from berkeley-hardfloat.

nibrunieAtSi5 avatar nibrunieAtSi5 commented on July 25, 2024

I think the sign of C=0 only depends on the rounding mode as -0 is the identity for addition for anything but rounding down (rounding towards minus infinity) and +0 is the identity of the addition when rounding down.

from berkeley-hardfloat.

mysoreanoop avatar mysoreanoop commented on July 25, 2024

If AB compute to 0 or -0, and that is all the operation is, then sign of C depends on sign of AB and the rounding mode -- right?

from berkeley-hardfloat.

nibrunieAtSi5 avatar nibrunieAtSi5 commented on July 25, 2024

I don't think so,

  • if A.B=+0
    • if rounding mode is down, then C=+0 and A.B + C = +0 + +0 = +0 (Ok)
    • if rounding mode is not down, then C=-0 and A.B + C = +0 + -0 = +0 (Ok, as +0 + -0 = +0 when not rounding down)
  • if A.B=-0
    • if rounding mode is down, then C=+0 and A.B + C = -0 + +0 = -0 (Ok, , as -0 + +0 = -0 in rounding down)
    • if rounding mode is not down, then C=-0 and A.B + C = -0 + -0 = -0 (Ok, as -0 + -0 = -0 when not rounding down)

so C does not depend on sign of A.B just on rounding mode.

from berkeley-hardfloat.

aamartin0000 avatar aamartin0000 commented on July 25, 2024

IMHO, this modification should be local to your implementation, and not released to the main code branch. My wrapper around mulAddRecFN involves steering/modifying the operands for fadd/fsub, NaN boxing, and different sized operands (e.g. using a single instance for dp and sp). No modifications to mulAddRecFN, other than to add pipeline flops.

Having said that, my starting point was the Verilog code, not the scala code. So even if you change the Scala, I won't need to make any local changes.

from berkeley-hardfloat.

nibrunieAtSi5 avatar nibrunieAtSi5 commented on July 25, 2024

(Thx, posterity is important)

from berkeley-hardfloat.

aamartin0000 avatar aamartin0000 commented on July 25, 2024

In my wrapper, the code is essentially
sZero = (rs1 != rs2) ? neg_zero : pos_zero

and then this is chosen for "C" if it's fmul. Although doing a full comparison is somewhat expensive, its latency is buried by "fNToRecFN" source operand recoding being done in parallel. Note that the equation doesn't include the rounding mode.

from berkeley-hardfloat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.