From f149e0ebc3d3d5ca63234e58ca72690caf07e3b5 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Thu, 7 Jan 2021 09:39:05 -0800 Subject: Fix MSVC complex sqrt and packetmath test. MSVC incorrectly handles `inf` cases for `std::sqrt>`. Here we replace it with a custom version (currently used on GPU). Also fixed the `packetmath` test, which previously skipped several corner cases since `CHECK_CWISE1` only tests the first `PacketSize` elements. --- test/packetmath_test_shared.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/packetmath_test_shared.h') diff --git a/test/packetmath_test_shared.h b/test/packetmath_test_shared.h index f8dc3711c..46a42604b 100644 --- a/test/packetmath_test_shared.h +++ b/test/packetmath_test_shared.h @@ -115,6 +115,17 @@ template bool areApprox(const Scalar* a, const Scalar* b, int s VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \ } +// Checks component-wise for input of size N. All of data1, data2, and ref +// should have size at least ceil(N/PacketSize)*PacketSize to avoid memory +// access errors. +#define CHECK_CWISE1_N(REFOP, POP, N) { \ + for (int i=0; i(data1 + j))); \ + VERIFY(test::areApprox(ref, data2, N) && #POP); \ +} + template struct packet_helper { -- cgit v1.2.3