-
Notifications
You must be signed in to change notification settings - Fork 346
Description
Review of handling of nans for Clamp function.
For min,max in wgsl the behavior for nan is called out explicitly
This behavior comes from the extended instructions of NMin, NMax SPIRV
if one operand is a NaN, the other is returned.
If both operands are NaNs, a NaN is returned.
This means you can trivially sanitize nan with these functions.
For wgsl Clamp we have either the min(max(... behavior or
"the median of the three values e, low, high."
This variant comes from AMD (GCN) but what is there anything specific that it says about nans. Any sort (implied by the median) might place the nan in a different location based on the the fact evaluation of comparison of nan being false.
The implementation of clamp in gecko is FClamp which works for all cases except for Nan.
The implementation min,max in tint is also Fmin,Fmax again doesnt work for Nan.
Adreno has significant bugs with NClamp having to do with vec2 and modification of the y component when x is nan. These have been worked around for the time being.
Spir-v extended ops
Metadata
Metadata
Assignees
Labels
Type
Projects
Status