Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
d0e4894f
Commit
d0e4894f
authored
May 28, 2020
by
OpInConnect_NCTU Terngyin/NY/GK/KM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parameterized multi-parallelism threads for pdsch
parent
9c645ed5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
53 deletions
+56
-53
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+6
-6
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+3
-3
openair1/PHY/defs_gNB.h
openair1/PHY/defs_gNB.h
+38
-35
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+9
-9
No files found.
openair1/PHY/NR_TRANSPORT/nr_dlsch.c
View file @
d0e4894f
...
...
@@ -241,7 +241,7 @@ for(int th=0;th<thread_num_pressure;th++){
}
//Get value for multi pdsch
//scrambling
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_scrambling
;
th
++
){
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
];
...
...
@@ -253,7 +253,7 @@ for (int th=0; th<2; th++){
gNB
->
multi_pdsch
.
n_RNTI
[
th
]
=
n_RNTI
;
}
//modulation
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_modulation
;
th
++
){
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
++
){
...
...
@@ -284,7 +284,7 @@ for (int q=0; q<thread_num_pdsch; q++){
for
(
int
q
=
0
;
q
<
thread_num_pressure
;
q
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
q
].
cond_scr_mod
));
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_scrambling
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_pdsch
.
cond_scr
[
th
]));
}
//Wait scrambling threads(or scr_mod threads)
...
...
@@ -294,7 +294,7 @@ for (int q=0; q<thread_num_pdsch; q++){
for
(
int
q
=
0
;
q
<
thread_num_pressure
;
q
++
){
while
(
gNB
->
pressure_test
[
q
].
complete_scr_mod
!=
1
);
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_scrambling
;
th
++
){
while
(
gNB
->
multi_pdsch
.
complete_scr
[
th
]
!=
1
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
...
...
@@ -303,11 +303,11 @@ printf("==================[Mod]==================\n");
printf
(
" [Movement] [No.] [Round] [Cost time]
\n
"
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
start_ts
);
//timing
//Awake modulation threads
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_modulation
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_pdsch
.
cond_mod
[
th
]));
}
//Wait modulation threads
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_modulation
;
th
++
){
while
(
gNB
->
multi_pdsch
.
complete_mod
[
th
]
!=
1
);
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
...
...
openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
View file @
d0e4894f
...
...
@@ -472,7 +472,7 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
gNB
->
pressure_test
[
th
].
n_segments
=
dlsch
->
harq_processes
[
harq_pid
]
->
C
;
}
/*cpy original data to multi pdsch*/
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_ldpc_encoder
;
th
++
){
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);
...
...
@@ -508,7 +508,7 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
pressure_test
[
th
].
cond
));
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_ldpc_encoder
;
th
++
){
pthread_cond_signal
(
&
(
gNB
->
multi_pdsch
.
cond_enc
[
th
]));
}
for
(
int
th
=
0
;
th
<
thread_num_pdsch
;
th
++
){
...
...
@@ -517,7 +517,7 @@ int nr_dlsch_encoding(unsigned char *a, //harq->pdu => dlsch->harq_processes[har
for
(
int
th
=
0
;
th
<
thread_num_pressure
;
th
++
){
while
(
gNB
->
pressure_test
[
th
].
complete
!=
1
);
// ==check if multi_ldpc_enc done ==
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_ldpc_encoder
;
th
++
){
while
(
gNB
->
multi_pdsch
.
complete_enc
[
th
]
!=
1
);
// ==check if multi_ldpc_enc done ==
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
end_ts
);
//timing
...
...
openair1/PHY/defs_gNB.h
View file @
d0e4894f
...
...
@@ -46,8 +46,11 @@
#include "common/utils/LOG/vcd_signal_dumper.h" //VCD
#define MAX_NUM_RU_PER_gNB MAX_NUM_RU_PER_eNB
#define thread_num_pdsch
1
// ==Change thread_num_pdsch here. Don't greater than 2 ==
#define thread_num_pdsch
0
// ==Change thread_num_pdsch here. Don't greater than 2 ==
#define thread_num_pressure 0 // ==Change thread_num_pressure here ==
#define thread_num_ldpc_encoder 2
#define thread_num_scrambling 3
#define thread_num_modulation 4
#define check_time 0 // ==Change if you wnat to check time of threads ==
typedef
struct
{
...
...
@@ -89,43 +92,43 @@ typedef struct{
typedef
struct
{
/*params of thread*/
int
id_enc
[
2
];
int
id_scr
[
2
];
int
id_mod
[
2
];
pthread_t
pthread_enc
[
2
];
pthread_t
pthread_scr
[
2
];
pthread_t
pthread_mod
[
2
];
pthread_cond_t
cond_enc
[
2
];
pthread_cond_t
cond_scr
[
2
];
pthread_cond_t
cond_mod
[
2
];
pthread_mutex_t
mutex_enc
[
2
];
pthread_mutex_t
mutex_scr
[
2
];
pthread_mutex_t
mutex_mod
[
2
];
pthread_attr_t
attr_enc
[
2
];
pthread_attr_t
attr_scr
[
2
];
pthread_attr_t
attr_mod
[
2
];
volatile
uint8_t
complete_enc
[
2
];
volatile
uint8_t
complete_scr
[
2
];
volatile
uint8_t
complete_mod
[
2
];
int
id_enc
[
thread_num_ldpc_encoder
];
int
id_scr
[
thread_num_scrambling
];
int
id_mod
[
thread_num_modulation
];
pthread_t
pthread_enc
[
thread_num_ldpc_encoder
];
pthread_t
pthread_scr
[
thread_num_scrambling
];
pthread_t
pthread_mod
[
thread_num_modulation
];
pthread_cond_t
cond_enc
[
thread_num_ldpc_encoder
];
pthread_cond_t
cond_scr
[
thread_num_scrambling
];
pthread_cond_t
cond_mod
[
thread_num_modulation
];
pthread_mutex_t
mutex_enc
[
thread_num_ldpc_encoder
];
pthread_mutex_t
mutex_scr
[
thread_num_scrambling
];
pthread_mutex_t
mutex_mod
[
thread_num_modulation
];
pthread_attr_t
attr_enc
[
thread_num_ldpc_encoder
];
pthread_attr_t
attr_scr
[
thread_num_scrambling
];
pthread_attr_t
attr_mod
[
thread_num_modulation
];
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
];
/*encoder*/
uint8_t
*
c
[
2
][
MAX_NUM_NR_DLSCH_SEGMENTS
];
uint8_t
*
d
[
2
][
MAX_NUM_NR_DLSCH_SEGMENTS
];
int
Zc
[
2
];
int
Kb
[
2
];
short
block_length
[
2
];
short
BG
[
2
];
int
n_segments
[
2
];
uint8_t
*
c
[
thread_num_ldpc_encoder
][
MAX_NUM_NR_DLSCH_SEGMENTS
];
uint8_t
*
d
[
thread_num_ldpc_encoder
][
MAX_NUM_NR_DLSCH_SEGMENTS
];
int
Zc
[
thread_num_ldpc_encoder
];
int
Kb
[
thread_num_ldpc_encoder
];
short
block_length
[
thread_num_ldpc_encoder
];
short
BG
[
thread_num_ldpc_encoder
];
int
n_segments
[
thread_num_ldpc_encoder
];
/*scrambling*/
uint8_t
f
[
2
][
MAX_NUM_NR_CHANNEL_BITS
]
__attribute__
((
aligned
(
32
)));
uint32_t
scrambled_output_scr
[
2
][
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
// ==use 2 or 2
==???
uint32_t
encoded_length_scr
[
2
];
// ==use 2 or 2
==???
uint16_t
Nid
[
2
];
uint16_t
n_RNTI
[
2
];
uint8_t
f
[
thread_num_scrambling
][
MAX_NUM_NR_CHANNEL_BITS
]
__attribute__
((
aligned
(
32
)));
uint32_t
scrambled_output_scr
[
thread_num_scrambling
][
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
// ==use thread_num_scrambling or thread_num_modulation
==???
uint32_t
encoded_length_scr
[
thread_num_scrambling
];
// ==use thread_num_scrambling or thread_num_modulation
==???
uint16_t
Nid
[
thread_num_scrambling
];
uint16_t
n_RNTI
[
thread_num_scrambling
];
/*modulation*/
uint32_t
scrambled_output_mod
[
2
][
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
// ==use 2 or 2
==???
int32_t
*
mod_symbs
[
2
][
NR_MAX_NB_CODEWORDS
];
uint32_t
encoded_length_mod
[
2
];
// ==use 2 or 2
==???
uint8_t
Qm
[
2
];
uint32_t
scrambled_output_mod
[
thread_num_modulation
][
NR_MAX_NB_CODEWORDS
][
NR_MAX_PDSCH_ENCODED_LENGTH
>>
5
];
// ==use thread_num_scrambling or thread_num_modulation
==???
int32_t
*
mod_symbs
[
thread_num_modulation
][
NR_MAX_NB_CODEWORDS
];
uint32_t
encoded_length_mod
[
thread_num_modulation
];
// ==use thread_num_scrambling or thread_num_modulation
==???
uint8_t
Qm
[
thread_num_modulation
];
}
multi_pdsch_gNB
;
typedef
struct
{
...
...
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
d0e4894f
...
...
@@ -141,18 +141,18 @@ 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 multi-parallelism threads for pdsch
* \brief
parameterized
multi-parallelism threads for pdsch
* \author Terngyin Hsu, Sendren Xu, Nungyi Kuo, Kuankai Hsiung, Kaimi Yang (OpInConnect_NCTU)
* \email tyhsu@cs.nctu.edu.tw
* \date 2
2
-05-2020
* \version 3.
0
* \date 2
8
-05-2020
* \version 3.
1
* \note
* \warning
*/
//[START]multi_genetate_pdsch_proc
struct
timespec
start_encoder_ts
[
thread_num_pdsch
],
end_encoder_ts
[
thread_num_pdsch
],
start_perenc_ts
[
thread_num_pdsch
],
end_perenc_ts
[
thread_num_pdsch
],
start_pressure_ts
[
thread_num_pressure
],
end_pressure_ts
[
thread_num_pressure
],
start_perpre_ts
[
thread_num_pressure
],
end_perpre_ts
[
thread_num_pressure
];
struct
timespec
start_multi_enc_ts
[
2
],
end_multi_enc_ts
[
2
],
start_multi_scr_ts
[
2
],
end_multi_scr_ts
[
2
],
start_multi_mod_ts
[
2
],
end_multi_mod_ts
[
2
];
struct
timespec
start_multi_enc_ts
[
thread_num_ldpc_encoder
],
end_multi_enc_ts
[
thread_num_ldpc_encoder
],
start_multi_scr_ts
[
thread_num_scrambling
],
end_multi_scr_ts
[
thread_num_scrambling
],
start_multi_mod_ts
[
thread_num_modulation
],
end_multi_mod_ts
[
thread_num_modulation
];
int
vcd
=
0
;
//default : 0
/*original genetate_pdsch for multi threads*/
static
void
*
multi_genetate_pdsch_proc
(
void
*
ptr
){
...
...
@@ -960,7 +960,7 @@ int main(int argc, char **argv)
printf
(
"[CREATE] LDPC encoder thread %d(p)
\n
"
,
gNB
->
pressure_test
[
th
].
id
);
}
/*multi pdsch*/
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_ldpc_encoder
;
th
++
){
pthread_attr_init
(
&
(
gNB
->
multi_pdsch
.
attr_enc
[
th
]));
pthread_mutex_init
(
&
(
gNB
->
multi_pdsch
.
mutex_enc
[
th
]),
NULL
);
pthread_cond_init
(
&
(
gNB
->
multi_pdsch
.
cond_enc
[
th
]),
NULL
);
...
...
@@ -969,7 +969,7 @@ int main(int argc, char **argv)
pthread_create
(
&
(
gNB
->
multi_pdsch
.
pthread_enc
[
th
]),
&
(
gNB
->
multi_pdsch
.
attr_enc
[
th
]),
multi_ldpc_encoder_proc
,
gNB
->
multi_pdsch
.
id_enc
[
th
]);
printf
(
"[CREATE] multi_ldpc_encoder_proc %d
\n
"
,
gNB
->
multi_pdsch
.
id_enc
[
th
]);
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_scrambling
;
th
++
){
pthread_attr_init
(
&
(
gNB
->
multi_pdsch
.
attr_scr
[
th
]));
pthread_mutex_init
(
&
(
gNB
->
multi_pdsch
.
mutex_scr
[
th
]),
NULL
);
pthread_cond_init
(
&
(
gNB
->
multi_pdsch
.
cond_scr
[
th
]),
NULL
);
...
...
@@ -979,7 +979,7 @@ int main(int argc, char **argv)
printf
(
"[CREATE] multi_scrambling_proc %d
\n
"
,
gNB
->
multi_pdsch
.
id_scr
[
th
]);
}
//for(int th=0;th<0;th++){
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_modulation
;
th
++
){
pthread_attr_init
(
&
(
gNB
->
multi_pdsch
.
attr_mod
[
th
]));
pthread_mutex_init
(
&
(
gNB
->
multi_pdsch
.
mutex_mod
[
th
]),
NULL
);
pthread_cond_init
(
&
(
gNB
->
multi_pdsch
.
cond_mod
[
th
]),
NULL
);
...
...
@@ -1359,13 +1359,13 @@ int main(int argc, char **argv)
// }
}
//free multi_pdsch memorys
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_ldpc_encoder
;
th
++
){
for
(
int
j
=
0
;
j
<
MAX_NUM_NR_DLSCH_SEGMENTS
/
bw_scaling
;
j
++
){
free
(
gNB
->
multi_pdsch
.
c
[
th
][
j
]);
free
(
gNB
->
multi_pdsch
.
d
[
th
][
j
]);
}
}
for
(
int
th
=
0
;
th
<
2
;
th
++
){
for
(
int
th
=
0
;
th
<
thread_num_modulation
;
th
++
){
for
(
int
q
=
0
;
q
<
NR_MAX_NB_CODEWORDS
;
q
++
){
free
(
gNB
->
multi_pdsch
.
mod_symbs
[
th
][
q
]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment