Commit c2d0eb7d authored by Florian Kaltenberger's avatar Florian Kaltenberger

enabling multi-thread encoder. To be tested.

parent 5e732df7
...@@ -288,14 +288,16 @@ int dlsch_encoding_2threads0(te_params *tep) { ...@@ -288,14 +288,16 @@ int dlsch_encoding_2threads0(te_params *tep) {
unsigned short iind; unsigned short iind;
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0,Kr_int=0;
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs; // unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_IN);
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
#ifdef TD_DECODING
for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) { for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
if (r<dlsch->harq_processes[harq_pid]->Cminus) if (r<dlsch->harq_processes[harq_pid]->Cminus)
...@@ -333,6 +335,30 @@ int dlsch_encoding_2threads0(te_params *tep) { ...@@ -333,6 +335,30 @@ int dlsch_encoding_2threads0(te_params *tep) {
&dlsch->harq_processes[harq_pid]->d[r][96], &dlsch->harq_processes[harq_pid]->d[r][96],
dlsch->harq_processes[harq_pid]->w[r]); dlsch->harq_processes[harq_pid]->w[r]);
} }
#else
Kr = dlsch->harq_processes[harq_pid]->Kplus;
//workaround for nr ldpc using lte interleaving
Kr_bytes = Kr>>3;
if (dlsch->harq_processes[harq_pid]->C >= 2)
Kr_int = G/(3*dlsch->harq_processes[harq_pid]->C);
else
Kr_int = Kr;
for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
memset(dlsch->harq_processes[harq_pid]->d[r],0,(96+12+3+3*8448)*sizeof(uint8_t));
d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][96];
}
ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,1,3,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
dlsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo((Kr_int),
&dlsch->harq_processes[harq_pid]->d[r][96],
dlsch->harq_processes[harq_pid]->w[r]);
}
#endif
} }
...@@ -439,9 +465,10 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, ...@@ -439,9 +465,10 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
unsigned char harq_pid = dlsch->harq_ids[subframe]; unsigned char harq_pid = dlsch->harq_ids[subframe];
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A; unsigned int A,Z;
unsigned char mod_order; unsigned char mod_order;
unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0,Kr_int=0;
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs; // unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
...@@ -466,6 +493,7 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, ...@@ -466,6 +493,7 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
//stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats); //stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
start_meas(&eNB->dlsch_turbo_encoding_segmentation_stats); start_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
#ifdef TD_DECODING
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c, dlsch->harq_processes[harq_pid]->c,
dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->B,
...@@ -476,6 +504,17 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, ...@@ -476,6 +504,17 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
&dlsch->harq_processes[harq_pid]->Kminus, &dlsch->harq_processes[harq_pid]->Kminus,
&dlsch->harq_processes[harq_pid]->F)<0) &dlsch->harq_processes[harq_pid]->F)<0)
return(-1); return(-1);
#else
nr_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c,
dlsch->harq_processes[harq_pid]->B,
&dlsch->harq_processes[harq_pid]->C,
&dlsch->harq_processes[harq_pid]->Kplus,
&dlsch->harq_processes[harq_pid]->Kminus,
&Z,
&dlsch->harq_processes[harq_pid]->F);
#endif
stop_meas(&eNB->dlsch_turbo_encoding_segmentation_stats); stop_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
...@@ -510,6 +549,8 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, ...@@ -510,6 +549,8 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
} }
stop_meas(&eNB->dlsch_turbo_encoding_signal_stats); stop_meas(&eNB->dlsch_turbo_encoding_signal_stats);
#ifdef TD_DECODING
start_meas(te_main_stats); start_meas(te_main_stats);
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) { for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
...@@ -552,6 +593,35 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, ...@@ -552,6 +593,35 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
dlsch->harq_processes[harq_pid]->w[r]); dlsch->harq_processes[harq_pid]->w[r]);
stop_meas(i_stats); stop_meas(i_stats);
} }
#else
Kr = dlsch->harq_processes[harq_pid]->Kplus;
//workaround for nr ldpc using lte interleaving
Kr_bytes = Kr>>3;
if (dlsch->harq_processes[harq_pid]->C >= 2)
Kr_int = G/(3*dlsch->harq_processes[harq_pid]->C);
else
Kr_int = Kr;
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
memset(dlsch->harq_processes[harq_pid]->d[r],0,(96+12+3+3*8448)*sizeof(uint8_t));
d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][96];
}
start_meas(te_stats);
ldpc_encoder_optim_8seg(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,1,3,dlsch->harq_processes[harq_pid]->C,NULL,NULL,NULL,NULL);
stop_meas(te_stats);
start_meas(i_stats);
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
dlsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo((Kr_int),
&dlsch->harq_processes[harq_pid]->d[r][96],
dlsch->harq_processes[harq_pid]->w[r]);
}
stop_meas(i_stats);
#endif
} }
else { else {
...@@ -638,107 +708,105 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, ...@@ -638,107 +708,105 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
return(0); return(0);
} }
int dlsch_encoding_all(PHY_VARS_eNB *eNB, int dlsch_encoding_all(PHY_VARS_eNB *eNB,
unsigned char *a, unsigned char *a,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch,
int frame, int frame,
uint8_t subframe, uint8_t subframe,
time_stats_t *rm_stats, time_stats_t *rm_stats,
time_stats_t *te_stats, time_stats_t *te_stats,
time_stats_t *te_wait_stats, time_stats_t *te_wait_stats,
time_stats_t *te_main_stats, time_stats_t *te_main_stats,
time_stats_t *te_wakeup_stats0, time_stats_t *te_wakeup_stats0,
time_stats_t *te_wakeup_stats1, time_stats_t *te_wakeup_stats1,
time_stats_t *i_stats) time_stats_t *i_stats)
{ {
int encoding_return = 0; int encoding_return = 0;
/* unsigned int L,C,B;
unsigned int L,C,B; B = dlsch->harq_processes[dlsch->harq_ids[subframe]]->B;
B = dlsch->harq_processes[dlsch->harq_ids[subframe]]->B; if(B<=8448)
if(B<=6144) {
{ L=0;
L=0; C=1;
C=1; }
} else
else {
{ L=24;
L=24; C = B/(8448-L);
C = B/(6144-L); if((8448-L)*C < B)
if((6144-L)*C < B)
{
C = C+1;
}
}
if(C >= 8 && get_nprocs()>8 && codingw)//one main three worker
{ {
encoding_return = C = C+1;
dlsch_encoding_2threads(eNB,
a,
num_pdcch_symbols,
dlsch,
frame,
subframe,
rm_stats,
te_stats,
te_wait_stats,
te_main_stats,
te_wakeup_stats0,
te_wakeup_stats1,
i_stats,
3);
} }
else if(C >= 6 && get_nprocs()>=6 && codingw)//one main two worker }
if(C >= 8 && get_nprocs()>=8 && codingw)//one main three worker
{ {
encoding_return = encoding_return =
dlsch_encoding_2threads(eNB, dlsch_encoding_2threads(eNB,
a, a,
num_pdcch_symbols, num_pdcch_symbols,
dlsch, dlsch,
frame, frame,
subframe, subframe,
rm_stats, rm_stats,
te_stats, te_stats,
te_wait_stats, te_wait_stats,
te_main_stats, te_main_stats,
te_wakeup_stats0, te_wakeup_stats0,
te_wakeup_stats1, te_wakeup_stats1,
i_stats, i_stats,
2); 3);
} }
else if(C >= 4 && get_nprocs()>=4 && codingw)//one main one worker else if(C >= 6 && get_nprocs()>=6 && codingw)//one main two worker
{ {
encoding_return = encoding_return =
dlsch_encoding_2threads(eNB, dlsch_encoding_2threads(eNB,
a, a,
num_pdcch_symbols, num_pdcch_symbols,
dlsch, dlsch,
frame, frame,
subframe, subframe,
rm_stats, rm_stats,
te_stats, te_stats,
te_wait_stats, te_wait_stats,
te_main_stats, te_main_stats,
te_wakeup_stats0, te_wakeup_stats0,
te_wakeup_stats1, te_wakeup_stats1,
i_stats, i_stats,
1); 2);
} }
else else if(C >= 4 && get_nprocs()>=4 && codingw)//one main one worker
{ {
*/ encoding_return =
encoding_return = dlsch_encoding_2threads(eNB,
dlsch_encoding(eNB, a,
a, num_pdcch_symbols,
num_pdcch_symbols, dlsch,
dlsch, frame,
frame, subframe,
subframe, rm_stats,
rm_stats, te_stats,
te_stats, te_wait_stats,
i_stats); te_main_stats,
//} te_wakeup_stats0,
return encoding_return; te_wakeup_stats1,
i_stats,
1);
}
else
{
encoding_return =
dlsch_encoding(eNB,
a,
num_pdcch_symbols,
dlsch,
frame,
subframe,
rm_stats,
te_stats,
i_stats);
}
return encoding_return;
} }
...@@ -763,9 +831,8 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -763,9 +831,8 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned char harq_pid = dlsch->harq_ids[subframe]; unsigned char harq_pid = dlsch->harq_ids[subframe];
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A, Z; unsigned int A, Z;
unsigned *pz = &Z;
unsigned char mod_order; unsigned char mod_order;
unsigned int Kr=0,Kr_bytes,r,r_offset=0,Kr_int=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0,Kr_int=0;
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs; // unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
uint8_t beamforming_mode=0; uint8_t beamforming_mode=0;
//double rate = 0.33; //double rate = 0.33;
...@@ -829,7 +896,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -829,7 +896,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
&dlsch->harq_processes[harq_pid]->C, &dlsch->harq_processes[harq_pid]->C,
&dlsch->harq_processes[harq_pid]->Kplus, &dlsch->harq_processes[harq_pid]->Kplus,
&dlsch->harq_processes[harq_pid]->Kminus, &dlsch->harq_processes[harq_pid]->Kminus,
pz, &Z,
&dlsch->harq_processes[harq_pid]->F); &dlsch->harq_processes[harq_pid]->F);
#endif #endif
......
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