Commit a2c9a280 authored by Hongzhi Wang's avatar Hongzhi Wang

moving ldpc offload to ulsch decoding function

parent eab51f6a
...@@ -841,9 +841,18 @@ test_vector.expected_status = 0; ...@@ -841,9 +841,18 @@ test_vector.expected_status = 0;
//printf("test vector expected status %d\n",test_vector.expected_status); //printf("test vector expected status %d\n",test_vector.expected_status);
//uint8_t *rv_index = &ldpc_dec_ref->rv_index; //uint8_t *rv_index = &ldpc_dec_ref->rv_index;
//rv_index = ldpc_dec_ref->rv_index; //rv_index = ldpc_dec_ref->rv_index;
ldpc_dec->code_block_mode = 1; //ldpc_dec_ref->code_block_mode;
if (ldpc_dec->code_block_mode == 0) {
ldpc_dec->tb_params.ea = ldpc_dec_ref->tb_params.ea;
ldpc_dec->tb_params.eb = ldpc_dec_ref->tb_params.eb;
ldpc_dec->tb_params.c = ldpc_dec_ref->tb_params.c;
ldpc_dec->tb_params.cab = ldpc_dec_ref->tb_params.cab;
ldpc_dec->tb_params.r = ldpc_dec_ref->tb_params.r;
} else {
ldpc_dec->cb_params.e = ldpc_dec_ref->cb_params.e;
}
ldpc_dec->rv_index = 0; //*rv_index; ldpc_dec->rv_index = 0; //*rv_index;
ldpc_dec->cb_params.e = ldpc_dec_ref->cb_params.e;
ldpc_dec->iter_count = 3; ldpc_dec->iter_count = 3;
ldpc_dec->basegraph = ldpc_dec_ref->basegraph; ldpc_dec->basegraph = ldpc_dec_ref->basegraph;
ldpc_dec->z_c = ldpc_dec_ref->z_c; ldpc_dec->z_c = ldpc_dec_ref->z_c;
...@@ -853,23 +862,35 @@ test_vector.expected_status = 0; ...@@ -853,23 +862,35 @@ test_vector.expected_status = 0;
ldpc_dec->iter_max = ldpc_dec_ref->iter_max; ldpc_dec->iter_max = ldpc_dec_ref->iter_max;
// ldpc_dec->rv_index = ldpc_dec_ref->rv_index; // ldpc_dec->rv_index = ldpc_dec_ref->rv_index;
ldpc_dec->op_flags = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE; ldpc_dec->op_flags = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
ldpc_dec->code_block_mode = 1; // ldpc_dec->code_block_mode = 1; //ldpc_dec_ref->code_block_mode;
struct op_data_entries *ref_entries =
&test_vector.entries[0];
struct op_data_entries *ref_entries_dec =
&test_vector_dec.entries[0];
//ref_entries->nb_segments = ref_entries_dec->nb_segments;
ret= init_entry(&test_vector, 0, ldpc_dec->cb_params.e); ret= init_entry(&test_vector, 0, ldpc_dec->cb_params.e);
ret= init_entry(&test_vector, 2, ldpc_dec->cb_params.e); ret= init_entry(&test_vector, 2, ldpc_dec->cb_params.e);
//printf("read test reference bg %d zc %d qm %d nfiller %d, n_cb %d iter max %d rv %d\n", ldpc_dec_ref->basegraph, ldpc_dec_ref->z_c, ldpc_dec_ref->q_m,ldpc_dec_ref->n_filler,ldpc_dec_ref->n_cb,ldpc_dec_ref->iter_max,rv_index); //printf("read test reference bg %d zc %d qm %d nfiller %d, n_cb %d iter max %d rv %d\n", ldpc_dec_ref->basegraph, ldpc_dec_ref->z_c, ldpc_dec_ref->q_m,ldpc_dec_ref->n_filler,ldpc_dec_ref->n_cb,ldpc_dec_ref->iter_max,rv_index);
//printf("read test reference bg %d zc %d qm %d nfiller %d, n_cb %d iter max %d rv %d\n", ldpc_dec_ref->basegraph, ldpc_dec_ref->z_c, ldpc_dec->q_m,ldpc_dec->n_filler,ldpc_dec->n_cb,ldpc_dec->iter_max,ldpc_dec->rv_index); //printf("read test reference bg %d zc %d qm %d nfiller %d, n_cb %d iter max %d rv %d\n", ldpc_dec_ref->basegraph, ldpc_dec_ref->z_c, ldpc_dec->q_m,ldpc_dec->n_filler,ldpc_dec->n_cb,ldpc_dec->iter_max,ldpc_dec->rv_index);
struct op_data_entries *ref_entries = printf("read test nb segments %d ref %d\n",ref_entries->nb_segments, ref_entries_dec->nb_segments);
&test_vector.entries[0]; uint8_t nbs = 1;
struct op_data_entries *ref_entries_dec = if (ldpc_dec->code_block_mode ==0) nbs =2;
&test_vector_dec.entries[0]; //for (int i=0;i<ref_entries_dec->nb_segments;i++) {
struct op_data_buf *seg = &ref_entries->segments[0]; for (int i=0;i<nbs;i++) {
struct op_data_buf *seg_dec = &ref_entries_dec->segments[0];
struct op_data_buf *seg = &ref_entries->segments[i];
struct op_data_buf *seg_dec = &ref_entries_dec->segments[i];
memcpy(seg->addr, seg_dec->addr, seg->length);
}
//printf("before seg addr %p seg dec addr %p nb segments %d\n",seg->addr,seg_dec->addr,ref_entries->nb_segments); //printf("before seg addr %p seg dec addr %p nb segments %d\n",seg->addr,seg_dec->addr,ref_entries->nb_segments);
memcpy(seg->addr, seg_dec->addr, seg->length);
//memcpy(ldpc_dec, ldpc_dec_ref, sizeof(struct rte_bbdev_op_ldpc_dec)); //memcpy(ldpc_dec, ldpc_dec_ref, sizeof(struct rte_bbdev_op_ldpc_dec));
//printf("seg addr %p length %d seg dec addr %p \n",seg->addr,seg->length, seg_dec->addr); //printf("seg addr %p length %d seg dec addr %p \n",seg->addr,seg->length, seg_dec->addr);
...@@ -1877,11 +1898,13 @@ validate_op_chain(struct rte_bbdev_op_data *op, ...@@ -1877,11 +1898,13 @@ validate_op_chain(struct rte_bbdev_op_data *op,
struct rte_mbuf *m = op->data; struct rte_mbuf *m = op->data;
uint8_t nb_dst_segments = orig_op->nb_segments; uint8_t nb_dst_segments = orig_op->nb_segments;
uint32_t total_data_size = 0; uint32_t total_data_size = 0;
char *data = m->buf_addr;
memcpy(ldpc_output, data+128, (rte_pktmbuf_data_len(m) - op->offset));
//ldpc_output = (int8_t *)(m->buf_addr);
/*printf("validate op chain nb segs %d offset %d data off %d\n",m->nb_segs, op->offset, m->data_off);
uint32_t r_offset = 0;
char *data; // = m->buf_addr;
//memcpy(ldpc_output, data+128, (rte_pktmbuf_data_len(m) - op->offset));
//ldpc_output = (int8_t *)(m->buf_addr);
printf("validate op chain nb segs %d offset %d data off %d\n",m->nb_segs, op->offset, m->data_off);
/*
int l=0; int l=0;
for (l=0;l<16;l++) for (l=0;l<16;l++)
{ {
...@@ -1900,15 +1923,18 @@ printf(" data[%d] = %x\n",l, *(data+l+128)); ...@@ -1900,15 +1923,18 @@ printf(" data[%d] = %x\n",l, *(data+l+128));
uint16_t data_len = rte_pktmbuf_data_len(m) - offset; uint16_t data_len = rte_pktmbuf_data_len(m) - offset;
total_data_size += orig_op->segments[i].length; total_data_size += orig_op->segments[i].length;
//printf("segment %d offset %d length %d\n",i, offset,total_data_size); data = m->buf_addr;
memcpy(ldpc_output+r_offset, data+m->data_off, data_len);
r_offset +=data_len;
printf("segment %d offset %d length %d data length %d\n",i, offset,total_data_size,data_len);
// TEST_ASSERT(orig_op->segments[i].length == data_len, // TEST_ASSERT(orig_op->segments[i].length == data_len,
// "Length of segment differ in original (%u) and filled (%u) op", // "Length of segment differ in original (%u) and filled (%u) op",
// orig_op->segments[i].length, data_len); // orig_op->segments[i].length, data_len);
/* TEST_ASSERT_BUFFERS_ARE_EQUAL(orig_op->segments[i].addr, TEST_ASSERT_BUFFERS_ARE_EQUAL(orig_op->segments[i].addr,
rte_pktmbuf_mtod_offset(m, uint32_t *, offset), rte_pktmbuf_mtod_offset(m, uint32_t *, offset),
data_len, data_len,
"Output buffers (CB=%u) are not equal", i); "Output buffers (CB=%u) are not equal", i);
*/
m = m->next; m = m->next;
} }
...@@ -3990,7 +4016,7 @@ throughput_test(struct active_device *ad, ...@@ -3990,7 +4016,7 @@ throughput_test(struct active_device *ad,
t_params[used_cores].queue_id = ad->queue_ids[used_cores]; t_params[used_cores].queue_id = ad->queue_ids[used_cores];
t_params[used_cores].iter_count = 0; t_params[used_cores].iter_count = 0;
rte_eal_remote_launch(throughput_function, rte_eal_remote_launch(throughput_pmd_lcore_ldpc_dec,
&t_params[used_cores++], lcore_id); &t_params[used_cores++], lcore_id);
} }
...@@ -5542,25 +5568,30 @@ init_entry(struct test_bbdev_vector *vector, enum op_data_type type, uint32_t da ...@@ -5542,25 +5568,30 @@ init_entry(struct test_bbdev_vector *vector, enum op_data_type type, uint32_t da
op_data = vector->entries[type].segments; op_data = vector->entries[type].segments;
nb_ops = &vector->entries[type].nb_segments; nb_ops = &vector->entries[type].nb_segments;
printf("init entry nb segs %d\n",*nb_ops);
if (*nb_ops >= RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) { if (*nb_ops >= RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) {
printf("Too many segments (code blocks defined): %u, max %d!\n", printf("Too many segments (code blocks defined): %u, max %d!\n",
*nb_ops, RTE_BBDEV_TURBO_MAX_CODE_BLOCKS); *nb_ops, RTE_BBDEV_TURBO_MAX_CODE_BLOCKS);
return -1; return -1;
} }
//(*nb_ops)--;
/* Clear new op data struct */ /* Clear new op data struct */
memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf)); memset(op_data + *nb_ops, 0, sizeof(struct op_data_buf));
//for (int i=0; i<nb_ops; i++) {
if (type == 0) if (type == 0)
ret = init_input(&data, data_length); ret = init_input(&data, data_length);
else else
ret = init_output(&data, data_length); ret = init_output(&data, data_length);
if (!ret) { if (!ret) {
op_data[*nb_ops].addr = data; op_data[0].addr = data;
op_data[*nb_ops].length = data_length; op_data[0].length = data_length;
++(*nb_ops); ++(*nb_ops);
// ret = init_input(&data, data_length);
// op_data[1].addr = data;
// op_data[1].length = data_length;
// ++(*nb_ops);
} }
return ret; return ret;
...@@ -5582,8 +5613,8 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_ ...@@ -5582,8 +5613,8 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
*/ */
uint16_t enq, deq; uint16_t enq, deq;
const uint16_t queue_id = 1; //tp->queue_id; const uint16_t queue_id = 1; //tp->queue_id;
const uint16_t burst_sz = 32; //tp->op_params->burst_sz; const uint16_t burst_sz = 2; //tp->op_params->burst_sz;
const uint16_t num_ops = 32; //tp->op_params->num_to_process; const uint16_t num_ops = 2; //tp->op_params->num_to_process;
struct rte_bbdev_dec_op *ops_enq[num_ops]; struct rte_bbdev_dec_op *ops_enq[num_ops];
struct rte_bbdev_dec_op *ops_deq[num_ops]; struct rte_bbdev_dec_op *ops_deq[num_ops];
struct thread_params *tp=&t_params_tp[0]; struct thread_params *tp=&t_params_tp[0];
...@@ -5593,6 +5624,9 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_ ...@@ -5593,6 +5624,9 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
int i, j, ret; int i, j, ret;
struct rte_bbdev_info info; struct rte_bbdev_info info;
uint16_t num_to_enq; uint16_t num_to_enq;
uint32_t offset=0;
uint32_t data_len=0;
// bufs->inputs->data->buf_addr = p_llr; // bufs->inputs->data->buf_addr = p_llr;
// ops_enq[i]->ldpc_dec.input.data->buf_addr = p_llr; // ops_enq[i]->ldpc_dec.input.data->buf_addr = p_llr;
...@@ -5643,14 +5677,22 @@ ldpc_dec->iter_count = 3; ...@@ -5643,14 +5677,22 @@ ldpc_dec->iter_count = 3;
ldpc_dec->iter_max = 8; ldpc_dec->iter_max = 8;
ldpc_dec->rv_index = rv; ldpc_dec->rv_index = rv;
ldpc_dec->op_flags = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE; ldpc_dec->op_flags = RTE_BBDEV_LDPC_ITERATION_STOP_ENABLE;
ldpc_dec->code_block_mode = 1; ldpc_dec->code_block_mode = (C>1)?1:0;
ldpc_dec->tb_params.ea = E;
ldpc_dec->tb_params.eb = E;
ldpc_dec->tb_params.c = C;
ldpc_dec->tb_params.r = 0;
printf("reference bg %d zc %d qm %d nfiller %d, n_cb %d iter max %d rv %d\n", ldpc_dec->basegraph, ldpc_dec->z_c, ldpc_dec->q_m,ldpc_dec->n_filler,ldpc_dec->n_cb,ldpc_dec->iter_max,ldpc_dec->rv_index); printf("reference bg %d zc %d qm %d nfiller %d, n_cb %d iter max %d rv %d\n", ldpc_dec->basegraph, ldpc_dec->z_c, ldpc_dec->q_m,ldpc_dec->n_filler,ldpc_dec->n_cb,ldpc_dec->iter_max,ldpc_dec->rv_index);
struct op_data_entries *ref_entries = struct op_data_entries *ref_entries =
&test_vector_dec.entries[0]; &test_vector_dec.entries[0];
ref_entries->segments[0].addr = (int32_t *)p_llr; ref_entries->nb_segments = C;
for (i=0;i<C;i++) {
ref_entries->segments[i].addr = (int32_t *)(p_llr+offset);
offset += E;
}
//memcpy(ref_entries->segments[0].addr, p_llr, 8448); //memcpy(ref_entries->segments[0].addr, p_llr, 8448);
/*printf("ref seg addr %p +384 %p data %x\n", ref_entries->segments[0].addr,(ref_entries->segments[0].addr+384), *(ref_entries->segments[0].addr+384)); /*printf("ref seg addr %p +384 %p data %x\n", ref_entries->segments[0].addr,(ref_entries->segments[0].addr+384), *(ref_entries->segments[0].addr+384));
...@@ -5661,14 +5703,14 @@ printf("ref seg addr +384 %p data %x\n", (ref_entries->segments[0].addr+384+l), ...@@ -5661,14 +5703,14 @@ printf("ref seg addr +384 %p data %x\n", (ref_entries->segments[0].addr+384+l),
snprintf(test_params.test_vector_filename,sizeof(test_params.test_vector_filename),"%s", argv_re[2]); snprintf(test_params.test_vector_filename,sizeof(test_params.test_vector_filename),"%s", argv_re[2]);
test_params.num_ops=32; test_params.num_ops=2;
test_params.burst_sz=32; test_params.burst_sz=2;
test_params.num_lcores=1; test_params.num_lcores=1;
test_params.num_tests = 1; test_params.num_tests = 1;
run_all_tests(); run_all_tests();
char *data = ldpc_output; char *data = ldpc_output;
memcpy(&p_out[0], data, E); data_len = (p_decParams->BG==1)?(22*p_decParams->Z):(10*p_decParams->Z);
memcpy(&p_out[0], data, C*data_len);
//p_out = ldpc_output; //p_out = ldpc_output;
//for (i=0;i<8;i++) //for (i=0;i<8;i++)
......
...@@ -306,21 +306,15 @@ void nr_processULSegment(void* arg) { ...@@ -306,21 +306,15 @@ void nr_processULSegment(void* arg) {
uint32_t Tbslbrm = rdata->Tbslbrm; uint32_t Tbslbrm = rdata->Tbslbrm;
short* ulsch_llr = rdata->ulsch_llr; short* ulsch_llr = rdata->ulsch_llr;
int max_ldpc_iterations = p_decoderParms->numMaxIter; int max_ldpc_iterations = p_decoderParms->numMaxIter;
int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR]; // __attribute__ ((aligned(32))); int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
int16_t z [68*384]; int16_t z [68*384];
int8_t l [68*384]; int8_t l [68*384];
int16_t z_ol [68*384];
int8_t l_ol [68*384];
__m128i *pv = (__m128i*)&z; __m128i *pv = (__m128i*)&z;
__m128i *pl = (__m128i*)&l; __m128i *pl = (__m128i*)&l;
__m128i *pv_ol128 = (__m128i*)&z_ol;
__m128i *pl_ol128 = (__m128i*)&l_ol;
// int16_t *pv = &z;
uint8_t Ilbrm = 0; uint8_t Ilbrm = 0;
// int8_t *pl = &l;
Kr = ulsch_harq->K; Kr = ulsch_harq->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
...@@ -348,13 +342,15 @@ void nr_processULSegment(void* arg) { ...@@ -348,13 +342,15 @@ void nr_processULSegment(void* arg) {
stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); stop_meas(&phy_vars_gNB->ulsch_deinterleaving_stats);
printf(" segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, rv %d, round %d)...\n", /*LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
r, A, harq_pid,r, G,
Kr*3, Kr*3,
ulsch_harq->TBS, ulsch_harq->TBS,
Qm, Qm,
rv_index, nb_rb,
ulsch_harq->round); n_layers,
pusch_pdu->pusch_data.rv_index,
ulsch_harq->round);*/
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
...@@ -402,13 +398,6 @@ void nr_processULSegment(void* arg) { ...@@ -402,13 +398,6 @@ void nr_processULSegment(void* arg) {
crc_type = CRC24_B; crc_type = CRC24_B;
length_dec = (ulsch_harq->B+24*ulsch_harq->C)/ulsch_harq->C; length_dec = (ulsch_harq->B+24*ulsch_harq->C)/ulsch_harq->C;
} }
/*LOG_I(PHY,"decoder input(segment %u) :",r);
for (int i=0;i<16;i++)
LOG_I(PHY,"%d : %d\n",i,ulsch_harq->d[r][i]);
LOG_I(PHY,"\n");
printf("LDPC lifting size Z %d F %d E %d\n",ulsch_harq->Z,ulsch_harq->F,E);
*/
//printf("input data %x\n",pl+ulsch_harq->Z);
//start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); //start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
...@@ -425,23 +414,6 @@ printf("LDPC lifting size Z %d F %d E %d\n",ulsch_harq->Z,ulsch_harq->F,E); ...@@ -425,23 +414,6 @@ printf("LDPC lifting size Z %d F %d E %d\n",ulsch_harq->Z,ulsch_harq->F,E);
{ {
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]); pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
} }
//memcpy((&z_ol[0]+2*ulsch_harq->Z),ulsch_harq->d[r],(K_bits_F-2*ulsch_harq->Z)*sizeof(int16_t));
//memcpy((&z_ol[0]),ulsch_harq->e[r],(kc*ulsch_harq->Z)*sizeof(int16_t));
memcpy((&z_ol[0]),ulsch_llr,E*sizeof(int16_t));
for (i=0, j=0; j < ((kc*ulsch_harq->Z)>>4)+1; i+=2, j++)
{
pl_ol128[j] = _mm_packs_epi16(pv_ol128[i],pv_ol128[i+1]);
}
//int8_t *pl_ol=(int8_t*)&z_ol[0];
/*for (i=0;i<8;i++){
printf("input addr z @ %p data %d \n", (&z[0]+2*ulsch_harq->Z+i), *(&z[0]+2*ulsch_harq->Z+i));
printf("input addr p @ %p data %d\n", (pl_ol128), *(pl_ol128));
}
*/
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
...@@ -450,29 +422,13 @@ printf("input addr p @ %p data %d\n", (pl_ol128), *(pl_ol128)); ...@@ -450,29 +422,13 @@ printf("input addr p @ %p data %d\n", (pl_ol128), *(pl_ol128));
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// pl =====> llrProcBuf ////////////////////////////////// ////////////////////////////////// pl =====> llrProcBuf //////////////////////////////////
/* no_iteration_ldpc = nrLDPC_decoder_offload(p_decoderParms,
(int8_t*)&pl_ol128[0], //pl_ol,
llrProcBuf,
ulsch_harq->p_nrLDPC_procBuf[r],// 3
p_procTime);
*/
no_iteration_ldpc = nrLDPC_decoder_offload(p_decoderParms,
ulsch_harq->C,
(uint8_t)rv_index,
ulsch_harq->F,
E,
Qm,
(int8_t*)&pl_ol128[0],
llrProcBuf);
/*
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms, no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
ulsch_harq->p_nrLDPC_procBuf[r], ulsch_harq->p_nrLDPC_procBuf[r],
p_procTime); p_procTime);
*/
if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
LOG_I(PHY, "Segment %d CRC OK\n",r); LOG_I(PHY, "Segment %d CRC OK\n",r);
...@@ -488,13 +444,8 @@ no_iteration_ldpc = nrLDPC_decoder(p_decoderParms, ...@@ -488,13 +444,8 @@ no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
for (int m=0; m < Kr>>3; m ++) { for (int m=0; m < Kr>>3; m ++) {
ulsch_harq->c[r][m]= (uint8_t) llrProcBuf[m]; ulsch_harq->c[r][m]= (uint8_t) llrProcBuf[m];
} }
/*for (int k=0;k<16;k++)
{ //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
printf("output decoder [%d] = 0x%02x \n", k, ulsch_harq->c[r][k]);
printf("llrprocbuf [%d] = %x adr %p\n", k, llrProcBuf[k], llrProcBuf+k);
}
printf("no_iterations_ldpc %d \n",no_iteration_ldpc);
*/
} }
uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
...@@ -514,7 +465,17 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -514,7 +465,17 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
int kc; int kc;
int Tbslbrm; int Tbslbrm;
int E; int E;
int8_t llrProcBuf[22*384];
int ret = 0;
int i,j;
int8_t enable_ldpc_offload = 1;
int16_t z_ol [68*384];
int8_t l_ol [68*384];
__m128i *pv_ol128 = (__m128i*)&z_ol;
__m128i *pl_ol128 = (__m128i*)&l_ol;
int no_iteration_ldpc;
int length_dec;
uint8_t crc_type;
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
prnt_crc_cnt++; prnt_crc_cnt++;
#endif #endif
...@@ -661,12 +622,82 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -661,12 +622,82 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
Kr = harq_process->K; Kr = harq_process->K;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
offset = 0; offset = 0;
if (enable_ldpc_offload) {
memset(harq_process->c[0],0,Kr_bytes);
if (harq_process->C == 1) {
if (A > 3824)
crc_type = CRC24_A;
else
crc_type = CRC16;
length_dec = harq_process->B;
}
else {
crc_type = CRC24_B;
length_dec = (harq_process->B+24*harq_process->C)/harq_process->C;
}
E = nr_get_E(G, harq_process->C, Qm, n_layers, 0);
memcpy((&z_ol[0]),ulsch_llr,G*sizeof(int16_t));
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++)
{
pl_ol128[j] = _mm_packs_epi16(pv_ol128[i],pv_ol128[i+1]);
}
ret = nrLDPC_decoder_offload(p_decParams,
harq_process->C,
pusch_pdu->pusch_data.rv_index,
harq_process->F,
E,
Qm,
(int8_t*)&pl_ol128[0],
llrProcBuf);
for (r=0; r<harq_process->C; r++) {
for (int m=0; m < Kr>>3; m ++) {
harq_process->c[r][m]= (uint8_t) llrProcBuf[m];
}
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
#ifdef PRINT_CRC_CHECK
LOG_I(PHY, "Segment %d CRC OK\n",r);
#endif
no_iteration_ldpc = 2;
} else {
#ifdef PRINT_CRC_CHECK
LOG_I(PHY, "CRC NOK\n");
#endif
no_iteration_ldpc = ulsch->max_ldpc_iterations + 1;
}
for (int k=0;k<8;k++)
{
printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
printf("llrprocbuf [%d] = %x adr %p\n", k, llrProcBuf[k], llrProcBuf+k);
}
memcpy(harq_process->b+offset,
harq_process->c[r],
Kr_bytes - (harq_process->F>>3) -((harq_process->C>1)?3:0));
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0));
}
}
else {
void (*nr_processULSegment_ptr)(void*) = &nr_processULSegment; void (*nr_processULSegment_ptr)(void*) = &nr_processULSegment;
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
E = nr_get_E(G, harq_process->C, Qm, n_layers, r); E = nr_get_E(G, harq_process->C, Qm, n_layers, r);
printf("rm length %d seg %d\n", E,r);
union ldpcReqUnion id = {.s={ulsch->rnti,frame,nr_tti_rx,0,0}}; union ldpcReqUnion id = {.s={ulsch->rnti,frame,nr_tti_rx,0,0}};
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(ldpcDecode_t), id.p, phy_vars_gNB->respDecode, nr_processULSegment_ptr); notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(ldpcDecode_t), id.p, phy_vars_gNB->respDecode, nr_processULSegment_ptr);
ldpcDecode_t * rdata=(ldpcDecode_t *) NotifiedFifoData(req); ldpcDecode_t * rdata=(ldpcDecode_t *) NotifiedFifoData(req);
...@@ -696,5 +727,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -696,5 +727,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0));
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
} }
}
return 1; return 1;
} }
...@@ -288,7 +288,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -288,7 +288,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
uint8_t l, number_dmrs_symbols = 0; uint8_t l, number_dmrs_symbols = 0;
uint32_t G; uint32_t G;
uint16_t start_symbol, number_symbols, nb_re_dmrs; uint16_t start_symbol, number_symbols, nb_re_dmrs;
uint8_t enable_ldpc_offload = 1;
start_symbol = pusch_pdu->start_symbol_index; start_symbol = pusch_pdu->start_symbol_index;
number_symbols = pusch_pdu->nr_of_symbols; number_symbols = pusch_pdu->nr_of_symbols;
...@@ -345,12 +345,13 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -345,12 +345,13 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
slot_rx, slot_rx,
harq_pid, harq_pid,
G); G);
if (enable_ldpc_offload ==0) {
while (gNB->nbDecode > 0) { while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool); notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool);
nr_postDecode(gNB, req); nr_postDecode(gNB, req);
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
} }
}
stop_meas(&gNB->ulsch_decoding_stats); stop_meas(&gNB->ulsch_decoding_stats);
} }
......
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