Integration of dual thread and multi-parallelism threads

parent d0e4894f
......@@ -242,6 +242,10 @@ for(int th=0;th<thread_num_pressure;th++){
//Get value for multi pdsch
//scrambling
for (int th=0; th<thread_num_scrambling; th++){
if(th == 0){ // ==copy original memory space for check ==
gNB->multi_pdsch.f_first = harq->f;
gNB->multi_pdsch.scrambled_output_first = scrambled_output[0]; // ==Need to change ==***
}
for (int i=0; i<encoded_length>>3; i++) {
for (int j=0; j<8; j++)
gNB->multi_pdsch.f[th][(i<<3)+j] = harq->f[(i<<3)+j];
......@@ -254,6 +258,9 @@ for (int th=0; th<thread_num_scrambling; th++){
}
//modulation
for (int th=0; th<thread_num_modulation; th++){
if(th == 0){ // ==copy original memory space for check ==
gNB->multi_pdsch.mod_symbs_first = mod_symbs[0]; // ==Need to change ==***
}
for (int q=0; q<rel15->nb_codewords; q++) // ==Look out!NR_MAX_NB_CODEWORDS is 2!So we can't let q>2 until spec change
memset((void*)gNB->multi_pdsch.scrambled_output_mod[th][q], 0, (encoded_length>>5)*sizeof(uint32_t));
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++){
......
......@@ -473,6 +473,10 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
}
/*cpy original data to multi pdsch*/
for(int th=0;th<thread_num_ldpc_encoder;th++){
if(th == 0){ // ==copy original memory space for check ==
gNB->multi_pdsch.test_input_first = dlsch->harq_processes[harq_pid]->c;
gNB->multi_pdsch.channel_input_optim_first = dlsch->harq_processes[harq_pid]->d;
}
for(int j=0;j<MAX_NUM_NR_DLSCH_SEGMENTS/bw_scaling;j++){ // ==Why can not just be MAX_NUM_NR_DLSCH_SEGMENTS ==???
gNB->multi_pdsch.c[th][j]=(uint8_t*)malloc16(8448);//(unsigned char *)malloc16(sizeof(unsigned char) * Kr/8);
gNB->multi_pdsch.d[th][j]=(uint8_t*)malloc16(68*384);//(unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
......
......@@ -110,6 +110,12 @@ typedef struct{
volatile uint8_t complete_enc[thread_num_ldpc_encoder];
volatile uint8_t complete_scr[thread_num_scrambling];
volatile uint8_t complete_mod[thread_num_modulation];
/*memorys of the first thread*/
unsigned char **test_input_first;
unsigned char **channel_input_optim_first;
uint8_t *f_first;
uint32_t *scrambled_output_first;
int16_t *mod_symbs_first;
/*encoder*/
uint8_t *c[thread_num_ldpc_encoder][MAX_NUM_NR_DLSCH_SEGMENTS];
uint8_t *d[thread_num_ldpc_encoder][MAX_NUM_NR_DLSCH_SEGMENTS];
......
......@@ -141,11 +141,11 @@ int32_t nr_segmentation(unsigned char *input_buffer, unsigned char **output_buff
int ldpc_encoder_optim_8seg_multi(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, int n_segments,unsigned int macro_num, time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput);
/*! \file openair1/SIMULATION/NR_PHY/dlsim.c
* \brief parameterized multi-parallelism threads for pdsch
* \brief Integration of dual thread and multi-parallelism threads
* \author Terngyin Hsu, Sendren Xu, Nungyi Kuo, Kuankai Hsiung, Kaimi Yang (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 28-05-2020
* \version 3.1
* \date 04-06-2020
* \version 3.2
* \note
* \warning
*/
......@@ -375,15 +375,27 @@ static void *multi_ldpc_encoder_proc(int id){
printf(" Active %d(e) %d\n", id, j);
//clock_gettime(CLOCK_MONOTONIC, &start_perpre_ts[id]); //timing
}
ldpc_encoder_optim_8seg_multi(gNB->multi_pdsch.c[id],
gNB->multi_pdsch.d[id],
gNB->multi_pdsch.Zc[id],
gNB->multi_pdsch.Kb[id],
gNB->multi_pdsch.block_length[id],
gNB->multi_pdsch.BG[id],
gNB->multi_pdsch.n_segments[id],
j,
NULL, NULL, NULL, NULL);
if(id == 0){ // ==deal with original memory space for check ==
ldpc_encoder_optim_8seg_multi(gNB->multi_pdsch.test_input_first,
gNB->multi_pdsch.channel_input_optim_first,
gNB->multi_pdsch.Zc[id],
gNB->multi_pdsch.Kb[id],
gNB->multi_pdsch.block_length[id],
gNB->multi_pdsch.BG[id],
gNB->multi_pdsch.n_segments[id],
j,
NULL, NULL, NULL, NULL);
}else{
ldpc_encoder_optim_8seg_multi(gNB->multi_pdsch.c[id],
gNB->multi_pdsch.d[id],
gNB->multi_pdsch.Zc[id],
gNB->multi_pdsch.Kb[id],
gNB->multi_pdsch.block_length[id],
gNB->multi_pdsch.BG[id],
gNB->multi_pdsch.n_segments[id],
j,
NULL, NULL, NULL, NULL);
}
if(check_time){
// clock_gettime(CLOCK_MONOTONIC, &end_perpre_ts[id]); //timing
// printf(" Done %d(e) %d %.2f usec\n", id, j, (end_perpre_ts[id].tv_nsec - start_perpre_ts[id].tv_nsec) *1.0 / 1000);
......@@ -419,12 +431,21 @@ static void *multi_scrambling_proc(int id){
// clock_gettime(CLOCK_MONOTONIC, &start_perpre_ts[id]); //timing
}
//if(0){
nr_pdsch_codeword_scrambling(gNB->multi_pdsch.f[id],
gNB->multi_pdsch.encoded_length_scr[id],
q,
gNB->multi_pdsch.Nid[id],
gNB->multi_pdsch.n_RNTI[id],
gNB->multi_pdsch.scrambled_output_scr[id]);
if(id == 0){ // ==deal with original memory space for check ==
nr_pdsch_codeword_scrambling(gNB->multi_pdsch.f_first,
gNB->multi_pdsch.encoded_length_scr[id],
q,
gNB->multi_pdsch.Nid[id],
gNB->multi_pdsch.n_RNTI[id],
gNB->multi_pdsch.scrambled_output_first);
}else{
nr_pdsch_codeword_scrambling(gNB->multi_pdsch.f[id],
gNB->multi_pdsch.encoded_length_scr[id],
q,
gNB->multi_pdsch.Nid[id],
gNB->multi_pdsch.n_RNTI[id],
gNB->multi_pdsch.scrambled_output_scr[id]);
}
if(check_time){
// clock_gettime(CLOCK_MONOTONIC, &end_perpre_ts[id]); //timing
// printf(" Done %d(p) %d %.2f usec\n", id, q, (end_perpre_ts[id].tv_nsec - start_perpre_ts[id].tv_nsec) *1.0 / 1000);
......@@ -461,10 +482,17 @@ static void *multi_modulation_proc(int id){
printf(" Active %d(m) %d\n", id, q);
// clock_gettime(CLOCK_MONOTONIC, &start_perpre_ts[id]); //timing
}
nr_modulation(gNB->multi_pdsch.scrambled_output_mod[id],
gNB->multi_pdsch.encoded_length_mod[id],
gNB->multi_pdsch.Qm[id],
*gNB->multi_pdsch.mod_symbs[id]);//gNB->pressure_test[id].mod_symbs_test);
if(id == 0){ // ==deal with original memory space for check ==
nr_modulation(gNB->multi_pdsch.scrambled_output_first,
gNB->multi_pdsch.encoded_length_mod[id],
gNB->multi_pdsch.Qm[id],
gNB->multi_pdsch.mod_symbs_first);
}else{
nr_modulation(gNB->multi_pdsch.scrambled_output_mod[id],
gNB->multi_pdsch.encoded_length_mod[id],
gNB->multi_pdsch.Qm[id],
*gNB->multi_pdsch.mod_symbs[id]);//gNB->pressure_test[id].mod_symbs_test);
}
if(check_time){
// clock_gettime(CLOCK_MONOTONIC, &end_perpre_ts[id]); //timing
// printf(" Done %d(p) %d %.2f usec\n", id, q, (end_perpre_ts[id].tv_nsec - start_perpre_ts[id].tv_nsec) *1.0 / 1000);
......
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