FP - DX9 vs IEEE-32

LeStoffer said:
sireric said:
6) FP32 vs. FP24 would not only be 30% larger from a storage standpoint, the multipliers and adders would be nearly twice as big as well.

Interesting info. The FP24 choice obviously had a lot to do with your silicon budget, but I didn't realize that FP32 is so demanding over FP24.

Though hardly an expert in the subject I would maybe not have guessed it to be nearly twice as big, but easily > 50% larger. A quick thought over the operations involved in floating point math kinda hints that transistor count would grow closer to a sqaure function of the bit-count rather than linearly.
 
Humus said:
A quick thought over the operations involved in floating point math kinda hints that transistor count would grow closer to a sqaure function of the bit-count rather than linearly.

Thanks, Humus. It kinda gives us a hint about what all those transitors went into on the NV3X architecture. Expensive stuff, some of those FP32 ALU units.
 
The multipliers area is roughly proportional to the product of the mantissa sizes (i.e. 16x16 vs. 24x24 is 256 vs. 576).

Adder area scales with mantissa size, plus overhead, depending on the final shifter (which is closer to the sum of the mantissa sizes).

The 30% for storage is simply 32 vs 24. That's a minimum across the board. The DP area is between 30% and 100% area growth.

Overall, that would translate to extra $$ that users would pay for, and they would get *nothing* in return.

Not a good deal.
 
sireric said:
Overall, that would translate to extra $$ that users would pay for, and they would get *nothing* in return.

That's sounding a little bit like the old 3dfx "16 bit is good enough".

You'd get something in return, it just might not be useful now; or worth what you pay for it.

Surely sometime in the future FP32 will be required, and even then, somebody will be bitching for more precision.
 
Don't get me wrong. Certainly at some point it will be required. But, from the analysis I showed, it will require larger textures, filtering on FP texture, probably native FP frame buffer as well as the development of procedural type shading.

Those things are here yet, so adding 32b SPFP will really not give anything to anyone. For that matter, even FP24 is overkill for all DX7 and DX8 apps (i.e. NV3x forces FP16 for all shaders, without any trouble). R300, with FP24, shoots to really benefit DX9 apps, which will come this year and in two to three years.

Beyond that, there will be more graphics chips and different requirements.
 
sireric said:
Don't get me wrong. Certainly at some point it will be required. But, from the analysis I showed, it will require larger textures, filtering on FP texture, probably native FP frame buffer as well as the development of procedural type shading.

Those things are here yet, so adding 32b SPFP will really not give anything to anyone. For that matter, even FP24 is overkill for all DX7 and DX8 apps (i.e. NV3x forces FP16 for all shaders, without any trouble). R300, with FP24, shoots to really benefit DX9 apps, which will come this year and in two to three years.

Beyond that, there will be more graphics chips and different requirements.

Thanks for the posts and congratulations on the excellent dx9 Radeon designs.
 
I find it very admirable that someone with such an important position within the 3D hardware and technology community has taken the time to explain and clarify, what many times are, behind the scenes, undisclosed, facts.

Thankyou sireric. :D
 
Another thing about IEEE 754 compliant floats. They require muls and adds to give the result of a correctly rounded exact calculation. That definition gives repeatability between different hardware, but at a steep price.

The maximum rounding error after a multiplication is then 0.5*least significant bit in mantissa. But if you allow that error to increase as little as to 0.8*lsb in mantissa, you can save ~30% of the gates in the multiplicator (24 bit mantissa).

The same approximation with 16 bit mantissa can save ~25% gates if the error is allowed to be 0.85*lsb in mantissa.

Since the DX9 definition says at least fp24, we will (already do) have hardware that use different precision. So all code written should never rely on precision in any other way than "at least as good as...". Or in other words, pixel programs should not depend on exact repeatability between different hardware.

So I think the approximation I said above would be good in a PS unit.

[Edit]
Corrected some numbers above.
 
Basic said:
The maximum rounding error after a multiplication is then 0.5*least significant bit in mantissa. But if you allow that error to increase as little as to 0.8*lsb in mantissa, you can save ~30% of the gates in the multiplicator (24 bit mantissa).

...

So I think the approximation I said above would be good in a PS unit.
I'm not so sure. There are many different ways to deal with the error. It is, for example, quite feasible for the error in these calculations to always be additive.

Such error would be absolutely devastating for the accuracy of anything resembling a long program.
 
sireric said:
Those things are here yet, so adding 32b SPFP will really not give anything to anyone. For that matter, even FP24 is overkill for all DX7 and DX8 apps (i.e. NV3x forces FP16 for all shaders, without any trouble). R300, with FP24, shoots to really benefit DX9 apps, which will come this year and in two to three years.
I'm not sure about that. Graphics cards have supported 2048x2048 textures for some time now. Such textures require 11 bits of integer data for addressing, plus buffer bits to ensure accuracy. FP16 isn't enough for this (With its 10-bit mantissa, FP16 would probably work well for up to about 8-bit addressing, or 256x256 texture sizes).
 
As some has said, thanks for your comments Eric. However...

sireric said:
About some misconceptions, and some comments:

1) IE^3 standards do not specify what should be returned for transcendental functions (sqrt, sin, etc...). They specify the format of data (including nans, infinites, denorms) and the internal roundings for results -- This rounding is not the f2i conversion, but how to compute the lsbs of the results. Different HW can return different results. People have learned to live with this.

Correct but here you have a fine alternative: if you need a reproducable version of cos, you can implement it yourself as a Taylor series, using floating point add and mul, if add and mul are deterministic. But if add and mul aren't deterministic, it's impossible to implement anything deterministically at all. The basic arithmetic ops are the building blocks.

If you need 24b of mantissa precision, FP32 is not enough for you anyway.

FP32 is 1.8.23

2) IE^3 does not guarantee, in any way, that operations are order independant. For example, consider:
result = a + b + c
The above, generally, needs to be broken down into 2 operations. If we select a = 1.0, b = -1.0 and c = 2^(-30), then the result can be 0 or c. Depends on the implementation. IE^3 does not "specify" anything. The programmer needs to specify what he wants (i.e. (a+b)+c).

Er...no, not according to my understanding. IEEE doesn't have any such operation as "a+b+c" whose order is undefined. IEEE only has "a+b", so to add three numbers you need to either specify "(a+b)+c" or "a+(b+c)", either of which is reproducible. Or use a language like C which has well-defined precedence and associativity rules, so that "a+b+c" is defined as being exactly the same as "(a+b)+c" and not "a+(b+c)". Any violation of this in modern languages is an optional compiler optimization that defaults to "off" and is called something like "optimize floating-point operations aggressively". We don't want this even if it's already happening ;) :)

2.5) IE^3 support for nans, inf and denorms is just not needed in PS. In the final conversion to [0,1.0] range, inf and 2.0 would give the same output. For that matter, it's not needed in VS either.

They're not needed if and only if you don't care about reproducability. But if you're going to do like NVidia does and sometimes run VS operations on the CPU for load-balancing, then you get different results along both paths, which is bad. This is exactly the kind of problem the IEEE spec was designed to remedy, so why not use it?

Saying "this device is IEEE compliant, with this small set of exceptions" is like saying "I am a virgin, with this small set of exceptions". Either Tagrineth is a virgin, or she's not :LOL: .

Again it all comes down to whether you see 3D hardware as a deterministic computational device which produces well-defined output for any input, or it's just some black box that you feed polygons into to produce some sort of random approximation of your scene.

3) FP24 has less precision than FP32, but has no worst other characteristics (well, range is reduce by 2^63 as well). Order of operations would be no "worst" than fp32, beyond the precision limits.

You're implying that the effect of precision loss on FP24 vs FP32 is linear, a sort of one-time penalty -- that's not the case at all in my books. In the worst case, cascading loss-of-precision errors can increase exponentially as a function of instruction count divided by mantissa bit count.

4) What are the outputs of the shader? There are two: The 10b color or 11b texture address (actually, with subtexel precision for filters, you could expect the texture address to be up 15b). With FP24, you get 17b of denormalized precision, which would allow you to have up to 8 (assuming 1/2 lsb of error per operation) ALU instructions at maximum error rate before even noticing any change in the texture address or texture filtering. Until texture sizes increase significantly (2kx2k right now, will give you a 16MB texture -- I don't know of many apps that even use that now), or that texture filtering on FP texture exists, there really is no need for added precision. On the other hand, it's obvious that FP16 is not good enough, unless you have smallish textures (i.e. < 512x512).

"Assuming 1/2 lsb of error per operation" is not realistic. The number of lsb's of error in the worst case can be equal to the difference between the two exponents in the computation, so you can easily have 2, 4, 8, or 16 lsb's of error in any given computation. For example, in a shader that says something like 1/square(magnitude(LightPosition-TexelPosition)), unless your light and texel are real close together, that subtract can easily have many bits of lsb error, and squaring that quantity then doubles the number of error bits.

5) The only exception to 4 above is for long procedural texture generation. In those cases you could expect that some fp24 limits would come into play. There's no real use of that out there right now, and we are probably years from seeing it in mainstream.

If Intel applied this kind of "gee, there's no real use for this combination of instructions" when designing the x86, it would be impossible to write the kind of programs people wrote.

Nevertheless, our Ashli program can take procedural texture generation code from Renderman, and generate long pixel shaders. We've generated shaders that are thousands of instructions long. What we found is that it looks perfect, compared to the original image. No one would ever complain about that quality -- It's actually quite amazing. So, empirically, we found that even in these cases, FP24 is a nearly perfect solution.

Sure, it's easy to come up with a 1000-instruction shader that looks perfect with FP24, and easy to come up with a 3-instruction shader that looks like crap with FP24 then looks great with FP32, and then a 3-instruction shader that looks like crap with FP32 but is great with FP64. Floating point is like that. :)

6) FP32 vs. FP24 would not only be 30% larger from a storage standpoint, the multipliers and adders would be nearly twice as big as well. That added area would of increased cost and given no quality benefits. We could of implemented a multi-pass approach to give higher precision, but we felt that simplicity was a much higher benefit. Given the NV3x PP fiasco, we even more strongly believe now that a single precision format is much better from a programming standpoint (can anyone get better than FP16 on NV3x?).

FP24 was a reasonable decision for the R3x0, which was available basically a year before NV30. It's a lot better than 8-bit integer and gave everyone a sneak peak at DX9's capabilities. But it should be considered a stepping stone, to be phased out as soon as FP32 is commercially viable, rather than being considered a long-term solution. And FP32 may be becoming viable now with NV35 (haven't got one, can't really say for sure). It's just like 3dfx's situation with 16-bit: it was the right solution in 1997, but when 1999 came and they were arguing that it was good enough and nobody needed 32-bit, well, that was not a realistic view.

[edit]Eh, didn't see Russ already mentioned the 3dfx-16-bit stance

At the end of it all, we believe we did the right engineering decision. We weighed all the factors and picked the best solution. DX9 did not come before the R300 and specify FP24. We felt that FP24 was the "right" thing, and DX9 agreed.

Like I said, the R3x0's is a fine part, a good start wrt FP. I just hope it doesn't become set in stone.

Like Simon F said, IANAHE so these are just my understanding.

[edit]minor touch-ups
 
Rev, where is the suggestion that this will or won't be replaced? We're only on the second iteration of shader architectures and we've jumped from 8-12 bit integer to fast 24bit FP - this is quite a leap. More than likely the precision will increase on a general level but this is unlikely to happen until newer silicon process (90nm) allow the footprint needed for it to occur at higher performance levels and we see newer API's.
 
Reverend said:
"Assuming 1/2 lsb of error per operation" is not realistic. The number of lsb's of error in the worst case can be equal to the difference between the two exponents in the computation, so you can easily have 2, 4, 8, or 16 lsb's of error in any given computation. For example, in a shader that says something like 1/square(magnitude(LightPosition-TexelPosition)), unless your light and texel are real close together, that subtract can easily have many bits of lsb error, and squaring that quantity then doubles the number of error bits.
I think you'd better think some more about the above example. The error bits you refer to are beyond the precision of your numbers so they basically don't count and you end up with a 1 bit error on your subtraction. In other words, if one number is of much larger magnitude than the other then the result of your subtraction is the larger number with the lsb being an error bit.
FP24 was a reasonable decision for the R3x0, which was available basically a year before NV30. It's a lot better than 8-bit integer and gave everyone a sneak peak at DX9's capabilities. But it should be considered a stepping stone, to be phased out as soon as FP32 is commercially viable, rather than being considered a long-term solution. And FP32 may be becoming viable now with NV35 (haven't got one, can't really say for sure).
Let's ask nVidia how viable FP32 is on the NV35. Answer: They'd rather run games/benchmarks in DX8 mode than DX9 mode. Oops! I guess that means that FP16 isn't even viable. Now, please tell us again who is giving the "sneak peek" at DX9 functionality?

-FUDie
 
Dave, ATi is on a roll. Some of their representatives have said "FP24 is good enough" many a times. I'm not saying this won't improve... I'm just worried it may not for a long time to come. I don't want, for instance, R400 to still have this. It's a possible scenario, given the comments by ATi representatives paraphrased above. I guess I'm just a pessimist.

Who knows -- perhaps if the R3x0 is full FP32, it may encounter the same performance problems we're seeing with the NV3x, so, like I said, it is a good initial step forward. When you mess around with codes, you're likely to get a little more frustrated than if you don't mess around.

Like I said, it's just my views.

PS. I'm leaving for work now. Will respond if the need arises when I'm at the office. Ta!
 
Reverend said:
Dave, ATi is on a roll. Some of their representatives have said "FP24 is good enough" many a times.

And thats probably a reasonable statement most of the time for the types and sizes of shaders available in DX9. I'd guess that by the time DX10 gets here FP32 may well be the baseline, but thats also probably a resonable time scale for the FP24 baseline to have been around and the shader specifications available in DX10 will also probably make it more worthwhile more of the time.
 
DaveBaumann said:
And thats probably a reasonable statement most of the time for the types and sizes of shaders available in DX9. I'd guess that by the time DX10 gets here FP32 may well be the baseline
I think what Reverend was worrying about was that an ATI engineer is here today saying "FP32 is too much" when they're likely well into the design cycle for their R400/DX10 card--which means their next generation won't support it.
 
Yes, and he seems to be talking in relation to DX9, not any future revisions, since his NDA prevents him talking about things that may occur in the future. "R400" (or whatever is next) is likely still to be a DX9 part so that will probably stay FP24 as well, I would expect DX10 parts to have different base precisions.
 
Dave said:
Rev said:
Dave, ATi is on a roll. Some of their representatives have said "FP24 is good enough" many a times.
And thats probably a reasonable statement most of the time for the types and sizes of shaders available in DX9. I'd guess that by the time DX10 gets here FP32 may well be the baseline, but thats also probably a resonable time scale for the FP24 baseline to have been around and the shader specifications available in DX10 will also probably make it more worthwhile more of the time.
No arguments there with you -- it's a reasonable statement and perfectly acceptable to me given the current industry progress/state.

I think I probably shouldn't be mentioning IHVs and their parts here -- I am just concerned about FP32 and used ATI and their R3x0 as an example for expressing my concerns about the possibility of FP24 being here to stay for a while to come, when I have my own conceptions about DX9 and IEEE.

Let's focus on FP24, FP32, DX9 and IEEE and what they all mean, without mentioning IHVs and parts.

Dave said:
"R400" (or whatever is next) is likely still to be a DX9 part so that will probably stay FP24 as well, I would expect DX10 parts to have different base precisions.
I hope this is not the case -- ATi is the leader now, with a lot of folks buying their parts, which is something developers always take into consideration... ATi should start pushing things, like NVIDIA did with 32-bit, static TnL and DX8 shaders back then. I'm sure nobody will complain. But then, time and market penetration is a very important factor so if R400 still has a FP24 "limit", I'd understand the decision but I personally would wish for more.

You seem to speak from the POV of "what's available and, therefore, what should be the case" while I wanted this very specific topic to be about going forward when FP24 made its debut while FP32 was already understood to be available to many developers as evangelized by ATi devrel wrt R3x0. Sorry if this intention of mine in starting this thread wasn't clear. It's kinda like 3DMark03 (oh no, not that word!) -- it's useless to look at it as representative of the way things are at the moment, in terms of both HW availability and, hence, SW implementation based on HW availability... it's more a look at what should come. You've always viewed 3DMark03 as primarily a glimpse of what is to come -- I am just expanding on that but not necessarily purely on a SW POV. Something like that, I think :)

I think we should not continue this line of discussion and just focus on what FP24 vs FP32 would mean to programmers. The difference is that I know what IEEE-32 avails to me that FP24 cannot regardless of HW availability at this time. Hopefully you will understand what I mean in this aspect.
 
Back
Top