drowe67 / LPCNet

Experimental Neural Net speech coding for FreeDV
BSD 3-Clause "New" or "Revised" License
68 stars 24 forks source link

test_vec.c fails with no SSE, no AVX, no NEON #64

Closed kabe-gh closed 9 months ago

kabe-gh commented 9 months ago

With no SSE, no AVX, no NEON, compile fails:

/home/kabe/r9builds/lpcnetfreedv-epel-r9/BUILD/LPCNet-0.2/src/test_vec.c:109: undefined reference to `sparse_sgemv_accum16_fast'
collect2: error: ld returned 1 exit status

patch-no-sse.patch Above patch seems to fix this. #include "vec.h" was missing.

tmiw commented 9 months ago

Interesting. test_vec.c actually isn't supposed to be included in the build unless there is SSE/AVX. From src/CMakeLists.txt:

if(
    (${SSE} AND (${SSE_PRESENT} OR ${SSE_PRESENT} GREATER 0)) OR
    (${AVX} AND (${AVX_PRESENT} OR ${AVX_PRESENT} GREATER 0)) OR
    (${AVX2} AND (${AVX2_PRESENT} OR ${AVX2_PRESENT} GREATER 0)) OR
    (${NEON} AND (${NEON_PRESENT} OR ${NEON_PRESENT} GREATER 0)) OR
    CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
    add_executable(test_vec test_vec.c)
    target_link_libraries(test_vec m)

    if(LPCNET_C_PROC_FLAGS)
        set_source_files_properties(test_vec.c PROPERTIES COMPILE_FLAGS ${LPCNET_C_PROC_FLAGS})
    endif(LPCNET_C_PROC_FLAGS)
else()
    message(WARNING "No SSE/AVX/AVX2 CPU flags identified, not building test_vec.")
endif()

How are you calling cmake? And can you provide your CMake output here?

kabe-gh commented 9 months ago

This was my fault. LPCNet was not to blame.

I had been disabling SSE by "-DAVX=FALSE -DSSE=FALSE", not "-DAVX=FALSE" "-DSSE=FALSE" . Properly passing "-DSSE=FALSE" made the patch unneeded.

It emits confusing error when "-DAVX=FALSE -DSSE=FALSE" is passed though.

tmiw commented 9 months ago

Good to hear that it's working! I'll go ahead and close this out.