cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sgratton
Adept I

muladd rounding

Hi there,

Would anybody mind detailing the actual rounding procedure that the MULADD instruction follows in its various flavours, i.e. MULADD, MULADD_IEEE and MULADD_64? Do any of them actually work out a*b+c and then only round at the end?

(...I think I may have read somewhere that, for MULADD at least, a*b is truncated and then this truncated product is added with rounding to c, but it'd be good to know for sure and if this applies to all variants).

Best,
Steven.
0 Likes
5 Replies
marcr
Staff

Hi Steven,

Given that fused multiply-add is not part of IEEE 754 yet, I would guess that current ISAs do not use it. The R600 ISA spec doesn't say anything about it, either.

I could try to track down someone in core engineering who can answer this for sure. Do you have application code that depends on the outcome? This would be highly implementation dependent, and non portable.

Marc (@AMD)
0 Likes

Hi Marc,

Thanks for your reply; I too couldn't find a statement either way in the r600 document. For numerical computatation I think it would be generally helpful to have on record what is actually being calculated by the card. I guess it would be possible to figure it out by trial and error but there are quite a few variants and special cases to check.

I'd like to do cholesky factorization of largish matrices, in single precision if possible for speed. I'm a little worried about truncation error accumulating, if indeed multiply-add truncates, though I haven't actually estimated yet whether this is a problem in practice.

Best,
Steven.
0 Likes

Ok, core engineering says that the combined muladd is definitely not a fused muladd, and that the result should be exactly the same as a mul followed by an add (which can be verified). This is for the current generation of chips, and may change in the future. Again, non portable, and an app at the Brook+ level should be shielded from this level of detail.

Marc
0 Likes

Hi Marc,

Thanks a lot for checking this out. It's good that a muladd should be the same as a mul followed by an add, so there should be no bias (and no need to compare a muladd version of code to a mul-and-add version). Then of course if eventually future hardware does a fused muladd that'll be even better with less round-off error.

(To address questions like this, perhaps AMD might consider eventually providing in the firestream documentation a table of the accuracy of all the mathematical functions?)

Best wishes,
Steven.
0 Likes

Hi Steven, good point!

I've got that down for our tech writer to chase down when he is cleaning up the documentation.

Michael.
0 Likes