4 ms·
Why is floating point math faster than integer? (Seems like integer should be simpler)
by joevandyk 13y ago
Why is floating point math faster than integer? (Seems like integer should be simpler)
- kevingadd 13y agoModern graphics hardware is tuned for floating point math, and may actually have less capacity for integer arithmetic.
- neobrain 13y agoBasically, what kevingadd said. As a matter of fact, AMD GPUs are using the floating point ALUs to perform integer math (note: this might have changed with their GCN architecture). However, given that the mantissa of IEEE floats is just 24 bits long, the ALU also can just handle 24 bits, which is not sufficient for full 32 bit math. Hence, for "true" integer arithmetic, the ALUs need to be double-pumped or emulated via floats (i.e. the dirty tricks which we avoided need to be done in the driver instead - but at this stage it can actually be done reliably, even if it's still ugly). I assume the situation is similar for Nvidia GPUs. Either way both vendors said their GPUs aren't designed for optimal integer performance - so that's why we expect the performance drawbacks of integer usage to become less and less of an issue in the future.
- foxhill 13y agoi'd like to see a source for that claim, regardless, pre-GCN GPUs had double precision support that wasn't purposefully knee-capped. 52 bits of mantissa would have been plenty. as for nvidia knee-capping integer arithmetic on their GPUs.. i terribly doubt that is the case - pointer arithmetic (and hence memory access) requires integer operations, and i've seen very little evidence to suggest that there are any artificial issues with it.
- neobrain 13y agoThere's no public source for the claim, it's what an AMD engineer told me via private e-mail (and I don't want to publish private mails for obvious reasons). That said, there's a "fast" path on AMD GPUs for shader code which only requires 24 bits of integer precision. Those are actually exactly enough for GameCube/Wii GPU emulation, however I'm not sure if their shader compiler properly optimizes our code to use that path.
- Retric 13y agoNvidia gimps the integer and double precision floating point math so they can sell ungimped chips for several times the price. http://www.nvidia.com/object/quadro.html http://www.nvidia.com/object/quadro.html Granted, most games don't use double precision or integer math so it's a reasonable choice for market segmentation.