diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 965dfaea3a..8ab9fff880 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -697,7 +697,7 @@ function main() { if [ "$SIMUS_PHY" = "1" ] ; then echo_info "Compiling physical unitary tests simulators" # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim - simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim" + simlist="ldpctest dlsim ulsim polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim" for f in $simlist ; do compilations \ phy_simulators $f \ diff --git a/cmake_targets/ldpctest_BG_1_Zc_176_rate_1-3_block_length_3848_maxit_5.txt b/cmake_targets/ldpctest_BG_1_Zc_176_rate_1-3_block_length_3848_maxit_5.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cmake_targets/ldpctest_BG_1_Zc_384_rate_1-3_block_length_8000_maxit_5.txt b/cmake_targets/ldpctest_BG_1_Zc_384_rate_1-3_block_length_8000_maxit_5.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cmake_targets/ldpctest_BG_1_Zc_384_rate_1-3_block_length_8448_maxit_5.txt b/cmake_targets/ldpctest_BG_1_Zc_384_rate_1-3_block_length_8448_maxit_5.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cmake_targets/ldpctest_BG_2_Zc_320_rate_1-3_block_length_3200_maxit_5.txt b/cmake_targets/ldpctest_BG_2_Zc_320_rate_1-3_block_length_3200_maxit_5.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cmake_targets/ldpctest_BG_2_Zc_384_rate_1-3_block_length_3840_maxit_5.txt b/cmake_targets/ldpctest_BG_2_Zc_384_rate_1-3_block_length_3840_maxit_5.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_bnProc.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_bnProc.h index 878150a9a8..9641563e9e 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_bnProc.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_bnProc.h @@ -30,7 +30,7 @@ #ifndef __NR_LDPC_BNPROC__H__ #define __NR_LDPC_BNPROC__H__ - +#include /** \brief Performs first part of BN processing on the BN processing buffer and stores the results in the LLR results buffer. At every BN, the sum of the returned LLRs from the connected CNs and the LLR of the receiver input is computed. diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_cnProc.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_cnProc.h index 50e425753d..74b66ab0b5 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_cnProc.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_cnProc.h @@ -438,6 +438,7 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; min = _mm256_min_epu8(min, _mm256_abs_epi8(ymm0)); sgn = _mm256_sign_epi8(sgn, ymm0); + // Store result min = _mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127 diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c index 493888ebbe..13223a1e40 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c @@ -263,8 +263,8 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP uint8_t BG = p_decParams->BG; uint8_t numMaxIter = p_decParams->numMaxIter; e_nrLDPC_outMode outMode = p_decParams->outMode; - int8_t* cnProcBuf= p_procBuf->cnProcBuf; - int8_t* cnProcBufRes=p_procBuf->cnProcBufRes; + // int8_t* cnProcBuf= p_procBuf->cnProcBuf; + // int8_t* cnProcBufRes=p_procBuf->cnProcBufRes; // Minimum number of iterations is 1 // 0 iterations means hard-decision on input LLRs @@ -334,7 +334,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP case 384: { // nrLDPC_cnProc_BG1_Z384_13_AVX2(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); - nrLDPC_cnProc_BG1_Z384_13_AVX512(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); //were test here + nrLDPC_cnProc_BG1_Z384_13_AVX512(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); //we test here break; } case 352: @@ -349,7 +349,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP nrLDPC_cnProc_BG1_Z320_13_AVX2(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); //nrLDPC_cnProc_BG1_Z320_13_AVX512(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); break; - } + } case 288: { @@ -1928,8 +1928,8 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP } case 352: { - //nrLDPC_cnProc_BG1_Z352_13_AVX2(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); - nrLDPC_cnProc_BG1_Z352_13_AVX512(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); + nrLDPC_cnProc_BG1_Z352_13_AVX2(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); + //nrLDPC_cnProc_BG1_Z352_13_AVX512(p_procBuf->cnProcBuf,p_procBuf->cnProcBufRes); break; } diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c index 1d6f2f14d8..277cea73cf 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c @@ -80,10 +80,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[0]*Z + 63)>>5; + M = (lut_numCnInCnGroups[0]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 3 @@ -104,7 +104,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i+=2) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>31)+lut_idxCnProcG3[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -112,7 +112,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // 32 CNs of second BN // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][1]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>31)+lut_idxCnProcG3[j][1]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -125,11 +125,11 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[0]>>31)+(j*bitOffsetInGroup)); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]+1); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>31)+lut_idxCnProcG3[j][0]+1); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -137,7 +137,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // 32 CNs of second BN // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][1]+1); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>31)+lut_idxCnProcG3[j][1]+1); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -150,7 +150,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup)+1); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[0]>>31)+(j*bitOffsetInGroup)+1); fprintf(fd," }\n"); } @@ -166,10 +166,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[1]*Z + 63)>>5; + M = (lut_numCnInCnGroups[1]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 4 @@ -188,7 +188,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>31)+lut_idxCnProcG4[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -198,7 +198,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<3; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>31)+lut_idxCnProcG4[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -212,7 +212,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[1]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[1]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -230,10 +230,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[2]*Z + 63)>>5; + M = (lut_numCnInCnGroups[2]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 4 @@ -253,7 +253,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>31)+lut_idxCnProcG5[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -263,7 +263,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<4; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>31)+lut_idxCnProcG5[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -277,7 +277,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[2]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[2]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -295,10 +295,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[3]*Z + 63)>>5; + M = (lut_numCnInCnGroups[3]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 4 @@ -318,7 +318,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>31)+lut_idxCnProcG6[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -328,7 +328,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<5; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>31)+lut_idxCnProcG6[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -342,7 +342,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[3]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[3]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -362,10 +362,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[4]*Z + 63)>>5; + M = (lut_numCnInCnGroups[4]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 4 @@ -385,7 +385,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG7[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>31)+lut_idxCnProcG7[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -395,7 +395,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<6; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG7[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>31)+lut_idxCnProcG7[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -409,7 +409,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[4]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[4]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -430,10 +430,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[5]*Z + 63)>>5; + M = (lut_numCnInCnGroups[5]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 4 @@ -453,7 +453,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG8[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>31)+lut_idxCnProcG8[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -463,7 +463,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<7; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG8[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>31)+lut_idxCnProcG8[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -477,7 +477,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[5]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[5]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -499,10 +499,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[6]*Z + 63)>>5; + M = (lut_numCnInCnGroups[6]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 9 @@ -522,7 +522,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>5)+lut_idxCnProcG9[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>31)+lut_idxCnProcG9[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -532,7 +532,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<8; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>5)+lut_idxCnProcG9[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>31)+lut_idxCnProcG9[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -546,7 +546,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[6]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[6]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -569,10 +569,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[7]*Z + 63)>>5; + M = (lut_numCnInCnGroups[7]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 10 @@ -592,7 +592,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>5)+lut_idxCnProcG10[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>31)+lut_idxCnProcG10[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -602,7 +602,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<9; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>5)+lut_idxCnProcG10[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>31)+lut_idxCnProcG10[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -616,7 +616,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[7]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[7]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } @@ -642,10 +642,10 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) { // Number of groups of 64 CNs for parallel processing // Ceil for values not divisible by 64 - M = (lut_numCnInCnGroups[8]*Z + 63)>>5; + M = (lut_numCnInCnGroups[8]*Z + 63)>>31; // Set the offset to each bit within a group in terms of 64 Byte - bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>5; + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>31; // Set pointers to start of group 19 @@ -665,7 +665,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," for (int i=0;i<%d;i++) {\n",M); // Abs and sign of 64 CNs (first BN) // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>5)+lut_idxCnProcG19[j][0]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>31)+lut_idxCnProcG19[j][0]); // sgn = _mm512_sign_epi16(ones, zmm0); fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); // min = _mm512_abs_epi8(zmm0); @@ -675,7 +675,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) // Loop over BNs for (k=1; k<18; k++) { - fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>5)+lut_idxCnProcG19[j][k]); + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>31)+lut_idxCnProcG19[j][k]); // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); @@ -689,7 +689,7 @@ void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); // p_cnProcBufResBit++; - fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[8]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[8]>>31)+(j*bitOffsetInGroup)); fprintf(fd," }\n"); } } diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c.save b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c.save new file mode 100644 index 0000000000..08c651c03b --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.c.save @@ -0,0 +1,742 @@ +#include +#include +#include "../../nrLDPCdecoder_defs.h" +#include "../../nrLDPC_types.h" +#include "../../nrLDPC_bnProc.h" + +void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) +{ + const char *ratestr[3]={"13","23","89"}; + + if (R<0 || R>2) {printf("Illegal R %d\n",R); abort();} + + + // system("mkdir -p ../ldpc_gen_files"); + + char fname[50]; + sprintf(fname,"../ldpc_gen_files/nrLDPC_cnProc_BG1_Z%d_%s_AVX512.c",Z,ratestr[R]); + FILE *fd=fopen(fname,"w"); + if (fd == NULL) {printf("Cannot create \n");abort();} + + fprintf(fd,"#include \n"); + fprintf(fd,"#include \n"); + fprintf(fd, "#include \"../include/avx512fintrin.h\"\n"); + + fprintf(fd, "__m512i _mm512_sign_epi16(__m512i a, __m512i b){ \n"); /* Emulate _mm512_sign_epi16() with instructions that exist in the AVX-512 instruction set */ + fprintf(fd, "b = _mm512_min_epi16(b, _mm512_set1_epi16(1)); \n" ); + fprintf(fd, "b = _mm512_max_epi16(b, _mm512_set1_epi16(-1)); \n" ); + fprintf(fd, " a = _mm512_mullo_epi16(a, b);\n"); + fprintf(fd, "return a;\n"); + fprintf(fd, "}\n" ); + + + fprintf(fd,"void nrLDPC_cnProc_BG1_Z%d_%s_AVX512(int8_t* cnProcBuf,int8_t* cnProcBufRes) {\n",Z,ratestr[R]); + + const uint8_t* lut_numCnInCnGroups; + const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG1; + + if (R==0) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R13; + else if (R==1) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R23; + else if (R==2) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R89; + else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();} + + //__m512i* p_cnProcBuf; + //__m512i* p_cnProcBufRes; + + // Number of CNs in Groups + uint32_t M; + uint32_t j; + uint32_t k; + // Offset to each bit within a group in terms of 64 Byte + uint32_t bitOffsetInGroup; + + //__m512i zmm0, min, sgn; + //__m512i* p_cnProcBufResBit; + + // const __m512i* p_ones = (__m512i*) ones256_epi8; + // const __m512i* p_maxLLR = (__m512i*) maxLLR256_epi8; + + // LUT with offsets for bits that need to be processed + // 1. bit proc requires LLRs of 2. and 3. bit, 2.bits of 1. and 3. etc. + // Offsets are in units of bitOffsetInGroup (1*384/64) + // const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}}; + + // ===================================================================== + // Process group with 3 BNs + fprintf(fd,"//Process group with 3 BNs\n"); + // LUT with offsets for bits that need to be processed + // 1. bit proc requires LLRs of 2. and 3. bit, 2.bits of 1. and 3. etc. + // Offsets are in units of bitOffsetInGroup (1*384/64)=6 + // Offsets are in units of bitOffsetInGroup (1*384/64)=6 + + // const uint8_t lut_idxCnProcG3[3][2] = {{6,12}, {0,12}, {0,6}}; + const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}}; + + fprintf(fd," __m512i zmm0, min, sgn,ones,maxLLR;\n"); + fprintf(fd," ones = _mm512_set1_epi8((char)1);\n"); + fprintf(fd," maxLLR = _mm512_set1_epi8((char)127);\n"); + + if (lut_numCnInCnGroups[0] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[0]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 3 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[0]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[0]]; + + // Loop over every BN + + for (j=0; j<3; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG3[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + // 32 CNs of second BN + // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][1]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup)); + + // Abs and sign of 64 CNs (first BN) + // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]+1); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + // 32 CNs of second BN + // zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][1]+1); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup)+1); + + fprintf(fd," }\n"); + } + } + + // ===================================================================== + // Process group with 4 BNs + fprintf(fd,"//Process group with 4 BNs\n"); + // Offset is 5*384/64 = 30 + // const uint8_t lut_idxCnProcG4[4][3] = {{30,60,90}, {0,60,90}, {0,30,90}, {0,30,60}}; + const uint8_t lut_idxCnProcG4[4][3] = {{60,120,180}, {0,120,180}, {0,60,180}, {0,60,120}}; + + if (lut_numCnInCnGroups[1] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[1]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + for (j=0; j<4; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG4[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<3; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[1]>>5)+lut_idxCnProcG4[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[1]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + + // ===================================================================== + // Process group with 5 BNs + fprintf(fd,"//Process group with 5 BNs\n"); + // Offset is 18*384/64 = 216 + //const uint16_t lut_idxCnProcG5[5][4] = {{108,216,324,432}, {0,216,324,432}, + // {0,108,324,432}, {0,108,216,432}, {0,108,216,324}}; + + + const uint16_t lut_idxCnProcG5[5][4] = {{216,432,648,864}, {0,432,648,864}, + {0,216,648,864}, {0,216,432,864}, {0,216,432,648}}; + + if (lut_numCnInCnGroups[2] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[2]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<5; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG5[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<4; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[2]>>5)+lut_idxCnProcG5[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[2]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + // ===================================================================== + // Process group with 6 BNs + fprintf(fd,"//Process group with 6 BNs\n"); + // Offset is 8*384/64 = 48 + /* const uint16_t lut_idxCnProcG6[6][5] = {{48,96,144,192,240}, {0,96,144,192,240}, + {0,48,144,192,240}, {0,48,96,192,240}, + {0,48,96,144,240}, {0,48,96,144,192}};*/ + + const uint16_t lut_idxCnProcG6[6][5] = {{96,192,288,384,480}, {0,192,288,384,480}, + {0,96,288,384,480}, {0,96,192,384,480}, + {0,96,192,288,480}, {0,96,192,288,384}}; + if (lut_numCnInCnGroups[3] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[3]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<6; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG6[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<5; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[3]>>5)+lut_idxCnProcG6[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[3]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + + // ===================================================================== + // Process group with 7 BNs + fprintf(fd,"//Process group with 7 BNs\n"); + // Offset is 5*384/64 = 30 + /* const uint16_t lut_idxCnProcG7[7][6] = {{30,60,90,120,150,180}, {0,60,90,120,150,180}, + {0,30,90,120,150,180}, {0,30,60,120,150,180}, + {0,30,60,90,150,180}, {0,30,60,90,120,180}, + {0,30,60,90,120,150}};*/ + + + const uint16_t lut_idxCnProcG7[7][6] = {{60,120,180,240,300,360}, {0,120,180,240,300,360}, + {0,60,180,240,300,360}, {0,60,120,240,300,360}, + {0,60,120,180,300,360}, {0,60,120,180,240,360}, + {0,60,120,180,240,300}}; + + if (lut_numCnInCnGroups[4] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[4]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<7; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG7[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<6; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[4]>>5)+lut_idxCnProcG7[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[4]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + + // ===================================================================== + // Process group with 8 BNs + fprintf(fd,"//Process group with 8 BNs\n"); + // Offset is 2*384/64 = 12 + /* const uint8_t lut_idxCnProcG8[8][7] = {{12,24,36,48,56,72,84}, {0,24,36,48,56,72,84}, + {0,12,36,48,56,72,84}, {0,12,24,48,56,72,84}, + {0,12,24,36,56,72,84}, {0,12,24,36,48,72,84}, + {0,12,24,36,48,56,84}, {0,12,24,36,48,120,72}};*/ + + const uint8_t lut_idxCnProcG8[8][7] = {{24,48,72,96,120,144,168}, {0,48,72,96,120,144,168}, + {0,24,72,96,120,144,168}, {0,24,48,96,120,144,168}, + {0,24,48,72,120,144,168}, {0,24,48,72,96,144,168}, + {0,24,48,72,96,120,168}, {0,24,48,72,96,120,144}}; + + + + if (lut_numCnInCnGroups[5] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[5]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<8; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG8[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<7; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[5]>>5)+lut_idxCnProcG8[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[5]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + // ===================================================================== + // Process group with 9 BNs + fprintf(fd,"//Process group with 9 BNs\n"); + // Offset is 2*384/64 = 12 + /*const uint8_t lut_idxCnProcG9[9][8] = {{12,24,36,48,60,72,84,96}, {0,24,36,48,60,72,84,96}, + {0,12,36,48,60,72,84,96}, {0,12,24,48,60,72,84,96}, + {0,12,24,36,60,72,84,96}, {0,12,24,36,48,72,84,96}, + {0,12,24,36,48,60,84,96}, {0,12,24,36,48,60,72,96}, + {0,12,24,36,48,60,72,84}};*/ + + const uint8_t lut_idxCnProcG9[9][8] = {{24,48,72,96,120,144,168,192}, {0,48,72,96,120,144,168,192}, + {0,24,72,96,120,144,168,192}, {0,24,48,96,120,144,168,192}, + {0,24,48,72,120,144,168,192}, {0,24,48,72,96,144,168,192}, + {0,24,48,72,96,120,168,192}, {0,24,48,72,96,120,144,192}, + {0,24,48,72,96,120,144,168}}; + + + if (lut_numCnInCnGroups[6] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[6]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 9 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<9; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG9[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<8; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[6]>>5)+lut_idxCnProcG9[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[6]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + // ===================================================================== + // Process group with 10 BNs + fprintf(fd,"//Process group with 10 BNs\n"); + // Offset is 1*384/64 = 6 + /* const uint8_t lut_idxCnProcG10[10][9] = {{6,12,18,24,30,36,42,48,54}, {0,12,18,24,30,36,42,48,54}, + {0,6,18,24,30,36,42,48,54}, {0,6,12,24,30,36,42,48,54}, + {0,6,12,18,30,36,42,48,54}, {0,6,12,18,24,36,42,48,54}, + {0,6,12,18,24,30,42,48,54}, {0,6,12,18,24,30,36,48,54}, + {0,6,12,18,24,30,36,42,54}, {0,6,12,36,24,30,36,42,48}};*/ + + const uint8_t lut_idxCnProcG10[10][9] = {{12,24,36,48,60,72,84,96,108}, {0,24,36,48,60,72,84,96,108}, + {0,12,36,48,60,72,84,96,108}, {0,12,24,48,60,72,84,96,108}, + {0,12,24,36,60,72,84,96,108}, {0,12,24,36,48,72,84,96,108}, + {0,12,24,36,48,60,84,96,108}, {0,12,24,36,48,60,72,96,108}, + {0,12,24,36,48,60,72,84,108}, {0,12,24,36,48,60,72,84,96}}; + + + + + + if (lut_numCnInCnGroups[7] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[7]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 10 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<10; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG10[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<9; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[7]>>5)+lut_idxCnProcG10[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[7]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + + // ===================================================================== + // Process group with 19 BNs + fprintf(fd,"//Process group with 19 BNs\n"); + // Offset is 4*384/64 = 24 + /* const uint16_t lut_idxCnProcG19[19][18] = {{24,48,72,96,120,144,168,192,216,240,264,288,312,336,360,384,408,432}, {0,48,72,96,120,144,168,192,216,240,264,288,312,336,360,384,408,432}, + {0,24,72,96,120,144,168,192,216,240,264,288,312,336,360,384,408,432}, {0,24,48,96,120,144,168,192,216,240,264,288,312,336,360,384,408,432}, + {0,24,48,72,120,144,168,192,216,240,264,288,312,336,360,384,408,432}, {0,24,48,72,96,144,168,192,216,240,264,288,312,336,360,384,408,432}, + {0,24,48,72,96,120,168,192,216,240,264,288,312,336,360,384,408,432}, {0,24,48,72,96,120,144,192,216,240,264,288,312,336,360,384,408,432}, + {0,24,48,72,96,120,144,168,216,240,264,288,312,336,360,384,408,432}, {0,24,48,72,96,120,144,168,192,240,264,288,312,336,360,384,408,432}, + {0,24,48,72,96,120,144,168,192,216,264,288,312,336,360,384,408,432}, {0,24,48,72,96,120,144,168,192,216,240,288,312,336,360,384,408,432}, + {0,24,48,72,96,120,144,168,192,216,240,264,312,336,360,384,408,432}, {0,24,48,72,96,120,144,168,192,216,240,264,288,336,360,384,408,432}, + {0,24,48,72,96,120,144,168,192,216,240,264,288,312,360,384,408,432}, {0,24,48,72,96,120,144,168,192,216,240,264,288,312,336,384,408,432}, + {0,24,48,72,96,120,144,168,192,216,240,264,288,312,336,360,408,432}, {0,24,48,72,96,120,144,168,192,216,240,264,288,312,336,360,384,432}, + {0,24,48,72,96,120,144,168,192,216,240,264,288,312,336,360,384,408}};*/ + +const uint16_t lut_idxCnProcG19[19][18] = {{48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, + {0,48,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,192,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, + {0,48,96,144,240,288,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,288,336,384,432,480,528,576,624,672,720,768,816,864}, + {0,48,96,144,192,240,336,384,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,384,432,480,528,576,624,672,720,768,816,864}, + {0,48,96,144,192,240,288,336,432,480,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,480,528,576,624,672,720,768,816,864}, + {0,48,96,144,192,240,288,336,384,432,528,576,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,576,624,672,720,768,816,864}, + {0,48,96,144,192,240,288,336,384,432,480,528,624,672,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,672,720,768,816,864}, + {0,48,96,144,192,240,288,336,384,432,480,528,576,624,720,768,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,768,816,864}, + {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,816,864}, {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,864}, + {0,48,96,144,192,240,288,336,384,432,480,528,576,624,672,720,768,816}}; + + + if (lut_numCnInCnGroups[8] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[8]*Z + 31)>>5; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>5; + + + // Set pointers to start of group 19 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<19; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i>5)+lut_idxCnProcG19[j][0]); + // sgn = _mm512_sign_epi16(ones, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(ones, zmm0);\n"); + // min = _mm512_abs_epi8(zmm0); + fprintf(fd," min = _mm512_abs_epi8(zmm0);\n"); + + + // Loop over BNs + for (k=1; k<18; k++) + { + fprintf(fd," zmm0 = ((__m512i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[8]>>5)+lut_idxCnProcG19[j][k]); + + // min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); + fprintf(fd," min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0));\n"); + + // sgn = _mm512_sign_epi16(sgn, zmm0); + fprintf(fd," sgn = _mm512_sign_epi16(sgn, zmm0);\n"); + } + + // Store result + // min = _mm512_min_epu8(min, maxLLR); // 128 in epi8 is -127 + fprintf(fd," min = _mm512_min_epu8(min, maxLLR);\n"); + // *p_cnProcBufResBit = _mm512_sign_epi16(min, sgn); + // p_cnProcBufResBit++; + fprintf(fd," ((__m512i*)cnProcBufRes)[%d+i] = _mm512_sign_epi16(min, sgn);\n",(lut_startAddrCnGroups[8]>>5)+(j*bitOffsetInGroup)); + fprintf(fd," }\n"); + } + } + + fprintf(fd,"}\n"); + fclose(fd); +}//end of the function nrLDPC_cnProc_BG1 + + + + + + diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.o b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.o new file mode 100644 index 0000000000..9eef9df59f Binary files /dev/null and b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.o differ diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.save11 b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.save11 new file mode 100644 index 0000000000..670a6ce59b --- /dev/null +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/generator_avx512/cnProc_gen_BG1_avx512.save11 @@ -0,0 +1,706 @@ + +#include +#include +#include "../../nrLDPCdecoder_defs.h" +#include "../../nrLDPC_types.h" +#include "../../nrLDPC_bnProc.h" + +void nrLDPC_cnProc_BG1_generator_AVX512(uint16_t Z,int R) +{ + const char *ratestr[3]={"13","23","89"}; + + if (R<0 || R>2) {printf("Illegal R %d\n",R); abort();} + + + // system("mkdir -p ../ldpc_gen_files"); + + char fname[50]; + sprintf(fname,"../ldpc_gen_files/nrLDPC_cnProc_BG1_Z%d_%s_AVX512.c",Z,ratestr[R]); + FILE *fd=fopen(fname,"w"); + if (fd == NULL) {printf("Cannot create \n");abort();} + + fprintf(fd,"#include \n"); + fprintf(fd,"#include \n"); + fprintf(fd, "#include \"../include/avx512fintrin.h\"\n"); + + fprintf(fd, "__m512i _mm512_sign_epi16(__m512i a, __m512i b){ \n"); /* Emulate _mm512_sign_epi16() with instructions that exist in the AVX-512 instruction set */ + fprintf(fd, "b = _mm512_min_epi16(b, _mm512_set1_epi16(1)); \n" ); + fprintf(fd, "b = _mm512_max_epi16(b, _mm512_set1_epi16(-1)); \n" ); + fprintf(fd, " a = _mm512_mullo_epi16(a, b);\n"); + fprintf(fd, "return a;\n"); + fprintf(fd, "}\n" ); + + + fprintf(fd,"void nrLDPC_cnProc_BG1_Z%d_%s_AVX512(int8_t* cnProcBuf,int8_t* cnProcBufRes) {\n",Z,ratestr[R]); + + const uint8_t* lut_numCnInCnGroups; + const uint32_t* lut_startAddrCnGroups = lut_startAddrCnGroups_BG1; + + if (R==0) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R13; + else if (R==1) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R23; + else if (R==2) lut_numCnInCnGroups = lut_numCnInCnGroups_BG1_R89; + else { printf("aborting, illegal R %d\n",R); fclose(fd);abort();} + + //__m512i* p_cnProcBuf; + //__m512i* p_cnProcBufRes; + + // Number of CNs in Groups + uint32_t M; + uint32_t j; + uint32_t k; + // Offset to each bit within a group in terms of 64 Byte + uint32_t bitOffsetInGroup; + + //__m512i zmm0, min, sgn; + //__m512i* p_cnProcBufResBit; + + // const __m512i* p_ones = (__m512i*) ones256_epi8; + // const __m512i* p_maxLLR = (__m512i*) maxLLR256_epi8; + + // LUT with offsets for bits that need to be processed + // 1. bit proc requires LLRs of 2. and 3. bit, 2.bits of 1. and 3. etc. + // Offsets are in units of bitOffsetInGroup (1*384/64) + // const uint8_t lut_idxCnProcG3[3][2] = {{12,24}, {0,24}, {0,12}}; + + // ===================================================================== + // Process group with 3 BNs + fprintf(fd,"//Process group with 3 BNs\n"); + // LUT with offsets for bits that need to be processed + // 1. bit proc requires LLRs of 2. and 3. bit, 2.bits of 1. and 3. etc. + // Offsets are in units of bitOffsetInGroup (1*384/64)=6 + // Offsets are in units of bitOffsetInGroup (1*384/64)=6 + + const uint8_t lut_idxCnProcG3[3][2] = {{6,12}, {0,12}, {0,6}}; + + + fprintf(fd," __m512i zmm0, min, sgn,ones,maxLLR;\n"); + fprintf(fd," ones = _mm512_set1_epi8((char)1);\n"); + fprintf(fd," maxLLR = _mm512_set1_epi8((char)127);\n"); + + if (lut_numCnInCnGroups[0] > 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[0]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 3 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[0]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[0]]; + + // Loop over every BN + + for (j=0; j<3; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[1]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + for (j=0; j<4; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[2]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<5; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[3]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<6; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[4]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<7; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[5]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 4 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<8; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[6]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 9 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<9; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[7]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 10 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<10; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i 0) + { + // Number of groups of 64 CNs for parallel processing + // Ceil for values not divisible by 64 + M = (lut_numCnInCnGroups[8]*Z ) ; + + // Set the offset to each bit within a group in terms of 64 Byte + bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX) ; + + + // Set pointers to start of group 19 + //p_cnProcBuf = (__m512i*) &cnProcBuf [lut_startAddrCnGroups[1]]; + //p_cnProcBufRes = (__m512i*) &cnProcBufRes[lut_startAddrCnGroups[1]]; + + // Loop over every BN + + for (j=0; j<19; j++) + { + // Set of results pointer to correct BN address + //p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup); + + // Loop over CNs + // for (i=0; i #ifndef __NR_LDPC_BNPROC__H__ #define __NR_LDPC_BNPROC__H__ @@ -59,7 +59,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc uint32_t cnOffsetInGroup; uint8_t idxBnGroup = 0; - __m512i zmm0, zmm1, zmmRes0, zmmRes1; + __m512i zmm0, zmm1, zmmRes0, zmmRes1,tmp; // ===================================================================== // Process group with 1 CN @@ -96,8 +96,8 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - //-*p_llrRes = _mm512_permute4x64_epi64(zmm0, 0xD8); // revenir ? - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + //-*p_llrRes = _mm512_permutevar_epi32 (tmp, zmm0); // revenir ? + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; } @@ -148,7 +148,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -201,7 +201,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -254,7 +254,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -307,7 +307,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -360,7 +360,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -413,7 +413,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -466,7 +466,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -519,7 +519,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -572,7 +572,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -625,7 +625,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -678,7 +678,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -731,7 +731,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -784,7 +784,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -837,7 +837,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -890,7 +890,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -943,7 +943,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -996,7 +996,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1049,7 +1049,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1102,7 +1102,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1155,7 +1155,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1208,7 +1208,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1261,7 +1261,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1314,7 +1314,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1367,7 +1367,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1420,7 +1420,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1473,7 +1473,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1526,7 +1526,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Pack results back to epi8 zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); - *p_llrRes = _mm512_permutex2var_epi16(zmm0, 0xD8,zmm1); + *p_llrRes = _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1571,16 +1571,16 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc // Add LLR from receiver input zmm0 = _mm512_cvtepi8_epi16(p_llrProcBuf[j]); - zmmRes0 = _mm512_adds_epi16(ymmRes0, ymm0); + zmmRes0 = _mm512_adds_epi16(zmmRes0, zmm0); - ymm1 = _mm512_cvtepi8_epi16(p_llrProcBuf[j+1]); - ymmRes1 = _mm512_adds_epi16(ymmRes1, ymm1); + zmm1 = _mm512_cvtepi8_epi16(p_llrProcBuf[j+1]); + zmmRes1 = _mm512_adds_epi16(zmmRes1, zmm1); // Pack results back to epi8 - ymm0 = _mm512_packs_epi16(ymmRes0, ymmRes1); - // ymm0 = [ymmRes1[255:128] ymmRes0[255:128] ymmRes1[127:0] ymmRes0[127:0]] - // p_llrRes = [ymmRes1[255:128] ymmRes1[127:0] ymmRes0[255:128] ymmRes0[127:0]] - *p_llrRes = _mm512_permute4x64_epi64(ymm0, 0xD8); + zmm0 = _mm512_packs_epi16(zmmRes0, zmmRes1); + // zmm0 = [zmmRes1[255:128] zmmRes0[255:128] zmmRes1[127:0] zmmRes0[127:0]] + // p_llrRes = [zmmRes1[255:128] zmmRes1[127:0] zmmRes0[255:128] zmmRes0[127:0]] + *p_llrRes= _mm512_permutex2var_epi16(zmm0,tmp,zmm1); // Next result p_llrRes++; @@ -1610,31 +1610,31 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc for (i=0,j=0; i>5; uint64_t Mr = numLLR&63; - const __m512i* p_zeros = (__m512i*) zeros256_epi8; - const __m512i* p_ones = (__m512i*) ones256_epi8; + const __m512i* p_zeros = (__m512i*) zeros512_epi8; + const __m512i* p_ones = (__m512i*) ones512_epi8; for (i=0; i>5; uint64_t Mr = numLLR&63; - const __m512i* p_shuffle = (__m512i*) constShuffle_256_epi8; + const __m512i* p_shuffle = (__m512i*) constShuffle_512_epi8; for (i=0; i -#include "include/avx512fintrin.h" +#include +//#include "include/immintrin.h" + /** \brief Performs CN processing for BG2 on the CN processing buffer and stores the results in the CN processing results buffer. @@ -110,12 +112,12 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // 64 CNS of second BN zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); // Store result @@ -157,13 +159,13 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG4[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<3; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG4[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -206,13 +208,13 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG5[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<4; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG5[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -256,13 +258,13 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG6[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<5; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG6[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -307,13 +309,13 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG8[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<7; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG8[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -359,13 +361,13 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG10[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<9; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG10[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -442,12 +444,12 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr { // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i]; - sgn = mm512_sign_epi16(*p_ones, zmm0); revenir - min = _m512_abs_epi8(zmm0); + sgn = mm512_sign_epi16(*p_ones, zmm0); + min = _mm512_abs_epi8(zmm0); // 64 CNS of second BN zmm0 = p_cnProcBuf[lut_idxCnProcG3[j][1] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); // Store result @@ -489,13 +491,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG4[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<3; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG4[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -539,13 +541,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG5[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<4; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG5[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -590,13 +592,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG6[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<5; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG6[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -642,13 +644,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG7[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<6; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG7[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -694,13 +696,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG8[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<7; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG8[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -747,13 +749,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG9[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<8; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG9[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -800,13 +802,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG10[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<9; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG10[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -857,13 +859,13 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr // Abs and sign of 64 CNS (first BN) zmm0 = p_cnProcBuf[lut_idxCnProcG19[j][0] + i]; sgn = mm512_sign_epi16(*p_ones, zmm0); - min = _m512_abs_epi8(zmm0); + min = _mm512_abs_epi8(zmm0); // Loop over BNs for (k=1; k<18; k++) { zmm0 = p_cnProcBuf[lut_idxCnProcG19[j][k] + i]; - min = _mm512_min_epu8(min, _m512_abs_epi8(zmm0)); + min = _mm512_min_epu8(min, _mm512_abs_epi8(zmm0)); sgn = mm512_sign_epi16(sgn, zmm0); } @@ -938,7 +940,7 @@ static inline uint64_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1072,7 +1074,7 @@ static inline uint64_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1226,7 +1228,7 @@ static inline uint64_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1341,7 +1343,7 @@ static inline uint64_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1408,7 +1410,7 @@ static inline uint64_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1422,12 +1424,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<10; j++) { // BN offset is units of 1*384/64 = 6 - ymm0 = p_cnProcBuf [j*6 + i]; - ymm1 = p_cnProcBufRes[j*6 + i]; + zmm0 = p_cnProcBuf [j*6 + i]; + zmm1 = p_cnProcBufRes[j*6 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1543,7 +1545,7 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf uint64_t Mrem; uint64_ ; - __m512i ymm0, ymm1; + __m512i zmm0, zmm1; // ===================================================================== // Process group with 3 BNs @@ -1574,12 +1576,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<3; j++) { // BN offset is units of (6*384/32) = 72 - ymm0 = p_cnProcBuf [j*72 + i]; - ymm1 = p_cnProcBufRes[j*72 + i]; + zmm0 = p_cnProcBuf [j*72 + i]; + zmm1 = p_cnProcBufRes[j*72 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1593,12 +1595,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<3; j++) { // BN offset is units of (6*384/32) = 72 - ymm0 = p_cnProcBuf [j*72 + i]; - ymm1 = p_cnProcBufRes[j*72 + i]; + zmm0 = p_cnProcBuf [j*72 + i]; + zmm1 = p_cnProcBufRes[j*72 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1641,12 +1643,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<4; j++) { // BN offset is units of 20*384/32 = 240 - ymm0 = p_cnProcBuf [j*240 + i]; - ymm1 = p_cnProcBufRes[j*240 + i]; + zmm0 = p_cnProcBuf [j*240 + i]; + zmm1 = p_cnProcBufRes[j*240 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1660,12 +1662,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<4; j++) { // BN offset is units of 20*384/32 = 240 - ymm0 = p_cnProcBuf [j*240 + i]; - ymm1 = p_cnProcBufRes[j*240 + i]; + zmm0 = p_cnProcBuf [j*240 + i]; + zmm1 = p_cnProcBufRes[j*240 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1708,12 +1710,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<5; j++) { // BN offset is units of 9*384/32 = 108 - ymm0 = p_cnProcBuf [j*108 + i]; - ymm1 = p_cnProcBufRes[j*108 + i]; + zmm0 = p_cnProcBuf [j*108 + i]; + zmm1 = p_cnProcBufRes[j*108 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1727,12 +1729,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<5; j++) { // BN offset is units of 9*384/32 = 108 - ymm0 = p_cnProcBuf [j*108 + i]; - ymm1 = p_cnProcBufRes[j*108 + i]; + zmm0 = p_cnProcBuf [j*108 + i]; + zmm1 = p_cnProcBufRes[j*108 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1775,12 +1777,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<6; j++) { // BN offset is units of 3*384/32 = 36 - ymm0 = p_cnProcBuf [j*36 + i]; - ymm1 = p_cnProcBufRes[j*36 + i]; + zmm0 = p_cnProcBuf [j*36 + i]; + zmm1 = p_cnProcBufRes[j*36 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1794,12 +1796,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<6; j++) { // BN offset is units of 3*384/32 = 36 - ymm0 = p_cnProcBuf [j*36 + i]; - ymm1 = p_cnProcBufRes[j*36 + i]; + zmm0 = p_cnProcBuf [j*36 + i]; + zmm1 = p_cnProcBufRes[j*36 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1842,12 +1844,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<8; j++) { // BN offset is units of 2*384/32 = 24 - ymm0 = p_cnProcBuf [j*24 + i]; - ymm1 = p_cnProcBufRes[j*24 + i]; + zmm0 = p_cnProcBuf [j*24 + i]; + zmm1 = p_cnProcBufRes[j*24 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1861,12 +1863,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<8; j++) { // BN offset is units of 2*384/32 = 24 - ymm0 = p_cnProcBuf [j*24 + i]; - ymm1 = p_cnProcBufRes[j*24 + i]; + zmm0 = p_cnProcBuf [j*24 + i]; + zmm1 = p_cnProcBufRes[j*24 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1909,12 +1911,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<10; j++) { // BN offset is units of 2*384/32 = 24 - ymm0 = p_cnProcBuf [j*24 + i]; - ymm1 = p_cnProcBufRes[j*24 + i]; + zmm0 = p_cnProcBuf [j*24 + i]; + zmm1 = p_cnProcBufRes[j*24 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 @@ -1928,12 +1930,12 @@ static inline uint64_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf for (j=0; j<10; j++) { // BN offset is units of 2*384/32 = 24 - ymm0 = p_cnProcBuf [j*24 + i]; - ymm1 = p_cnProcBufRes[j*24 + i]; + zmm0 = p_cnProcBuf [j*24 + i]; + zmm1 = p_cnProcBufRes[j*24 + i]; // Add BN and input LLR, extract the sign bit // and add in GF(2) (xor) - pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(ymm0,ymm1)); + pcRes ^= _mm512_movemask_epi8(_mm512_adds_epi8(zmm0,zmm1)); } // If no error pcRes should be 0 diff --git a/openair1/PHY/CODING/nrLDPC_decoder_full/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder_full/nrLDPC_decoder.c index 9ff57acf22..b8075ee528 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder_full/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder_full/nrLDPC_decoder.c @@ -29,17 +29,15 @@ */ #include -//#include +#include #include "nrLDPCdecoder_defs.h" #include "nrLDPC_types.h" #include "nrLDPC_init.h" #include "nrLDPC_mPass.h" #include "nrLDPC_cnProc.h" #include "nrLDPC_bnProc.h" - +#include //#include "include/immintrin.h" -#include "include/avx512fintrin.h" -#include "include/avx2intrin.h" #define NR_LDPC_ENABLE_PARITY_CHECK #define NR_LDPC_PROFILER_DETAIL