[Mesa-dev] [PATCH 3/4] r600: use ieee version of rcp

Roland Scheidegger sroland at vmware.com
Thu Nov 9 18:01:58 UTC 2017


Am 09.11.2017 um 18:58 schrieb Roland Scheidegger:
> Am 09.11.2017 um 18:27 schrieb Jan Vesely:
>> On Thu, 2017-11-09 at 03:58 +0100, sroland at vmware.com wrote:
>>> From: Roland Scheidegger <sroland at vmware.com>
>>>
>>> r600 used the clamped version for rcp, whereas both evergreen and cayman
>>> used the ieee version. I don't know why that discrepancy exists (it does so
>>> since day 1) but there does not seem to be a valid reason for this, so make
>>> it consistent. This seems now safer than before the previous commit (using
>>> the mystery dx10 clamp).
>>> Note that rsq still uses clamped version (as before even though the table
>>> may have suggested otherwise for evergreen) for r600/eg, but not for cayman.
>>
>> just layman's opinion here. Does TGSI not mandate specific behaviour
>> wrt nans and infinities for this OP?
> No, not really. Ideally all (non-legacy such as LIT) opcodes would
> follow ieee754 (or d3d10) semantics (and that's how they are implemented
> at least in llvmpipe). But we don't enforce denorm behavior for instance
> neither (llvmpipe will disable them - on x86 at least...).
> Some hw supported by gallium drivers also simply can't generate NaNs, no
> matter the opcode.
> I think in general drivers should try to stick as close to ieee754 (and
> d3d10) semantics as they can, regardless what GL may allow, so yes, I
> guess the ieee version should be used (albeit the abs modifier doesn't
> really fit in there neither, and that is done because there's problems
> otherwise).
> 
> Roland
> 
> 
>>
>>> I just don't feel lucky enough to change this (it should also be noted r600
>>> supports sqrt natively, which is always ieee, therefore might not really see
>>> rsqrt with glsl often presumably).
>>
>> why would that be? isn't RECIPSQRT_IEEE(x) still optimization over
>> RECIP_IEEE(SQRT(x))?

Forgot to mention previously, I was actually thinking glsl doesn't have
rsqrt, but that's not true. In any case, shaders using sqrt will have
this lowered to rsqrt/rcp on some drivers, but not r600.
I'll send out new patches also rsq to ieee behavior in any case...

Roland


More information about the mesa-dev mailing list