build: include LDPC encoder in libldpc_hexagon.so

Add ldpc_encoder_optim8segmulti.c to the ARM (HLOS) build target so that
libldpc_hexagon.so exports all four symbols expected by ldpctest and the
OAI segmentation layer: LDPCinit, LDPCshutdown, LDPCdecoder, LDPCencoder.

The encoder runs on the ARM side unchanged. Offloading the encoder to the
Hexagon DSP can be evaluated separately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Raymond Knopp <raymond.knopp@eurecom.fr>
This commit is contained in:
Raymond Knopp
2026-05-25 07:20:43 +00:00
parent 7a74c9f377
commit c124997d3c
2 changed files with 25 additions and 7 deletions

View File

@@ -88,6 +88,10 @@ if(${OS_TYPE} MATCHES "HLOS")
add_library(ldpc_hexagon SHARED
${CMAKE_CURRENT_BINARY_DIR}/ldpc_hexagon_stub
${CMAKE_CURRENT_SOURCE_DIR}/src/ldpc_hexagon_arm
# Encoder runs on the ARM side (not offloaded); included so that
# ldpctest and the segmentation layer can call LDPCencoder() from
# this .so exactly as they would from libldpc.so.
${OAI_SRC_ROOT}/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti
)
build_idl(inc/ldpc_hexagon.idl ldpc_hexagon)
@@ -98,6 +102,14 @@ if(${OS_TYPE} MATCHES "HLOS")
link_custom_library(ldpc_hexagon ${dsprpc})
link_custom_library(ldpc_hexagon rpcmem)
# OAI encoder dependencies (present when built as an OAI subdirectory)
if(TARGET ldpc_segment)
target_link_libraries(ldpc_hexagon PRIVATE ldpc_segment)
endif()
if(TARGET ldpc_gen_HEADERS)
target_link_libraries(ldpc_hexagon PRIVATE ldpc_gen_HEADERS)
endif()
set_common_compile_and_link_options(ldpc_hexagon)
install(TARGETS ldpc_hexagon LIBRARY DESTINATION lib)

View File

@@ -41,15 +41,21 @@ The DSP always returns posterior LLRs in `llr_out`. The ARM stub converts to the
requested `outMode` (bit-packed / int8 / LLR pass-through) locally, and the
`check_crc` function pointer never crosses the FastRPC boundary.
## ARM stub (`ldpc_hexagon_arm.c`)
## ARM stub (`ldpc_hexagon_arm.c` + `ldpc_encoder_optim8segmulti.c`)
Exports the three symbols expected by OAI's LDPC loader:
`libldpc_hexagon.so` exports the same four symbols as `libldpc.so` so it is a
drop-in replacement for testing with `ldpctest` and the segmentation layer:
| Symbol | Description |
|----------------|------------------------------------------------------|
| `LDPCinit()` | Opens FastRPC session to cDSP, initialises rpcmem |
| `LDPCshutdown()` | Closes session, releases rpcmem |
| `LDPCdecoder()` | Marshals one code-block decode call to the DSP |
| Symbol | Source | Description |
|----------------|--------------------------------------|-----------------------------------|
| `LDPCinit()` | ldpc_hexagon_arm.c | Opens FastRPC session, rpcmem init |
| `LDPCshutdown()` | ldpc_hexagon_arm.c | Closes session, releases rpcmem |
| `LDPCdecoder()` | ldpc_hexagon_arm.c | Offloads decode to cDSP |
| `LDPCencoder()` | ldpc_encoder_optim8segmulti.c | Runs on ARM (not offloaded) |
The encoder is included unchanged from the standard `libldpc.so` build and
links against `ldpc_segment` and `ldpc_gen_HEADERS` exactly as it does there.
Offloading the encoder to the DSP may be evaluated separately.
`LDPCdecoder` flow:
1. Calls `nrLDPC_init` to derive `numLLR` from BG/Z/R.