Compare commits

...

70 Commits

Author SHA1 Message Date
Raymond Knopp
2a6ec7faf9 fix after rebase with develop 2024-12-15 18:54:11 +01:00
Raymond Knopp
585dde1772 Merge remote-tracking branch 'origin/develop' into rlc_testing_rk 2024-12-15 18:01:12 +01:00
Karim Boutiba
2932c8c193 AVX512 ldpc interleaving for QPSK 2024-12-14 17:39:20 +01:00
Karim Boutiba
f40919afb7 AVX512 ldpc interleaving for 16QAM 2024-12-14 17:21:50 +01:00
Jason
83123ad4b4 aarch64 optimizations for ldpc interleaving 2024-12-14 15:47:32 +00:00
Karim Boutiba
76b064a114 128-bit optimizations in ldpc_interleaving 2024-12-14 14:08:41 +01:00
Karim Boutiba
27c64ccf00 AVX512 code for 64 and 256QAM ldpc interleaving 2024-12-14 02:35:51 +01:00
Raymond Knopp
8b46360de7 optmizations for nr_ldpc_interleaving 2024-12-13 22:39:25 +01:00
Raymond Knopp
89b04ba9eb fix for CPU affinity in ORAN interface. memcpy in nr_segmentation.c 2024-12-13 21:39:49 +01:00
Raymond Knopp
fece5b6c9b Merge branch 'resource_mapping_optim' into rlc_testing 2024-12-04 14:48:41 +01:00
Raymond Knopp
baff396b59 testing with "gather" 2024-12-04 14:48:14 +01:00
Raymond Knopp
fb0278272b small patches for rlc buffers 2024-12-04 09:55:48 +01:00
Raymond Knopp
f9799c4991 corrections for 4-layer transmission (CI tests) 2024-12-01 23:49:05 +01:00
Jason
13559a8144 fix for unaligned reads with aarch64 2024-12-01 20:59:52 +00:00
Jason
0ed7b9165e unaligned reads in nr_dlsch.c for aarch64 2024-12-01 20:57:35 +00:00
Raymond Knopp
3999e1f292 fix for 256-bit unaligned reads in nr_dlsch.c 2024-12-01 21:03:17 +01:00
Raymond Knopp
ec615c8435 unaligned reads in tx_layers array in resource mapping 2024-12-01 20:28:13 +01:00
Raymond Knopp
1e68a0ff0c fixed issues with new resource mapping with PTRS formats 2024-12-01 18:19:31 +01:00
Raymond Knopp
99182533e8 check for alignment in nr_dlsch.c 2024-12-01 10:13:19 +01:00
Raymond Knopp
149e53ce05 removal of "clang" warning 2024-11-28 11:27:35 +01:00
Raymond Knopp
9f94daa251 Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-28 09:17:34 +01:00
Raymond Knopp
5285267770 _mmX_xor_siY(a,a) -> _mmX_setzero_siY() to avoid warnings with clang 2024-11-28 09:16:34 +01:00
Jason
03a18d24aa yet another error, this type aarch64. hopefully the last 2024-11-27 19:53:33 +00:00
Raymond Knopp
64393a9d2d Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-27 19:45:00 +01:00
Raymond Knopp
9c10743748 avx2 build fix 2024-11-27 19:44:44 +01:00
Jason
9248a80d03 fixed for aarch64 build 2024-11-27 15:46:45 +00:00
Raymond Knopp
456e80f4ca compilation issues for multi-platforms 2024-11-27 15:18:40 +01:00
Raymond Knopp
cc8450628d removal of warning 2024-11-27 14:30:39 +01:00
Raymond Knopp
b44bd9319e removed incomplete optimization for LDPC encoder for AARCH64 2024-11-26 14:42:45 +01:00
Raymond Knopp
06d34836d0 Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-26 14:29:56 +01:00
Raymond Knopp
74225f2d88 fixes for ARM 2024-11-26 14:29:32 +01:00
Jason
0e70590958 fixes for ARM 2024-11-25 21:33:26 +00:00
Raymond Knopp
fd1276c535 clang-formta 2024-11-25 22:16:25 +01:00
Karim Boutiba
99f089b9af case statements on stupix 2024-11-25 21:47:50 +01:00
Raymond Knopp
ffc3ff0b57 fixed AVX512 issues 2024-11-25 21:37:15 +01:00
Raymond Knopp
166c519011 temporary 2024-11-25 19:33:21 +01:00
Raymond Knopp
41e215bc1a AVX512 additions for "resource mapping" in TX DLSCH procedures 2024-11-25 14:59:10 +01:00
Jason
7f407ee19d changes for __aarch64__ 2024-11-24 14:28:46 +00:00
Raymond Knopp
1a6c69893c Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-24 07:37:44 +01:00
Raymond Knopp
68b99dd81f commit before merge 2024-11-23 21:41:26 +01:00
Raymond Knopp
2f42628a20 bug fixes for 3-layer DL 2024-11-23 21:35:30 +01:00
Raymond Knopp
942648f628 Merge remote-tracking branch 'origin/develop' into resource_mapping_optim 2024-11-23 09:47:02 +01:00
Raymond Knopp
a163d8c609 Merge remote-tracking branch 'origin/develop' into resource_mapping_optim 2024-11-23 09:44:04 +01:00
Raymond Knopp
afe610d97c Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-23 09:18:27 +01:00
Raymond Knopp
8601a5e446 commit before merge 2024-11-23 09:18:07 +01:00
Raymond Knopp
392438cf50 bugfix for 3/4 layers 2024-11-23 09:15:16 +01:00
Raymond Knopp
ac4b540001 dmrs_offset in new mapping 2024-11-23 01:09:19 +01:00
Raymond Knopp
aee48ccaaf debugging 3 2024-11-22 23:35:37 +01:00
Raymond Knopp
7edb74ae62 debugging3 2024-11-22 23:23:43 +01:00
Raymond Knopp
771e1c674c debugging2 2024-11-22 23:22:31 +01:00
Raymond Knopp
41d7570b82 debuggin 2024-11-22 23:20:57 +01:00
Raymond Knopp
f79ca60ea4 Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-22 11:25:23 +01:00
Raymond Knopp
fd03d288f9 debugging of 3-layer resource mapping 2024-11-22 09:21:25 +01:00
Raymond Knopp
2a28e2fd82 Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-11-20 21:04:50 +01:00
Raymond Knopp
5f05a3bf66 merged all layers in nr_layer_mapping() instead of running each
individually
2024-11-20 15:44:54 +01:00
Raymond Knopp
84e87248dd Merge remote-tracking branch 'origin/develop' into resource_mapping_optim 2024-11-19 20:13:06 +01:00
Raymond Knopp
afd6cc6ade SIMD processing for nr_layer_mapping 2024-11-19 18:52:17 +01:00
Raymond Knopp
9a278e8d2d Merge remote-tracking branch 'origin/develop' into resource_mapping_optim 2024-11-17 23:07:20 +01:00
Karim Boutiba
29a324c37d Merge remote-tracking branch 'origin/fix-4layers-nr_dlsim' into resource_mapping_optim 2024-11-04 20:54:29 +01:00
Karim Boutiba
ed102689ed Merge remote-tracking branch 'origin/fix-4layers-nr_dlsim' into resource_mapping_optim 2024-11-04 20:53:58 +01:00
Laurent THOMAS
1a214beaa5 change the alignment of OAI mutli-dim arrays from 16 to 32 bytes 2024-11-04 16:07:26 +01:00
Laurent THOMAS
fd1a33d7f6 fix blocking bugs in command nr_dlsim -n100 -e27 -s35 -b 273 -R273 -x4 -y4 -z4
use a better complex vector multiplication function
2024-11-04 15:13:32 +01:00
Laurent THOMAS
2f65813a31 small fix of rotate vector unit test 2024-10-31 14:51:51 +01:00
Laurent THOMAS
5fc41e7681 add a optimzed complex vector multiplication function 2024-10-31 14:50:25 +01:00
Karim Boutiba
69ac466b4a resolved issue after merge with develop 2024-10-30 14:11:08 +01:00
Karim Boutiba
74adddd5b1 Merge remote-tracking branch 'origin/develop' into resource_mapping_optim 2024-10-30 12:18:39 +01:00
Karim Boutiba
10a7daede4 Merge branch 'resource_mapping_optim' of https://gitlab.eurecom.fr/oai/openairinterface5g into resource_mapping_optim 2024-10-17 07:36:03 +02:00
Raymond Knopp
3f5ff5b0ef dlsim memory allocations for 256QAM (fixes issue for large TBS) 2024-10-17 07:34:42 +02:00
Karim Boutiba
fda3db9ff3 dlsim memory allocations for 256QAM (fixes issue for large TBS) 2024-10-17 07:29:00 +02:00
Raymond Knopp
19e0d94685 testing avx2 for resource mapping 2024-10-11 11:32:07 +02:00
13 changed files with 2266 additions and 622 deletions

View File

@@ -45,6 +45,8 @@ typedef struct {
time_stats_t *tprep;
time_stats_t *tparity;
time_stats_t *toutput;
time_stats_t *dlsch_rate_matching_stats;
time_stats_t *dlsch_interleaving_stats;
int Kr;
uint32_t Kb;
uint32_t Zc;

View File

@@ -41,43 +41,131 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
memset(f,0,E*sizeof(uint8_t));
uint8_t *e0,*e1,*e2,*e3,*e4,*e5,*e6,*e7;
uint8_t *fp;
#if 0 //def __WASAVX2__
simde__m256i tmp0,tmp1,tmp2,tmp0b,tmp1b,tmp3,tmp4,tmp5;
simde__m256i *e0_256,*e1_256,*e2_256,*e3_256,*e4_256,*e5_256,*e6_256,*e7_256;
int j,k;
#if 1 //def __WASAVX2__
#ifdef __AVX512F__
__m512i tmp0,tmp1,tmp2,tmp3,tmp4,tmp5;
__m512i *e0_512,*e1_512,*e2_512,*e3_512,*e4_512,*e5_512,*e6_512,*e7_512;
simde__m256i *f_256=(simde__m256i *)f;
__m512i *f_512=(__m512i *)f;
#else
simde__m128i tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7;
simde__m128i *e0_128,*e1_128,*e2_128,*e3_128,*e4_128,*e5_128,*e6_128,*e7_128;
uint8_t *fp2;
simde__m128i *f_128=(simde__m128i *)f;
#endif
switch(Qm) {
case 2:
e0=e;
e1=e0+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
for (int k=0,j=0;j<EQm>>5;j++,k+=2) {
f_256[k] = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]);
f_256[k+1] = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]);
#ifdef __AVX512F__
e0_512=(__m512i *)e0;
e1_512=(__m512i *)e1;
__m512i p8a = _mm512_set_epi8(95,31,94,30,93,29,92,28,91,27,90,26,89,25,88,24,87,23,86,22,85,21,84,20,83,19,82,18,81,17,80,16,79,15,78,14,77,13,76,12,75,11,74,10,73,9,72,8,71,7,70,6,69,5,68,4,67,3,66,2,65,1,64,0);
__m512i p8b = _mm512_set_epi8(127,63,126,62,125,61,124,60,123,59,122,58,121,57,120,56,119,55,118,54,117,53,116,52,115,51,114,50,113,49,112,48,111,47,110,46,109,45,108,44,107,43,106,42,105,41,104,40,103,39,102,38,101,37,100,36,99,35,98,34,97,33,96,32);
__m512i e0j,e1j;
for (k=0,j=0;j<EQm>>6;j++,k+=2) {
e0j = _mm512_loadu_si512(e0_512+j);
e1j = _mm512_loadu_si512(e1_512+j);
_mm512_storeu_si512(f_512+k,_mm512_permutex2var_epi8(e0j,p8a,e1j)); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
_mm512_storeu_si512(f_512+k+1,_mm512_permutex2var_epi8(e0j,p8b,e1j));
}
if ((j<<6) != EQm) {
int k2=k<<6;
fp = &f[k2];
for (int j2=(j<<6) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
}
}
#else
e0_128=(simde__m128i *)e0;
e1_128=(simde__m128i *)e1;
for (k=0,j=0;j<EQm>>4;j++,k+=2) {
f_128[k] = simde_mm_unpacklo_epi8(e0_128[j],e1_128[j]);
f_128[k+1] = simde_mm_unpackhi_epi8(e0_128[j],e1_128[j]);
}
if ((j<<4) != EQm) {
int k2=k<<4;
fp = &f[k2];
for (int j2=(j<<4) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
}
}
#endif
break;
case 4:
e0=e;
e1=e0+EQm;
e2=e1+EQm;
e3=e2+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
e2_256=(simde__m256i *)e2;
e3_256=(simde__m256i *)e3;
for (int k=0,j=0;j<EQm>>5;j++,k+=4) {
tmp0 = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = simde_mm256_unpacklo_epi8(e2_256[j],e3_256[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
f_256[k] = simde_mm256_unpacklo_epi8(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
f_256[k+1] = simde_mm256_unpackhi_epi8(tmp0,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp0 = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = simde_mm256_unpackhi_epi8(e2_256[j],e3_256[j]); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
f_256[k+2] = simde_mm256_unpacklo_epi8(tmp0,tmp1);
f_256[k+3] = simde_mm256_unpackhi_epi8(tmp0,tmp1);
#ifdef __AVX512F__
e0_512=(__m512i *)e0;
e1_512=(__m512i *)e1;
e2_512=(__m512i *)e2;
e3_512=(__m512i *)e3;
p8a = _mm512_set_epi8(95,31,94,30,93,29,92,28,91,27,90,26,89,25,88,24,87,23,86,22,85,21,84,20,83,19,82,18,81,17,80,16,79,15,78,14,77,13,76,12,75,11,74,10,73,9,72,8,71,7,70,6,69,5,68,4,67,3,66,2,65,1,64,0);
p8b = _mm512_set_epi8(127,63,126,62,125,61,124,60,123,59,122,58,121,57,120,56,119,55,118,54,117,53,116,52,115,51,114,50,113,49,112,48,111,47,110,46,109,45,108,44,107,43,106,42,105,41,104,40,103,39,102,38,101,37,100,36,99,35,98,34,97,33,96,32);
__m512i p16a = _mm512_set_epi16(47,15,46,14,45,13,44,12,43,11,42,10,41,9,40,8,39,7,38,6,37,5,36,4,35,3,34,2,33,1,32,0);
__m512i p16b = _mm512_set_epi16(63,31,62,30,61,29,60,28,59,27,58,26,57,25,56,24,55,23,54,22,53,21,52,20,51,19,50,18,49,17,48,16);
__m512i p32a = _mm512_set_epi32(23,7,22,6,21,5,20,4,19,3,18,2,17,1,16,0);
__m512i p32b = _mm512_set_epi32(31,15,30,14,29,13,28,12,27,11,26,10,25,9,24,8);
__m512i e2j,e3j;
for (k=0,j=0;j<EQm>>6;j++,k+=4) {
e0j = _mm512_loadu_si512(e0_512+j);
e1j = _mm512_loadu_si512(e1_512+j);
e2j = _mm512_loadu_si512(e2_512+j);
e3j = _mm512_loadu_si512(e3_512+j);
tmp0 = _mm512_permutex2var_epi8(e0j,p8a,e1j); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = _mm512_permutex2var_epi8(e2j,p8a,e3j); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
_mm512_storeu_si512(f_512+k,_mm512_permutex2var_epi16(tmp0,p16a,tmp1)); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
_mm512_storeu_si512(f_512+k+1,_mm512_permutex2var_epi16(tmp0,p16b,tmp1));
tmp0 = _mm512_permutex2var_epi8(e0j,p8b,e1j); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = _mm512_permutex2var_epi8(e2j,p8b,e3j); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
_mm512_storeu_si512(f_512+k+2,_mm512_permutex2var_epi16(tmp0,p16a,tmp1)); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
_mm512_storeu_si512(f_512+k+3,_mm512_permutex2var_epi16(tmp0,p16b,tmp1));
}
if ((j<<6) != EQm) {
int k2=k<<6;
fp = &f[k2];
for (int j2=(j<<6) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
*fp++ = e2[j2];
*fp++ = e3[j2];
}
}
#else
e0_128=(simde__m128i *)e0;
e1_128=(simde__m128i *)e1;
e2_128=(simde__m128i *)e2;
e3_128=(simde__m128i *)e3;
for (k=0,j=0;j<EQm>>4;j++,k+=4) {
tmp0 = simde_mm_unpacklo_epi8(e0_128[j],e1_128[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+7) e1(i+7)
tmp1 = simde_mm_unpacklo_epi8(e2_128[j],e3_128[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+7) e3(i+7)
f_128[k] = simde_mm_unpacklo_epi16(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+3) e1(i+3) e2(i+3) e3(i+3)
f_128[k+1] = simde_mm_unpackhi_epi16(tmp0,tmp1); // e0(i+4) e1(i+4) e2(i+4) e3(i+4) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp0 = simde_mm_unpackhi_epi8(e0_128[j],e1_128[j]); // e0(i+8) e1(i+8) e0(i+9) e1(i+9) .... e0(i+15) e1(i+15)
tmp1 = simde_mm_unpackhi_epi8(e2_128[j],e3_128[j]); // e2(i+8) e3(i+9) e2(i+10) e3(i+10) .... e2(i+31) e3(i+31)
f_128[k+2] = simde_mm_unpacklo_epi16(tmp0,tmp1);
f_128[k+3] = simde_mm_unpackhi_epi16(tmp0,tmp1);
}
if ((j<<4) != EQm) {
int k2=k<<4;
fp = &f[k2];
for (int j2=(j<<4) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
*fp++ = e2[j2];
*fp++ = e3[j2];
}
}
#endif
break;
case 6:
e0=e;
@@ -86,95 +174,77 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
e3=e2+EQm;
e4=e3+EQm;
e5=e4+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
e2_256=(simde__m256i *)e2;
e3_256=(simde__m256i *)e3;
e4_256=(simde__m256i *)e4;
e5_256=(simde__m256i *)e5;
#ifdef __AVX512F__
e0_512=(__m512i *)e0;
e1_512=(__m512i *)e1;
e2_512=(__m512i *)e2;
e3_512=(__m512i *)e3;
e4_512=(__m512i *)e4;
e5_512=(__m512i *)e5;
__m512i e4j,e5j;
p8a = _mm512_set_epi8(95,31,94,30,93,29,92,28,91,27,90,26,89,25,88,24,87,23,86,22,85,21,84,20,83,19,82,18,81,17,80,16,79,15,78,14,77,13,76,12,75,11,74,10,73,9,72,8,71,7,70,6,69,5,68,4,67,3,66,2,65,1,64,0);
p8b = _mm512_set_epi8(127,63,126,62,125,61,124,60,123,59,122,58,121,57,120,56,119,55,118,54,117,53,116,52,115,51,114,50,113,49,112,48,111,47,110,46,109,45,108,44,107,43,106,42,105,41,104,40,103,39,102,38,101,37,100,36,99,35,98,34,97,33,96,32);
for (int j=0,k=0;j<EQm>>5;j++,k+=192) {
fp = f+k;
fp2 = fp+96;
p16a = _mm512_set_epi16(47,15,46,14,45,13,44,12,43,11,42,10,41,9,40,8,39,7,38,6,37,5,36,4,35,3,34,2,33,1,32,0);
p16b = _mm512_set_epi16(63,31,62,30,61,29,60,28,59,27,58,26,57,25,56,24,55,23,54,22,53,21,52,20,51,19,50,18,49,17,48,16);
tmp0 = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = simde_mm256_unpacklo_epi8(e2_256[j],e3_256[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
tmp0b = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp1b = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp0 = simde_mm256_unpacklo_epi8(e4_256[j],e5_256[j]); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+15) e5(i+15)
*((uint32_t*)fp) = simde_mm256_extract_epi32(tmp0b,0);
*((uint16_t*)(fp+4)) = simde_mm256_extract_epi16(tmp0,0);
*((uint32_t*)(fp+6)) = simde_mm256_extract_epi32(tmp0b,1);
*((uint16_t*)(fp+10)) = simde_mm256_extract_epi16(tmp0,1);
*((uint32_t*)(fp+12)) = simde_mm256_extract_epi32(tmp0b,2);
*((uint16_t*)(fp+16)) = simde_mm256_extract_epi16(tmp0,2);
*((uint32_t*)(fp+18)) = simde_mm256_extract_epi32(tmp0b,3);
*((uint16_t*)(fp+22)) = simde_mm256_extract_epi16(tmp0,3);
*((uint32_t*)(fp+24)) = simde_mm256_extract_epi32(tmp0b,4);
*((uint16_t*)(fp+26)) = simde_mm256_extract_epi16(tmp0,4);
*((uint32_t*)(fp+30)) = simde_mm256_extract_epi32(tmp0b,5);
*((uint16_t*)(fp+34)) = simde_mm256_extract_epi16(tmp0,5);
*((uint32_t*)(fp+36)) = simde_mm256_extract_epi32(tmp0,6);
*((uint16_t*)(fp+40)) = simde_mm256_extract_epi16(tmp0,6);
*((uint32_t*)(fp+42)) = simde_mm256_extract_epi32(tmp0b,7);
*((uint16_t*)(fp+46)) = simde_mm256_extract_epi16(tmp0,7);
__m512i p16c = _mm512_set_epi16(21,20,41,19,18,40,17,16,39,15,14,38,13,12,37,11,10,36,9,8,35,7,6,34,5,4,33,3,2,32,1,0);
__m512i p16d = _mm512_set_epi16(10,52,9,8,51,7,6,50,5,4,49,3,2,48,1,0,47,31,30,46,29,28,45,27,26,44,25,24,43,23,22,42);
__m512i p16d2 = _mm512_set_epi16(32+10,30,32+9,32+8,27,32+7,32+6,24,32+5,32+4,21,32+3,32+2,18,32+1,32+0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
__m512i p16e = _mm512_set_epi16(63,31,30,62,29,28,61,27,26,60,25,24,59,23,22,58,21,20,57,19,18,56,17,16,55,15,14,54,13,12,53,11);
*((uint32_t*)(fp+48)) = simde_mm256_extract_epi32(tmp1b,0);
*((uint16_t*)(fp+52)) = simde_mm256_extract_epi16(tmp0,8);
*((uint32_t*)(fp+56)) = simde_mm256_extract_epi32(tmp1b,1);
*((uint16_t*)(fp+60)) = simde_mm256_extract_epi16(tmp0,9);
*((uint32_t*)(fp+62)) = simde_mm256_extract_epi32(tmp1b,2);
*((uint16_t*)(fp+66)) = simde_mm256_extract_epi16(tmp0,10);
*((uint32_t*)(fp+68)) = simde_mm256_extract_epi32(tmp1b,3);
*((uint16_t*)(fp+72)) = simde_mm256_extract_epi16(tmp0,11);
*((uint32_t*)(fp+74)) = simde_mm256_extract_epi32(tmp1b,4);
*((uint16_t*)(fp+76)) = simde_mm256_extract_epi16(tmp0,12);
*((uint32_t*)(fp+80)) = simde_mm256_extract_epi32(tmp1b,5);
*((uint16_t*)(fp+82)) = simde_mm256_extract_epi16(tmp0,13);
*((uint32_t*)(fp+86)) = simde_mm256_extract_epi32(tmp1b,6);
*((uint16_t*)(fp+90)) = simde_mm256_extract_epi16(tmp0,14);
*((uint32_t*)(fp+92)) = simde_mm256_extract_epi32(tmp1b,7);
*((uint16_t*)(fp+94)) = simde_mm256_extract_epi16(tmp0,15);
for (j=0,k=0;j<EQm>>6;j++,k+=6) {
e0j = _mm512_loadu_si512(e0_512+j);
e1j = _mm512_loadu_si512(e1_512+j);
e2j = _mm512_loadu_si512(e2_512+j);
e3j = _mm512_loadu_si512(e3_512+j);
e4j = _mm512_loadu_si512(e4_512+j);
e5j = _mm512_loadu_si512(e5_512+j);
tmp0 = _mm512_permutex2var_epi8(e0j,p8a,e1j); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+31) e1(i+31)
tmp1 = _mm512_permutex2var_epi8(e2j,p8a,e3j); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+31) e3(i+31)
tmp2 = _mm512_permutex2var_epi8(e4j,p8a,e5j); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+31) e5(i+31)
tmp3 = _mm512_permutex2var_epi16(tmp0,p16a,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp4 = _mm512_permutex2var_epi16(tmp0,p16b,tmp1); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
_mm512_storeu_si512(f_512+k,_mm512_permutex2var_epi16(tmp3,p16c,tmp2)); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) ... e0(i+9) e1(i+9) e2(i+9) e3(i+9) e4(i+9) e5(i+9) e0(i+10) e1(i+10)
tmp5 = _mm512_permutex2var_epi16(tmp3,p16d,tmp2); // e2(i+10) e3(i+10) e4(i+10) e5(i+10) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) x x x x e4(i+16) e5(i+16) x x x x .... e4(i+20) e5(i+20) x x
_mm512_storeu_si512(f_512+k+1,_mm512_permutex2var_epi16(tmp5,p16d2,tmp4)); // e2(i+10) e3(i+10) e4(i+10) e5(i+10) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) e0(i+16) e1(i+16) e2(i+16) e3(i+16) e4(i+16) e5(i+16) e0(i+20) e1(i+20) e2(i+20) e3(i+20) e4(i+20) e5(i+20) e0(i+21) e1(i+21)
_mm512_storeu_si512(f_512+k+2,_mm512_permutex2var_epi16(tmp4,p16e,tmp2)); // e2(i+21) e3(i+21) e4(i+21) e5(i+21) .... e0(i+31) e1(i+31) e2(i+31) e3(i+31) e4(i+31) e5(i+31)
tmp0 = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = simde_mm256_unpackhi_epi8(e2_256[j],e3_256[j]); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
tmp0b = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) ... e0(i+23) e1(i+23) e2(i+23) e3(i+23)
tmp1b = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
tmp0 = simde_mm256_unpackhi_epi8(e4_256[j],e5_256[j]); // e4(i+16) e5(i+16) e4(i+17) e5(i+17) .... e4(i+31) e5(i+31)
*((uint32_t*)fp2) = simde_mm256_extract_epi32(tmp0b,0);
*((uint16_t*)(fp2+4)) = simde_mm256_extract_epi16(tmp0,0);
*((uint32_t*)(fp2+6)) = simde_mm256_extract_epi32(tmp0b,1);
*((uint16_t*)(fp2+10)) = simde_mm256_extract_epi16(tmp0,1);
*((uint32_t*)(fp2+12)) = simde_mm256_extract_epi32(tmp0b,2);
*((uint16_t*)(fp2+16)) = simde_mm256_extract_epi16(tmp0,2);
*((uint32_t*)(fp2+18)) = simde_mm256_extract_epi32(tmp0b,3);
*((uint16_t*)(fp2+22)) = simde_mm256_extract_epi16(tmp0,3);
*((uint32_t*)(fp2+24)) = simde_mm256_extract_epi32(tmp0b,4);
*((uint16_t*)(fp2+26)) = simde_mm256_extract_epi16(tmp0,4);
*((uint32_t*)(fp2+30)) = simde_mm256_extract_epi32(tmp0b,5);
*((uint16_t*)(fp2+34)) = simde_mm256_extract_epi16(tmp0,5);
*((uint32_t*)(fp2+36)) = simde_mm256_extract_epi32(tmp0,6);
*((uint16_t*)(fp2+40)) = simde_mm256_extract_epi16(tmp0,6);
*((uint32_t*)(fp2+42)) = simde_mm256_extract_epi32(tmp0b,7);
*((uint16_t*)(fp2+46)) = simde_mm256_extract_epi16(tmp0,7);
tmp0 = _mm512_permutex2var_epi8(e0j,p8b,e1j); // e0(i+32) e1(i+32) e0(i+32) e1(i+32) .... e0(i+63) e1(i+63)
tmp1 = _mm512_permutex2var_epi8(e2j,p8b,e3j); // e2(i+32) e3(i+32) e2(i+32) e3(i+32) .... e2(i+63) e3(i+63)
tmp2 = _mm512_permutex2var_epi8(e4j,p8b,e5j); // e4(i+32) e5(i+32) e4(i+32) e5(i+32) .... e4(i+63) e5(i+63)
tmp3 = _mm512_permutex2var_epi16(tmp0,p16a,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp4 = _mm512_permutex2var_epi16(tmp0,p16b,tmp1); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
*((uint32_t*)(fp2+48)) = simde_mm256_extract_epi32(tmp1b,0);
*((uint16_t*)(fp2+52)) = simde_mm256_extract_epi16(tmp0,8);
*((uint32_t*)(fp2+56)) = simde_mm256_extract_epi32(tmp1b,1);
*((uint16_t*)(fp2+60)) = simde_mm256_extract_epi16(tmp0,9);
*((uint32_t*)(fp2+62)) = simde_mm256_extract_epi32(tmp1b,2);
*((uint16_t*)(fp2+66)) = simde_mm256_extract_epi16(tmp0,10);
*((uint32_t*)(fp2+68)) = simde_mm256_extract_epi32(tmp1b,3);
*((uint16_t*)(fp2+72)) = simde_mm256_extract_epi16(tmp0,11);
*((uint32_t*)(fp2+74)) = simde_mm256_extract_epi32(tmp1b,4);
*((uint16_t*)(fp2+76)) = simde_mm256_extract_epi16(tmp0,12);
*((uint32_t*)(fp2+80)) = simde_mm256_extract_epi32(tmp1b,5);
*((uint16_t*)(fp2+82)) = simde_mm256_extract_epi16(tmp0,13);
*((uint32_t*)(fp2+86)) = simde_mm256_extract_epi32(tmp1b,6);
*((uint16_t*)(fp2+90)) = simde_mm256_extract_epi16(tmp0,14);
*((uint32_t*)(fp2+92)) = simde_mm256_extract_epi32(tmp1b,7);
*((uint16_t*)(fp2+94)) = simde_mm256_extract_epi16(tmp0,15);
_mm512_storeu_si512(f_512+k+3,_mm512_permutex2var_epi16(tmp3,p16c,tmp2)); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) ... e0(i+9) e1(i+9) e2(i+9) e3(i+9) e4(i+9) e5(i+9) e0(i+10) e1(i+10)
tmp5 = _mm512_permutex2var_epi16(tmp3,p16d,tmp2); // e2(i+10) e3(i+10) e4(i+10) e5(i+10) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) x x x x e4(i+16) e5(i+16) x x x x .... e4(i+20) e5(i+20) x x
_mm512_storeu_si512(f_512+k+4,_mm512_permutex2var_epi16(tmp5,p16d2,tmp4)); // e2(i+10) e3(i+10) e4(i+10) e5(i+10) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) e0(i+16) e1(i+16) e2(i+16) e3(i+16) e4(i+16) e5(i+16) e0(i+20) e1(i+20) e2(i+20) e3(i+20) e4(i+20) e5(i+20) e0(i+21) e1(i+21)
_mm512_storeu_si512(f_512+k+5,_mm512_permutex2var_epi16(tmp4,p16e,tmp2)); // e2(i+21) e3(i+21) e4(i+21) e5(i+21) .... e0(i+31) e1(i+31) e2(i+31) e3(i+31) e4(i+31) e5(i+31)
}
if ((j<<6) != EQm) {
int k2=k<<6;
fp = &f[k2];
for (int j2=(j<<6) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
*fp++ = e2[j2];
*fp++ = e3[j2];
*fp++ = e4[j2];
*fp++ = e5[j2];
}
}
#else
fp = f;
for (int j = 0; j< EQm; j++){
*fp++ = e0[j];
*fp++ = e1[j];
*fp++ = e2[j];
*fp++ = e3[j];
*fp++ = e4[j];
*fp++ = e5[j];
}
#endif
break;
case 8:
e0=e;
@@ -186,43 +256,135 @@ void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f)
e6=e5+EQm;
e7=e6+EQm;
e0_256=(simde__m256i *)e0;
e1_256=(simde__m256i *)e1;
e2_256=(simde__m256i *)e2;
e3_256=(simde__m256i *)e3;
e4_256=(simde__m256i *)e4;
e5_256=(simde__m256i *)e5;
e6_256=(simde__m256i *)e6;
e7_256=(simde__m256i *)e7;
for (int k=0,j=0;j<EQm>>5;j++,k+=8) {
tmp0 = simde_mm256_unpacklo_epi8(e0_256[j],e1_256[j]); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = simde_mm256_unpacklo_epi8(e2_256[j],e3_256[j]); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
tmp2 = simde_mm256_unpacklo_epi8(e4_256[j],e5_256[j]); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+15) e5(i+15)
tmp3 = simde_mm256_unpacklo_epi8(e6_256[j],e7_256[j]); // e6(i) e7(i) e6(i+1) e7(i+1) .... e6(i+15) e7(i+15)
tmp4 = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp5 = simde_mm256_unpacklo_epi16(tmp2,tmp3); // e4(i) e5(i) e6(i) e7(i) ... e4(i+7) e5(i+7) e6(i+7) e7(i+7)
f_256[k] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) e6(i) e7(i)... e0(i+3) e1(i+3) e2(i+3) e3(i+3) e4(i+3) e5(i+3) e6(i+3) e7(i+3))
f_256[k+1] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+4) e1(i+4) e2(i+4) e3(i+4) e4(i+4) e5(i+4) e6(i+4) e7(i+4)... e0(i+7) e1(i+7) e2(i+7) e3(i+7) e4(i+7) e5(i+7) e6(i+7) e7(i+7))
#ifdef __AVX512F__
e0_512=(__m512i *)e0;
e1_512=(__m512i *)e1;
e2_512=(__m512i *)e2;
e3_512=(__m512i *)e3;
e4_512=(__m512i *)e4;
e5_512=(__m512i *)e5;
e6_512=(__m512i *)e6;
e7_512=(__m512i *)e7;
__m512i e6j,e7j;
p8a = _mm512_set_epi8(95,31,94,30,93,29,92,28,91,27,90,26,89,25,88,24,87,23,86,22,85,21,84,20,83,19,82,18,81,17,80,16,79,15,78,14,77,13,76,12,75,11,74,10,73,9,72,8,71,7,70,6,69,5,68,4,67,3,66,2,65,1,64,0);
p8b = _mm512_set_epi8(127,63,126,62,125,61,124,60,123,59,122,58,121,57,120,56,119,55,118,54,117,53,116,52,115,51,114,50,113,49,112,48,111,47,110,46,109,45,108,44,107,43,106,42,105,41,104,40,103,39,102,38,101,37,100,36,99,35,98,34,97,33,96,32);
tmp4 = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp5 = simde_mm256_unpackhi_epi16(tmp2,tmp3); // e4(i+8) e5(i+8) e6(i+8) e7(i+8) ... e4(i+15) e5(i+15) e6(i+15) e7(i+15)
f_256[k+2] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) e4(i+8) e5(i+8) e6(i+8) e7(i+8)... e0(i+11) e1(i+11) e2(i+11) e3(i+11) e4(i+11) e5(i+11) e6(i+11) e7(i+11))
f_256[k+3] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+12) e1(i+12) e2(i+12) e3(i+12) e4(i+12) e5(i+12) e6(i+12) e7(i+12)... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) e6(i+15) e7(i+15))
p16a = _mm512_set_epi16(47,15,46,14,45,13,44,12,43,11,42,10,41,9,40,8,39,7,38,6,37,5,36,4,35,3,34,2,33,1,32,0);
p16b = _mm512_set_epi16(63,31,62,30,61,29,60,28,59,27,58,26,57,25,56,24,55,23,54,22,53,21,52,20,51,19,50,18,49,17,48,16);
tmp0 = simde_mm256_unpackhi_epi8(e0_256[j],e1_256[j]); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = simde_mm256_unpackhi_epi8(e2_256[j],e3_256[j]); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
tmp2 = simde_mm256_unpackhi_epi8(e4_256[j],e5_256[j]); // e4(i+16) e5(i+16) e4(i+17) e5(i+17) .... e4(i+31) e5(i+31)
tmp3 = simde_mm256_unpackhi_epi8(e6_256[j],e7_256[j]); // e6(i+16) e7(i+16) e6(i+17) e7(i+17) .... e6(i+31) e7(i+31)
tmp4 = simde_mm256_unpacklo_epi16(tmp0,tmp1); // e0(i+!6) e1(i+16) e2(i+16) e3(i+16) ... e0(i+23) e1(i+23) e2(i+23) e3(i+23)
tmp5 = simde_mm256_unpacklo_epi16(tmp2,tmp3); // e4(i+16) e5(i+16) e6(i+16) e7(i+16) ... e4(i+23) e5(i+23) e6(i+23) e7(i+23)
f_256[k+4] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) e4(i+16) e5(i+16) e6(i+16) e7(i+16)... e0(i+19) e1(i+19) e2(i+19) e3(i+19) e4(i+19) e5(i+19) e6(i+19) e7(i+19))
f_256[k+5] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+20) e1(i+20) e2(i+20) e3(i+20) e4(i+20) e5(i+20) e6(i+20) e7(i+20)... e0(i+23) e1(i+23) e2(i+23) e3(i+23) e4(i+23) e5(i+23) e6(i+23) e7(i+23))
p32a = _mm512_set_epi32(23,7,22,6,21,5,20,4,19,3,18,2,17,1,16,0);
p32b = _mm512_set_epi32(31,15,30,14,29,13,28,12,27,11,26,10,25,9,24,8);
for (k=0,j=0;j<EQm>>6;j++,k+=8) {
e0j = _mm512_loadu_si512(e0_512+j);
e1j = _mm512_loadu_si512(e1_512+j);
e2j = _mm512_loadu_si512(e2_512+j);
e3j = _mm512_loadu_si512(e3_512+j);
e4j = _mm512_loadu_si512(e4_512+j);
e5j = _mm512_loadu_si512(e5_512+j);
e6j = _mm512_loadu_si512(e6_512+j);
e7j = _mm512_loadu_si512(e7_512+j);
tmp0 = _mm512_permutex2var_epi8(e0j,p8a,e1j); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+15) e1(i+15)
tmp1 = _mm512_permutex2var_epi8(e2j,p8a,e3j); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+15) e3(i+15)
tmp2 = _mm512_permutex2var_epi8(e4j,p8a,e5j); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+15) e5(i+15)
tmp3 = _mm512_permutex2var_epi8(e6j,p8a,e7j); // e6(i) e7(i) e6(i+1) e7(i+1) .... e6(i+15) e7(i+15)
tmp4 = _mm512_permutex2var_epi16(tmp0,p16a,tmp1); // e0(i) e1(i) e2(i) e3(i) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp5 = _mm512_permutex2var_epi16(tmp2,p16a,tmp3); // e4(i) e5(i) e6(i) e7(i) ... e4(i+7) e5(i+7) e6(i+7) e7(i+7)
_mm512_storeu_si512(f_512+k,_mm512_permutex2var_epi32(tmp4,p32a,tmp5)); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) e6(i) e7(i)... e0(i+3) e1(i+3) e2(i+3) e3(i+3) e4(i+3) e5(i+3) e6(i+3) e7(i+3))
_mm512_storeu_si512(f_512+k+1,_mm512_permutex2var_epi32(tmp4,p32b,tmp5)); // e0(i+4) e1(i+4) e2(i+4) e3(i+4) e4(i+4) e5(i+4) e6(i+4) e7(i+4)... e0(i+7) e1(i+7) e2(i+7) e3(i+7) e4(i+7) e5(i+7) e6(i+7) e7(i+7))
tmp4 = simde_mm256_unpackhi_epi16(tmp0,tmp1); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
tmp5 = simde_mm256_unpackhi_epi16(tmp2,tmp3); // e4(i+24) e5(i+24) e6(i+24) e7(i+24) ... e4(i+31) e5(i+31) e6(i+31) e7(i+31)
f_256[k+6] = simde_mm256_unpacklo_epi16(tmp4,tmp5); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) e4(i+24) e5(i+24) e6(i+24) e7(i+24)... e0(i+27) e1(i+27) e2(i+27) e3(i+27) e4(i+27) e5(i+27) e6(i+27) e7(i+27))
f_256[k+7] = simde_mm256_unpackhi_epi16(tmp4,tmp5); // e0(i+28) e1(i+28) e2(i+28) e3(i+28) e4(i+28) e5(i+28) e6(i+28) e7(i+28)... e0(i+31) e1(i+31) e2(i+31) e3(i+31) e4(i+31) e5(i+31) e6(i+31) e7(i+31))
tmp4 = _mm512_permutex2var_epi16(tmp0,p16b,tmp1); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) ... e0(i+15) e1(i+15) e2(i+15) e3(i+15)
tmp5 = _mm512_permutex2var_epi16(tmp2,p16b,tmp3); // e4(i+8) e5(i+8) e6(i+8) e7(i+8) ... e4(i+15) e5(i+15) e6(i+15) e7(i+15)
_mm512_storeu_si512(f_512+k+2,_mm512_permutex2var_epi32(tmp4,p32a,tmp5)); // e0(i+8) e1(i+8) e2(i+8) e3(i+8) e4(i+8) e5(i+8) e6(i+8) e7(i+8)... e0(i+11) e1(i+11) e2(i+11) e3(i+11) e4(i+11) e5(i+11) e6(i+11) e7(i+11))
_mm512_storeu_si512(f_512+k+3,_mm512_permutex2var_epi32(tmp4,p32b,tmp5)); // e0(i+12) e1(i+12) e2(i+12) e3(i+12) e4(i+12) e5(i+12) e6(i+12) e7(i+12)... e0(i+15) e1(i+15) e2(i+15) e3(i+15) e4(i+15) e5(i+15) e6(i+15) e7(i+15))
tmp0 = _mm512_permutex2var_epi8(e0j,p8b,e1j); // e0(i+16) e1(i+16) e0(i+17) e1(i+17) .... e0(i+31) e1(i+31)
tmp1 = _mm512_permutex2var_epi8(e2j,p8b,e3j); // e2(i+16) e3(i+16) e2(i+17) e3(i+17) .... e2(i+31) e3(i+31)
tmp2 = _mm512_permutex2var_epi8(e4j,p8b,e5j); // e4(i+16) e5(i+16) e4(i+17) e5(i+17) .... e4(i+31) e5(i+31)
tmp3 = _mm512_permutex2var_epi8(e6j,p8b,e7j); // e6(i+16) e7(i+16) e6(i+17) e7(i+17) .... e6(i+31) e7(i+31)
tmp4 = _mm512_permutex2var_epi16(tmp0,p16a,tmp1); // e0(i+!6) e1(i+16) e2(i+16) e3(i+16) ... e0(i+23) e1(i+23) e2(i+23) e3(i+23)
tmp5 = _mm512_permutex2var_epi16(tmp2,p16a,tmp3); // e4(i+16) e5(i+16) e6(i+16) e7(i+16) ... e4(i+23) e5(i+23) e6(i+23) e7(i+23)
_mm512_storeu_si512(f_512+k+4,_mm512_permutex2var_epi32(tmp4,p32a,tmp5)); // e0(i+16) e1(i+16) e2(i+16) e3(i+16) e4(i+16) e5(i+16) e6(i+16) e7(i+16)... e0(i+19) e1(i+19) e2(i+19) e3(i+19) e4(i+19) e5(i+19) e6(i+19) e7(i+19))
_mm512_storeu_si512(f_512+k+5,_mm512_permutex2var_epi32(tmp4,p32b,tmp5)); // e0(i+20) e1(i+20) e2(i+20) e3(i+20) e4(i+20) e5(i+20) e6(i+20) e7(i+20)... e0(i+23) e1(i+23) e2(i+23) e3(i+23) e4(i+23) e5(i+23) e6(i+23) e7(i+23))
tmp4 = _mm512_permutex2var_epi16(tmp0,p16b,tmp1); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) ... e0(i+31) e1(i+31) e2(i+31) e3(i+31)
tmp5 = _mm512_permutex2var_epi16(tmp2,p16b,tmp3); // e4(i+24) e5(i+24) e6(i+24) e7(i+24) ... e4(i+31) e5(i+31) e6(i+31) e7(i+31)
_mm512_storeu_si512(f_512+k+6,_mm512_permutex2var_epi32(tmp4,p32a,tmp5)); // e0(i+24) e1(i+24) e2(i+24) e3(i+24) e4(i+24) e5(i+24) e6(i+24) e7(i+24)... e0(i+27) e1(i+27) e2(i+27) e3(i+27) e4(i+27) e5(i+27) e6(i+27) e7(i+27))
_mm512_storeu_si512(f_512+k+7,_mm512_permutex2var_epi32(tmp4,p32b,tmp5)); // e0(i+28) e1(i+28) e2(i+28) e3(i+28) e4(i+28) e5(i+28) e6(i+28) e7(i+28)... e0(i+31) e1(i+31) e2(i+31) e3(i+31) e4(i+31) e5(i+31) e6(i+31) e7(i+31))
}
if ((j<<6) != EQm) {
int k2=k<<6;
fp=&f[k2];
for (int j2=(j<<6) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
*fp++ = e2[j2];
*fp++ = e3[j2];
*fp++ = e4[j2];
*fp++ = e5[j2];
*fp++ = e6[j2];
*fp++ = e7[j2];
}
}
#else
e0_128=(simde__m128i *)e0;
e1_128=(simde__m128i *)e1;
e2_128=(simde__m128i *)e2;
e3_128=(simde__m128i *)e3;
e4_128=(simde__m128i *)e4;
e5_128=(simde__m128i *)e5;
e6_128=(simde__m128i *)e6;
e7_128=(simde__m128i *)e7;
simde__m128i e0j,e1j,e2j,e3j,e4j,e5j,e6j,e7j;
for (k=0,j=0;j<EQm>>4;j++,k+=8) {
e0j = simde_mm_loadu_si128(e0_128+j);
e1j = simde_mm_loadu_si128(e1_128+j);
e2j = simde_mm_loadu_si128(e2_128+j);
e3j = simde_mm_loadu_si128(e3_128+j);
e4j = simde_mm_loadu_si128(e4_128+j);
e5j = simde_mm_loadu_si128(e5_128+j);
e6j = simde_mm_loadu_si128(e6_128+j);
e7j = simde_mm_loadu_si128(e7_128+j);
tmp0 = simde_mm_unpacklo_epi8(e0j,e1j); // e0(i) e1(i) e0(i+1) e1(i+1) .... e0(i+7) e1(i+7)
tmp1 = simde_mm_unpacklo_epi8(e2j,e3j); // e2(i) e3(i) e2(i+1) e3(i+1) .... e2(i+7) e3(i+7)
tmp2 = simde_mm_unpacklo_epi16(tmp0,tmp1);// e0(i) e1(i) e2(i) e3(i) e0(i+1) e1(i+1) e2(i+1) e3(i+1) ... e0(i+3) e1(i+3) e2(i+3) e3(i+3)
tmp3 = simde_mm_unpackhi_epi16(tmp0,tmp1);// e0(i+4) e1(i+4) e2(i+4) e3(i+4) e0(i+5) e1(i+5) e2(i+5) e3(i+5) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp4 = simde_mm_unpacklo_epi8(e4j,e5j); // e4(i) e5(i) e4(i+1) e5(i+1) .... e4(i+7) e5(i+7)
tmp5 = simde_mm_unpacklo_epi8(e6j,e7j); // e6(i) e7(i) e6(i+1) e7(i+1) .... e6(i+7) e7(i+7)
tmp6 = simde_mm_unpacklo_epi16(tmp4,tmp5);// e4(i) e5(i) e6(i) e7(i) e4(i+1) e5(i+1) e6(i+1) e7(i+1) ... e4(i+3) e5(i+3) e6(i+) e7(i+3)
tmp7 = simde_mm_unpackhi_epi16(tmp4,tmp5);// e4(i+4) e5(i+4) e6(i+4) e7(i+4) e4(i+5) e5(i+5) e6(i+5) e7(i+5) ... e4(i+7) e5(i+7) e6(i+7) e7(i+7)
simde_mm_storeu_si128(f_128+k,simde_mm_unpacklo_epi32(tmp2,tmp6)); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) e6(i) e7(i) e0(i+1) ... e7(i+1)
simde_mm_storeu_si128(f_128+k+1,simde_mm_unpackhi_epi32(tmp2,tmp6)); // e0(i+2) e1(i+2) e2(i+2) e3(i+2) e4(i+2) e5(i+2) e6(i+2) e7(i+2) e0(i+3) e1(i+3) ... e7(i+3)
simde_mm_storeu_si128(f_128+k+2,simde_mm_unpacklo_epi32(tmp3,tmp7)); // e0(i+4) e1(i+4) e2(i+4) e3(i+4) e4(i+4) e5(i+4) e6(i+4) e7+4(i) e0(i+5) ... e7(i+5)
simde_mm_storeu_si128(f_128+k+3,simde_mm_unpackhi_epi32(tmp3,tmp7)); // e0(i+6) e1(i+6) e2(i+6) e3(i+6) e4(i+6) e5(i+6) e6(i+6) e7(i+6) e0(i+7) e0(i+7) ... e7(i+7)
tmp0 = simde_mm_unpackhi_epi8(e0j,e1j); // e0(i+8) e1(i+8) e0(i+9) e1(i+9) .... e0(i+15) e1(i+15)
tmp1 = simde_mm_unpackhi_epi8(e2j,e3j); // e2(i+8) e3(i+8) e2(i+9) e3(i+9) .... e2(i+15) e3(i+15)
tmp2 = simde_mm_unpacklo_epi16(tmp0,tmp1);// e0(i) e1(i) e2(i) e3(i) e0(i+1) e1(i+1) e2(i+1) e3(i+1) ... e0(i+3) e1(i+3) e2(i+3) e3(i+3)
tmp3 = simde_mm_unpackhi_epi16(tmp0,tmp1);// e0(i+4) e1(i+4) e2(i+4) e3(i+4) e0(i+5) e1(i+5) e2(i+5) e3(i+5) ... e0(i+7) e1(i+7) e2(i+7) e3(i+7)
tmp4 = simde_mm_unpackhi_epi8(e4j,e5j); // e4(i+8) e5(i+8) e4(i+9) e5(i+9) .... e4(i+15) e515i+7)
tmp5 = simde_mm_unpackhi_epi8(e6j,e7j); // e6(i+8) e7(i+8) e6(i+9) e7(i+9) .... e6(i+15) e7(i+15)
tmp6 = simde_mm_unpacklo_epi16(tmp4,tmp5);// e4(i) e5(i) e6(i) e7(i) e4(i+1) e5(i+1) e6(i+1) e7(i+1) ... e4(i+3) e5(i+3) e6(i+) e7(i+3)
tmp7 = simde_mm_unpackhi_epi16(tmp4,tmp5);// e4(i+4) e5(i+4) e6(i+4) e7(i+4) e4(i+5) e5(i+5) e6(i+5) e7(i+5) ... e4(i+7) e5(i+7) e6(i+7) e7(i+7)
simde_mm_storeu_si128(f_128+k+4,simde_mm_unpacklo_epi32(tmp2,tmp6)); // e0(i) e1(i) e2(i) e3(i) e4(i) e5(i) e6(i) e7(i) e0(i+1) ... e7(i+1)
simde_mm_storeu_si128(f_128+k+5,simde_mm_unpackhi_epi32(tmp2,tmp6)); // e0(i+2) e1(i+2) e2(i+2) e3(i+2) e4(i+2) e5(i+2) e6(i+2) e7(i+2) e0(i+3) e1(i+3) ... e7(i+3)
simde_mm_storeu_si128(f_128+k+6,simde_mm_unpacklo_epi32(tmp3,tmp7)); // e0(i+4) e1(i+4) e2(i+4) e3(i+4) e4(i+4) e5(i+4) e6(i+4) e7+4(i) e0(i+5) ... e7(i+5)
simde_mm_storeu_si128(f_128+k+7,simde_mm_unpackhi_epi32(tmp3,tmp7)); // e0(i+6) e1(i+6) e2(i+6) e3(i+6) e4(i+6) e5(i+6) e6(i+6) e7(i+6) e0(i+7) e0(i+7) ... e7(i+7)
}
if ((j<<4) != EQm) {
int k2=k<<4;
fp=&f[k2];
for (int j2=(j<<4) ; j2< EQm ; j2++) {
*fp++ = e0[j2];
*fp++ = e1[j2];
*fp++ = e2[j2];
*fp++ = e3[j2];
*fp++ = e4[j2];
*fp++ = e5[j2];
}
}
#endif
break;
default: AssertFatal(1==0,"Should be here!\n");
}

View File

@@ -151,13 +151,8 @@ else
for (r=0; r<*C; r++) {
k = 0;
while (k<((Kprime - L)>>3)) {
output_buffers[r][k] = input_buffer[s];
//printf("encoding segment %d : byte %d (%d) => %d\n",r,k,(Kprime-L)>>3,input_buffer[s]);
k++;
s++;
}
memcpy(output_buffers[r],input_buffer+s,(Kprime-L)>>3);
s+=(Kprime-L)>>3;
if (*C > 1) { // add CRC
crc = crc24b(output_buffers[r],Kprime-L)>>8;

View File

@@ -24,8 +24,10 @@
#include "executables/softmodem-common.h"
// #define DEBUG_DLSCH_PRECODING_PRINT_WITH_TRIVIAL // TODO: For debug, to be removed if want to merge to develop
//Table 6.3.1.5-1 Precoding Matrix W 1 layer 2 antenna ports 'n' = -1 and 'o' = -j
//#define DEBUG_LAYER_MAPPING
#define USE_NEON
//#define USE_GATHER
// Table 6.3.1.5-1 Precoding Matrix W 1 layer 2 antenna ports 'n' = -1 and 'o' = -j
const char nr_W_1l_2p[6][2][1] = {
{{'1'}, {'0'}}, // pmi 0
{{'0'}, {'1'}},
@@ -35,7 +37,7 @@ const char nr_W_1l_2p[6][2][1] = {
{{'1'}, {'o'}} // pmi 5
};
//Table 6.3.1.5-3 Precoding Matrix W 1 layer 4 antenna ports 'n' = -1 and 'o' = -j
// Table 6.3.1.5-3 Precoding Matrix W 1 layer 4 antenna ports 'n' = -1 and 'o' = -j
const char nr_W_1l_4p[28][4][1] = {
{{'1'}, {'0'}, {'0'}, {'0'}}, // pmi 0
{{'0'}, {'1'}, {'0'}, {'0'}},
@@ -68,14 +70,14 @@ const char nr_W_1l_4p[28][4][1] = {
{{'1'}, {'o'}, {'o'}, {'n'}} // pmi 27
};
//Table 6.3.1.5-4 Precoding Matrix W 2 antenna ports layers 2 'n' = -1 and 'o' = -j
// Table 6.3.1.5-4 Precoding Matrix W 2 antenna ports layers 2 'n' = -1 and 'o' = -j
const char nr_W_2l_2p[3][2][2] = {
{{'1', '0'}, {'0', '1'}}, // pmi 0
{{'1', '1'}, {'1', 'n'}},
{{'1', '1'}, {'j', 'o'}} // pmi 2
};
//Table 6.3.1.5-5 Precoding Matrix W 2 layers 4 antenna ports 'n' = -1 and 'o' = -j
// Table 6.3.1.5-5 Precoding Matrix W 2 layers 4 antenna ports 'n' = -1 and 'o' = -j
const char nr_W_2l_4p[22][4][2] = {
{{'1', '0'}, {'0', '1'}, {'0', '0'}, {'0', '0'}}, // pmi 0
{{'1', '0'}, {'0', '0'}, {'0', '1'}, {'0', '0'}}, {{'1', '0'}, {'0', '0'}, {'0', '0'}, {'0', '1'}},
@@ -94,7 +96,7 @@ const char nr_W_2l_4p[22][4][2] = {
{{'1', '1'}, {'o', 'o'}, {'1', 'n'}, {'o', 'j'}}, {{'1', '1'}, {'o', 'o'}, {'j', 'o'}, {'1', 'n'}} // pmi 21
};
//Table 6.3.1.5-6 Precoding Matrix W 3 layers 4 antenna ports 'n' = -1 and 'o' = -j
// Table 6.3.1.5-6 Precoding Matrix W 3 layers 4 antenna ports 'n' = -1 and 'o' = -j
const char nr_W_3l_4p[7][4][3] = {{{'1', '0', '0'}, {'0', '1', '0'}, {'0', '0', '1'}, {'0', '0', '0'}}, // pmi 0
{{'1', '0', '0'}, {'0', '1', '0'}, {'1', '0', '0'}, {'0', '0', '1'}},
{{'1', '0', '0'}, {'0', '1', '0'}, {'n', '0', '0'}, {'0', '0', '1'}},
@@ -103,7 +105,7 @@ const char nr_W_3l_4p[7][4][3] = {{{'1', '0', '0'}, {'0', '1', '0'}, {'0', '0',
{{'1', '1', '1'}, {'n', '1', 'n'}, {'1', '1', 'n'}, {'n', '1', '1'}},
{{'1', '1', '1'}, {'n', '1', 'n'}, {'j', 'j', 'o'}, {'o', 'j', 'j'}}};
//Table 6.3.1.5-7 Precoding Matrix W 4 layers 4 antenna ports 'n' = -1 and 'o' = -j
// Table 6.3.1.5-7 Precoding Matrix W 4 layers 4 antenna ports 'n' = -1 and 'o' = -j
const char nr_W_4l_4p[5][4][4] = {
{{'1', '0', '0', '0'}, {'0', '1', '0', '0'}, {'0', '0', '1', '0'}, {'0', '0', '0', '1'}}, // pmi 0
{{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'1', 'n', '0', '0'}, {'0', '0', '1', 'n'}},
@@ -112,137 +114,133 @@ const char nr_W_4l_4p[5][4][4] = {
{{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'j', 'j', 'o', 'o'}, {'j', 'o', 'o', 'j'}} // pmi 4
};
void nr_modulation(const uint32_t *in,
uint32_t length,
uint16_t mod_order,
int16_t *out)
void nr_modulation(const uint32_t *in, uint32_t length, uint16_t mod_order, int16_t *out)
{
uint16_t mask = ((1<<mod_order)-1);
int32_t* nr_mod_table32;
int32_t* out32 = (int32_t*) out;
uint16_t mask = ((1 << mod_order) - 1);
int32_t *nr_mod_table32;
int32_t *out32 = (int32_t *)out;
const uint8_t *in_bytes = (const uint8_t *)in;
const uint64_t *in64 = (const uint64_t *)in;
int64_t* out64 = (int64_t*) out;
uint32_t i=0;
int64_t *out64 = (int64_t *)out;
uint32_t i = 0;
#if defined(__SSE2__)
simde__m128i *nr_mod_table128;
simde__m128i *out128;
#endif
LOG_D(PHY,"nr_modulation: length %d, mod_order %d\n",length,mod_order);
LOG_D(PHY, "nr_modulation: length %d, mod_order %d\n", length, mod_order);
switch (mod_order) {
#if defined(__SSE2__)
case 2:
nr_mod_table128 = (simde__m128i *)nr_qpsk_byte_mod_table;
out128 = (simde__m128i *)out;
for (i=0; i<length/8; i++)
out128[i] = nr_mod_table128[in_bytes[i]];
// the bits that are left out
i = i*8/2;
nr_mod_table32 = (int32_t*) nr_qpsk_mod_table;
while (i<length/2) {
const int idx = ((in_bytes[(i * 2) / 8] >> ((i * 2) & 0x7)) & mask);
out32[i] = nr_mod_table32[idx];
i++;
}
return;
case 2:
nr_mod_table128 = (simde__m128i *)nr_qpsk_byte_mod_table;
out128 = (simde__m128i *)out;
for (i = 0; i < length / 8; i++)
out128[i] = nr_mod_table128[in_bytes[i]];
// the bits that are left out
i = i * 8 / 2;
nr_mod_table32 = (int32_t *)nr_qpsk_mod_table;
while (i < length / 2) {
const int idx = ((in_bytes[(i * 2) / 8] >> ((i * 2) & 0x7)) & mask);
out32[i] = nr_mod_table32[idx];
i++;
}
return;
#else
case 2:
nr_mod_table32 = (int32_t*) nr_qpsk_mod_table;
for (i=0; i<length/mod_order; i++) {
const int idx = ((in[i * 2 / 32] >> ((i * 2) & 0x1f)) & mask);
out32[i] = nr_mod_table32[idx];
}
return;
case 2:
nr_mod_table32 = (int32_t *)nr_qpsk_mod_table;
for (i = 0; i < length / mod_order; i++) {
const int idx = ((in[i * 2 / 32] >> ((i * 2) & 0x1f)) & mask);
out32[i] = nr_mod_table32[idx];
}
return;
#endif
case 4:
out64 = (int64_t*) out;
for (i=0; i<length/8; i++)
out64[i] = nr_16qam_byte_mod_table[in_bytes[i]];
// the bits that are left out
i = i*8/4;
while (i<length/4) {
const int idx = ((in_bytes[(i * 4) / 8] >> ((i * 4) & 0x7)) & mask);
out32[i] = nr_16qam_mod_table[idx];
i++;
}
return;
case 6:
if (length > (3*64))
for (i = 0; i < length - 3 * 64; i += 3 * 64) {
uint64_t x = *in64++;
uint64_t x1 = x & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 24) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 36) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 48) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
uint64_t x2 = (x >> 60);
x = *in64++;
x2 |= x<<4;
x1 = x2 & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 24) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 36) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 48) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x2 = ((x>>56)&0xf0) | (x2>>60);
x = *in64++;
x2 |= x<<8;
x1 = x2 & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 24) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 36) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 48) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x2 = ((x>>52)&0xff0) | (x2>>60);
*out64++ = nr_64qam_mod_table[x2];
case 4:
out64 = (int64_t *)out;
for (i = 0; i < length / 8; i++)
out64[i] = nr_16qam_byte_mod_table[in_bytes[i]];
// the bits that are left out
i = i * 8 / 4;
while (i < length / 4) {
const int idx = ((in_bytes[(i * 4) / 8] >> ((i * 4) & 0x7)) & mask);
out32[i] = nr_16qam_mod_table[idx];
i++;
}
while (i + 24 <= length) {
uint32_t xx = 0;
memcpy(&xx, in_bytes + i / 8, 3);
uint64_t x1 = xx & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (xx >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
i += 24;
}
if (i != length) {
uint32_t xx = 0;
memcpy(&xx, in_bytes + i / 8, 2);
uint64_t x1 = xx & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
}
return;
return;
case 8:
nr_mod_table32 = (int32_t*) nr_256qam_mod_table;
for (i=0; i<length/8; i++)
out32[i] = nr_mod_table32[in_bytes[i]];
return;
case 6:
if (length > (3 * 64))
for (i = 0; i < length - 3 * 64; i += 3 * 64) {
uint64_t x = *in64++;
uint64_t x1 = x & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 24) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 36) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x >> 48) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
uint64_t x2 = (x >> 60);
x = *in64++;
x2 |= x << 4;
x1 = x2 & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 24) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 36) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 48) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x2 = ((x >> 56) & 0xf0) | (x2 >> 60);
x = *in64++;
x2 |= x << 8;
x1 = x2 & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 24) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 36) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (x2 >> 48) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x2 = ((x >> 52) & 0xff0) | (x2 >> 60);
*out64++ = nr_64qam_mod_table[x2];
}
default:
break;
while (i + 24 <= length) {
uint32_t xx = 0;
memcpy(&xx, in_bytes + i / 8, 3);
uint64_t x1 = xx & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
x1 = (xx >> 12) & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
i += 24;
}
if (i != length) {
uint32_t xx = 0;
memcpy(&xx, in_bytes + i / 8, 2);
uint64_t x1 = xx & 0xfff;
*out64++ = nr_64qam_mod_table[x1];
}
return;
case 8:
nr_mod_table32 = (int32_t *)nr_256qam_mod_table;
for (i = 0; i < length / 8; i++)
out32[i] = nr_mod_table32[in_bytes[i]];
return;
default:
break;
}
AssertFatal(false,"Invalid or unsupported modulation order %d\n",mod_order);
AssertFatal(false, "Invalid or unsupported modulation order %d\n", mod_order);
}
void nr_layer_mapping(int nbCodes,
@@ -251,36 +249,296 @@ void nr_layer_mapping(int nbCodes,
uint8_t n_layers,
int layerSz,
uint32_t n_symbs,
c16_t tx_layer[layerSz],
int layer)
c16_t tx_layers[][layerSz])
{
LOG_D(PHY,"Doing layer mapping for %d layers, %d symbols\n",n_layers,n_symbs);
LOG_D(PHY, "Doing layer mapping for %d layers, %d symbols\n", n_layers, n_symbs);
switch (n_layers) {
case 1:
memcpy(tx_layer, mod_symbs[0], n_symbs * sizeof(**mod_symbs));
memcpy(tx_layers[0], mod_symbs[0], n_symbs * sizeof(**mod_symbs));
break;
case 2:
case 3:
case 4:
for (int i = 0; i < n_symbs / n_layers; i++) {
const c16_t *base = mod_symbs[0] + n_layers * i;
tx_layer[i] = base[layer];
}
break;
case 2: {
#if defined(__AVX512BW__)
int i=0;
__m512i perm2a = _mm512_set_epi32(30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0);
__m512i perm2b = _mm512_set_epi32(31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1);
#ifndef USE_GATHER
__m512i a, b;
int j;
for (i = 0, j = 0; i < n_symbs >> 4; i += 2, j++) {
a = ((__m512i *)mod_symbs[0])[i];
b = ((__m512i *)mod_symbs[0])[i + 1];
((__m512i *)tx_layers[0])[j] = _mm512_permutex2var_epi32(a, perm2a, b);
((__m512i *)tx_layers[1])[j] = _mm512_permutex2var_epi32(a, perm2b, b);
}
if (i << 4 != n_symbs) {
for (int i2 = ((n_symbs >> 4) << 4); i2 < n_symbs; i2 += 2) {
tx_layers[0][i2 >> 1] = mod_symbs[0][i2];
tx_layers[1][i2 >> 1] = mod_symbs[0][i2 + 1];
}
}
#else
for (i=0; i <n_symbs; i+=32) {
*(__m512i *)(tx_layers[0]+i/2)=_mm512_i32gather_epi32(perm2a, mod_symbs[0]+i, 4);
*(__m512i *)(tx_layers[1]+i/2)=_mm512_i32gather_epi32(perm2b, mod_symbs[0]+i, 4);
}
for (; i < n_symbs; i += 2) {
tx_layers[0][i >> 1] = mod_symbs[0][i];
tx_layers[1][i >> 1] = mod_symbs[0][i + 1];
}
#endif
#elif defined(__aarch64__)
int i;
#ifdef USE_NEON
// SIMDe doesn't handle this properly, gcc up to 14.2 neither
uint8_t const perm0[16] = {0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 12, 13, 14, 15};
uint8x16_t perm = vld1q_u8(perm0);
uint8x16_t d;
for (i = 0; i < n_symbs >> 2; i++) {
d = vqtbl1q_u8(((uint8x16_t *)mod_symbs[0])[i], perm);
((int64_t *)tx_layers[0])[i] = vgetq_lane_u64((uint64x2_t)d, 0);
((int64_t *)tx_layers[1])[i] = vgetq_lane_u64((uint64x2_t)d, 1);
}
if (i << 2 != n_symbs) {
for (int i2 = ((n_symbs >> 3) << 3); i2 < n_symbs; i2 += 2) {
tx_layers[0][i2 >> 1] = mod_symbs[0][i2];
tx_layers[1][i2 >> 1] = mod_symbs[0][i2 + 1];
}
}
#else
for (i = 0; i < n_symbs; i += 2) {
tx_layers[0][i >> 1] = mod_symbs[0][i];
tx_layers[1][i >> 1] = mod_symbs[0][i + 1];
}
#endif
#else
int i;
simde__m256i perm2 = simde_mm256_set_epi32(7, 5, 3, 1, 6, 4, 2, 0);
simde__m256i d;
for (i = 0; i < n_symbs >> 3; i++) {
d = simde_mm256_permutevar8x32_epi32(((simde__m256i *)mod_symbs[0])[i], perm2);
((simde__m128i *)tx_layers[0])[i] = simde_mm256_extractf128_si256(d, 0);
((simde__m128i *)tx_layers[1])[i] = simde_mm256_extractf128_si256(d, 1);
}
if (i << 3 != n_symbs) {
for (int i2 = ((n_symbs >> 3) << 3); i2 < n_symbs; i2 += 2) {
tx_layers[0][i2 >> 1] = mod_symbs[0][i2];
tx_layers[1][i2 >> 1] = mod_symbs[0][i2 + 1];
}
}
#endif
} break;
case 3: {
#if defined(__AVX512BW__)
__m512i i0, i1, i2, d0;
__m512i perm3_0 =
_mm512_set_epi32(13 + 16, 10 + 16, 7 + 16, 4 + 16, 1 + 16, 14 + 16, 11 + 16, 8 + 16, 5 + 16, 2 + 16, 15, 12, 9, 6, 3, 0);
__m512i perm3_0b = _mm512_set_epi32(13 + 16, 10 + 16, 7 + 16, 4 + 16, 1 + 16, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
__m512i perm3_1 = _mm512_set_epi32(14 + 16,
11 + 16,
8 + 16,
5 + 16,
2 + 16,
15 + 16,
12 + 16,
9 + 16,
6 + 16,
3 + 16,
0 + 16,
13,
10,
7,
4,
1);
__m512i perm3_1b = _mm512_set_epi32(14 + 16, 11 + 16, 8 + 16, 5 + 16, 2 + 16, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
__m512i perm3_2 = _mm512_set_epi32(15 + 16,
12 + 16,
9 + 16,
6 + 16,
3 + 16,
0 + 16,
13 + 16,
10 + 16,
7 + 16,
4 + 16,
1 + 16,
14,
11,
8,
5,
2);
__m512i perm3_2b = _mm512_set_epi32(15 + 16, 12 + 16, 9 + 16, 6 + 16, 3 + 16, 0 + 16, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
int i,n;
for (i = 0, n = 0; i < n_symbs >> 4; i += 3, n++) {
i0 = ((__m512i *)mod_symbs[0])[i];
i1 = ((__m512i *)mod_symbs[0])[i + 1];
i2 = ((__m512i *)mod_symbs[0])[i + 2];
d0 = _mm512_permutex2var_epi32(i0, perm3_0, i1);
((__m512i *)tx_layers[0])[n] = _mm512_permutex2var_epi32(d0, perm3_0b, i2); // 11000000
d0 = _mm512_permutex2var_epi32(i0, perm3_1, i1);
((__m512i *)tx_layers[1])[n] = _mm512_permutex2var_epi32(d0, perm3_1b, i2); // 11000000
d0 = _mm512_permutex2var_epi32(i0, perm3_2, i1);
((__m512i *)tx_layers[2])[n] = _mm512_permutex2var_epi32(d0, perm3_2b, i2); // 11000000
}
#elif defined(__aarch64__)
for (int i = 0; i < n_symbs; i += 3) {
tx_layers[0][i / 3] = mod_symbs[0][i];
tx_layers[1][i / 3] = mod_symbs[0][i + 1];
tx_layers[2][i / 3] = mod_symbs[0][i + 2];
}
#else
simde__m256i i0, i1, i2, d0, d1, d2, d3;
simde__m256i perm3_0 = simde_mm256_set_epi32(5, 2, 7, 4, 1, 6, 3, 0);
simde__m256i perm3_1 = simde_mm256_set_epi32(6, 3, 0, 5, 2, 7, 4, 1);
simde__m256i perm3_2 = simde_mm256_set_epi32(7, 4, 1, 6, 3, 0, 5, 2);
int i,n;
for (i = 0, n = 0; i < n_symbs >> 3; i += 3, n++) {
i0 = ((simde__m256i *)mod_symbs[0])[i];
i1 = ((simde__m256i *)mod_symbs[0])[i + 1];
i2 = ((simde__m256i *)mod_symbs[0])[i + 2];
d0 = simde_mm256_permutevar8x32_epi32(i0, perm3_0);
d1 = simde_mm256_permutevar8x32_epi32(i1, perm3_0);
d2 = simde_mm256_permutevar8x32_epi32(i2, perm3_0);
d3 = simde_mm256_blend_epi32(d0, d1, 0x38); // 00111000
((simde__m256i *)tx_layers[0])[n] = simde_mm256_blend_epi32(d3, d2, 0xc0); // 11000000
d0 = simde_mm256_permutevar8x32_epi32(i0, perm3_1);
d1 = simde_mm256_permutevar8x32_epi32(i1, perm3_1);
d2 = simde_mm256_permutevar8x32_epi32(i2, perm3_1);
d3 = simde_mm256_blend_epi32(d0, d1, 0x18); // 00011000
((simde__m256i *)tx_layers[1])[n] = simde_mm256_blend_epi32(d3, d2, 0xe0); // 11100000
d0 = simde_mm256_permutevar8x32_epi32(i0, perm3_2);
d1 = simde_mm256_permutevar8x32_epi32(i1, perm3_2);
d2 = simde_mm256_permutevar8x32_epi32(i2, perm3_2);
d3 = simde_mm256_blend_epi32(d0, d1, 0x1c); // 00011100
((simde__m256i *)tx_layers[2])[n] = simde_mm256_blend_epi32(d3, d2, 0xe0); // 11100000
#ifdef DEBUG_LAYER_MAPPING
printf("\nsymb %d/%d\n", i << 3, n_symbs);
printf(" layer 0:\t");
for (int j = 0; j < 8 * 6; j += 6) {
printf("%d %d ", ((int16_t *)&mod_symbs[0][i << 3])[j], ((int16_t *)&mod_symbs[0][i << 3])[j + 1]);
}
printf("\n layer 1:\t");
for (int j = 2; j < 8 * 6; j += 6) {
printf("%d %d ", ((int16_t *)&mod_symbs[0][i << 3])[j], ((int16_t *)&mod_symbs[0][i << 3])[j + 1]);
}
printf("\n layer 2:\t");
for (int j = 4; j < 8 * 6; j += 6) {
printf("%d %d ", ((int16_t *)&mod_symbs[0][i << 3])[j], ((int16_t *)&mod_symbs[0][i << 3])[j + 1]);
}
printf("\n Mapping layer 0:\t");
for (int j = 0; j < 16; j++) {
printf("%d ", ((int16_t *)&tx_layers[0][n << 3])[j]);
}
printf("\n Mapping layer 1:\t");
for (int j = 0; j < 16; j++) {
printf("%d ", ((int16_t *)&tx_layers[1][n << 3])[j]);
}
printf("\n Mapping layer 2:\t");
for (int j = 0; j < 16; j++) {
printf("%d ", ((int16_t *)&tx_layers[2][n << 3])[j]);
}
#endif
}
if (i << 3 != n_symbs) {
for (int i2 = ((n_symbs >> 3) << 3); i2 < n_symbs; i2 += 3) {
tx_layers[0][i2 / 3] = mod_symbs[0][i2];
tx_layers[1][i2 / 3] = mod_symbs[0][i2 + 1];
tx_layers[2][i2 / 3] = mod_symbs[0][i2 + 2];
}
}
#endif
} break;
case 4: {
#if defined(__AVX512BW__)
__m512i perm4 = _mm512_set_epi32(15, 11, 7, 3, 14, 10, 6, 2, 13, 9, 5, 1, 12, 8, 4, 0);
__m512i e;
int i;
for (i = 0; i < n_symbs >> 4; i++) {
e = _mm512_permutexvar_epi32(perm4, ((__m512i *)mod_symbs[0])[i]);
((__m128i *)tx_layers[0])[i] = _mm512_extracti64x2_epi64(e, 0);
((__m128i *)tx_layers[1])[i] = _mm512_extracti64x2_epi64(e, 1);
((__m128i *)tx_layers[2])[i] = _mm512_extracti64x2_epi64(e, 2);
((__m128i *)tx_layers[3])[i] = _mm512_extracti64x2_epi64(e, 3);
}
if (i << 4 != n_symbs) {
for (int i2 = ((n_symbs >> 4) << 4); i2 < n_symbs; i2 += 4) {
tx_layers[0][i2 >> 2] = mod_symbs[0][i2];
tx_layers[1][i2 >> 2] = mod_symbs[0][i2 + 1];
tx_layers[2][i2 >> 2] = mod_symbs[0][i2 + 2];
tx_layers[3][i2 >> 2] = mod_symbs[0][i2 + 3];
}
}
#elif defined(__aarch64__)
int i;
#ifdef USE_NEON
// SIMDe doesn't handle this properly, gcc up to 14.2 neither
uint32x4_t d4;
for (i = 0; i < n_symbs >> 2; i++) {
d4 = ((uint32x4_t *)mod_symbs[0])[i];
((uint32_t *)tx_layers[0])[i] = vgetq_lane_u32(d4, 0);
((uint32_t *)tx_layers[1])[i] = vgetq_lane_u32(d4, 1);
((uint32_t *)tx_layers[2])[i] = vgetq_lane_u32(d4, 0);
((uint32_t *)tx_layers[3])[i] = vgetq_lane_u32(d4, 1);
}
if (i << 2 != n_symbs) {
for (int i2 = ((n_symbs >> 2) << 2); i2 < n_symbs; i2 += 4) {
tx_layers[0][i2 >> 2] = mod_symbs[0][i2];
tx_layers[1][i2 >> 2] = mod_symbs[0][i2 + 1];
tx_layers[0][i2 >> 2] = mod_symbs[0][i2];
tx_layers[1][i2 >> 2] = mod_symbs[0][i2 + 1];
}
}
#else
for (int i = 0; i < n_symbs; i += 4) {
tx_layers[0][i >> 2] = mod_symbs[0][i];
tx_layers[1][i >> 2] = mod_symbs[0][i + 1];
tx_layers[2][i >> 2] = mod_symbs[0][i + 2];
tx_layers[3][i >> 2] = mod_symbs[0][i + 3];
}
#endif
#else
simde__m256i perm4 = simde_mm256_set_epi32(7, 3, 6, 2, 5, 1, 4, 0);
simde__m256i e;
int i;
for (i = 0; i < n_symbs >> 3; i++) {
e = simde_mm256_permutevar8x32_epi32(((simde__m256i *)mod_symbs[0])[i], perm4);
((uint64_t *)tx_layers[0])[i] = simde_mm256_extract_epi64(e, 0);
((uint64_t *)tx_layers[1])[i] = simde_mm256_extract_epi64(e, 1);
((uint64_t *)tx_layers[2])[i] = simde_mm256_extract_epi64(e, 2);
((uint64_t *)tx_layers[3])[i] = simde_mm256_extract_epi64(e, 3);
}
if (i << 3 != n_symbs) {
for (int i2 = ((n_symbs >> 3) << 3); i2 < n_symbs; i2 += 3) {
tx_layers[0][i2 >> 1] = mod_symbs[0][i2];
tx_layers[1][i2 >> 1] = mod_symbs[0][i2 + 1];
tx_layers[2][i2 >> 1] = mod_symbs[0][i2 + 2];
tx_layers[3][i2 >> 1] = mod_symbs[0][i2 + 2];
}
}
#endif
} break;
case 5:
if (layer < 2)
for (int i = 0; i < n_symbs; i += 2) {
case 6:
case 7:
case 8:
/*
// Layer 0,1
for (int i = 0; i < n_symbs; i += 2) {
const int txIdx = i / 2;
tx_layer[txIdx] = mod_symbs[0][i + layer];
}
tx_layer[0][txIdx] = mod_symbs[0][i];
tx_layer[1][txIdx] = mod_symbs[0][i + 1];
}
// layers 2,3,4
else
for (int i = 0; i < n_symbs; i += 3) {
const int txIdx = i / 3;
tx_layer[txIdx] = mod_symbs[1][i + layer];
tx_layer[2][txIdx] = mod_symbs[1][i + 2];
tx_layer[3][txIdx] = mod_symbs[1][i + 3];
tx_layer[4][txIdx] = mod_symbs[1][i + 4];
}
break;
@@ -288,7 +546,12 @@ void nr_layer_mapping(int nbCodes,
for (int q=0; q<2; q++)
for (int i = 0; i < n_symbs; i += 3) {
const int txIdx = i / 3;
tx_layer[txIdx] = mod_symbs[q][i + layer];
tx_layer[0][txIdx] = mod_symbs[q][i + layer];
tx_layer[1][txIdx] = mod_symbs[q][i + layer];
tx_layer[2][txIdx] = mod_symbs[q][i + layer];
tx_layer[3][txIdx] = mod_symbs[q][i + layer];
tx_layer[4][txIdx] = mod_symbs[q][i + layer];
tx_layer[5][txIdx] = mod_symbs[q][i + layer];
}
break;
@@ -312,7 +575,7 @@ void nr_layer_mapping(int nbCodes,
tx_layer[txIdx] = mod_symbs[q][i + layer];
}
break;
*/
default:
AssertFatal(0, "Invalid number of layers %d\n", n_layers);
}
@@ -337,7 +600,7 @@ void nr_dft(c16_t *z, c16_t *d, uint32_t Msc_PUSCH)
simde__m128i norm128;
if ((Msc_PUSCH % 1536) > 0) {
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip += 4) {
dft_in0[ip] = d[i];
}
}
@@ -357,19 +620,18 @@ void nr_dft(c16_t *z, c16_t *d, uint32_t Msc_PUSCH)
}
if ((Msc_PUSCH % 1536) > 0) {
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip += 4)
z[i] = dft_out0[ip];
}
}
void perform_symbol_rotation(NR_DL_FRAME_PARMS *fp, double f0, c16_t *symbol_rotation)
{
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
const double Tc=(1/480e3/4096);
const double Nu=2048*64*(1/(float)(1<<fp->numerology_index));
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index)));
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index)));
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame / 10;
const double Tc = (1 / 480e3 / 4096);
const double Nu = 2048 * 64 * (1 / (float)(1 << fp->numerology_index));
const double Ncp0 = 16 * 64 + (144 * 64 * (1 / (float)(1 << fp->numerology_index)));
const double Ncp1 = (144 * 64 * (1 / (float)(1 << fp->numerology_index)));
LOG_D(PHY, "Doing symbol rotation calculation for TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
@@ -430,7 +692,9 @@ void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp)
fp->timeshift_symbol_rotation[i].i = (int16_t)round(exp_im * 32767);
if (i < 10)
LOG_D(PHY,"Timeshift symbol rotation %d => (%d,%d) %f\n",i,
LOG_D(PHY,
"Timeshift symbol rotation %d => (%d,%d) %f\n",
i,
fp->timeshift_symbol_rotation[i].r,
fp->timeshift_symbol_rotation[i].i,
poff);
@@ -441,13 +705,13 @@ c16_t nr_layer_precoder(int sz, c16_t datatx_F_precoding[][sz], const char *prec
{
c16_t precodatatx_F = {0};
for (int al = 0; al<n_layers; al++) {
for (int al = 0; al < n_layers; al++) {
c16_t antenna = datatx_F_precoding[al][re_offset];
switch (prec_matrix[al]) {
case '0': //multiply by zero
case '0': // multiply by zero
break;
case '1': //multiply by 1
case '1': // multiply by 1
precodatatx_F = c16add(precodatatx_F, antenna);
break;
@@ -492,15 +756,15 @@ c16_t nr_layer_precoder_cm(int n_layers,
}
void nr_layer_precoder_simd(const int n_layers,
const int n_symbols,
const int symSz,
const c16_t txdataF_res_mapped[n_layers][n_symbols][symSz],
const int ant,
const nfapi_nr_pm_pdu_t *pmi_pdu,
const int symbol,
const int sc_offset,
const int re_cnt,
c16_t *txdataF_precoded)
const int n_symbols,
const int symSz,
const c16_t txdataF_res_mapped[n_layers][n_symbols][symSz],
const int ant,
const nfapi_nr_pm_pdu_t *pmi_pdu,
const int symbol,
const int sc_offset,
const int re_cnt,
c16_t *txdataF_precoded)
{
uint32_t sc = sc_offset;
c16_t prec_weight = {0};
@@ -510,22 +774,25 @@ void nr_layer_precoder_simd(const int n_layers,
// 256 SIMD: Do 8 RE in one iteration, 3 iterations for 2 RB
#ifdef __AVX2__
const uint32_t re_cnt_align8 = re_cnt & ~7;
for(; sc < sc_offset + (re_cnt_align8); sc += sizeof(simde__m256i) / sizeof(prec_weight)) {
for (; sc < sc_offset + (re_cnt_align8); sc += sizeof(simde__m256i) / sizeof(prec_weight)) {
// Matrix multiplication for 4 elements of the result (sizeof(simde__m256i) / sizeof(*prec_matrix) = 8)
simde__m256i y = simde_mm256_set1_epi16(0); // Y = W[0]*X[0] + W[1]*X[1] + ... + W[nrOfLayers-1]*X[nrOfLayers-1]
for(int nl = 0; nl < n_layers; nl++) {
for (int nl = 0; nl < n_layers; nl++) {
prec_weight.r = pmi_pdu->weights[nl][ant].precoder_weight_Re;
prec_weight.i = pmi_pdu->weights[nl][ant].precoder_weight_Im;
const simde__m256i x = simde_mm256_loadu_epi32(&txdataF_res_mapped[nl][symbol][sc]);
// Rearrange precoding matrix weight to match complex multiplication and broadcast it to match SIMD size
const simde__m256i w_c = simde_mm256_set1_epi32(c16toI32(c16conj(prec_weight))); // broadcast conjugate of w
const simde__m256i w_s = simde_mm256_set1_epi32(c16toI32(c16swap(prec_weight))); // broadcast swapped real and img of w
const simde__m256i w_c = simde_mm256_set1_epi32(c16toI32(c16conj(prec_weight))); // broadcast conjugate of w
const simde__m256i w_s = simde_mm256_set1_epi32(c16toI32(c16swap(prec_weight))); // broadcast swapped real and img of w
// Multiplication and shift
const simde__m256i reals = simde_mm256_srai_epi32(simde_mm256_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15
const simde__m256i imags = simde_mm256_slli_epi32(simde_mm256_madd_epi16(x, w_s), 1); // (int32_t) .i = (x.r * w.i + x.i * w.r) << 1, since higher 16 bit of each 32 bit is taken by blend_epi16
const simde__m256i reals =
simde_mm256_srai_epi32(simde_mm256_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15
const simde__m256i imags = simde_mm256_slli_epi32(
simde_mm256_madd_epi16(x, w_s),
1); // (int32_t) .i = (x.r * w.i + x.i * w.r) << 1, since higher 16 bit of each 32 bit is taken by blend_epi16
// Re-arrange to match c16_t format
const simde__m256i produ = simde_mm256_blend_epi16(reals, imags, 0xAA);
@@ -540,43 +807,40 @@ void nr_layer_precoder_simd(const int n_layers,
// 128 SIMD: Do 4 RE in one iteration, 3 iterations for 1 RB
const uint32_t re_cnt_align4 = re_cnt & ~3;
for(; sc < sc_offset+re_cnt_align4; sc += sizeof(simde__m128i) / sizeof(prec_weight)) {
#ifdef DEBUG_DLSCH_PRECODING_PRINT_WITH_TRIVIAL // Get result with trivial solution, TODO: To be removed
c16_t y_triv[4];
for(int i = 0; i < 4; i++)
y_triv[i] = nr_layer_precoder_cm(n_layers,
NR_SYMBOLS_PER_SLOT,
symSz,
txdataF_res_mapped,
ant,
pmi_pdu,
symbol,
sc + i);
memcpy(&txdataF_precoded[sc], y_triv, sizeof(y_triv));
#endif
for (; sc < sc_offset + re_cnt_align4; sc += sizeof(simde__m128i) / sizeof(prec_weight)) {
#ifdef DEBUG_DLSCH_PRECODING_PRINT_WITH_TRIVIAL // Get result with trivial solution, TODO: To be removed
c16_t y_triv[4];
for (int i = 0; i < 4; i++)
y_triv[i] = nr_layer_precoder_cm(n_layers, NR_SYMBOLS_PER_SLOT, symSz, txdataF_res_mapped, ant, pmi_pdu, symbol, sc + i);
memcpy(&txdataF_precoded[sc], y_triv, sizeof(y_triv));
#endif
// Matrix multiplication for 4 elements of the result (sizeof(simde__m128i) / sizeof(c16_t) = 4)
simde__m128i y = simde_mm_set1_epi16(0); // Y = W[0]*X[0] + W[1]*X[1] + ... + W[nrOfLayers-1]*X[nrOfLayers-1]
for(int nl = 0; nl < n_layers; nl++) {
for (int nl = 0; nl < n_layers; nl++) {
prec_weight.r = pmi_pdu->weights[nl][ant].precoder_weight_Re;
prec_weight.i = pmi_pdu->weights[nl][ant].precoder_weight_Im;
const simde__m128i x = simde_mm_loadu_epi32(&txdataF_res_mapped[nl][symbol][sc]);
// Rearrange precoding matrix weight to match complex multiplication and broadcast it to match SIMD size
const simde__m128i w_c = simde_mm_set1_epi32(c16toI32(c16conj(prec_weight))); // broadcast conjugate of w
const simde__m128i w_s = simde_mm_set1_epi32(c16toI32(c16swap(prec_weight))); // broadcast swapped real and img of w
const simde__m128i w_c = simde_mm_set1_epi32(c16toI32(c16conj(prec_weight))); // broadcast conjugate of w
const simde__m128i w_s = simde_mm_set1_epi32(c16toI32(c16swap(prec_weight))); // broadcast swapped real and img of w
// Multiplication and shift
const simde__m128i reals = simde_mm_srai_epi32(simde_mm_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15
const simde__m128i imags = simde_mm_slli_epi32(simde_mm_madd_epi16(x, w_s), 1); // (int32_t) .i = (x.r * w.i + x.i * w.r) << 1, since higher 16 bit of each 32 bit is taken by blend_epi16
const simde__m128i reals =
simde_mm_srai_epi32(simde_mm_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15
const simde__m128i imags = simde_mm_slli_epi32(
simde_mm_madd_epi16(x, w_s),
1); // (int32_t) .i = (x.r * w.i + x.i * w.r) << 1, since higher 16 bit of each 32 bit is taken by blend_epi16
/* Re-arrange to match c16_t format
bit index: 0 | 16 | 32 | 48 | 64 | 80 | 96 | 112
reals = {R0.r[15..30] | R0.r[31] (0)*15 | R1.r[15..30] | R1.r[31] (0)*15 | R2.r[15..30] | R2.r[31] (0)*15 | R3.r[15..30] | R3.r[31] (0)*15}
imags = {0 R0.i[0..14]| R0.i[15..30] | 0 R1.i[0..14]| R1.i[15..30] | 0 R2.i[0..14]| R2.i[15..30] | 0 R3.i[0..14]| R3.i[15..30] }
16b from {reals | imags | reals | imags | reals | imags | reals | imags }
produ = {R0.r[15..30] | R0.i[15..30] | R1.r[15..30] | R1.i[15..30] | R2.r[15..30] | R2.i[15..30] | R3.r[15..30] | R3.i[15..30] }
bit index: 0 | 16 | 32 | 48 | 64 | 80 | 96 |
112 reals = {R0.r[15..30] | R0.r[31] (0)*15 | R1.r[15..30] | R1.r[31] (0)*15 | R2.r[15..30] | R2.r[31] (0)*15 |
R3.r[15..30] | R3.r[31] (0)*15} imags = {0 R0.i[0..14]| R0.i[15..30] | 0 R1.i[0..14]| R1.i[15..30] | 0 R2.i[0..14]|
R2.i[15..30] | 0 R3.i[0..14]| R3.i[15..30] } 16b from {reals | imags | reals | imags | reals
| imags | reals | imags } produ = {R0.r[15..30] | R0.i[15..30] | R1.r[15..30] | R1.i[15..30]
| R2.r[15..30] | R2.i[15..30] | R3.r[15..30] | R3.i[15..30] }
*/
const simde__m128i produ = simde_mm_blend_epi16(reals, imags, 0xAA);
@@ -586,30 +850,30 @@ void nr_layer_precoder_simd(const int n_layers,
// Store the result to txdataF
simde_mm_storeu_si128(&txdataF_precoded[sc], y);
#ifdef DEBUG_DLSCH_PRECODING_PRINT_WITH_TRIVIAL // Print simd and trivial result, TODO: To be removed
c16_t *y_simd = (c16_t*) &y;
printf("debug_to_be_removed re_cnt=%d, sc=%u, y_simd=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n",
re_cnt,
sc,
y_simd[0].r,
y_simd[0].i,
y_simd[1].r,
y_simd[1].i,
y_simd[2].r,
y_simd[2].i,
y_simd[3].r,
y_simd[3].i);
printf("debug_to_be_removed re_cnt=%d, sc=%u, y_triv=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n",
re_cnt,
sc,
y_triv[0].r,
y_triv[0].i,
y_triv[1].r,
y_triv[1].i,
y_triv[2].r,
y_triv[2].i,
y_triv[3].r,
y_triv[3].i);
#endif
#ifdef DEBUG_DLSCH_PRECODING_PRINT_WITH_TRIVIAL // Print simd and trivial result, TODO: To be removed
c16_t *y_simd = (c16_t *)&y;
printf("debug_to_be_removed re_cnt=%d, sc=%u, y_simd=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n",
re_cnt,
sc,
y_simd[0].r,
y_simd[0].i,
y_simd[1].r,
y_simd[1].i,
y_simd[2].r,
y_simd[2].i,
y_simd[3].r,
y_simd[3].i);
printf("debug_to_be_removed re_cnt=%d, sc=%u, y_triv=(%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d), (%+4d,%+4d)\n",
re_cnt,
sc,
y_triv[0].r,
y_triv[0].i,
y_triv[1].r,
y_triv[1].i,
y_triv[2].r,
y_triv[2].i,
y_triv[3].r,
y_triv[3].i);
#endif
}
}

View File

@@ -60,8 +60,7 @@ void nr_layer_mapping(int nbCodes,
uint8_t n_layers,
int layerSz,
uint32_t n_symbs,
c16_t tx_layers[layerSz],
int l);
c16_t tx_layers[][layerSz]);
/*! \brief Perform NR layer mapping. TS 38.211 V15.4.0 subclause 7.3.1.3
@param[in] ulsch_ue, double Pointer to NR_UE_ULSCH_t struct

View File

@@ -248,9 +248,11 @@ void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_off
{
PHY_VARS_gNB *gNB = msgTx->gNB;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
start_meas(&gNB->dci_generation_stats);
for (int i = 0; i < msgTx->num_ul_pdcch; i++)
nr_generate_dci(msgTx->gNB, &msgTx->ul_pdcch_pdu[i].pdcch_pdu.pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
for (int i = 0; i < msgTx->num_dl_pdcch; i++)
nr_generate_dci(msgTx->gNB, &msgTx->pdcch_pdu[i].pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
stop_meas(&gNB->dci_generation_stats);
}

File diff suppressed because it is too large Load Diff

View File

@@ -176,6 +176,7 @@ static void ldpc8blocks(void *p)
uint8_t e[E];
bzero (e, E);
start_meas(impp->dlsch_rate_matching_stats);
nr_rate_matching_ldpc(Tbslbrm,
impp->BG,
impp->Zc,
@@ -186,6 +187,7 @@ static void ldpc8blocks(void *p)
impp->K - impp->F - 2 * impp->Zc,
rel15->rvIndex[0],
E);
stop_meas(impp->dlsch_rate_matching_stats);
if (impp->K - impp->F - 2 * impp->Zc > E) {
LOG_E(PHY,
"dlsch coding A %d Kr %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n",
@@ -217,10 +219,12 @@ static void ldpc8blocks(void *p)
printf("output ratematching e[%d]= %d r_offset %u\n", i,e[i], r_offset);
#endif
start_meas(impp->dlsch_interleaving_stats);
nr_interleaving_ldpc(E,
mod_order,
e,
impp->output+r_offset);
stop_meas(impp->dlsch_interleaving_stats);
#ifdef DEBUG_DLSCH_CODING
for (int i =0; i<16; i++)
@@ -377,7 +381,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
encoder_implemparams_t arr[n_seg];
task_ans_t ans[n_seg];
memset(ans, 0, n_seg * sizeof(task_ans_t));
impp.dlsch_rate_matching_stats = dlsch_rate_matching_stats;
impp.dlsch_interleaving_stats = dlsch_interleaving_stats;
for (int j = 0; j < n_seg; j++) {
encoder_implemparams_t *perJobImpp = &arr[j];
*perJobImpp = impp;

View File

@@ -535,6 +535,8 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t dlsch_interleaving_stats;
time_stats_t dlsch_segmentation_stats;
time_stats_t dci_generation_stats;
time_stats_t phase_comp_stats;
time_stats_t rx_pusch_stats;
time_stats_t rx_pusch_init_stats;
time_stats_t rx_pusch_symbol_processing_stats;

View File

@@ -286,6 +286,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
//apply the OFDM symbol rotation here
if (gNB->phase_comp) {
start_meas(&gNB->phase_comp_stats);
for(int i = 0; i < gNB->common_vars.num_beams_period; ++i) {
for (int aa = 0; aa < cfg->carrier_config.num_tx_ant.value; aa++) {
apply_nr_rotation_TX(fp,
@@ -300,6 +301,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
T_INT(aa), T_BUFFER(&gNB->common_vars.txdataF[aa][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)));
}
}
stop_meas(&gNB->phase_comp_stats);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX + gNB->CC_id, 0);

View File

@@ -969,10 +969,12 @@ int main(int argc, char **argv)
reset_meas(&gNB->dlsch_segmentation_stats);
reset_meas(&gNB->dlsch_modulation_stats);
reset_meas(&gNB->dlsch_encoding_stats);
reset_meas(&gNB->dci_generation_stats);
reset_meas(&gNB->tinput);
reset_meas(&gNB->tprep);
reset_meas(&gNB->tparity);
reset_meas(&gNB->toutput);
reset_meas(&gNB->phase_comp_stats);
uint32_t errors_scrambling[16] = {0};
int n_errors[16] = {0};
@@ -1270,6 +1272,7 @@ int main(int argc, char **argv)
UE->dl_harq_processes[0][slot].C,
msgDataTx->dlsch[0][0].harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0] << 3);
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
printStatIndent2(&gNB->dci_generation_stats,"DCI encoding time");
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
printStatIndent3(&gNB->tinput,"DLSCH LDPC input processing time");
@@ -1282,6 +1285,7 @@ int main(int argc, char **argv)
printStatIndent2(&gNB->dlsch_scrambling_stats, "DLSCH scrambling time");
printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time");
printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time");
if (gNB->phase_comp) printStatIndent2(&gNB->phase_comp_stats,"Phase Compensation");
printf("\nUE function statistics (per %d us slot)\n", 1000 >> *scc->ssbSubcarrierSpacing);
for (int i = RX_PDSCH_STATS; i <= DLSCH_PROCEDURES_STATS; i++) {

View File

@@ -100,6 +100,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_am(
exit(1);
}
tx_maxsize *= 100;
rx_maxsize *= 100;
ret->tx_maxsize = tx_maxsize;
ret->rx_maxsize = rx_maxsize;

View File

@@ -452,7 +452,7 @@ static uint64_t get_u64_mask(const paramdef_t *pd)
for (int i = 0; i < pd->numelt; ++i) {
int num = pd->iptr[i];
AssertFatal(num >= 0 && num < 64, "cannot put element of %d in 64-bit mask\n", num);
mask |= 1 << num;
mask |= 1LL << num;
}
return mask;
}