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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
3e019af4
Commit
3e019af4
authored
Sep 04, 2024
by
Laurent THOMAS
Committed by
Robert Schmidt
Nov 07, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the big LUT for decoder de-interleaver
no performance degradation some reformatting
parent
d57ea715
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
138 additions
and
217 deletions
+138
-217
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+102
-102
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+20
-98
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+12
-11
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+2
-4
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+2
-0
openair1/PHY/CODING/nr_polar_init.c
openair1/PHY/CODING/nr_polar_init.c
+0
-2
No files found.
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
3e019af4
This diff is collapsed.
Click to expand it.
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
View file @
3e019af4
...
...
@@ -592,29 +592,6 @@ int8_t polar_decoder_dci(double *input,
return
0
;
}
void
init_polar_deinterleaver_table
(
t_nrPolar_params
*
polarParams
)
{
AssertFatal
(
polarParams
->
K
>
17
,
"K = %d < 18, is not allowed
\n
"
,
polarParams
->
K
);
AssertFatal
(
polarParams
->
K
<
129
,
"K = %d > 128, is not supported yet
\n
"
,
polarParams
->
K
);
int
numbytes
=
(
polarParams
->
K
+
7
)
/
8
;
for
(
int
byte
=
0
;
byte
<
numbytes
;
byte
++
)
{
int
numbits
=
byte
<
(
polarParams
->
K
>>
3
)
?
8
:
polarParams
->
K
&
7
;
for
(
int
bit
=
0
;
bit
<
numbits
;
bit
++
)
{
// flip bit endian for B
int
ip
=
polarParams
->
K
-
1
-
polarParams
->
interleaving_pattern
[(
8
*
byte
)
+
bit
];
int
ipmod64
=
ip
&
63
;
AssertFatal
(
ip
<
128
,
"ip = %d
\n
"
,
ip
);
for
(
int
val
=
0
;
val
<
256
;
val
++
)
{
int
bit_i
=
(
val
>>
bit
)
&
1
;
if
(
ip
<
64
)
polarParams
->
B_tab0
[
byte
][
val
]
|=
((
uint64_t
)
bit_i
)
<<
ipmod64
;
else
polarParams
->
B_tab1
[
byte
][
val
]
|=
((
uint64_t
)
bit_i
)
<<
ipmod64
;
}
}
}
}
static
inline
void
nr_polar_rate_matching_int16
(
int16_t
*
input
,
int16_t
*
output
,
const
uint16_t
*
rmp
,
...
...
@@ -644,28 +621,29 @@ static inline void nr_polar_info_extraction_from_u(uint64_t *Cprime,
const
uint8_t
*
u
,
const
uint8_t
*
information_bit_pattern
,
const
uint8_t
*
parity_check_bit_pattern
,
const
uint16_t
*
interleaving_pattern
,
uint16_t
N
,
uint8_t
n_pc
)
uint8_t
n_pc
,
int
K
)
{
int
k
=
0
;
if
(
n_pc
>
0
)
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
if
(
parity_check_bit_pattern
[
n
]
==
0
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
if
(
information_bit_pattern
[
n
]
==
1
&&
parity_check_bit_pattern
[
n
]
==
0
)
{
int
targetBit
=
K
-
1
-
interleaving_pattern
[
k
];
int
k1
=
targetBit
>>
6
;
int
k2
=
targetBit
&
63
;
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
}
}
else
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
if
(
information_bit_pattern
[
n
]
==
1
)
{
int
k1
=
k
>>
6
;
int
k2
=
k
-
(
k1
<<
6
);
int
targetBit
=
K
-
1
-
interleaving_pattern
[
k
];
int
k1
=
targetBit
>>
6
;
int
k2
=
targetBit
&
63
;
Cprime
[
k1
]
|=
(
uint64_t
)
u
[
n
]
<<
k2
;
k
++
;
}
...
...
@@ -725,18 +703,8 @@ uint32_t polar_decoder_int16(int16_t *input,
#endif
uint8_t
nr_polar_U
[
N
];
memset
(
nr_polar_U
,
0
,
sizeof
(
nr_polar_U
));
static
uint64_t
cnt
=
0
,
timeTree
=
0
,
timeDecoder
=
0
;
uint64_t
a
=
rdtsc_oai
();
decoder_tree_t
tree
;
build_decoder_tree
(
&
tree
,
polarParams
);
uint64_t
b
=
rdtsc_oai
();
memcpy
(
treeAlpha
(
tree
.
root
),
d_tilde
,
sizeof
(
d_tilde
));
generic_polar_decoder
(
polarParams
,
tree
.
root
,
nr_polar_U
);
uint64_t
c
=
rdtsc_oai
();
timeTree
+=
b
-
a
;
timeDecoder
+=
c
-
b
;
if
(
cnt
++
%
1000
==
0
)
printf
(
"tree: %ld, dec %ld
\n
"
,
timeTree
/
(
cnt
),
timeDecoder
/
(
cnt
));
memcpy
(
treeAlpha
(
polarParams
->
decoder
.
root
),
d_tilde
,
sizeof
(
d_tilde
));
generic_polar_decoder
(
polarParams
,
polarParams
->
decoder
.
root
,
nr_polar_U
);
#ifdef POLAR_CODING_DEBUG
printf
(
"u: "
);
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
...
...
@@ -749,13 +717,15 @@ uint32_t polar_decoder_int16(int16_t *input,
#endif
// Extract the information bits (û to ĉ)
uint64_t
Cprime
[
4
]
=
{
0
};
nr_polar_info_extraction_from_u
(
Cprime
,
uint64_t
B
[
4
]
=
{
0
};
nr_polar_info_extraction_from_u
(
B
,
nr_polar_U
,
polarParams
->
information_bit_pattern
,
polarParams
->
parity_check_bit_pattern
,
polarParams
->
interleaving_pattern
,
N
,
polarParams
->
n_pc
);
polarParams
->
n_pc
,
polarParams
->
K
);
#ifdef POLAR_CODING_DEBUG
printf
(
"c: "
);
...
...
@@ -765,55 +735,7 @@ uint32_t polar_decoder_int16(int16_t *input,
}
int
n1
=
n
>>
6
;
int
n2
=
n
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
Cprime
[
n1
]
>>
n2
)
&
1
);
}
printf
(
"
\n
"
);
#endif
//Deinterleaving (ĉ to b)
uint8_t
*
Cprimebyte
=
(
uint8_t
*
)
Cprime
;
uint64_t
B
[
4
]
=
{
0
};
if
(
polarParams
->
K
<
65
)
{
B
[
0
]
=
polarParams
->
B_tab0
[
0
][
Cprimebyte
[
0
]]
|
polarParams
->
B_tab0
[
1
][
Cprimebyte
[
1
]]
|
polarParams
->
B_tab0
[
2
][
Cprimebyte
[
2
]]
|
polarParams
->
B_tab0
[
3
][
Cprimebyte
[
3
]]
|
polarParams
->
B_tab0
[
4
][
Cprimebyte
[
4
]]
|
polarParams
->
B_tab0
[
5
][
Cprimebyte
[
5
]]
|
polarParams
->
B_tab0
[
6
][
Cprimebyte
[
6
]]
|
polarParams
->
B_tab0
[
7
][
Cprimebyte
[
7
]];
}
else
if
(
polarParams
->
K
<
129
)
{
for
(
int
k
=
0
;
k
<
8
;
k
++
)
{
B
[
0
]
|=
polarParams
->
B_tab0
[
k
][
Cprimebyte
[
k
]];
B
[
1
]
|=
polarParams
->
B_tab1
[
k
][
Cprimebyte
[
k
]];
}
}
uint128_t
Cprime128
=
*
(
uint128_t
*
)
Cprime
;
uint128_t
res
=
0
;
uint
deinterleaving_pattern
[
polarParams
->
K
];
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
deinterleaving_pattern
[
polarParams
->
interleaving_pattern
[
i
]]
=
i
;
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
{
uint128_t
bit
=
(
Cprime128
>>
i
)
&
1
;
res
|=
bit
<<
(
polarParams
->
K
-
1
-
deinterleaving_pattern
[
i
]);
}
uint128_t
B128
=
*
(
uint128_t
*
)
B
;
printf
(
"old:(k=%d)"
,
polarParams
->
K
);
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
printf
(
"%lld"
,
(
B128
>>
i
)
&
1
);
printf
(
"
\n
new:(k=%d)"
,
polarParams
->
K
);
for
(
int
i
=
0
;
i
<
polarParams
->
K
;
i
++
)
printf
(
"%lld"
,
(
res
>>
i
)
&
1
);
printf
(
"
\n\n
"
);
#ifdef POLAR_CODING_DEBUG
int
B_array
=
(
polarParams
->
K
+
63
)
>>
6
;
int
n_start
=
(
B_array
<<
6
)
-
polarParams
->
K
;
printf
(
"b: "
);
for
(
int
n
=
0
;
n
<
polarParams
->
K
;
n
++
)
{
if
(
n
%
4
==
0
)
{
printf
(
" "
);
}
int
n1
=
(
n
+
n_start
)
>>
6
;
int
n2
=
(
n
+
n_start
)
-
(
n1
<<
6
);
printf
(
"%lu"
,
(
B
[
B_array
-
1
-
n1
]
>>
(
63
-
n2
))
&
1
);
printf
(
"%lu"
,
(
B
[
n1
]
>>
n2
)
&
1
);
}
printf
(
"
\n
"
);
#endif
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
View file @
3e019af4
...
...
@@ -161,8 +161,10 @@ static inline decoder_node_t *new_decoder_node(simde__m256i **buffer,
if
(
leaf_sz
>
15
)
// we will use SIMD256
leaf_sz
=
(
leaf_sz
+
15
)
&
~
15
;
const
int
tree_sz
=
(
sizeof
(
decoder_node_t
)
+
31
)
&
~
31
;
decoder_node_t
*
node
=
(
decoder_node_t
*
)
*
buffer
;
*
buffer
=
*
buffer
+
(
tree_sz
+
leaf_sz
*
sizeof
(
int16_t
)
+
leaf_sz
+
sizeof
(
**
buffer
)
-
1
)
/
sizeof
(
**
buffer
);
uintptr_t
tmp
=
(
uintptr_t
)
*
buffer
;
tmp
=
(
tmp
+
sizeof
(
**
buffer
)
-
1
)
&
~
(
sizeof
(
**
buffer
)
-
1
);
decoder_node_t
*
node
=
(
decoder_node_t
*
)
tmp
;
*
buffer
=
(
simde__m256i
*
)(
tmp
+
tree_sz
+
leaf_sz
*
sizeof
(
int16_t
)
+
leaf_sz
);
*
node
=
(
decoder_node_t
){.
first_leaf_index
=
first_leaf_index
,
.
level
=
level
,
.
leaf
=
leaf
,
...
...
@@ -204,17 +206,16 @@ static inline decoder_node_t *add_nodes(decoder_tree_t *tree,
return
(
new_node
);
}
void
build_decoder_tree
(
decoder_tree_t
*
tree
,
const
t_nrPolar_params
*
pp
)
void
build_decoder_tree
(
t_nrPolar_params
*
pp
)
{
simde__m256i
*
buffer
=
tree
->
buffer
;
tree
->
root
=
add_nodes
(
tree
,
pp
->
n
,
0
,
pp
->
information_bit_pattern
,
&
buffer
);
AssertFatal
(
buffer
<
tree
->
buffer
+
sizeofArray
(
tree
->
buffer
),
uintptr_t
tmp
=
(
uintptr_t
)
pp
->
decoder
.
buffer
;
tmp
=
(
tmp
+
sizeof
(
*
pp
->
decoder
.
buffer
)
-
1
)
&
~
(
sizeof
(
*
pp
->
decoder
.
buffer
)
-
1
);
simde__m256i
*
buffer
=
(
simde__m256i
*
)
tmp
;
pp
->
decoder
.
root
=
add_nodes
(
&
pp
->
decoder
,
pp
->
n
,
0
,
pp
->
information_bit_pattern
,
&
buffer
);
AssertFatal
(
buffer
<
pp
->
decoder
.
buffer
+
sizeofArray
(
pp
->
decoder
.
buffer
),
"Arbitrary size too small (also check arbitrary max size of the entire polar decoder) %ld instead of max %ld
\n
"
,
buffer
-
tree
->
buffer
,
sizeofArray
(
tree
->
buffer
));
#ifdef DEBUG_NEW_IMPL
printf
(
"root : left %p, right %p
\n
"
,
tree
->
root
->
left
,
tree
->
root
->
right
);
#endif
buffer
-
pp
->
decoder
.
buffer
,
sizeofArray
(
pp
->
decoder
.
buffer
));
}
static
inline
void
applyFtoleft
(
const
t_nrPolar_params
*
pp
,
decoder_node_t
*
node
,
uint8_t
*
output
)
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
View file @
3e019af4
...
...
@@ -113,8 +113,7 @@ typedef struct nrPolar_params {
int
*
rm_tab
;
uint64_t
cprime_tab0
[
16
][
256
];
uint64_t
cprime_tab1
[
16
][
256
];
uint64_t
B_tab0
[
16
][
256
];
uint64_t
B_tab1
[
16
][
256
];
decoder_tree_t
decoder
;
}
t_nrPolar_params
;
void
polar_encoder
(
uint32_t
*
input
,
...
...
@@ -172,9 +171,8 @@ static inline int8_t *treeBeta(decoder_node_t *node)
return
(
int8_t
*
)
node
+
node
->
beta
;
}
void
build_decoder_tree
(
decoder_tree_t
*
tree
,
const
t_nrPolar_params
*
pp
);
void
build_decoder_tree
(
t_nrPolar_params
*
pp
);
void
build_polar_tables
(
t_nrPolar_params
*
polarParams
);
void
init_polar_deinterleaver_table
(
t_nrPolar_params
*
polarParams
);
void
nr_polar_print_polarParams
(
void
);
...
...
openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
View file @
3e019af4
...
...
@@ -452,6 +452,8 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
// rerun again to create groups
for
(
int
outpos
=
0
,
tcnt
=
0
;
outpos
<
polarParams
->
encoderLength
;
outpos
+=
mingroupsize
,
tcnt
++
)
polarParams
->
rm_tab
[
tcnt
]
=
polarParams
->
rate_matching_pattern
[
outpos
]
>>
shift
;
build_decoder_tree
(
polarParams
);
}
...
...
openair1/PHY/CODING/nr_polar_init.c
View file @
3e019af4
...
...
@@ -246,8 +246,6 @@ t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, ui
qsort
((
void
*
)
newPolarInitNode
->
Q_I_N
,
newPolarInitNode
->
K
,
sizeof
(
int16_t
),
intcmp
);
build_polar_tables
(
newPolarInitNode
);
init_polar_deinterleaver_table
(
newPolarInitNode
);
return
newPolarInitNode
;
}
...
...
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