Commit dbb4eedb authored by Raymond Knopp's avatar Raymond Knopp Committed by Robert Schmidt

TODO: fix unaligned access. LLR type and optimization

parent 67bc4391
......@@ -351,7 +351,7 @@ one_measurement_t test_ldpc(short max_iterations,
n_iter = ldpc_toCompare.LDPCdecoder(&decParams[j],
(int8_t *)channel_output_fixed[j],
(int8_t *)estimated_output[j],
estimated_output[j],
&decoder_profiler,
&dec_abort);
stop_meas(&ret.time_decoder);
......
......@@ -209,8 +209,7 @@ static void nr_process_decode_segment(void *arg)
////////////////////////////////// pl =====> llrProcBuf //////////////////////////////////
start_meas(rdata->p_ts_ldpc_decode);
int decodeIterations = LDPCdecoder(p_decoderParms, l, llrProcBuf, p_procTime, rdata->abort_decode);
int decodeIterations = LDPCdecoder(p_decoderParms, l, (uint8_t*)llrProcBuf, p_procTime, rdata->abort_decode);
if (decodeIterations < p_decoderParms->numMaxIter) {
memcpy(rdata->c, llrProcBuf, K >> 3);
*rdata->decodeSuccess = true;
......
......@@ -1318,7 +1318,7 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, int8_t* bnProcBuf, int8_t*
\param llrOut Pointer to output LLRs
\param numLLR Number of LLRs
*/
static inline void nrLDPC_llr2bit(int8_t* out, int8_t* llrOut, uint16_t numLLR)
static inline void nrLDPC_llr2bit(uint8_t* out, int8_t* llrOut, uint16_t numLLR)
{
simde__m256i* p_llrOut = (simde__m256i*) llrOut;
simde__m256i* p_out = (simde__m256i*) out;
......@@ -1335,7 +1335,7 @@ static inline void nrLDPC_llr2bit(int8_t* out, int8_t* llrOut, uint16_t numLLR)
// Remaining LLRs that do not fit in multiples of 32 bytes
int8_t* p_llrOut8 = (int8_t*)p_llrOut;
int8_t* p_out8 = (int8_t*)p_out;
uint8_t* p_out8 = (uint8_t*)p_out;
for (uint32_t i = 0; i < Mr; i++)
p_out8[i] = p_llrOut8[i] < 0;
......@@ -1350,7 +1350,7 @@ static inline void nrLDPC_llr2bit(int8_t* out, int8_t* llrOut, uint16_t numLLR)
\param llrOut Pointer to output LLRs
\param numLLR Number of LLRs
*/
static inline void nrLDPC_llr2bitPacked(int8_t* out, int8_t* llrOut, uint16_t numLLR)
static inline void nrLDPC_llr2bitPacked(uint8_t* out, int8_t* llrOut, uint16_t numLLR)
{
/** Vector of indices for shuffling input */
const uint8_t constShuffle_256_epi8[32] __attribute__ ((aligned(32))) = {7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
......
......@@ -152,7 +152,7 @@
*/
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
int8_t* p_out,
uint8_t* p_out,
uint32_t numLLR,
t_nrLDPC_lut* p_lut,
t_nrLDPC_dec_params* p_decParams,
......@@ -171,7 +171,7 @@ int32_t LDPCshutdown()
int32_t LDPCdecoder(t_nrLDPC_dec_params* p_decParams,
int8_t* p_llr,
int8_t* p_out,
uint8_t* p_out,
t_nrLDPC_time_stats* p_profiler,
decode_abort_t* ab)
{
......@@ -201,7 +201,7 @@ int32_t LDPCdecoder(t_nrLDPC_dec_params* p_decParams,
\param p_profilernrLDPC profiler statistics
*/
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
int8_t* p_out,
uint8_t* p_out,
uint32_t numLLR,
t_nrLDPC_lut* p_lut,
t_nrLDPC_dec_params* p_decParams,
......@@ -844,7 +844,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
} else {
if (numIter > 0) {
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};
int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? p_out : llrOut;
int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? (int8_t*)p_out : llrOut;
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
if (outMode == nrLDPC_outMode_BIT)
nrLDPC_llr2bitPacked(p_out, p_llrOut, numLLR);
......@@ -861,7 +861,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr,
}
if (!p_decParams->check_crc) {
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__((aligned(64))) = {0};
int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? p_out : llrOut;
int8_t* p_llrOut = outMode == nrLDPC_outMode_LLRINT8 ? (int8_t*)p_out : llrOut;
// Assign results from processing buffer to output
NR_LDPC_PROFILER_DETAIL(start_meas(&p_profiler->llrRes2llrOut));
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
......
......@@ -89,7 +89,7 @@ typedef int32_t(LDPC_shutdownfunc_t)(void);
*/
typedef int32_t(LDPC_decoderfunc_t)(t_nrLDPC_dec_params *p_decParams,
int8_t *p_llr,
int8_t *p_out,
uint8_t *p_out,
t_nrLDPC_time_stats *time_stats,
decode_abort_t *ab);
typedef int32_t(LDPC_encoderfunc_t)(uint8_t **, uint8_t *, encoder_implemparams_t *);
......
......@@ -1087,8 +1087,11 @@ static void nr_pusch_symbol_processing(void *arg)
int16_t *llr16 = (int16_t*)&rdata->llr[pusch_vars->llr_offset[symbol] * rel15_ul->nrOfLayers];
int16_t *s = rdata->scramblingSequence + pusch_vars->llr_offset[symbol] * rel15_ul->nrOfLayers;
const int end = nb_re_pusch * rel15_ul->qam_mod_order * rel15_ul->nrOfLayers;
for (int i = 0; i < end; i++)
llr16[i] = llr_ptr[i] * s[i];
int i=0;
for (; (i+8) <= end; i+=8)
simde_mm_storeu_si128(llr16+i, simde_mm_mullo_epi16(*(simde__m128i*)&llr_ptr[i],*(simde__m128i*)&s[i]));
for (;i<end;i++)
llr16[i]=llr_ptr[i] * s[i];
stop_meas(&gNB->ulsch_unscrambling_stats);
}
......
......@@ -521,7 +521,7 @@ typedef struct LDPCDecode_s {
NR_UL_gNB_HARQ_t *ulsch_harq;
t_nrLDPC_dec_params decoderParms;
NR_gNB_ULSCH_t *ulsch;
short* ulsch_llr;
int16_t* ulsch_llr;
int ulsch_id;
int harq_pid;
int rv_index;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment