mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
3b015dfc7d
AVX512 wide universal intrinsics (#14210) * Added implementation of 512-bit wide universal intrinsics(WIP) * Added implementation of 512-bit wide universal intrinsics: implemented WUI vector types(WIP) * Added implementation of 512-bit wide universal intrinsics(WIP): implemented load/store * Added implementation of 512-bit wide universal intrinsics(WIP): implemented fp16 load/store * Added implementation of 512-bit wide universal intrinsics(WIP): implemented recombine and zip, implemented non-saturating and saturating arithmetics * Added implementation of 512-bit wide universal intrinsics(WIP): implemented bit operations * Added implementation of 512-bit wide universal intrinsics(WIP): implemented comparisons * Added implementation of 512-bit wide universal intrinsics(WIP): implemented lane shifts and reduction * Added implementation of 512-bit wide universal intrinsics(WIP): implemented absolute values * Added implementation of 512-bit wide universal intrinsics(WIP): implemented rounding and cast to float * Added implementation of 512-bit wide universal intrinsics(WIP): implemented LUT * Added implementation of 512-bit wide universal intrinsics(WIP): implemented type extension/narrowing and matrix operations * Added implementation of 512-bit wide universal intrinsics(WIP): implemented load_deinterleave for 2 and 3 channels images * Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented load_deinterleave for 2- and implemented for 4-channel images * Added implementation of 512-bit wide universal intrinsics(WIP): implemented store_interleave * Added implementation of 512-bit wide universal intrinsics(WIP): implemented signmask and checks * Added implementation of 512-bit wide universal intrinsics(WIP): build fixes * Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented popcount in case AVX512_BITALG is unavailable * Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented zip * Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented rotate for s8 and s16 * Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented interleave/deinterleave for s8 and s16 * Added implementation of 512-bit wide universal intrinsics(WIP): updated v512_set macros * Added implementation of 512-bit wide universal intrinsics(WIP): fix for GCC wrong _mm512_abs_pd definition * Added implementation of 512-bit wide universal intrinsics(WIP): reworked v_zip to avoid AVX512_VBMI intrinsics * Added implementation of 512-bit wide universal intrinsics(WIP): reworked v_invsqrt to avoid AVX512_ER intrinsics * Added implementation of 512-bit wide universal intrinsics(WIP): reworked v_rotate, v_popcount and interleave/deinterleave for U8 to avoid AVX512_VBMI intrinsics * Added implementation of 512-bit wide universal intrinsics(WIP): fixed integral image SIMD part * Added implementation of 512-bit wide universal intrinsics(WIP): fixed warnings * Added implementation of 512-bit wide universal intrinsics(WIP): fixed load_deinterleave for u8 and u16 * Added implementation of 512-bit wide universal intrinsics(WIP): fixed v_invsqrt accuracy for f64 * Added implementation of 512-bit wide universal intrinsics(WIP): fixed interleave/deinterleave for u32 and u64 * Added implementation of 512-bit wide universal intrinsics(WIP): fixed interleave_pairs, interleave_quads and pack_triplets * Added implementation of 512-bit wide universal intrinsics(WIP): fixed rotate_left * Added implementation of 512-bit wide universal intrinsics(WIP): fixed rotate_left/right, part 2 * Added implementation of 512-bit wide universal intrinsics(WIP): fixed 512-wide universal intrinsics based resize * Added implementation of 512-bit wide universal intrinsics(WIP): fixed findContours by avoiding use of uint64 dependent 512-wide v_signmask() * Added implementation of 512-bit wide universal intrinsics(WIP): fixed trailing whitespaces * Added implementation of 512-bit wide universal intrinsics(WIP): reworked specific intrinsic sets dependent parts to check availability of intrinsics based on CPU feature group defines * Added implementation of 512-bit wide universal intrinsics(WIP):Updated AVX512 implementation of v_popcount to avoid AVX512VPOPCNTDQ intrinsics if unavailable. * Added implementation of 512-bit wide universal intrinsics(WIP): Fixed universal intrinsics data initialisation, v_mul_wrap, v_floor, v_ceil and v_signmask. * Added implementation of 512-bit wide universal intrinsics(WIP): Removed hasSIMD512() * Added implementation of 512-bit wide universal intrinsics(WIP): Fixes for gcc build * Added implementation of 512-bit wide universal intrinsics(WIP): Reworked v_signmask, v_check_any() and v_check_all() implementation.
135 lines
4.8 KiB
C++
135 lines
4.8 KiB
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
#include "test_precomp.hpp"
|
|
|
|
#include "test_intrin128.simd.hpp"
|
|
#include "test_intrin128.simd_declarations.hpp"
|
|
|
|
#undef CV_CPU_DISPATCH_MODES_ALL
|
|
#include "opencv2/core/cv_cpu_dispatch.h"
|
|
#include "test_intrin256.simd.hpp"
|
|
#include "test_intrin256.simd_declarations.hpp"
|
|
|
|
#undef CV_CPU_DISPATCH_MODES_ALL
|
|
#include "opencv2/core/cv_cpu_dispatch.h"
|
|
#include "test_intrin512.simd.hpp"
|
|
#include "test_intrin512.simd_declarations.hpp"
|
|
|
|
#ifdef _MSC_VER
|
|
# pragma warning(disable:4702) // unreachable code
|
|
#endif
|
|
|
|
namespace opencv_test { namespace hal {
|
|
|
|
#define CV_CPU_CALL_BASELINE_(fn, args) CV_CPU_CALL_BASELINE(fn, args)
|
|
|
|
#define DISPATCH_SIMD128(fn, cpu_opt) do { \
|
|
CV_CPU_CALL_ ## cpu_opt ## _(fn, ()); \
|
|
throw SkipTestException("SIMD128 (" #cpu_opt ") is not available or disabled"); \
|
|
} while(0)
|
|
|
|
#define DISPATCH_SIMD256(fn, cpu_opt) do { \
|
|
CV_CPU_CALL_ ## cpu_opt ## _(fn, ()); \
|
|
throw SkipTestException("SIMD256 (" #cpu_opt ") is not available or disabled"); \
|
|
} while(0)
|
|
|
|
#define DISPATCH_SIMD512(fn, cpu_opt) do { \
|
|
CV_CPU_CALL_ ## cpu_opt ## _(fn, ()); \
|
|
throw SkipTestException("SIMD512 (" #cpu_opt ") is not available or disabled"); \
|
|
} while(0)
|
|
|
|
#define DEFINE_SIMD_TESTS(simd_size, cpu_opt) \
|
|
TEST(hal_intrin ## simd_size, uint8x16_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_uint8, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, int8x16_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_int8, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, uint16x8_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_uint16, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, int16x8_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_int16, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, int32x4_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_int32, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, uint32x4_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_uint32, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, uint64x2_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_uint64, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, int64x2_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_int64, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, float32x4_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_float32, cpu_opt); } \
|
|
TEST(hal_intrin ## simd_size, float64x2_ ## cpu_opt) { DISPATCH_SIMD ## simd_size(test_hal_intrin_float64, cpu_opt); } \
|
|
|
|
namespace intrin128 {
|
|
|
|
DEFINE_SIMD_TESTS(128, BASELINE)
|
|
|
|
#if defined CV_CPU_DISPATCH_COMPILE_SSE2 || defined CV_CPU_BASELINE_COMPILE_SSE2
|
|
DEFINE_SIMD_TESTS(128, SSE2)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_SSE3 || defined CV_CPU_BASELINE_COMPILE_SSE3
|
|
DEFINE_SIMD_TESTS(128, SSE3)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_SSSE3 || defined CV_CPU_BASELINE_COMPILE_SSSE3
|
|
DEFINE_SIMD_TESTS(128, SSSE3)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_SSE4_1 || defined CV_CPU_BASELINE_COMPILE_SSE4_1
|
|
DEFINE_SIMD_TESTS(128, SSE4_1)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_SSE4_2 || defined CV_CPU_BASELINE_COMPILE_SSE4_2
|
|
DEFINE_SIMD_TESTS(128, SSE4_2)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_AVX || defined CV_CPU_BASELINE_COMPILE_AVX
|
|
DEFINE_SIMD_TESTS(128, AVX)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_AVX2 || defined CV_CPU_BASELINE_COMPILE_AVX2
|
|
DEFINE_SIMD_TESTS(128, AVX2)
|
|
#endif
|
|
#if defined CV_CPU_DISPATCH_COMPILE_AVX512_SKX || defined CV_CPU_BASELINE_COMPILE_AVX512_SKX
|
|
DEFINE_SIMD_TESTS(128, AVX512_SKX)
|
|
#endif
|
|
|
|
TEST(hal_intrin128, float16x8_FP16)
|
|
{
|
|
CV_CPU_CALL_FP16_(test_hal_intrin_float16, ());
|
|
throw SkipTestException("Unsupported hardware: FP16 is not available");
|
|
}
|
|
|
|
} // namespace intrin128
|
|
|
|
|
|
namespace intrin256 {
|
|
|
|
|
|
// Not available due missing C++ backend for SIMD256
|
|
//DEFINE_SIMD_TESTS(256, BASELINE)
|
|
|
|
//#if defined CV_CPU_DISPATCH_COMPILE_AVX
|
|
//DEFINE_SIMD_TESTS(256, AVX)
|
|
//#endif
|
|
|
|
#if defined CV_CPU_DISPATCH_COMPILE_AVX2 || defined CV_CPU_BASELINE_COMPILE_AVX2
|
|
DEFINE_SIMD_TESTS(256, AVX2)
|
|
#endif
|
|
|
|
#if defined CV_CPU_DISPATCH_COMPILE_AVX512_SKX || defined CV_CPU_BASELINE_COMPILE_AVX512_SKX
|
|
DEFINE_SIMD_TESTS(256, AVX512_SKX)
|
|
#endif
|
|
|
|
TEST(hal_intrin256, float16x16_FP16)
|
|
{
|
|
//CV_CPU_CALL_FP16_(test_hal_intrin_float16, ());
|
|
CV_CPU_CALL_AVX2_(test_hal_intrin_float16, ());
|
|
throw SkipTestException("Unsupported hardware: FP16 is not available");
|
|
}
|
|
|
|
|
|
} // namespace intrin256
|
|
|
|
namespace intrin512 {
|
|
|
|
#if defined CV_CPU_DISPATCH_COMPILE_AVX512_SKX || defined CV_CPU_BASELINE_COMPILE_AVX512_SKX
|
|
DEFINE_SIMD_TESTS(512, AVX512_SKX)
|
|
#endif
|
|
|
|
TEST(hal_intrin512, float16x32_FP16)
|
|
{
|
|
CV_CPU_CALL_AVX512_SKX_(test_hal_intrin_float16, ());
|
|
throw SkipTestException("Unsupported hardware: FP16 is not available");
|
|
}
|
|
|
|
|
|
} // namespace intrin512
|
|
|
|
}} // namespace
|