From dde6d61dd4e919d9b8597c10590884de0e8e4e94 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@openairinterface.org> Date: Thu, 9 Jun 2022 14:44:53 +0200 Subject: [PATCH] Dynamically create LDPC decoder headers when building ldpc libs --- cmake_targets/CMakeLists.txt | 5 ++ .../CODING/nrLDPC_decoder/nrLDPC_decoder.c | 60 +++++++++---------- .../nrLDPC_tools/CMakeLists.txt | 19 ++++++ .../generator_bnProc/CMakeLists.txt | 36 +++++++++++ .../generator_bnProc_avx512/CMakeLists.txt | 36 +++++++++++ .../generator_cnProc/CMakeLists.txt | 25 ++++++++ .../generator_cnProc_avx512/CMakeLists.txt | 25 ++++++++ 7 files changed, 176 insertions(+), 30 deletions(-) create mode 100644 openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt create mode 100644 openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/CMakeLists.txt create mode 100644 openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc_avx512/CMakeLists.txt create mode 100644 openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc/CMakeLists.txt create mode 100644 openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc_avx512/CMakeLists.txt diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 368c3fd6434..5de12903596 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1390,8 +1390,11 @@ set(PHY_NR_CODINGIF ) add_library(ldpc_orig MODULE ${PHY_LDPC_ORIG_SRC} ) +target_link_libraries(ldpc_orig PRIVATE ldpc_gen_HEADERS) add_library(ldpc_optim MODULE ${PHY_LDPC_OPTIM_SRC} ) +target_link_libraries(ldpc_optim PRIVATE ldpc_gen_HEADERS) add_library(ldpc_optim8seg MODULE ${PHY_LDPC_OPTIM8SEG_SRC} ) +target_link_libraries(ldpc_optim8seg PRIVATE ldpc_gen_HEADERS) add_library(ldpc_cl MODULE ${PHY_LDPC_CL_SRC} ) target_link_libraries(ldpc_cl OpenCL) add_dependencies(ldpc_cl nrLDPC_decoder_kernels_CL) @@ -1403,6 +1406,7 @@ if (CUDA_FOUND) endif (CUDA_FOUND) add_library(ldpc MODULE ${PHY_LDPC_OPTIM8SEGMULTI_SRC} ) +target_link_libraries(ldpc PRIVATE ldpc_gen_HEADERS) add_library(coding MODULE ${PHY_TURBOSRC} ) @@ -3160,3 +3164,4 @@ ADD_CUSTOM_TARGET(oarf ) include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt) +include(${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c index 3c95c9c69a2..3640378f85a 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c @@ -42,13 +42,13 @@ //BG1------------------------------------------------------------------- #ifdef __AVX512BW__ -#include "nrLDPC_tools/ldpc_gen_files/cnProc_avx512/nrLDPC_cnProc_BG1_R13_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc_avx512/nrLDPC_cnProc_BG1_R23_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc_avx512/nrLDPC_cnProc_BG1_R89_AVX512.h" +#include "cnProc_avx512/nrLDPC_cnProc_BG1_R13_AVX512.h" +#include "cnProc_avx512/nrLDPC_cnProc_BG1_R23_AVX512.h" +#include "cnProc_avx512/nrLDPC_cnProc_BG1_R89_AVX512.h" //BG2------------------------------------------------------------------- -#include "nrLDPC_tools/ldpc_gen_files/cnProc_avx512/nrLDPC_cnProc_BG2_R15_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc_avx512/nrLDPC_cnProc_BG2_R13_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc_avx512/nrLDPC_cnProc_BG2_R23_AVX512.h" +#include "cnProc_avx512/nrLDPC_cnProc_BG2_R15_AVX512.h" +#include "cnProc_avx512/nrLDPC_cnProc_BG2_R13_AVX512.h" +#include "cnProc_avx512/nrLDPC_cnProc_BG2_R23_AVX512.h" #else @@ -57,13 +57,13 @@ /----------------------------------------------------------------------*/ //BG1------------------------------------------------------------------ -#include "nrLDPC_tools/ldpc_gen_files/cnProc/nrLDPC_cnProc_BG1_R13_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc/nrLDPC_cnProc_BG1_R23_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc/nrLDPC_cnProc_BG1_R89_AVX2.h" +#include "cnProc/nrLDPC_cnProc_BG1_R13_AVX2.h" +#include "cnProc/nrLDPC_cnProc_BG1_R23_AVX2.h" +#include "cnProc/nrLDPC_cnProc_BG1_R89_AVX2.h" //BG2 -------------------------------------------------------------------- -#include "nrLDPC_tools/ldpc_gen_files/cnProc/nrLDPC_cnProc_BG2_R15_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc/nrLDPC_cnProc_BG2_R13_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/cnProc/nrLDPC_cnProc_BG2_R23_AVX2.h" +#include "cnProc/nrLDPC_cnProc_BG2_R15_AVX2.h" +#include "cnProc/nrLDPC_cnProc_BG2_R13_AVX2.h" +#include "cnProc/nrLDPC_cnProc_BG2_R23_AVX2.h" #endif @@ -73,34 +73,34 @@ //bnProcPc------------------------------------------------------------- //BG1------------------------------------------------------------------ -#include "nrLDPC_tools/ldpc_gen_files/bnProcPc/nrLDPC_bnProcPc_BG1_R13_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProcPc/nrLDPC_bnProcPc_BG1_R23_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProcPc/nrLDPC_bnProcPc_BG1_R89_AVX2.h" +#include "bnProcPc/nrLDPC_bnProcPc_BG1_R13_AVX2.h" +#include "bnProcPc/nrLDPC_bnProcPc_BG1_R23_AVX2.h" +#include "bnProcPc/nrLDPC_bnProcPc_BG1_R89_AVX2.h" //BG2 -------------------------------------------------------------------- -#include "nrLDPC_tools/ldpc_gen_files/bnProcPc/nrLDPC_bnProcPc_BG2_R15_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProcPc/nrLDPC_bnProcPc_BG2_R13_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProcPc/nrLDPC_bnProcPc_BG2_R23_AVX2.h" +#include "bnProcPc/nrLDPC_bnProcPc_BG2_R15_AVX2.h" +#include "bnProcPc/nrLDPC_bnProcPc_BG2_R13_AVX2.h" +#include "bnProcPc/nrLDPC_bnProcPc_BG2_R23_AVX2.h" //bnProc---------------------------------------------------------------- #ifdef __AVX512BW__ //BG1------------------------------------------------------------------- -#include "nrLDPC_tools/ldpc_gen_files/bnProc_avx512/nrLDPC_bnProc_BG1_R13_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc_avx512/nrLDPC_bnProc_BG1_R23_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc_avx512/nrLDPC_bnProc_BG1_R89_AVX512.h" +#include "bnProc_avx512/nrLDPC_bnProc_BG1_R13_AVX512.h" +#include "bnProc_avx512/nrLDPC_bnProc_BG1_R23_AVX512.h" +#include "bnProc_avx512/nrLDPC_bnProc_BG1_R89_AVX512.h" //BG2 -------------------------------------------------------------------- -#include "nrLDPC_tools/ldpc_gen_files/bnProc_avx512/nrLDPC_bnProc_BG2_R15_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc_avx512/nrLDPC_bnProc_BG2_R13_AVX512.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc_avx512/nrLDPC_bnProc_BG2_R23_AVX512.h" +#include "bnProc_avx512/nrLDPC_bnProc_BG2_R15_AVX512.h" +#include "bnProc_avx512/nrLDPC_bnProc_BG2_R13_AVX512.h" +#include "bnProc_avx512/nrLDPC_bnProc_BG2_R23_AVX512.h" #else -#include "nrLDPC_tools/ldpc_gen_files/bnProc/nrLDPC_bnProc_BG1_R13_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc/nrLDPC_bnProc_BG1_R23_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc/nrLDPC_bnProc_BG1_R89_AVX2.h" +#include "bnProc/nrLDPC_bnProc_BG1_R13_AVX2.h" +#include "bnProc/nrLDPC_bnProc_BG1_R23_AVX2.h" +#include "bnProc/nrLDPC_bnProc_BG1_R89_AVX2.h" //BG2 -------------------------------------------------------------------- -#include "nrLDPC_tools/ldpc_gen_files/bnProc/nrLDPC_bnProc_BG2_R15_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc/nrLDPC_bnProc_BG2_R13_AVX2.h" -#include "nrLDPC_tools/ldpc_gen_files/bnProc/nrLDPC_bnProc_BG2_R23_AVX2.h" +#include "bnProc/nrLDPC_bnProc_BG2_R15_AVX2.h" +#include "bnProc/nrLDPC_bnProc_BG2_R13_AVX2.h" +#include "bnProc/nrLDPC_bnProc_BG2_R23_AVX2.h" #endif diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt new file mode 100644 index 00000000000..669ab17aa7d --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/CMakeLists.txt @@ -0,0 +1,19 @@ +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/generator_bnProc ldpc/generator_bnProc) +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/generator_bnProc_avx512 ldpc/generator_bnProc_avx512) +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/generator_cnProc ldpc/generator_cnProc) +add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/generator_cnProc_avx512 ldpc/generator_cnProc_avx512) + +# custom target to build all generators +add_custom_target(ldpc_generators) +add_dependencies(ldpc_generators + bnProc_gen_avx2 + bnProc_gen_avx512 + cnProc_gen_avx2 + cnProc_gen_avx512) + +add_library(ldpc_gen_HEADERS INTERFACE) +target_link_libraries(ldpc_gen_HEADERS INTERFACE + bnProc_gen_avx2_HEADERS + bnProc_gen_avx512_HEADERS + cnProc_gen_avx2_HEADERS + cnProc_gen_avx512_HEADERS) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/CMakeLists.txt b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/CMakeLists.txt new file mode 100644 index 00000000000..baf2f19d97c --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc/CMakeLists.txt @@ -0,0 +1,36 @@ +add_executable(bnProc_gen_avx2 + bnProc_gen_BG1_avx2.c + bnProc_gen_BG2_avx2.c + bnProcPc_gen_BG1_avx2.c + bnProcPc_gen_BG2_avx2.c + main.c) +target_compile_options(bnProc_gen_avx2 PRIVATE -W -Wall -mavx2) + +#set(bnProc_headers +# bnProc/nrLDPC_bnProc_BG1_R13_AVX2.h +# bnProc/nrLDPC_bnProc_BG1_R23_AVX2.h +# bnProc/nrLDPC_bnProc_BG1_R89_AVX2.h +# bnProc/rLDPC_bnProc_BG2_R13_AVX2.h +# bnProc/rLDPC_bnProc_BG2_R15_AVX2.h +# bnProc/rLDPC_bnProc_BG2_R23_AVX2.h) +# +#set(bnProcPc_headers +# bnProcPc/rLDPC_bnProcPc_BG1_R13_AVX2.h +# bnProcPc/rLDPC_bnProcPc_BG1_R23_AVX2.h +# bnProcPc/rLDPC_bnProcPc_BG1_R89_AVX2.h +# bnProcPc/rLDPC_bnProcPc_BG2_R13_AVX2.h +# bnProcPc/rLDPC_bnProcPc_BG2_R15_AVX2.h +# bnProcPc/rLDPC_bnProcPc_BG2_R23_AVX2.h) + +add_custom_command(TARGET bnProc_gen_avx2 POST_BUILD + #OUTPUT ${bnProc_headers} ${bnProcPc_headers} + COMMAND ${CMAKE_COMMAND} -E make_directory bnProc + COMMAND ${CMAKE_COMMAND} -E make_directory bnProcPc + COMMAND bnProc_gen_avx2 . + DEPENDS bnProc_gen_avx2 + COMMENT "Generating LDPC bnProc header files for AVX2" +) + +add_library(bnProc_gen_avx2_HEADERS INTERFACE) +target_include_directories(bnProc_gen_avx2_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) +add_dependencies(bnProc_gen_avx2_HEADERS bnProc_gen_avx2) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc_avx512/CMakeLists.txt b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc_avx512/CMakeLists.txt new file mode 100644 index 00000000000..f0b3d49b1e6 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_bnProc_avx512/CMakeLists.txt @@ -0,0 +1,36 @@ +add_executable(bnProc_gen_avx512 + bnProc_gen_BG1_avx512.c + bnProc_gen_BG2_avx512.c + bnProcPc_gen_BG1_avx512.c + bnProcPc_gen_BG2_avx512.c + main.c) +target_compile_options(bnProc_gen_avx512 PRIVATE -W -Wall -mavx2) + +#set(bnProc_avx512_headers +# bnProc_avx512/rLDPC_bnProc_BG1_R13_AVX512.h +# bnProc_avx512/rLDPC_bnProc_BG1_R23_AVX512.h +# bnProc_avx512/rLDPC_bnProc_BG1_R89_AVX512.h +# bnProc_avx512/rLDPC_bnProc_BG2_R13_AVX512.h +# bnProc_avx512/rLDPC_bnProc_BG2_R15_AVX512.h +# bnProc_avx512/rLDPC_bnProc_BG2_R23_AVX512.h) +# +#set(bnProcPc_avx512_headers +# bnProcPc_avx512/rLDPC_bnProcPc_BG1_R13_AVX512.h +# bnProcPc_avx512/rLDPC_bnProcPc_BG1_R23_AVX512.h +# bnProcPc_avx512/rLDPC_bnProcPc_BG1_R89_AVX512.h +# bnProcPc_avx512/rLDPC_bnProcPc_BG2_R13_AVX512.h +# bnProcPc_avx512/rLDPC_bnProcPc_BG2_R15_AVX512.h +# bnProcPc_avx512/rLDPC_bnProcPc_BG2_R23_AVX512.h) + +add_custom_command(TARGET bnProc_gen_avx512 POST_BUILD + #OUTPUT ${bnProc_avx512_headers} ${bnProcPc_avx512_headers} + COMMAND ${CMAKE_COMMAND} -E make_directory bnProc_avx512 + COMMAND ${CMAKE_COMMAND} -E make_directory bnProcPc_avx512 + COMMAND bnProc_gen_avx512 . + DEPENDS bnProc_gen_avx512 + COMMENT "Generating LDPC bnProc header files for AVX512" +) + +add_library(bnProc_gen_avx512_HEADERS INTERFACE) +target_include_directories(bnProc_gen_avx512_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) +add_dependencies(bnProc_gen_avx512_HEADERS bnProc_gen_avx512) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc/CMakeLists.txt b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc/CMakeLists.txt new file mode 100644 index 00000000000..d78dfc4436c --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc/CMakeLists.txt @@ -0,0 +1,25 @@ +add_executable(cnProc_gen_avx2 + cnProc_gen_BG1_avx2.c + cnProc_gen_BG2_avx2.c + main.c) +target_compile_options(cnProc_gen_avx2 PRIVATE -W -Wall -mavx2) + +#set(cnProc_headers +# cnProc/rLDPC_cnProc_BG1_R13_AVX2.h +# cnProc/rLDPC_cnProc_BG1_R23_AVX2.h +# cnProc/rLDPC_cnProc_BG1_R89_AVX2.h +# cnProc/rLDPC_cnProc_BG2_R13_AVX2.h +# cnProc/rLDPC_cnProc_BG2_R15_AVX2.h +# cnProc/rLDPC_cnProc_BG2_R23_AVX2.h) + +add_custom_command(TARGET cnProc_gen_avx2 POST_BUILD + #OUTPUT ${cnProc_headers} + COMMAND ${CMAKE_COMMAND} -E make_directory cnProc + COMMAND cnProc_gen_avx2 . + DEPENDS cnProc_gen_avx2 + COMMENT "Generating LDPC cnProc header files for AVX2" +) + +add_library(cnProc_gen_avx2_HEADERS INTERFACE) +target_include_directories(cnProc_gen_avx2_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) +add_dependencies(cnProc_gen_avx2_HEADERS cnProc_gen_avx2) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc_avx512/CMakeLists.txt b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc_avx512/CMakeLists.txt new file mode 100644 index 00000000000..7ca988f1ca2 --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_cnProc_avx512/CMakeLists.txt @@ -0,0 +1,25 @@ +add_executable(cnProc_gen_avx512 + cnProc_gen_BG1_avx512.c + cnProc_gen_BG2_avx512.c + main.c) +target_compile_options(cnProc_gen_avx512 PRIVATE -W -Wall -mavx2) + +#set(cnProc_avx512_headers +# cnProc_avx512/nrLDPC_cnProc_BG1_R13_AVX512.h +# cnProc_avx512/nrLDPC_cnProc_BG1_R23_AVX512.h +# cnProc_avx512/nrLDPC_cnProc_BG1_R89_AVX512.h +# cnProc_avx512/nrLDPC_cnProc_BG2_R13_AVX512.h +# cnProc_avx512/nrLDPC_cnProc_BG2_R15_AVX512.h +# cnProc_avx512/nrLDPC_cnProc_BG2_R23_AVX512.h) + +add_custom_command(TARGET cnProc_gen_avx512 POST_BUILD + #OUTPUT ${cnProc_avx512_headers} + COMMAND ${CMAKE_COMMAND} -E make_directory cnProc_avx512 + COMMAND cnProc_gen_avx512 . + DEPENDS cnProc_gen_avx512 + COMMENT "Generating LDPC cnProc header files for AVX512" +) + +add_library(cnProc_gen_avx512_HEADERS INTERFACE) +target_include_directories(cnProc_gen_avx512_HEADERS INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) +add_dependencies(cnProc_gen_avx512_HEADERS cnProc_gen_avx512) -- GitLab