Skip to content

NEON doesn't get enabled on ARM #8945

@tomoaki0705

Description

@tomoaki0705
System information (version)
  • OpenCV => master ( b21b694 )
  • Operating System / Platform => Linux ARM32bit / Linux ARM64bit
  • Compiler => GCC 4.8.4, 5.4.0
Detailed description
  • CPU dispatch option is introduced, but it keeps blocking to activate the NEON on ARM platform
  • The main problem comes from obsolete options ENABLE_NEON here
OCV_OPTION(ENABLE_NEON                "Enable NEON instructions"                                 "${NEON}" IF CMAKE_COMPILER_IS_GNUCXX AND (ARM OR AARCH64 OR IOS) )
OCV_OPTION(ENABLE_VFPV3               "Enable VFPv3-D32 instructions"                            OFF  IF CMAKE_COMPILER_IS_GNUCXX AND (ARM OR AARCH64 OR IOS) )
ocv_optimization_process_obsolete_option(ENABLE_VFPV3 VFPV3 OFF)
ocv_optimization_process_obsolete_option(ENABLE_NEON NEON OFF)
  • This macro ocv_optimization_process_obsolete_option will check the obsolete option and pass it to the "new" dispatch option, but I think there is a bug in this macro which ends up always switching flags to OFF
    if(${legacy_flag}) # !!!! this will not be evaluated as ON/OFF !!!!
      if(NOT ";${CPU_BASELINE_REQUIRE};" MATCHES ";${OPT};")
        set(CPU_BASELINE_REQUIRE "${CPU_BASELINE_REQUIRE};${OPT}" CACHE STRING "${HELP_CPU_BASELINE_REQUIRE}" FORCE)
      endif()
    else()
      if(NOT ";${CPU_BASELINE_DISABLE};" MATCHES ";${OPT};")
        set(CPU_BASELINE_DISABLE "${CPU_BASELINE_DISABLE};${OPT}" CACHE STRING "${HELP_CPU_BASELINE_DISABLE}" FORCE)
      endif()
    endif()
  • as a conclusion, the NEON flag and FP16 flags always become false because those flag always go to CPU_BASELINE_DISABLE option.
  • I'll push a fix for this issue.
Steps to reproduce
  • on ARM 32bit (Jetson TK1)
cmake -DCPU_BASELINE=NEON ..
  • on ARM 64bit (Jetson TX1)
cmake ..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions