Commit 1664d814 authored by Florian Kaltenberger's avatar Florian Kaltenberger

integrating SIMD optimized LDPC encoder

Conflicts:
	openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
parent 9118116a
...@@ -573,6 +573,7 @@ void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t); ...@@ -573,6 +573,7 @@ void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
short *ldpc_decoder(short *msgChannel,short block_length,short No_iteration,double rate); short *ldpc_decoder(short *msgChannel,short block_length,short No_iteration,double rate);
int encode_parity_check_part(uint16_t *c,uint16_t *d, short BG,short Zc,short Kb); int encode_parity_check_part(uint16_t *c,uint16_t *d, short BG,short Zc,short Kb);
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate); int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate);
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,unsigned char gen_code); int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,unsigned char gen_code);
int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments); int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments);
......
...@@ -94,16 +94,14 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -94,16 +94,14 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int simd_size; int simd_size;
//determine number of bits in codeword //determine number of bits in codeword
//if (block_length>3840) if (block_length>3840)
//{ {
AssertFatal(block_length>3840,"Block length < 3840 not supported yet\n");
BG=1; BG=1;
Kb = 22; Kb = 22;
nrows=46; //parity check bits nrows=46; //parity check bits
ncols=22; //info bits ncols=22; //info bits
}
//} else if (block_length<=3840)
/* else if (block_length<=3840)
{ {
BG=2; BG=2;
nrows=42; //parity check bits nrows=42; //parity check bits
...@@ -117,7 +115,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -117,7 +115,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
Kb = 8; Kb = 8;
else else
Kb = 6; Kb = 6;
} */ }
//find minimum value in all sets of lifting size //find minimum value in all sets of lifting size
Zc=0; Zc=0;
...@@ -156,6 +154,8 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -156,6 +154,8 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
c[i]=(test_input[i/8]&(1<<(i&7)))>>(i&7); c[i]=(test_input[i/8]&(1<<(i&7)))>>(i&7);
} }
stop_meas(tinput); stop_meas(tinput);
if (BG==1) {
// extend matrix // extend matrix
start_meas(tprep); start_meas(tprep);
for (i1=0; i1 < ncols; i1++) for (i1=0; i1 < ncols; i1++)
...@@ -177,6 +177,18 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh ...@@ -177,6 +177,18 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
start_meas(tparity); start_meas(tparity);
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb); encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
stop_meas(tparity); stop_meas(tparity);
}
else if (BG==2) {
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
printf("Problem with encoder\n");
return(-1);
}
}
else {
printf("Problem with encoder\n");
return(-1);
}
start_meas(toutput); start_meas(toutput);
// information part and puncture columns // information part and puncture columns
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char)); memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
......
...@@ -709,6 +709,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -709,6 +709,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
else else
Kr_int = Kr; Kr_int = Kr;
start_meas(te_stats);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][96]; d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][96];
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
...@@ -716,9 +717,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -716,9 +717,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]); printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]);
#endif #endif
//ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],&dlsch->harq_processes[harq_pid]->d[r][96],Kr,rate); //ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],&dlsch->harq_processes[harq_pid]->d[r][96],Kr,rate);
ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][96],Kr,1,3,NULL,NULL,NULL,NULL);
} }
start_meas(te_stats); //ldpc_encoder_multi_segment(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,rate,dlsch->harq_processes[harq_pid]->C);
ldpc_encoder_multi_segment(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,rate,dlsch->harq_processes[harq_pid]->C);
stop_meas(te_stats); stop_meas(te_stats);
#endif #endif
/*printf("end ldpc encoder -- output\n"); /*printf("end ldpc encoder -- output\n");
......
...@@ -43,7 +43,7 @@ double get_cpu_freq_GHz(void) { ...@@ -43,7 +43,7 @@ double get_cpu_freq_GHz(void) {
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
if (opp_enabled) { if (opp_enabled && ts) {
//static double cpu_freq_GHz = 3.2; //static double cpu_freq_GHz = 3.2;
...@@ -62,7 +62,7 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){ ...@@ -62,7 +62,7 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time) void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time)
{ {
if (opp_enabled) { if (opp_enabled && ts) {
static int first_time = 0; static int first_time = 0;
static double cpu_freq_GHz = 0.0; static double cpu_freq_GHz = 0.0;
......
...@@ -98,7 +98,7 @@ static inline uint32_t rdtsc_oai(void) ...@@ -98,7 +98,7 @@ static inline uint32_t rdtsc_oai(void)
static inline void start_meas(time_stats_t *ts) static inline void start_meas(time_stats_t *ts)
{ {
if (opp_enabled) { if (opp_enabled && ts) {
if (ts->meas_flag==0) { if (ts->meas_flag==0) {
ts->trials++; ts->trials++;
ts->in = rdtsc_oai(); ts->in = rdtsc_oai();
...@@ -113,7 +113,7 @@ static inline void start_meas(time_stats_t *ts) ...@@ -113,7 +113,7 @@ static inline void start_meas(time_stats_t *ts)
static inline void stop_meas(time_stats_t *ts) static inline void stop_meas(time_stats_t *ts)
{ {
if (opp_enabled) { if (opp_enabled && ts) {
long long out = rdtsc_oai(); long long out = rdtsc_oai();
ts->diff_now = (out-ts->in); ts->diff_now = (out-ts->in);
...@@ -133,6 +133,8 @@ static inline void stop_meas(time_stats_t *ts) ...@@ -133,6 +133,8 @@ static inline void stop_meas(time_stats_t *ts)
static inline void reset_meas(time_stats_t *ts) { static inline void reset_meas(time_stats_t *ts) {
if (ts) {
ts->trials=0; ts->trials=0;
ts->diff=0; ts->diff=0;
ts->diff_now=0; ts->diff_now=0;
...@@ -141,6 +143,7 @@ static inline void reset_meas(time_stats_t *ts) { ...@@ -141,6 +143,7 @@ static inline void reset_meas(time_stats_t *ts) {
ts->max=0; ts->max=0;
ts->meas_flag=0; ts->meas_flag=0;
}
} }
static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
......
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