When comparing fp16 values it's not possible to use a bitwise
comparison because there can be many different bit patterns
representing nan values, and all nans are equal. This CL updates
the computeCheckBuffersFloats function which compares two
buffers of fp16 values to take into account different forms
of nan.
Affects:
dEQP-VK.spirv_assembly.instruction.compute.16bit_storage.uniform_16_to_16.stress_test
Components: Vulkan
VK-GL-CTS issue: 1018
Change-Id: I77013b49ce070d9615b287eae24dd32731b314b1
using std::map;
using std::string;
using std::vector;
+using tcu::Float16;
using tcu::IVec3;
using tcu::IVec4;
using tcu::RGBA;
{
std::vector<deUint8> result;
originalFloats.front()->getBytes(result);
- return deMemCmp(&result[0], outputAllocs.front()->getHostPtr(), result.size()) == 0;
+
+ const deUint16 * results = reinterpret_cast<const deUint16 *>(&result[0]);
+ const deUint16 * expected = reinterpret_cast<const deUint16 *>(outputAllocs.front()->getHostPtr());
+
+ for (size_t i = 0; i < result.size() / sizeof (deUint16); ++i)
+ {
+ if (results[i] == expected[i])
+ continue;
+
+ if (Float16(results[i]).isNaN() && Float16(expected[i]).isNaN())
+ continue;
+
+ return false;
+ }
+
+ return true;
}
template<RoundingModeFlags RoundingMode>