mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
DNN: add the Winograd fp16 support (#23654)
* add Winograd FP16 implementation * fixed dispatching of FP16 code paths in dnn; use dynamic dispatcher only when NEON_FP16 is enabled in the build and the feature is present in the host CPU at runtime * fixed some warnings * hopefully fixed winograd on x64 (and maybe other platforms) --------- Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
|
||||
set(CPU_ALL_OPTIMIZATIONS "SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F")
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS "AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SKX;AVX512_CNL;AVX512_CLX;AVX512_ICL")
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16 NEON_DOTPROD)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16 NEON_DOTPROD NEON_FP16 NEON_BF16)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS RVV)
|
||||
|
||||
@@ -15,12 +15,12 @@ int test()
|
||||
#include "arm_neon.h"
|
||||
int test()
|
||||
{
|
||||
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
short dst[8];
|
||||
float32x4_t v_src = *(float32x4_t*)src;
|
||||
const float src[] = { 0.0f, 1.0f, 2.0f, 3.0f };
|
||||
short dst[4];
|
||||
float32x4_t v_src = vld1q_f32(src);
|
||||
float16x4_t v_dst = vcvt_f16_f32(v_src);
|
||||
*(float16x4_t*)dst = v_dst;
|
||||
return (int)dst[0];
|
||||
vst1_f16((__fp16*)dst, v_dst);
|
||||
return dst[0] + dst[1] + dst[2] + dst[3];
|
||||
}
|
||||
#else
|
||||
#error "FP16 is not supported"
|
||||
|
||||
Reference in New Issue
Block a user