is VFPV3 necessary (or suitable) for ARM64?

1.9k Views Asked by At

I am trying to compile OpenCV for the Jetson AGX Xavier (ARM64) with the option VFPV3 and get the error

CMake Error at cmake/OpenCVCompilerOptimization.cmake:527 (message)
Required baseline optimization is not supported: VFPV3
(CPU_BASELINE_REQUIRE=;VFPV3;NEON)

Then reading several posts on the internet, it seems that VFPV3 is used for ARMv7. So my question is , is VFPV3 supported or even necessary to set active in a ARMv8 platform?

1

There are 1 best solutions below

2
On

According to this entry on the opencv github, using -march=native -mcpu=native -mtune=native is sufficient for opencv to be optimized for using NEON and VFPv3/VFPv4 when compiled with aarch64-linux-gcc.

More specifically opencv/cmake/OpenCVCompilerOptimizations.cmake does not use any specific option for AARCH64, since, again, NEON and VFP are implicitly present in an any standard armv8-a implementation - see if(NOT AARCH64) statement:

elseif(ARM OR AARCH64) 
   ocv_update(CPU_NEON_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_neon.cpp") 
   ocv_update(CPU_FP16_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_fp16.cpp") 
   if(NOT AARCH64) 
     ocv_update(CPU_KNOWN_OPTIMIZATIONS "VFPV3;NEON;FP16") 
     if(NOT MSVC) 
       ocv_update(CPU_VFPV3_FLAGS_ON "-mfpu=vfpv3") 
       ocv_update(CPU_NEON_FLAGS_ON "-mfpu=neon") 
       ocv_update(CPU_NEON_FLAGS_CONFLICT "-mfpu=[^ ]*") 
       ocv_update(CPU_FP16_FLAGS_ON "-mfpu=neon-fp16 -mfp16-format=ieee") 
       ocv_update(CPU_FP16_FLAGS_CONFLICT "-mfpu=[^ ]*") 
     endif() 
     ocv_update(CPU_FP16_IMPLIES "NEON") 
   else() 
     ocv_update(CPU_KNOWN_OPTIMIZATIONS "NEON;FP16") 
     ocv_update(CPU_NEON_FLAGS_ON "") 
     ocv_update(CPU_FP16_IMPLIES "NEON") 
     set(CPU_BASELINE "NEON;FP16" CACHE STRING "${HELP_CPU_BASELINE}") 
   endif() 
 elseif(MIPS) 

So, again, answer to is VFPV3 supported in a ARMv8 platform would be yes, and to is it even necessary to set VFPV3 active in a ARMv8 platform? would be no.