mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-20 16:10:29 +00:00
Compare commits
21 Commits
eurecom/ea
...
602-ldpc-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b91461792d | ||
|
|
b2435595aa | ||
|
|
813d9a5baf | ||
|
|
f3cb9a66b3 | ||
|
|
c070b0e8a6 | ||
|
|
555bd4c2f0 | ||
|
|
e9777f0487 | ||
|
|
2c971fab85 | ||
|
|
0e5934d79f | ||
|
|
18bd1ffd25 | ||
|
|
f5533dbf74 | ||
|
|
1358d87bfa | ||
|
|
5c3320bca3 | ||
|
|
916ed869be | ||
|
|
82b42d0390 | ||
|
|
82381ad4ff | ||
|
|
1b024d4d04 | ||
|
|
05bf012464 | ||
|
|
85d8db0a24 | ||
|
|
0ee87fbff5 | ||
|
|
80e70f60c3 |
@@ -31,6 +31,919 @@
|
||||
#ifndef __NR_LDPC_BNPROC__H__
|
||||
#define __NR_LDPC_BNPROC__H__
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "nrLDPC_intrinsics.h"
|
||||
|
||||
/**
|
||||
\brief Performs BN processing on the CN results buffer and stores the results in the LLR results buffer as well as the CN results buffer.
|
||||
At every BN, the sum of the returned LLRs from the connected CNs and the LLR of the receiver input is computed.
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param Z Lifting size
|
||||
*/
|
||||
static inline void nrLDPC_bnProcPcOpt3(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, int8_t* llr, int8_t* llrRes, uint16_t Z, uint8_t BG)
|
||||
{
|
||||
const uint32_t* p_addrEdgeInCnBuffer = p_lut->addrEdgeInCnBuffer;
|
||||
const uint16_t* p_cshift = p_lut->cShift;
|
||||
|
||||
uint32_t startColParity;
|
||||
const uint8_t* numEdgesPerBn;
|
||||
uint8_t numColBg;
|
||||
if (BG == 1)
|
||||
{
|
||||
numEdgesPerBn = lut_numEdgesPerBn_BG1_R13;
|
||||
startColParity = NR_LDPC_START_COL_PARITY_BG1;
|
||||
numColBg = NR_LDPC_NCOL_BG1_R13;
|
||||
}
|
||||
else
|
||||
{
|
||||
numEdgesPerBn = lut_numEdgesPerBn_BG2_R15;
|
||||
startColParity = NR_LDPC_START_COL_PARITY_BG2;
|
||||
numColBg = NR_LDPC_NCOL_BG2_R15;
|
||||
}
|
||||
|
||||
int8_t* p_cnProcBufRes;
|
||||
int8_t* p_cnProcBuf;
|
||||
__m256i* p_llrRes = (__m256i*) llrRes;
|
||||
|
||||
|
||||
|
||||
__m256i* p_llrResTmp256;
|
||||
__m256i* p_cnProcBufRes256;
|
||||
__m256i* p_cnProcBuf256;
|
||||
__m128i* p_cnProcBufRes128;
|
||||
|
||||
|
||||
__m128i* p_llr128;
|
||||
|
||||
uint32_t c;
|
||||
uint32_t r;
|
||||
int32_t i,j;
|
||||
int16_t M;
|
||||
|
||||
uint16_t remShift;
|
||||
uint16_t remShift32;
|
||||
int16_t M1;
|
||||
const __m256i* p_minLLR = (__m256i*) minLLR256_epi8;
|
||||
int16_t llrResTmp[384] __attribute__ ((aligned(64)));
|
||||
int8_t tmp[64] __attribute__ ((aligned(64)));
|
||||
|
||||
__m256i* p_tmp256 = (__m256i*)tmp;
|
||||
|
||||
__m256i ymm0,ymm1, ymmRes0, ymmRes1;
|
||||
|
||||
// Number of groups of 32 values in edge of length Z
|
||||
M = (Z + 31)>>5;
|
||||
|
||||
// Loop over BNs excluding parity BNs which can be processed way easier since they have no shift
|
||||
for (c = 0; c < startColParity; c++)
|
||||
{
|
||||
// First iteration for BN, sum input LLR with first connected CN
|
||||
// Account for shift in edge
|
||||
// Set pointer to start of edge
|
||||
p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
p_llrRes = (__m256i*)&llrRes[c*Z];
|
||||
p_llr128 = (__m128i*)&llr[c*Z];
|
||||
p_cnProcBufRes128 = (__m128i*)p_cnProcBufRes;
|
||||
p_cnProcBufRes256 = (__m256i*)p_cnProcBufRes;
|
||||
p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
|
||||
remShift = (Z - *p_cshift)%Z;
|
||||
remShift32 = (remShift)&31;
|
||||
M1 = (remShift)>>5;
|
||||
|
||||
for (i=0,j=0; i<(M-M1-1); i++)
|
||||
{
|
||||
// load first 32 LLR values from unaligned memory
|
||||
ymm0 = _mm256_srli_si2x256_loadu((int8_t*)&p_cnProcBufRes256[M1+i],remShift32);
|
||||
p_cnProcBufRes128 = (__m128i*)&ymm0;
|
||||
|
||||
// First 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[0]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(*p_llr128++);
|
||||
|
||||
*p_llrResTmp256++ = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[1]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(*p_llr128++);
|
||||
|
||||
*p_llrResTmp256++ = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
}
|
||||
// Wrap around
|
||||
p_tmp256[0] = p_cnProcBufRes256[M-1];
|
||||
p_tmp256[1] = p_cnProcBufRes256[0];
|
||||
ymm0 = _mm256_srli_si2x256_loadu((int8_t*)p_tmp256,remShift32);
|
||||
p_cnProcBufRes128 = (__m128i*)&ymm0;
|
||||
// First 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[0]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(*p_llr128++);
|
||||
|
||||
*p_llrResTmp256++ = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[1]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(*p_llr128++);
|
||||
|
||||
*p_llrResTmp256++ = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
|
||||
// First half
|
||||
for (i=0; i<M1; i++)
|
||||
{
|
||||
// load first 32 LLR values from unaligned memory
|
||||
ymm0 = _mm256_srli_si2x256_loadu((int8_t*)&p_cnProcBufRes256[i],remShift32);
|
||||
p_cnProcBufRes128 = (__m128i*)&ymm0;
|
||||
|
||||
// First 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[0]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(*p_llr128++);
|
||||
|
||||
*p_llrResTmp256++ = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[1]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(*p_llr128++);
|
||||
|
||||
*p_llrResTmp256++ = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
}
|
||||
|
||||
|
||||
// p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
// p_llrRes = (__m256i*)&llrRes[c*Z];
|
||||
// // Shift
|
||||
// nrLDPC_inv_circ_memcpy(&cnShifted[0],p_cnProcBufRes,Z,*p_cshift);
|
||||
|
||||
// // Do the processing
|
||||
// p_llr128 = (__m128i*)&llr[c*Z];
|
||||
// p_cnProcBufRes128 = (__m128i*)&cnShifted[0];
|
||||
// p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
// for (i = 0,j=0; i < M; i++,j+=2)
|
||||
// {
|
||||
// // First 16 LLRs of first CN
|
||||
// ymm0 = simde_mm256_cvtepi8_epi16(p_llr128[j]);
|
||||
// ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j]);
|
||||
|
||||
// p_llrResTmp256[j] = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
|
||||
// // Second 16 LLRs of first CN
|
||||
// ymm0 = simde_mm256_cvtepi8_epi16(p_llr128[j+1]);
|
||||
// ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j+1]);
|
||||
|
||||
// p_llrResTmp256[j+1] = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
// }
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
p_cshift++;
|
||||
|
||||
// Loop over remaining connected CNs for that BN
|
||||
for (r = 1; r < numEdgesPerBn[c]; r++)
|
||||
{
|
||||
remShift = (Z - *p_cshift)%Z;
|
||||
remShift32 = (remShift)&31;
|
||||
M1 = (remShift)>>5;
|
||||
|
||||
// Set pointer to start of edge
|
||||
p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
|
||||
for (i=0,j=0; i<(M-M1-1); i++,j+=2)
|
||||
{
|
||||
// load first 32 LLR values from unaligned memory
|
||||
ymm0 = simde_mm256_loadu_si256((__m256i*)(p_cnProcBufRes + remShift + i*32));
|
||||
p_cnProcBufRes128 = (__m128i*)&ymm0;
|
||||
|
||||
// First 16 LLRs of first CN
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[0]);
|
||||
|
||||
*p_llrResTmp256 = simde_mm256_adds_epi16(ymm1, *p_llrResTmp256);
|
||||
p_llrResTmp256++;
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[1]);
|
||||
|
||||
*p_llrResTmp256 = simde_mm256_adds_epi16(ymm1, *p_llrResTmp256);
|
||||
p_llrResTmp256++;
|
||||
}
|
||||
// Wrap around
|
||||
p_tmp256[0] = simde_mm256_loadu_si256((__m256i*)&p_cnProcBufRes[Z-32]);
|
||||
p_tmp256[1] = simde_mm256_loadu_si256((__m256i*)&p_cnProcBufRes[0]);
|
||||
ymm0 = simde_mm256_loadu_si256((__m256i*)&tmp[remShift32]);
|
||||
p_cnProcBufRes128 = (__m128i*)&ymm0;
|
||||
// First 16 LLRs of first CN
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[0]);
|
||||
|
||||
*p_llrResTmp256 = simde_mm256_adds_epi16(ymm1, *p_llrResTmp256);
|
||||
p_llrResTmp256++;
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[1]);
|
||||
|
||||
*p_llrResTmp256 = simde_mm256_adds_epi16(ymm1, *p_llrResTmp256);
|
||||
p_llrResTmp256++;
|
||||
|
||||
// First half
|
||||
|
||||
for (i=0; i<M1; i++,j+=2)
|
||||
{
|
||||
// load first 32 LLR values from unaligned memory
|
||||
ymm0 = simde_mm256_loadu_si256((__m256i*)(p_cnProcBufRes + remShift32 + i*32));
|
||||
p_cnProcBufRes128 = (__m128i*)&ymm0;
|
||||
|
||||
// First 16 LLRs of first CN
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[0]);
|
||||
|
||||
*p_llrResTmp256 = simde_mm256_adds_epi16(ymm1, *p_llrResTmp256);
|
||||
p_llrResTmp256++;
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[1]);
|
||||
|
||||
*p_llrResTmp256 = simde_mm256_adds_epi16(ymm1, *p_llrResTmp256);
|
||||
p_llrResTmp256++;
|
||||
}
|
||||
|
||||
|
||||
// nrLDPC_inv_circ_memcpy(&cnShifted[r*384],p_cnProcBufRes,Z,*p_cshift);
|
||||
|
||||
// p_cnProcBufRes128 = (__m128i*)&cnShifted[r*384];
|
||||
// for (i = 0,j=0; i < M; i++,j+=2)
|
||||
// {
|
||||
// // First 16 LLRs of first CN
|
||||
// ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j]);
|
||||
|
||||
// p_llrResTmp256[j] = simde_mm256_adds_epi16(p_llrResTmp256[j], ymm0);
|
||||
|
||||
// // Second 16 LLRs of first CN
|
||||
// ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j+1]);
|
||||
|
||||
// p_llrResTmp256[j+1] = simde_mm256_adds_epi16(p_llrResTmp256[j+1], ymm0);
|
||||
// }
|
||||
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
p_cshift++;
|
||||
}
|
||||
// Sum is complete
|
||||
// saturate and move to LLR results
|
||||
p_llrResTmp256 = (__m256i*) &llrResTmp[0];
|
||||
for (i = 0,j=0; i < M; i++,j+=2)
|
||||
{
|
||||
ymmRes0 = p_llrResTmp256[j];
|
||||
ymmRes1 = p_llrResTmp256[j+1];
|
||||
// Pack results back to epi8
|
||||
ymm0 = simde_mm256_packs_epi16(ymmRes0, ymmRes1);
|
||||
// We need to saturate -128 to -127
|
||||
// ymm0 = simde_mm256_max_epi8(ymm0, *p_minLLR); // 128 in epi8 is -127
|
||||
// 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 = simde_mm256_permute4x64_epi64(ymm0, 0xD8);
|
||||
p_llrRes++;
|
||||
}
|
||||
// Now we do BN processing to compute the values for CN processing
|
||||
// Loop over remaining connected CNs for that BN
|
||||
p_addrEdgeInCnBuffer -= numEdgesPerBn[c];
|
||||
p_cshift -= numEdgesPerBn[c];
|
||||
|
||||
for (r = 0; r < numEdgesPerBn[c]; r++)
|
||||
{
|
||||
// p_cnProcBufRes256 = (__m256i*)&cnShifted[r*384];
|
||||
p_cnProcBuf256 = (__m256i*)&cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
// p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
p_llrRes = (__m256i*) &llrRes[c*Z];
|
||||
|
||||
remShift = *p_cshift;
|
||||
remShift32 = (remShift)&31;
|
||||
M1 = (remShift)>>5;
|
||||
p_cnProcBufRes256 = (__m256i*)&cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
for (i=0; i<(M-M1-1); i++)
|
||||
{
|
||||
// load first 32 LLR values from unaligned memory
|
||||
// ymm0 = _mm256_srli_si2x256[remShift32](p_llrRes[M1+i],p_llrRes[M1+i+1]);
|
||||
|
||||
ymm0 = _mm256_srli_si2x256_loadu((int8_t*)&p_llrRes[M1+i],remShift32);
|
||||
// ymm0 = _mm256_srliv_si2x256(p_llrRes[M1+i],p_llrRes[M1+i+1],remShift32);
|
||||
*p_cnProcBuf256++ = simde_mm256_subs_epi8(ymm0, *p_cnProcBufRes256++);
|
||||
}
|
||||
// Wrap around
|
||||
p_tmp256[0] = p_llrRes[M-1];
|
||||
p_tmp256[1] = p_llrRes[0];
|
||||
ymm0 = _mm256_srli_si2x256_loadu((int8_t*)p_tmp256,remShift32);
|
||||
|
||||
// ymm0 = _mm256_srli_si2x256[remShift32](p_llrRes[M-1],p_llrRes[0]);
|
||||
// ymm0 = _mm256_srliv_si2x256(p_llrRes[M-1],p_llrRes[0],remShift32);
|
||||
*p_cnProcBuf256++ = simde_mm256_subs_epi8(ymm0, *p_cnProcBufRes256++);
|
||||
|
||||
// First half
|
||||
for (i=0; i<M1; i++)
|
||||
{
|
||||
// ymm0 = _mm256_srli_si2x256[remShift32](p_llrRes[i],p_llrRes[i+1]);
|
||||
ymm0 = _mm256_srli_si2x256_loadu((int8_t*)&p_llrRes[i],remShift32);
|
||||
// ymm0 = _mm256_srliv_si2x256(p_llrRes[i],p_llrRes[i+1],remShift32);
|
||||
*p_cnProcBuf256++ = simde_mm256_subs_epi8(ymm0, *p_cnProcBufRes256++);
|
||||
}
|
||||
|
||||
|
||||
// Loop over BNs
|
||||
// for (i=0; i<M; i++)
|
||||
// {
|
||||
// // TODO: is it perhaps better to subtract from the 16bit LLRs?
|
||||
// p_llrResTmp256[i] = simde_mm256_subs_epi8(*p_llrRes, *p_cnProcBufRes256);
|
||||
|
||||
// p_cnProcBufRes256++;
|
||||
// p_llrRes++;
|
||||
// }
|
||||
// nrLDPC_circ_memcpy((int8_t*)p_cnProcBuf256,(int8_t*)p_llrResTmp256,Z,*p_cshift);
|
||||
|
||||
// if (test[0] != ((int8_t*)p_cnProcBuf256)[1])
|
||||
// {
|
||||
// printf('Problem c = %d, r = %d\n',c,r);
|
||||
// }
|
||||
|
||||
// p_procTmp256 = (__m256i*)&procTmp[0];
|
||||
// p_cnProcBufRes128 = (__m128i*)&cnShifted[r*384];
|
||||
// p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
// p_cnProcBuf256 = (__m256i*)&cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
|
||||
// for (i = 0,j=0; i < M; i++,j+=2)
|
||||
// {
|
||||
// ymm0 = p_llrResTmp256[j];
|
||||
// ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j]);
|
||||
|
||||
// ymmRes0 = simde_mm256_subs_epi16(ymm0,ymm1);
|
||||
|
||||
// ymm0 = p_llrResTmp256[j+1];
|
||||
// ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j+1]);
|
||||
|
||||
// ymmRes1 = simde_mm256_subs_epi16(ymm0,ymm1);
|
||||
|
||||
// ymm0 = simde_mm256_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_procTmp256 = simde_mm256_permute4x64_epi64(ymm0, 0xD8);
|
||||
// p_procTmp256++;
|
||||
// }
|
||||
|
||||
// nrLDPC_circ_memcpy(p_cnProcBuf256,&procTmp[0],Z,*p_cshift);
|
||||
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
p_cshift++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now the parity bits
|
||||
// Init with input LLR, memcpy is ok since we are only summing 2 values
|
||||
|
||||
const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0];
|
||||
|
||||
uint32_t colG1 = startColParity*Z;
|
||||
memcpy(&llrRes[colG1], &llr[colG1], numBn2CnG1*Z);
|
||||
p_llrRes = (__m256i*) &llrRes[colG1];
|
||||
|
||||
for (c = startColParity; c < numColBg; c++)
|
||||
{
|
||||
// Set pointer to start of edge
|
||||
p_cnProcBufRes256 = (__m256i*) &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
*p_llrRes = simde_mm256_adds_epi8(*p_llrRes,*p_cnProcBufRes256);
|
||||
|
||||
p_cnProcBufRes256++;
|
||||
p_llrRes++;
|
||||
}
|
||||
|
||||
// Copy results in processing buffer
|
||||
p_cnProcBuf = &cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
memcpy(p_cnProcBuf,&llr[c*Z],Z);
|
||||
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Performs first part of BN processing on the CN results 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.
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param Z Lifting size
|
||||
*/
|
||||
static inline void nrLDPC_bnProcPcOpt2(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, int8_t* llr, int8_t* llrRes, uint16_t Z, uint8_t BG)
|
||||
{
|
||||
const uint32_t* p_addrEdgeInCnBuffer = p_lut->addrEdgeInCnBuffer;
|
||||
const uint16_t* p_cshift = p_lut->cShift;
|
||||
|
||||
uint32_t startColParity;
|
||||
const uint8_t* numEdgesPerBn;
|
||||
uint8_t numColBg;
|
||||
if (BG == 1)
|
||||
{
|
||||
numEdgesPerBn = lut_numEdgesPerBn_BG1_R13;
|
||||
startColParity = NR_LDPC_START_COL_PARITY_BG1;
|
||||
numColBg = NR_LDPC_NCOL_BG1_R13;
|
||||
}
|
||||
else
|
||||
{
|
||||
numEdgesPerBn = lut_numEdgesPerBn_BG2_R15;
|
||||
startColParity = NR_LDPC_START_COL_PARITY_BG2;
|
||||
numColBg = NR_LDPC_NCOL_BG2_R15;
|
||||
}
|
||||
|
||||
int8_t* p_cnProcBufRes;
|
||||
int8_t* p_cnProcBuf;
|
||||
__m256i* p_llrRes = (__m256i*) llrRes;
|
||||
|
||||
|
||||
|
||||
__m256i* p_llrResTmp256;
|
||||
__m256i* p_cnProcBufRes256;
|
||||
__m256i* p_cnProcBuf256;
|
||||
__m128i* p_cnProcBufRes128;
|
||||
|
||||
|
||||
__m128i* p_llr128;
|
||||
|
||||
uint32_t c;
|
||||
uint32_t r;
|
||||
uint32_t i,j;
|
||||
uint16_t M;
|
||||
|
||||
// TODO no need for set to 0
|
||||
int16_t llrResTmp[384] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t cnShifted[30*384] __attribute__ ((aligned(64))) = {0};
|
||||
|
||||
__m256i ymm0,ymm1, ymmRes0, ymmRes1;
|
||||
|
||||
// Number of groups of 32 values in edge of length Z
|
||||
M = (Z + 31)>>5;
|
||||
|
||||
// Loop over BNs excluding parity BNs which can be processed way easier since they have no shift
|
||||
for (c = 0; c < startColParity; c++)
|
||||
{
|
||||
// First iteration for BN, sum input LLR with first connected CN
|
||||
// Account for shift in edge
|
||||
// Set pointer to start of edge
|
||||
p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
p_llrRes = (__m256i*) &llrRes[c*Z];
|
||||
// Shift
|
||||
nrLDPC_inv_circ_memcpy(&cnShifted[0],p_cnProcBufRes,Z,*p_cshift);
|
||||
|
||||
// Do the processing
|
||||
p_llr128 = (__m128i*)&llr[c*Z];
|
||||
p_cnProcBufRes128 = (__m128i*)&cnShifted[0];
|
||||
p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
for (i = 0,j=0; i < M; i++,j+=2)
|
||||
{
|
||||
// First 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_llr128[j]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j]);
|
||||
|
||||
p_llrResTmp256[j] = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_llr128[j+1]);
|
||||
ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j+1]);
|
||||
|
||||
p_llrResTmp256[j+1] = simde_mm256_adds_epi16(ymm0, ymm1);
|
||||
}
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
p_cshift++;
|
||||
// Loop over remaining connected CNs for that BN
|
||||
for (r = 1; r < numEdgesPerBn[c]; r++)
|
||||
{
|
||||
// Set pointer to start of edge
|
||||
p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
nrLDPC_inv_circ_memcpy(&cnShifted[r*384],p_cnProcBufRes,Z,*p_cshift);
|
||||
|
||||
p_cnProcBufRes128 = (__m128i*)&cnShifted[r*384];
|
||||
p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
for (i = 0,j=0; i < M; i++,j+=2)
|
||||
{
|
||||
// First 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j]);
|
||||
|
||||
p_llrResTmp256[j] = simde_mm256_adds_epi16(p_llrResTmp256[j], ymm0);
|
||||
|
||||
// Second 16 LLRs of first CN
|
||||
ymm0 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j+1]);
|
||||
|
||||
p_llrResTmp256[j+1] = simde_mm256_adds_epi16(p_llrResTmp256[j+1], ymm0);
|
||||
}
|
||||
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
p_cshift++;
|
||||
}
|
||||
// Sum is complete
|
||||
// saturate and move to LLR results
|
||||
p_llrResTmp256 = (__m256i*) &llrResTmp[0];
|
||||
for (i = 0,j=0; i < M; i++,j+=2)
|
||||
{
|
||||
ymmRes0 = p_llrResTmp256[j];
|
||||
ymmRes1 = p_llrResTmp256[j+1];
|
||||
// Pack results back to epi8
|
||||
ymm0 = simde_mm256_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 = simde_mm256_permute4x64_epi64(ymm0, 0xD8);
|
||||
p_llrRes++;
|
||||
}
|
||||
// Now we do BN processing to compute the values for CN processing
|
||||
// Loop over remaining connected CNs for that BN
|
||||
p_addrEdgeInCnBuffer -= numEdgesPerBn[c];
|
||||
p_cshift -= numEdgesPerBn[c];
|
||||
|
||||
for (r = 0; r < numEdgesPerBn[c]; r++)
|
||||
{
|
||||
p_cnProcBufRes256 = (__m256i*)&cnShifted[r*384];
|
||||
p_cnProcBuf256 = (__m256i*)&cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
p_llrRes = (__m256i*) &llrRes[c*Z];
|
||||
|
||||
// uint16_t cshift32 = *p_cshift&31;
|
||||
// uint16_t M2 = (*p_cshift)>>5;
|
||||
// uint16_t M1 = M - 1;
|
||||
|
||||
// // Loop over first half
|
||||
// for (i=(M2-1); i<M1; i++)
|
||||
// {
|
||||
// ymm0 = _mm256_srli_si2x256[cshift32](p_llrRes[i],p_llrRes[i+1]);
|
||||
// *p_cnProcBuf256 = simde_mm256_subs_epi8(ymm0, *p_cnProcBufRes256);
|
||||
// p_cnProcBufRes256++;
|
||||
// p_cnProcBuf256++;
|
||||
// }
|
||||
// // Wrap around
|
||||
// ymm0 = _mm256_srli_si2x256[cshift32](p_llrRes[M-1],p_llrRes[0]);
|
||||
// *p_cnProcBuf256 = simde_mm256_subs_epi8(ymm0, *p_cnProcBufRes256);
|
||||
// p_cnProcBufRes256++;
|
||||
// p_cnProcBuf256++;
|
||||
|
||||
// // Loop over second half
|
||||
// for (i=0; i<M2; i++)
|
||||
// {
|
||||
// ymm0 = _mm256_srli_si2x256[cshift32](p_llrRes[i],p_llrRes[i+1]);
|
||||
// *p_cnProcBuf256 = simde_mm256_subs_epi8(ymm0, *p_cnProcBufRes256);
|
||||
// p_cnProcBufRes256++;
|
||||
// p_cnProcBuf256++;
|
||||
// }
|
||||
|
||||
// // Loop over BNs
|
||||
for (i=0; i<M; i++)
|
||||
{
|
||||
// TODO: is it perhaps better to subtract from the 16bit LLRs?
|
||||
p_llrResTmp256[i] = simde_mm256_subs_epi8(*p_llrRes, *p_cnProcBufRes256);
|
||||
|
||||
p_cnProcBufRes256++;
|
||||
p_llrRes++;
|
||||
}
|
||||
// int8_t test[384] __attribute__ ((aligned(64))) = {0};
|
||||
// nrLDPC_circ_memcpy256(p_cnProcBuf256,p_llrResTmp256,Z,*p_cshift);
|
||||
// nrLDPC_circ_memcpy256_load(p_cnProcBuf256,p_llrResTmp256,Z,*p_cshift);
|
||||
nrLDPC_circ_memcpy((int8_t*)p_cnProcBuf256,(int8_t*)p_llrResTmp256,Z,*p_cshift);
|
||||
|
||||
// if (test[0] != ((int8_t*)p_cnProcBuf256)[1])
|
||||
// {
|
||||
// printf('Problem c = %d, r = %d\n',c,r);
|
||||
// }
|
||||
|
||||
// p_procTmp256 = (__m256i*)&procTmp[0];
|
||||
// p_cnProcBufRes128 = (__m128i*)&cnShifted[r*384];
|
||||
// p_llrResTmp256 = (__m256i*)&llrResTmp[0];
|
||||
// p_cnProcBuf256 = (__m256i*)&cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
|
||||
// for (i = 0,j=0; i < M; i++,j+=2)
|
||||
// {
|
||||
// ymm0 = p_llrResTmp256[j];
|
||||
// ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j]);
|
||||
|
||||
// ymmRes0 = simde_mm256_subs_epi16(ymm0,ymm1);
|
||||
|
||||
// ymm0 = p_llrResTmp256[j+1];
|
||||
// ymm1 = simde_mm256_cvtepi8_epi16(p_cnProcBufRes128[j+1]);
|
||||
|
||||
// ymmRes1 = simde_mm256_subs_epi16(ymm0,ymm1);
|
||||
|
||||
// ymm0 = simde_mm256_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_procTmp256 = simde_mm256_permute4x64_epi64(ymm0, 0xD8);
|
||||
// p_procTmp256++;
|
||||
// }
|
||||
|
||||
// nrLDPC_circ_memcpy(p_cnProcBuf256,&procTmp[0],Z,*p_cshift);
|
||||
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
p_cshift++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now the parity bits
|
||||
// Init with input LLR, memcpy is ok since we are only summing 2 values
|
||||
|
||||
const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0];
|
||||
|
||||
uint32_t colG1 = startColParity*Z;
|
||||
memcpy(&llrRes[colG1], &llr[colG1], numBn2CnG1*Z);
|
||||
p_llrRes = (__m256i*) &llrRes[colG1];
|
||||
|
||||
for (c = startColParity; c < numColBg; c++)
|
||||
{
|
||||
// Set pointer to start of edge
|
||||
p_cnProcBufRes256 = (__m256i*) &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
*p_llrRes = simde_mm256_adds_epi8(*p_llrRes,*p_cnProcBufRes256);
|
||||
|
||||
p_cnProcBufRes256++;
|
||||
p_llrRes++;
|
||||
}
|
||||
|
||||
// Copy results in processing buffer
|
||||
p_cnProcBuf = &cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
memcpy(p_cnProcBuf,&llr[c*Z],Z);
|
||||
|
||||
// Next edge
|
||||
p_addrEdgeInCnBuffer++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Performs first part of BN processing on the CN results 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.
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param Z Lifting size
|
||||
*/
|
||||
// static inline void nrLDPC_bnProcPcOpt(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, int8_t* llr, int8_t* llrRes, uint16_t Z, uint8_t BG)
|
||||
// {
|
||||
// const uint32_t* p_addrEdgeInCnBuffer = p_lut->addrEdgeInCnBuffer;
|
||||
// const uint16_t* p_cshift = p_lut->cShift;
|
||||
|
||||
// uint32_t startColParity;
|
||||
// uint8_t* numEdgesPerBn;
|
||||
// uint8_t numColBg;
|
||||
// if (BG == 1)
|
||||
// {
|
||||
// numEdgesPerBn = lut_numEdgesPerBn_BG1_R13;
|
||||
// startColParity = NR_LDPC_START_COL_PARITY_BG1;
|
||||
// numColBg = NR_LDPC_NCOL_BG1_R13;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// numEdgesPerBn = lut_numEdgesPerBn_BG2_R15;
|
||||
// startColParity = NR_LDPC_START_COL_PARITY_BG2;
|
||||
// numColBg = NR_LDPC_NCOL_BG2_R15;
|
||||
// }
|
||||
|
||||
// int8_t* p_cnProcBufRes;
|
||||
// __m256i* p_llrRes = (__m256i*) llrRes;
|
||||
|
||||
// int8_t* p_llr;
|
||||
// int16_t* p_llrResTmp;
|
||||
// __m256i* p_llrResTmp256;
|
||||
// __m256i* p_cnProcBufRes256;
|
||||
// __m128i* p_cnProcBufRes128;
|
||||
// __m128i* p_llrRes128;
|
||||
|
||||
// uint32_t c;
|
||||
// uint32_t r;
|
||||
// uint32_t i,j;
|
||||
// uint16_t M;
|
||||
// uint16_t relAddr;
|
||||
// int16_t llrResTmp[384] __attribute__ ((aligned(64))) = {0};
|
||||
// __m256i ymm0,ymm1, ymmRes0, ymmRes1;
|
||||
|
||||
// // Number of groups of 32 values in edge of length Z
|
||||
// M = (Z + 31)>>5;
|
||||
|
||||
// // Loop over BNs excluding parity BNs which can be processed way easier since they have no shift
|
||||
// for (c = 0; c < startColParity; c++)
|
||||
// {
|
||||
// // Init with input LLR, cannot do memcpy since we need 16bit for the summation
|
||||
// p_llr = &llr[c*Z];
|
||||
// for (i = 0; i < Z; i++)
|
||||
// {
|
||||
// llrResTmp[i] = (int16_t)(p_llr[i]);
|
||||
// }
|
||||
|
||||
// // Loop over all connected CNs for that BN
|
||||
// for (r = 0; r < numEdgesPerBn[c]; r++)
|
||||
// {
|
||||
// // Relative address in edge
|
||||
// relAddr = *p_cshift;
|
||||
// // Set pointer to start of edge
|
||||
// p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
// p_llrResTmp = &llrResTmp[relAddr];
|
||||
|
||||
// // Loop over first half of shifted buffer
|
||||
// for (i = 0; i < (Z-relAddr); i++)
|
||||
// {
|
||||
// // Add
|
||||
// *p_llrResTmp += *p_cnProcBufRes;
|
||||
|
||||
// p_cnProcBufRes++;
|
||||
// p_llrResTmp++;
|
||||
// }
|
||||
// // Second half
|
||||
// p_llrResTmp = &llrResTmp[0];
|
||||
// for (i = 0; i < relAddr; i++)
|
||||
// {
|
||||
// // Add
|
||||
// *p_llrResTmp += *p_cnProcBufRes;
|
||||
|
||||
// p_cnProcBufRes++;
|
||||
// p_llrResTmp++;
|
||||
// }
|
||||
|
||||
// // Next edge
|
||||
// p_addrEdgeInCnBuffer++;
|
||||
// p_cshift++;
|
||||
// }
|
||||
// // Sum is complete
|
||||
// // saturate and move to LLR results
|
||||
// p_llrResTmp256 = (__m256i*) &llrResTmp[0];
|
||||
// for (i = 0,j=0; i < M; i++,j+=2)
|
||||
// {
|
||||
// ymmRes0 = p_llrResTmp256[j];
|
||||
// ymmRes1 = p_llrResTmp256[j+1];
|
||||
// // Pack results back to epi8
|
||||
// ymm0 = simde_mm256_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 = simde_mm256_permute4x64_epi64(ymm0, 0xD8);
|
||||
// p_llrRes++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Now the parity bits
|
||||
// // Init with input LLR, memcpy is ok since we are only summing 2 values
|
||||
|
||||
// const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0];
|
||||
|
||||
// uint32_t colG1 = startColParity*Z;
|
||||
// memcpy(&llrRes[colG1], &llr[colG1], numBn2CnG1*Z);
|
||||
|
||||
// for (c = startColParity; c < numColBg; c++)
|
||||
// {
|
||||
// // Set pointer to start of edge
|
||||
// p_cnProcBufRes256 = (__m256i*) &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
|
||||
// for (i = 0; i < M; i++)
|
||||
// {
|
||||
// *p_llrRes = simde_mm256_adds_epi8(*p_llrRes,*p_cnProcBufRes256);
|
||||
|
||||
// p_cnProcBufRes256++;
|
||||
// p_llrRes++;
|
||||
// }
|
||||
// // Next edge
|
||||
// p_addrEdgeInCnBuffer++;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
/**
|
||||
\brief Performs first part of BN processing on the CN results 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.
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param Z Lifting size
|
||||
*/
|
||||
// static inline void nrLDPC_bnProcOpt(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, int8_t* llr, int8_t* llrRes, uint16_t Z, uint8_t BG)
|
||||
// {
|
||||
// const uint32_t* p_addrEdgeInCnBuffer = p_lut->addrEdgeInCnBuffer;
|
||||
// const uint16_t* p_cshift = p_lut->cShift;
|
||||
|
||||
// uint32_t startColParity;
|
||||
// uint8_t* numEdgesPerBn;
|
||||
// uint8_t numColBg;
|
||||
// if (BG == 1)
|
||||
// {
|
||||
// numEdgesPerBn = lut_numEdgesPerBn_BG1_R13;
|
||||
// startColParity = NR_LDPC_START_COL_PARITY_BG1;
|
||||
// numColBg = NR_LDPC_NCOL_BG1_R13;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// numEdgesPerBn = lut_numEdgesPerBn_BG2_R15;
|
||||
// startColParity = NR_LDPC_START_COL_PARITY_BG2;
|
||||
// numColBg = NR_LDPC_NCOL_BG2_R15;
|
||||
// }
|
||||
|
||||
// int8_t* p_cnProcBufRes;
|
||||
// int8_t* p_cnProcBuf;
|
||||
// int8_t* p_llrRes;
|
||||
// int16_t* p_resTmp;
|
||||
// __m256i* p_resTmp256;
|
||||
// __m256i* p_cnProcBuf256;
|
||||
|
||||
// uint32_t c;
|
||||
// uint32_t r;
|
||||
// uint32_t i,j;
|
||||
// uint16_t M;
|
||||
// uint16_t relAddr;
|
||||
// int16_t resTmp[384] __attribute__ ((aligned(64))) = {0};
|
||||
// __m256i ymm0, ymm1, ymmRes0,ymmRes1;
|
||||
|
||||
// // Number of groups of 32 values in edge of length Z
|
||||
// M = (Z + 31)>>5;
|
||||
|
||||
// // Loop over BNs excluding parity BNs which can be processed way easier since they have no shift
|
||||
// for (c = 0; c < startColParity; c++)
|
||||
// {
|
||||
// // Init with input LLR, cannot do memcpy since we need 16bit for the summation
|
||||
// // p_llrRes = &llrRes[c*Z];
|
||||
// // for (i = 0; i < Z; i++)
|
||||
// // {
|
||||
// // resTmp[i] = (int16_t)(p_llrRes[i]);
|
||||
// // }
|
||||
|
||||
// // Loop over all connected CNs for that BN
|
||||
// for (r = 0; r < numEdgesPerBn[c]; r++)
|
||||
// {
|
||||
// memset(&resTmp[0],0,384*sizeof(int16_t));
|
||||
// // Relative address in edge
|
||||
// relAddr = *p_cshift;
|
||||
// // Set pointer to start of edge
|
||||
// p_cnProcBufRes = &cnProcBufRes[*p_addrEdgeInCnBuffer];
|
||||
// p_resTmp = &resTmp [0];
|
||||
// p_llrRes = &llrRes [c*Z + relAddr];
|
||||
|
||||
// // Loop over first half of shifted buffer
|
||||
// for (i = 0; i < (Z-relAddr); i++)
|
||||
// {
|
||||
// // Subtract
|
||||
// *p_resTmp = (int16_t) (*p_llrRes - *p_cnProcBufRes);
|
||||
// // *p_cnProcBuf = *p_llrRes - *p_cnProcBufRes;
|
||||
|
||||
// // ((int8_t*)&ymm0)[0] = *p_llrRes;
|
||||
// // ((int8_t*)&ymm1)[0] = *p_cnProcBufRes;
|
||||
// // ymmRes = simde_mm256_subs_epi8(ymm0, ymm1);
|
||||
// // *p_cnProcBuf = ((int8_t*)&ymmRes)[0];
|
||||
|
||||
// p_cnProcBufRes++;
|
||||
// // p_cnProcBuf++;
|
||||
// p_resTmp++;
|
||||
// p_llrRes++;
|
||||
// }
|
||||
// // Second half
|
||||
// // p_resTmp = &resTmp[0];
|
||||
// p_llrRes = &llrRes[c*Z];
|
||||
// for (i = 0; i < relAddr; i++)
|
||||
// {
|
||||
// // Subtract
|
||||
// *p_resTmp = (int16_t) (*p_llrRes - *p_cnProcBufRes);
|
||||
// // *p_cnProcBuf = *p_llrRes - *p_cnProcBufRes;
|
||||
// // *p_resTmp -= *p_cnProcBufRes;
|
||||
|
||||
// // ((int8_t*)&ymm0)[0] = *p_llrRes;
|
||||
// // ((int8_t*)&ymm1)[0] = *p_cnProcBufRes;
|
||||
// // ymmRes = simde_mm256_subs_epi8(ymm0, ymm1);
|
||||
// // *p_cnProcBuf = ((int8_t*)&ymmRes)[0];
|
||||
|
||||
// p_cnProcBufRes++;
|
||||
// // p_cnProcBuf++;
|
||||
// p_resTmp++;
|
||||
// p_llrRes++;
|
||||
// }
|
||||
|
||||
// // Sum is complete
|
||||
// // saturate and move to LLR results
|
||||
// p_resTmp256 = (__m256i*) &resTmp[0];
|
||||
// p_cnProcBuf256 = (__m256i*) &cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
// for (i = 0,j=0; i < M; i++,j+=2)
|
||||
// {
|
||||
// ymmRes0 = p_resTmp256[j];
|
||||
// ymmRes1 = p_resTmp256[j+1];
|
||||
// // Pack results back to epi8
|
||||
// ymm0 = simde_mm256_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_cnProcBuf256 = simde_mm256_permute4x64_epi64(ymm0, 0xD8);
|
||||
// p_cnProcBuf256++;
|
||||
// }
|
||||
|
||||
// // Next edge
|
||||
// p_addrEdgeInCnBuffer++;
|
||||
// p_cshift++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Now the parity bits
|
||||
// // The results are just the input LLRs
|
||||
|
||||
// for (c = startColParity; c < numColBg; c++)
|
||||
// {
|
||||
// p_cnProcBuf = &cnProcBuf[*p_addrEdgeInCnBuffer];
|
||||
// memcpy(p_cnProcBuf,&llr[c*Z],Z);
|
||||
// // memset(p_cnProcBuf,1,Z);
|
||||
// // Next edge
|
||||
// p_addrEdgeInCnBuffer++;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
/**
|
||||
\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.
|
||||
@@ -2818,4 +3731,4 @@ static inline void nrLDPC_llr2bitPacked(int8_t* out, int8_t* llrOut, uint16_t nu
|
||||
*p_bits = bitsTmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -371,21 +371,12 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Performs CN processing for BG1 on the CN processing buffer and stores the results in the CN processing results buffer.
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param Z Lifting size
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Performs CN processing for BG1 on the CN processing buffer and stores the results in the CN processing results buffer.
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param Z Lifting size
|
||||
*/
|
||||
static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z)
|
||||
static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z, t_nrLDPC_time_stats* p_profiler)
|
||||
{
|
||||
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
|
||||
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
|
||||
@@ -414,7 +405,9 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
|
||||
// =====================================================================
|
||||
// Process group with 3 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng3);
|
||||
#endif
|
||||
if (lut_numCnInCnGroups[0] > 0)
|
||||
{
|
||||
// Number of groups of 32 CNs for parallel processing
|
||||
@@ -455,10 +448,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng3);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 4 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng4);
|
||||
#endif
|
||||
// Offset is 5*384/32 = 60
|
||||
const uint8_t lut_idxCnProcG4[4][3] = {{60,120,180}, {0,120,180}, {0,60,180}, {0,60,120}};
|
||||
|
||||
@@ -504,10 +501,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng4);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 5 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng5);
|
||||
#endif
|
||||
// Offset is 18*384/32 = 216
|
||||
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}};
|
||||
@@ -554,10 +555,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng5);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 6 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng6);
|
||||
#endif
|
||||
// Offset is 8*384/32 = 96
|
||||
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},
|
||||
@@ -605,10 +610,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng6);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 7 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng7);
|
||||
#endif
|
||||
// Offset is 5*384/32 = 60
|
||||
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},
|
||||
@@ -657,10 +666,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng7);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 8 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng8);
|
||||
#endif
|
||||
// Offset is 2*384/32 = 24
|
||||
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},
|
||||
@@ -709,10 +722,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng8);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 9 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng9);
|
||||
#endif
|
||||
// Offset is 2*384/32 = 24
|
||||
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},
|
||||
@@ -762,10 +779,14 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng9);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 10 BNs
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng10);
|
||||
#endif
|
||||
// Offset is 1*384/32 = 12
|
||||
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},
|
||||
@@ -815,27 +836,33 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng10);
|
||||
#endif
|
||||
// =====================================================================
|
||||
// Process group with 19 BNs
|
||||
|
||||
// Offset is 4*384/32 = 12
|
||||
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}};
|
||||
|
||||
// Process group with 19 BNs NEW
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcCng19);
|
||||
#endif
|
||||
if (lut_numCnInCnGroups[8] > 0)
|
||||
{
|
||||
uint32_t N = lut_numCnInCnGroups[8]*Z;
|
||||
|
||||
// Allocate buffer for 1-min, 2-min and sign
|
||||
int8_t min1[N] __attribute__ ((aligned(64)));
|
||||
int8_t min2[N] __attribute__ ((aligned(64)));
|
||||
int8_t sign[N] __attribute__ ((aligned(64)));
|
||||
|
||||
__m256i* p_cn;
|
||||
__m256i* p_min1 = (__m256i*) min1;
|
||||
__m256i* p_min2 = (__m256i*) min2;
|
||||
__m256i* p_sign = (__m256i*) sign;
|
||||
__m256i min1mask,min2mask;
|
||||
__m256i zeros = simde_mm256_setzero_si256();
|
||||
|
||||
// Number of groups of 32 CNs for parallel processing
|
||||
// Ceil for values not divisible by 32
|
||||
M = (lut_numCnInCnGroups[8]*Z + 31)>>5;
|
||||
M = (N + 31)>>5;
|
||||
|
||||
// Set the offset to each bit within a group in terms of 32 Byte
|
||||
bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>5;
|
||||
@@ -844,36 +871,191 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int
|
||||
p_cnProcBuf = (__m256i*) &cnProcBuf [lut_startAddrCnGroups[8]];
|
||||
p_cnProcBufRes = (__m256i*) &cnProcBufRes[lut_startAddrCnGroups[8]];
|
||||
|
||||
// Compute the 2 min values + sign
|
||||
// Init
|
||||
memcpy(p_min1,p_cnProcBuf,N);
|
||||
memcpy(p_min2,&p_cnProcBuf[bitOffsetInGroup],N);
|
||||
memset(p_sign,1,N);
|
||||
|
||||
p_cn = (__m256i*)&p_cnProcBuf[bitOffsetInGroup];
|
||||
|
||||
for (i=0; i<M; i++)
|
||||
{
|
||||
// sign
|
||||
// only change sign if values are not 0
|
||||
*p_sign = simde_mm256_sign_epi8(*p_sign, simde_mm256_blendv_epi8(*p_min1,*p_ones,simde_mm256_cmpeq_epi8(*p_min1,zeros)));
|
||||
*p_sign = simde_mm256_sign_epi8(*p_sign, simde_mm256_blendv_epi8(*p_min2,*p_ones,simde_mm256_cmpeq_epi8(*p_min2,zeros)));
|
||||
// *p_sign = simde_mm256_sign_epi8(*p_sign, *p_cn);
|
||||
|
||||
// abs
|
||||
*p_min1 = simde_mm256_abs_epi8(*p_min1);
|
||||
*p_min2 = simde_mm256_abs_epi8(*p_min2);
|
||||
|
||||
// Here we exchange values in min1 and min2
|
||||
ymm0 = simde_mm256_abs_epi8(*p_cn);
|
||||
// m1mask = m1>m2;
|
||||
min1mask = simde_mm256_cmpgt_epi8(*p_min1, *p_min2);
|
||||
// m2(m1mask) = m1(m1mask);
|
||||
*p_min2 = simde_mm256_blendv_epi8(*p_min2, *p_min1, min1mask);
|
||||
// m1 = min(m1,s2);
|
||||
*p_min1 = simde_mm256_min_epu8(*p_min1,ymm0);
|
||||
|
||||
p_min1++;
|
||||
p_min2++;
|
||||
p_sign++;
|
||||
p_cn++;
|
||||
}
|
||||
p_min1 -= M;
|
||||
p_min2 -= M;
|
||||
p_sign -= M;
|
||||
p_cn = (__m256i*)&p_cnProcBuf[2*bitOffsetInGroup];
|
||||
|
||||
// Loop over every BN
|
||||
for (j=2; j<19; j++)
|
||||
{
|
||||
for (i=0;i<M;i++)
|
||||
{
|
||||
ymm0 = simde_mm256_abs_epi8(*p_cn);
|
||||
// m1mask = m1>sl;
|
||||
min1mask = simde_mm256_cmpgt_epi8(*p_min1, ymm0);
|
||||
// m2(m1mask) = m1(m1mask);
|
||||
*p_min2 = simde_mm256_blendv_epi8(*p_min2, *p_min1, min1mask);
|
||||
// m1 = min(m1,sl);
|
||||
*p_min1 = simde_mm256_min_epu8(*p_min1,ymm0);
|
||||
|
||||
|
||||
// m2mask = (m2 > sl);
|
||||
min2mask = simde_mm256_cmpgt_epi8(*p_min2, ymm0);
|
||||
// m2mask = xor(m2mask,m1mask);
|
||||
min2mask = simde_mm256_xor_si256(min2mask,min1mask);
|
||||
// m2(m2mask) = sl(m2mask);
|
||||
*p_min2 = simde_mm256_blendv_epi8(*p_min2, ymm0, min2mask);
|
||||
|
||||
// sign
|
||||
*p_sign = simde_mm256_sign_epi8(*p_sign, simde_mm256_blendv_epi8(*p_cn,*p_ones,simde_mm256_cmpeq_epi8(*p_cn,zeros)));
|
||||
// *p_sign = simde_mm256_sign_epi8(*p_sign, *p_cn);
|
||||
|
||||
// _mm256_print_epu8(*p_min1);
|
||||
// _mm256_print_epu8(*p_min2);
|
||||
p_min1++;
|
||||
p_min2++;
|
||||
p_sign++;
|
||||
p_cn++;
|
||||
}
|
||||
p_min1 -= M;
|
||||
p_min2 -= M;
|
||||
p_sign -= M;
|
||||
}
|
||||
|
||||
// Now compute the metric
|
||||
p_min1 = (__m256i*) min1;
|
||||
p_min2 = (__m256i*) min2;
|
||||
p_sign = (__m256i*) sign;
|
||||
|
||||
// Loop over every BN
|
||||
for (j=0; j<19; j++)
|
||||
{
|
||||
// Set of results pointer to correct BN address
|
||||
p_cnProcBufResBit = p_cnProcBufRes + (j*bitOffsetInGroup);
|
||||
p_cn = p_cnProcBuf + (j*bitOffsetInGroup);
|
||||
|
||||
// Loop over CNs
|
||||
for (i=0; i<M; i++)
|
||||
{
|
||||
// Abs and sign of 32 CNs (first BN)
|
||||
ymm0 = p_cnProcBuf[lut_idxCnProcG19[j][0] + i];
|
||||
sgn = simde_mm256_sign_epi8(*p_ones, ymm0);
|
||||
min = simde_mm256_abs_epi8(ymm0);
|
||||
// Current values
|
||||
ymm0 = simde_mm256_abs_epi8(*p_cn);
|
||||
// Set min to 1-min
|
||||
min = *p_min1;
|
||||
// Check if current values are equal to 1-min
|
||||
min1mask = simde_mm256_cmpeq_epi8(ymm0,*p_min1);
|
||||
// When equal set min to 2-min
|
||||
min = simde_mm256_blendv_epi8(min, *p_min2, min1mask);
|
||||
|
||||
// Loop over BNs
|
||||
for (k=1; k<18; k++)
|
||||
{
|
||||
ymm0 = p_cnProcBuf[lut_idxCnProcG19[j][k] + i];
|
||||
min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
|
||||
sgn = simde_mm256_sign_epi8(sgn, ymm0);
|
||||
}
|
||||
// Update sign
|
||||
sgn = simde_mm256_sign_epi8(*p_sign, simde_mm256_blendv_epi8(*p_cn,*p_ones,simde_mm256_cmpeq_epi8(*p_cn,zeros)));
|
||||
// sgn = simde_mm256_sign_epi8(*p_sign, *p_cn);
|
||||
|
||||
// Store result
|
||||
min = simde_mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
|
||||
*p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
|
||||
p_cnProcBufResBit++;
|
||||
p_cn++;
|
||||
p_min1++;
|
||||
p_min2++;
|
||||
p_sign++;
|
||||
}
|
||||
p_min1 -= M;
|
||||
p_min2 -= M;
|
||||
p_sign -= M;
|
||||
}
|
||||
}
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcCng19);
|
||||
#endif
|
||||
|
||||
// =====================================================================
|
||||
// Process group with 19 BNs
|
||||
|
||||
// #ifdef NR_LDPC_PROFILER_DETAIL
|
||||
// start_meas(&p_profiler->cnProcCng19);
|
||||
// #endif
|
||||
// // Offset is 4*384/32 = 12
|
||||
// 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 32 CNs for parallel processing
|
||||
// // Ceil for values not divisible by 32
|
||||
// M = (lut_numCnInCnGroups[8]*Z + 31)>>5;
|
||||
|
||||
// // Set the offset to each bit within a group in terms of 32 Byte
|
||||
// bitOffsetInGroup = (lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX)>>5;
|
||||
|
||||
// // Set pointers to start of group 19
|
||||
// p_cnProcBuf = (__m256i*) &cnProcBuf [lut_startAddrCnGroups[8]];
|
||||
// p_cnProcBufRes = (__m256i*) &cnProcBufRes[lut_startAddrCnGroups[8]];
|
||||
|
||||
// // 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<M; i++)
|
||||
// {
|
||||
// // Abs and sign of 32 CNs (first BN)
|
||||
// ymm0 = p_cnProcBuf[lut_idxCnProcG19[j][0] + i];
|
||||
// sgn = simde_mm256_sign_epi8(*p_ones, ymm0);
|
||||
// min = simde_mm256_abs_epi8(ymm0);
|
||||
|
||||
// // Loop over BNs
|
||||
// for (k=1; k<18; k++)
|
||||
// {
|
||||
// ymm0 = p_cnProcBuf[lut_idxCnProcG19[j][k] + i];
|
||||
// min = simde_mm256_min_epu8(min, simde_mm256_abs_epi8(ymm0));
|
||||
// sgn = simde_mm256_sign_epi8(sgn, ymm0);
|
||||
// }
|
||||
|
||||
// // Store result
|
||||
// min = simde_mm256_min_epu8(min, *p_maxLLR); // 128 in epi8 is -127
|
||||
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
|
||||
// p_cnProcBufResBit++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// #ifdef NR_LDPC_PROFILER_DETAIL
|
||||
// stop_meas(&p_profiler->cnProcCng19);
|
||||
// #endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,14 +33,15 @@
|
||||
#include "nrLDPC_mPass.h"
|
||||
#include "nrLDPC_cnProc.h"
|
||||
#include "nrLDPC_bnProc.h"
|
||||
#define UNROLL_CN_PROC 1
|
||||
#define UNROLL_BN_PROC 1
|
||||
#define UNROLL_BN_PROC_PC 1
|
||||
#define UNROLL_BN2CN_PROC 1
|
||||
#include "nrLDPC_intrinsics.h"
|
||||
// #define UNROLL_CN_PROC 1
|
||||
// #define UNROLL_BN_PROC 1
|
||||
// #define UNROLL_BN_PROC_PC 1
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
| cn processing files -->AVX512
|
||||
/----------------------------------------------------------------------*/
|
||||
|
||||
#ifdef UNROLL_CN_PROC
|
||||
//BG1-------------------------------------------------------------------
|
||||
#if defined(__AVX512BW__)
|
||||
|
||||
@@ -68,11 +69,11 @@
|
||||
#include "cnProc/nrLDPC_cnProc_BG2_R23_AVX2.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------
|
||||
| bn Processing files -->AVX2
|
||||
/----------------------------------------------------------------------*/
|
||||
|
||||
#ifdef UNROLL_BN_PROC_PC
|
||||
//bnProcPc-------------------------------------------------------------
|
||||
//BG1------------------------------------------------------------------
|
||||
#include "bnProcPc/nrLDPC_bnProcPc_BG1_R13_AVX2.h"
|
||||
@@ -83,8 +84,10 @@
|
||||
#include "bnProcPc/nrLDPC_bnProcPc_BG2_R13_AVX2.h"
|
||||
#include "bnProcPc/nrLDPC_bnProcPc_BG2_R23_AVX2.h"
|
||||
|
||||
//bnProc----------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
//bnProc----------------------------------------------------------------
|
||||
#ifdef UNROLL_BN_PROC
|
||||
#if defined(__AVX512BW__)
|
||||
//BG1-------------------------------------------------------------------
|
||||
#include "bnProc_avx512/nrLDPC_bnProc_BG1_R13_AVX512.h"
|
||||
@@ -105,13 +108,13 @@
|
||||
#include "bnProc/nrLDPC_bnProc_BG2_R23_AVX2.h"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define NR_LDPC_ENABLE_PARITY_CHECK
|
||||
// #define NR_LDPC_ENABLE_PARITY_CHECK
|
||||
//#define NR_LDPC_PROFILER_DETAIL
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
@@ -120,8 +123,7 @@
|
||||
|
||||
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler);
|
||||
int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type);
|
||||
void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out) {
|
||||
}
|
||||
void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out);
|
||||
int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_time_stats* p_profiler)
|
||||
{
|
||||
uint32_t numLLR;
|
||||
@@ -130,7 +132,13 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_
|
||||
t_nrLDPC_lut* p_lut = &lut;
|
||||
|
||||
// Initialize decoder core(s) with correct LUTs
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->ldpcInit);
|
||||
#endif
|
||||
numLLR = nrLDPC_init(p_decParams, p_lut);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->ldpcInit);
|
||||
#endif
|
||||
|
||||
// Launch LDPC decoder core for one segment
|
||||
numIter = nrLDPC_decoder_core(p_llr, p_out, numLLR, p_lut, p_decParams, p_profiler);
|
||||
@@ -144,26 +152,33 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_
|
||||
\param p_out Output vector
|
||||
\param numLLR Number of LLRs
|
||||
\param p_lut Pointer to decoder LUTs
|
||||
\param p_decParamsnrLDPC decoder parameters
|
||||
\param p_profilernrLDPC profiler statistics
|
||||
\param p_decParams decoder parameters
|
||||
\param p_profiler profiler statistics
|
||||
*/
|
||||
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler)
|
||||
{
|
||||
uint16_t Z = p_decParams->Z;
|
||||
uint8_t BG = p_decParams->BG;
|
||||
uint8_t R = p_decParams->R; //Decoding rate: Format 15,13,... for code rates 1/5, 1/3,... */
|
||||
#if(defined UNROLL_CN_PROC || defined UNROLL_BN_PROC || defined UNROLL_BN_PROC_PC)
|
||||
uint8_t R = p_decParams->R; //Decoding rate: Format 15,13,... for code rates 1/5, 1/3,... */
|
||||
#endif
|
||||
uint8_t numMaxIter = p_decParams->numMaxIter;
|
||||
e_nrLDPC_outMode outMode = p_decParams->outMode;
|
||||
// int8_t* cnProcBuf= cnProcBuf;
|
||||
// int8_t* cnProcBufRes= cnProcBufRes;
|
||||
|
||||
int8_t cnProcBuf[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t cnProcBufRes[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t bnProcBuf[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t bnProcBufRes[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
// Allocate LDPC processing buffers on stack
|
||||
// Note, input buffers p_llr, p_out are probably allocated on heap
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->ldpcMemAlloc);
|
||||
#endif
|
||||
int8_t procBuf[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t procBufRes[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrRes[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
// int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(64))) = {0};
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->ldpcMemAlloc);
|
||||
#endif
|
||||
|
||||
// Minimum number of iterations is 1
|
||||
// 0 iterations means hard-decision on input LLRs
|
||||
uint32_t i = 1;
|
||||
@@ -186,28 +201,34 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llr2llrProcBuf);
|
||||
#endif
|
||||
nrLDPC_llr2llrProcBuf(p_lut, p_llr, llrProcBuf, Z, BG);
|
||||
// nrLDPC_llr2llrProcBuf(p_lut, p_llr, llrProcBuf, Z, BG);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llr2llrProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC, llrProcBuf);
|
||||
#endif
|
||||
// #ifdef NR_LDPC_DEBUG_MODE
|
||||
// nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC);
|
||||
// nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC, llrProcBuf);
|
||||
// #endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llr2CnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_llr2CnProcBuf_BG1(p_lut, p_llr, cnProcBuf, Z);
|
||||
else nrLDPC_llr2CnProcBuf_BG2(p_lut, p_llr, cnProcBuf, Z);
|
||||
if (BG == 1)
|
||||
{
|
||||
nrLDPC_llr2CnProcBuf_BG1(p_lut, p_llr, procBuf, Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
nrLDPC_llr2CnProcBuf_BG2(p_lut, p_llr, procBuf, Z);
|
||||
}
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llr2CnProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, procBuf);
|
||||
#endif
|
||||
|
||||
// First iteration
|
||||
@@ -216,18 +237,19 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProc);
|
||||
#endif
|
||||
if (BG==1) {
|
||||
if (BG==1)
|
||||
{
|
||||
#ifndef UNROLL_CN_PROC
|
||||
nrLDPC_cnProc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1(p_lut, procBuf, procBufRes, Z, p_profiler);
|
||||
#else
|
||||
switch (R)
|
||||
{
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG1_R13_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R13_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG1_R13_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R13_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +257,9 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG1_R23_AVX512(cnProcBuf,cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R23_AVX512(procBuf,procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG1_R23_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R23_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -245,44 +267,46 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
case 89:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG1_R89_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R89_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG1_R89_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R89_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef UNROLL_CN_PROC
|
||||
nrLDPC_cnProc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2(p_lut, procBuf, procBufRes, Z);
|
||||
#else
|
||||
switch (R) {
|
||||
case 15:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG2_R15_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R15_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG2_R15_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R15_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG2_R13_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R13_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG2_R13_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R13_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG2_R23_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R23_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG2_R23_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R23_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -296,21 +320,27 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC_RES);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, cnProcBufRes);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, procBufRes);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cn2bnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_cn2bnProcBuf_BG1(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
else nrLDPC_cn2bnProcBuf_BG2(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
// if (BG == 1)
|
||||
// {
|
||||
// nrLDPC_cn2bnProcBuf_BG1(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nrLDPC_cn2bnProcBuf_BG2(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cn2bnProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, bnProcBuf);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, procBuf);
|
||||
#endif
|
||||
|
||||
// BN processing
|
||||
@@ -318,25 +348,29 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
start_meas(&p_profiler->bnProcPc);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef UNROLL_BN_PROC_PC
|
||||
nrLDPC_bnProcPc(p_lut, bnProcBuf, bnProcBufRes, llrProcBuf, llrRes, Z);
|
||||
// nrLDPC_bnProcPc(p_lut, procBuf, procBufRes, llrProcBuf, llrRes, Z);
|
||||
//nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
|
||||
// nrLDPC_bnProcPcOpt(p_lut, procBuf, procBufRes, p_llr, llrRes, Z,BG);
|
||||
nrLDPC_bnProcPcOpt3(p_lut, procBuf, procBufRes, p_llr, llrRes, Z, BG);
|
||||
// nrLDPC_llr2llrProcBuf(p_lut, llrRes, p_llrOut, Z, BG);
|
||||
// memcpy(llrRes,p_llrOut,NR_LDPC_MAX_NUM_LLR*sizeof(int8_t));
|
||||
#else
|
||||
if (BG==1) {
|
||||
switch (R) {
|
||||
case 13:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG1_R13_AVX2(bnProcBuf,bnProcBufRes,llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG1_R13_AVX2(procBuf,procBufRes,llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG1_R23_AVX2(bnProcBuf,bnProcBufRes, llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG1_R23_AVX2(procBuf,procBufRes, llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 89:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG1_R89_AVX2(bnProcBuf,bnProcBufRes, llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG1_R89_AVX2(procBuf,procBufRes, llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -344,18 +378,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
switch (R) {
|
||||
case 15:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG2_R15_AVX2(bnProcBuf,bnProcBufRes, llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG2_R15_AVX2(procBuf,procBufRes, llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG2_R13_AVX2(bnProcBuf,bnProcBufRes,llrRes,llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG2_R13_AVX2(procBuf,procBufRes,llrRes,llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
|
||||
case 23:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG2_R23_AVX2(bnProcBuf,bnProcBufRes,llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG2_R23_AVX2(procBuf,procBufRes,llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -375,60 +409,60 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
start_meas(&p_profiler->bnProc);
|
||||
#endif
|
||||
|
||||
if (BG==1) {
|
||||
#ifndef UNROLL_BN_PROC
|
||||
nrLDPC_bnProc(p_lut, bnProcBuf, bnProcBufRes, llrRes, Z);
|
||||
// nrLDPC_bnProc(p_lut, procBuf, procBufRes, llrRes, Z);
|
||||
// nrLDPC_bnProcOpt(p_lut, procBuf, procBufRes, p_llr, llrRes, Z, BG);
|
||||
#else
|
||||
if (BG==1)
|
||||
{
|
||||
switch (R) {
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG1_R13_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R13_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG1_R13_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R13_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG1_R23_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R23_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG1_R23_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R23_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 89:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG1_R89_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R89_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG1_R89_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R89_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#ifndef UNROLL_BN2CN_PROC
|
||||
nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (R) {
|
||||
case 15:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG2_R15_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R15_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG2_R15_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R15_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG2_R13_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R13_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG2_R13_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R13_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -436,15 +470,15 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG2_R23_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R23_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG2_R23_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R23_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bnProc);
|
||||
@@ -452,26 +486,33 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC_RES);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, bnProcBufRes);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, procBufRes);
|
||||
#endif
|
||||
|
||||
// BN results to CN processing buffer
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_bn2cnProcBuf_BG1(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
else nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
// if (BG == 1)
|
||||
// {
|
||||
// nrLDPC_bn2cnProcBuf_BG1(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nrLDPC_bn2cnProcBuf_BG2(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, procBuf);
|
||||
#endif
|
||||
|
||||
// Parity Check not necessary here since it will fail
|
||||
// because first 2 cols/BNs in BG are punctured and cannot be
|
||||
// estimated after only one iteration
|
||||
// Another CN processing is necessary in order for the PC to pass
|
||||
|
||||
// First iteration finished
|
||||
|
||||
@@ -483,69 +524,72 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProc);
|
||||
#endif
|
||||
if (BG==1) {
|
||||
if (BG==1)
|
||||
{
|
||||
#ifndef UNROLL_CN_PROC
|
||||
nrLDPC_cnProc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1(p_lut, procBuf, procBufRes, Z, p_profiler);
|
||||
#else
|
||||
switch (R) {
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG1_R13_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R13_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG1_R13_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R13_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG1_R23_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R23_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG1_R23_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R23_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 89:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG1_R89_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R89_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG1_R89_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG1_R89_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef UNROLL_CN_PROC
|
||||
nrLDPC_cnProc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2(p_lut, procBuf, procBufRes, Z);
|
||||
#else
|
||||
switch (R) {
|
||||
case 15:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG2_R15_AVX512(cnProcBuf,cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R15_AVX512(procBuf,procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG2_R15_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R15_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG2_R13_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R13_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG2_R13_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R13_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_cnProc_BG2_R23_AVX512(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R23_AVX512(procBuf, procBufRes, Z);
|
||||
#else
|
||||
nrLDPC_cnProc_BG2_R23_AVX2(cnProcBuf, cnProcBufRes, Z);
|
||||
nrLDPC_cnProc_BG2_R23_AVX2(procBuf, procBufRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -557,21 +601,28 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, cnProcBufRes);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, procBufRes);
|
||||
#endif
|
||||
|
||||
|
||||
// Send CN results back to BNs
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cn2bnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_cn2bnProcBuf_BG1(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
else nrLDPC_cn2bnProcBuf_BG2(p_lut, cnProcBufRes, bnProcBuf, Z);
|
||||
// if (BG == 1)
|
||||
// {
|
||||
// nrLDPC_cn2bnProcBuf_BG1(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nrLDPC_cn2bnProcBuf_BG2(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cn2bnProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, bnProcBuf);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, procBuf);
|
||||
#endif
|
||||
|
||||
// BN Processing
|
||||
@@ -580,23 +631,27 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
#endif
|
||||
|
||||
#ifndef UNROLL_BN_PROC_PC
|
||||
nrLDPC_bnProcPc(p_lut, bnProcBuf, bnProcBufRes, llrProcBuf, llrRes, Z);
|
||||
//nrLDPC_bnProcPc(p_lut, procBuf, procBufRes, llrProcBuf, llrRes, Z);
|
||||
// nrLDPC_bnProcPcOpt(p_lut, procBuf, procBufRes, p_llr, llrRes, Z, BG);
|
||||
nrLDPC_bnProcPcOpt3(p_lut, procBuf, procBufRes, p_llr, llrRes, Z, BG);
|
||||
// nrLDPC_llr2llrProcBuf(p_lut, llrRes, p_llrOut, Z, BG);
|
||||
// memcpy(llrRes,p_llrOut,NR_LDPC_MAX_NUM_LLR*sizeof(int8_t));
|
||||
#else
|
||||
if (BG==1) {
|
||||
switch (R) {
|
||||
case 13:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG1_R13_AVX2(bnProcBuf,bnProcBufRes,llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG1_R13_AVX2(procBuf,procBufRes,llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG1_R23_AVX2(bnProcBuf,bnProcBufRes, llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG1_R23_AVX2(procBuf,procBufRes, llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 89:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG1_R89_AVX2(bnProcBuf,bnProcBufRes, llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG1_R89_AVX2(procBuf,procBufRes, llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -605,17 +660,17 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
{
|
||||
case 15:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG2_R15_AVX2(bnProcBuf,bnProcBufRes,llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG2_R15_AVX2(procBuf,procBufRes,llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG2_R13_AVX2(bnProcBuf,bnProcBufRes,llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG2_R13_AVX2(procBuf,procBufRes,llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
nrLDPC_bnProcPc_BG2_R23_AVX2(bnProcBuf,bnProcBufRes,llrRes, llrProcBuf, Z);
|
||||
nrLDPC_bnProcPc_BG2_R23_AVX2(procBuf,procBufRes,llrRes, llrProcBuf, Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -633,34 +688,35 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
start_meas(&p_profiler->bnProc);
|
||||
#endif
|
||||
#ifndef UNROLL_BN_PROC
|
||||
nrLDPC_bnProc(p_lut, bnProcBuf, bnProcBufRes, llrRes, Z);
|
||||
//nrLDPC_bnProc(p_lut, procBuf, procBufRes, llrRes, Z);
|
||||
// nrLDPC_bnProcOpt(p_lut, procBuf, procBufRes, p_llr, llrRes, Z, BG);
|
||||
#else
|
||||
if (BG==1) {
|
||||
switch (R) {
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG1_R13_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R13_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG1_R13_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R13_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG1_R23_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R23_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG1_R23_AVX2(bnProcBuf,bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R23_AVX2(procBuf,procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 89:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG1_R89_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R89_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG1_R89_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG1_R89_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -671,27 +727,27 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
case 15:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG2_R15_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R15_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG2_R15_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R15_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG2_R13_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R13_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG2_R13_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R13_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
#if defined(__AVX512BW__)
|
||||
nrLDPC_bnProc_BG2_R23_AVX512(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R23_AVX512(procBuf, procBufRes,llrRes, Z);
|
||||
#else
|
||||
nrLDPC_bnProc_BG2_R23_AVX2(bnProcBuf, bnProcBufRes,llrRes, Z);
|
||||
nrLDPC_bnProc_BG2_R23_AVX2(procBuf, procBufRes,llrRes, Z);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -699,28 +755,12 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bnProc);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, bnProcBufRes);
|
||||
#endif
|
||||
|
||||
// BN results to CN processing buffer
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
if (BG == 1) nrLDPC_bn2cnProcBuf_BG1(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
else nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, procBufRes);
|
||||
#endif
|
||||
|
||||
// Parity Check
|
||||
@@ -728,21 +768,61 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->cnProcPc);
|
||||
#endif
|
||||
if (BG == 1) pcRes = nrLDPC_cnProcPc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
else pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
|
||||
if (BG == 1)
|
||||
{
|
||||
pcRes = nrLDPC_cnProcPc_BG1(p_lut, procBuf, procBufRes, Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
pcRes = nrLDPC_cnProcPc_BG2(p_lut, procBuf, procBufRes, Z);
|
||||
}
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->cnProcPc);
|
||||
#endif
|
||||
// Exit Loop if parity check passes
|
||||
if (pcRes == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// BN results to CN processing buffer
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
// if (BG == 1)
|
||||
// {
|
||||
// nrLDPC_bn2cnProcBuf_BG1(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// nrLDPC_bn2cnProcBuf_BG2(p_lut, procBufRes, procBuf, Z);
|
||||
// }
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->bn2cnProcBuf);
|
||||
#endif
|
||||
|
||||
#ifdef NR_LDPC_DEBUG_MODE
|
||||
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, procBuf);
|
||||
#endif
|
||||
|
||||
} // end while
|
||||
|
||||
// Last iteration
|
||||
if (pcRes != 0) i++;
|
||||
// All iterations finished
|
||||
if (pcRes != 0)
|
||||
{
|
||||
// If PC still failed increase iteration counter to indicate that PC failed since i = numIterMax+1
|
||||
// Note that if NR_LDPC_ENABLE_PARITY_CHECK, we do not do PC after the last iteration. Hence
|
||||
// it is possible that the PC passes in the last iteration. Computing the PC would require another
|
||||
// cnProc + cnProcPc which take time that we don't have :)
|
||||
i++;
|
||||
}
|
||||
// Assign results from processing buffer to output
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
start_meas(&p_profiler->llrRes2llrOut);
|
||||
#endif
|
||||
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
|
||||
// nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
|
||||
p_llrOut = llrRes;
|
||||
#ifdef NR_LDPC_PROFILER_DETAIL
|
||||
stop_meas(&p_profiler->llrRes2llrOut);
|
||||
#endif
|
||||
|
||||
@@ -62,6 +62,9 @@ static inline uint32_t nrLDPC_init(t_nrLDPC_dec_params* p_decParams, t_nrLDPC_lu
|
||||
p_lut->posBnInCnProcBuf[7] = NULL;
|
||||
p_lut->posBnInCnProcBuf[8] = NULL;
|
||||
|
||||
p_lut->addrEdgeInCnBuffer = (const uint32_t*) addrEdgeInCnBuffer_BG2_Z128;
|
||||
p_lut->cShift = (const uint16_t*) cShift_BG2_Z128;
|
||||
|
||||
// LUT that only depend on R
|
||||
if (R == 15)
|
||||
{
|
||||
@@ -855,6 +858,9 @@ static inline uint32_t nrLDPC_init(t_nrLDPC_dec_params* p_decParams, t_nrLDPC_lu
|
||||
p_lut->posBnInCnProcBuf[7] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG10;
|
||||
p_lut->posBnInCnProcBuf[8] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG19;
|
||||
|
||||
p_lut->addrEdgeInCnBuffer = (const uint32_t*) addrEdgeInCnBuffer_BG1_Z384;
|
||||
p_lut->cShift = (const uint16_t*) cShift_BG1_Z384;
|
||||
|
||||
// LUT that only depend on R
|
||||
if (R == 13)
|
||||
{
|
||||
|
||||
411
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_intrinsics.h
Normal file
411
openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_intrinsics.h
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*!\file nrLDPC_intrinsics.h
|
||||
* \brief Defines the new intrinsics for efficient processing
|
||||
* \author Sebastian Wagner (EURECOM) Email: <mailto:sebastian.wagner@eurecom.fr>
|
||||
* \date 21-02-2023
|
||||
* \version 1.0
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef __NR_LDPC_INTRINSICS__H__
|
||||
#define __NR_LDPC_INTRINSICS__H__
|
||||
#include "PHY/sse_intrin.h"
|
||||
|
||||
// Shift mask, first 16 entries shift left, second 16 entries shift right
|
||||
static const int8_t shiftmask256_epi8[33][32] __attribute__ ((aligned(32))) = {
|
||||
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
|
||||
{-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14, -1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14},
|
||||
{-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13, -1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13},
|
||||
{-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12, -1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12},
|
||||
{-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11, -1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11},
|
||||
{-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10, -1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10},
|
||||
{-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9, -1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9},
|
||||
{-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8, -1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7, -1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6, -1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0},
|
||||
|
||||
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
|
||||
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,-1, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,-1},
|
||||
{2,3,4,5,6,7,8,9,10,11,12,13,14,15,-1,-1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,-1,-1},
|
||||
{3,4,5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1, 3,4,5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1},
|
||||
{4,5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1, 4,5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1},
|
||||
{5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1, 5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1},
|
||||
{6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1, 6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1},
|
||||
{7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1, 7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1},
|
||||
{8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1, 8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}};
|
||||
|
||||
|
||||
// variable left left and right shift
|
||||
static inline __m256i simde_mm256_sliv_si256(__m256i a, uint8_t shift)
|
||||
{
|
||||
return simde_mm256_shuffle_epi8(a,*(__m256i*)&shiftmask256_epi8[shift]);
|
||||
}
|
||||
|
||||
// right shift of concatinated vectors a and b, shift = 0,...,31
|
||||
static inline __m256i _mm256_srliv_si2x256(__m256i a, __m256i b, uint8_t shift)
|
||||
{
|
||||
if (shift == 0)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
else if(shift > 16)
|
||||
{
|
||||
// Shift is > 16
|
||||
__m256i a0 = simde_mm256_sliv_si256(a,shift);
|
||||
__m256i b0 = simde_mm256_sliv_si256(b,shift);
|
||||
__m256i b1 = simde_mm256_sliv_si256(b,32-shift);
|
||||
__m256i c0 = simde_mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return simde_mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
else
|
||||
{
|
||||
__m256i a0 = simde_mm256_sliv_si256(a,shift+16);
|
||||
__m256i b0 = simde_mm256_sliv_si256(b,16-shift);
|
||||
__m256i a1 = simde_mm256_sliv_si256(a,16-shift);
|
||||
__m256i c0 = simde_mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return simde_mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
}
|
||||
|
||||
static inline __m256i _mm256_srli_si2x256_loadu(int8_t* a, uint8_t shift)
|
||||
{
|
||||
return simde_mm256_loadu_si256((__m256i*)&(a[shift]));
|
||||
}
|
||||
|
||||
static inline __m256i _mm256_srli_0_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
// return a;
|
||||
return _mm256_permute2x128_si256(a,b,0x10);
|
||||
}
|
||||
|
||||
static inline __m256i _mm256_srli_1_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,1);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-1);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-1);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_2_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,2);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-2);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-2);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_3_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,3);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-3);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-3);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_4_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,4);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-4);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-4);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_5_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,5);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-5);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-5);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_6_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,6);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-6);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-6);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_7_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,7);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-7);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-7);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_8_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,8);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-8);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-8);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
/**
|
||||
\brief Performs right shift of concatinated vectors a and b by 9 bytes
|
||||
\param a first input vector
|
||||
\param Z second input vector
|
||||
*/
|
||||
static inline __m256i _mm256_srli_9_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,9);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-9);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-9);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_10_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,10);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-10);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-10);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_11_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,11);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-11);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-11);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_12_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,12);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-12);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-12);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_13_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,13);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-13);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-13);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_14_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,14);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-14);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-14);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_15_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,15);
|
||||
__m256i b0 = _mm256_slli_si256(b,16-15);
|
||||
__m256i a1 = _mm256_slli_si256(a,16-15);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a1,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,a0);
|
||||
}
|
||||
static inline __m256i _mm256_srli_16_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
return _mm256_permute2x128_si256(a,b,0x21);
|
||||
}
|
||||
|
||||
// Shifts larger than 16 bytes
|
||||
static inline __m256i _mm256_srli_17_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,17-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,17-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-17);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_18_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,18-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,18-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-18);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_19_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,19-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,19-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-19);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
/**
|
||||
\brief Performs right shift of concatinated vectors a and b by 20 bytes
|
||||
\param a first input vector
|
||||
\param Z second input vector
|
||||
*/
|
||||
static inline __m256i _mm256_srli_20_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,20-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,20-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-20);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_21_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,21-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,21-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-21);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_22_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,22-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,22-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-22);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_23_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,23-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,23-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-23);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_24_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,24-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,24-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-24);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_25_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,25-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,25-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-25);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_26_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,26-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,26-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-26);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_27_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,27-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,27-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-27);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_28_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,28-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,28-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-28);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_29_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,29-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,29-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-29);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_30_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,30-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,30-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-30);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
static inline __m256i _mm256_srli_31_si2x256(__m256i a, __m256i b)
|
||||
{
|
||||
__m256i a0 = _mm256_srli_si256(a,31-16);
|
||||
__m256i b0 = _mm256_srli_si256(b,31-16);
|
||||
__m256i b1 = _mm256_slli_si256(b,32-31);
|
||||
__m256i c0 = _mm256_permute2x128_si256(a0,b0,0x21);
|
||||
return _mm256_adds_epi8(c0,b1);
|
||||
}
|
||||
|
||||
typedef __m256i (*t_nrLDPC_mm256_srli_si2x256)(__m256i, __m256i);
|
||||
|
||||
static const t_nrLDPC_mm256_srli_si2x256 _mm256_srli_si2x256[32] =
|
||||
{
|
||||
_mm256_srli_0_si2x256,
|
||||
_mm256_srli_1_si2x256,
|
||||
_mm256_srli_2_si2x256,
|
||||
_mm256_srli_3_si2x256,
|
||||
_mm256_srli_4_si2x256,
|
||||
_mm256_srli_5_si2x256,
|
||||
_mm256_srli_6_si2x256,
|
||||
_mm256_srli_7_si2x256,
|
||||
_mm256_srli_8_si2x256,
|
||||
_mm256_srli_9_si2x256,
|
||||
_mm256_srli_10_si2x256,
|
||||
_mm256_srli_11_si2x256,
|
||||
_mm256_srli_12_si2x256,
|
||||
_mm256_srli_13_si2x256,
|
||||
_mm256_srli_14_si2x256,
|
||||
_mm256_srli_15_si2x256,
|
||||
_mm256_srli_16_si2x256,
|
||||
_mm256_srli_17_si2x256,
|
||||
_mm256_srli_18_si2x256,
|
||||
_mm256_srli_19_si2x256,
|
||||
_mm256_srli_20_si2x256,
|
||||
_mm256_srli_21_si2x256,
|
||||
_mm256_srli_22_si2x256,
|
||||
_mm256_srli_23_si2x256,
|
||||
_mm256_srli_24_si2x256,
|
||||
_mm256_srli_25_si2x256,
|
||||
_mm256_srli_26_si2x256,
|
||||
_mm256_srli_27_si2x256,
|
||||
_mm256_srli_28_si2x256,
|
||||
_mm256_srli_29_si2x256,
|
||||
_mm256_srli_30_si2x256,
|
||||
_mm256_srli_31_si2x256
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1001,4 +1001,12 @@ static const uint8_t posBnInCnProcBuf_BG2_CNG6[6][3] = {{0, 0, 1},{1, 5, 5},{5,
|
||||
static const uint8_t posBnInCnProcBuf_BG2_CNG8[8][2] = {{0, 0},{1, 1},{2, 3},{3, 4},{6, 8},{9, 10},{10, 12},{11, 13}};
|
||||
static const uint8_t posBnInCnProcBuf_BG2_CNG10[10][2] = {{0, 1},{3, 2},{4, 4},{5, 5},{6, 6},{7, 7},{8, 8},{9, 9},{11, 10},{12, 13}};
|
||||
|
||||
// New LUT
|
||||
static const uint32_t addrEdgeInCnBuffer_BG2_Z128[197] = {61824, 67968, 61952, 6912, 54912, 55040, 7040, 37760, 37888, 38016, 7296, 7424, 7552, 7808, 7936, 128, 256, 384, 8320, 8576, 8832, 9088, 62592, 62720, 68096, 14592, 56064, 55168, 14720, 37632, 41216, 7168, 41472, 38144, 38272, 38400, 15232, 7680, 0, 8064, 8192, 512, 8704, 8960, 9344, 63360, 68864, 2304, 15744, 38528, 15872, 38656, 8448, 16512, 9216, 64128, 68736, 63488, 14848, 15616, 69504, 64256, 69632, 15360, 2688, 70272, 70400, 57216, 56192, 56320, 41856, 23296, 2432, 23552, 42112, 16000, 16384, 16640, 17024, 64896, 71040, 71168, 44672, 41600, 15104, 2560, 71808, 71936, 58368, 57344, 57472, 48128, 41344, 22784, 41984, 45568, 16128, 24192, 16768, 72576, 65024, 72704, 41088, 44928, 15488, 65664, 73344, 73472, 58496, 44800, 41728, 23424, 49024, 66432, 65792, 74240, 44544, 14976, 22912, 23808, 640, 16896, 67200, 74112, 22272, 59520, 59648, 58624, 48000, 22528, 45056, 22656, 45184, 45312, 23040, 24064, 24320, 24704, 74880, 66560, 22400, 48640, 48768, 45440, 23680, 16256, 24448, 67328, 75008, 59776, 48256, 48384, 48512, 23168, 48896, 2816, 23936, 2944, 24576, 29952, 60672, 60800, 60928, 30080, 51456, 51584, 51712, 30208, 51840, 51968, 30336, 52096, 52224, 30464, 30592, 30720, 30848, 4608, 30976, 31104, 4736, 52352, 4864, 31232, 4992, 52480, 5120, 31360, 31488, 31616, 31744, 31872, 5248, 32000, 32128, 32256, 32384};
|
||||
//static const uint16_t cShift_BG2_Z128[159] = {9, 39, 81, 51, 103, 27, 14, 11, 11, 83, 51, 92, 87, 76, 23, 100, 8, 18, 114, 19, 12, 111, 117, 114, 8, 86, 41, 1, 94, 75, 57, 63, 2, 115, 75, 126, 20, 26, 94, 46, 98, 106, 57, 31, 1, 76, 58, 63, 11, 29, 101, 71, 4, 38, 0, 26, 38, 44, 111, 107, 125, 52, 30, 105, 28, 125, 104, 66, 100, 19, 124, 110, 28, 7, 112, 44, 40, 66, 101, 61, 98, 81, 0, 17, 66, 23, 28, 54, 31, 45, 12, 117, 108, 50, 15, 9, 36, 26, 44, 96, 112, 18, 77, 38, 42, 77, 124, 0, 28, 82, 14, 8, 84, 0, 1, 0, 61, 47, 57, 107, 91, 75, 0, 0, 71, 103, 30, 3, 119, 14, 3, 85, 8, 114, 29, 63, 38, 118, 0, 0, 102, 114, 64, 32, 38, 85, 34, 0, 0, 116, 56, 94, 104, 82, 122, 1, 36, 23, 120};
|
||||
static const uint16_t cShift_BG2_Z128[197] = {9, 39, 81, 51, 103, 27, 14, 11, 11, 83, 51, 92, 87, 76, 23, 100, 8, 18, 114, 19, 12, 111, 117, 114, 8, 86, 41, 1, 94, 75, 57, 63, 2, 115, 75, 126, 20, 26, 94, 46, 98, 106, 57, 31, 1, 76, 58, 63, 11, 29, 101, 71, 4, 38, 0, 26, 38, 44, 111, 107, 125, 52, 30, 105, 28, 125, 104, 66, 100, 19, 124, 110, 28, 7, 112, 44, 40, 66, 101, 61, 98, 81, 0, 17, 66, 23, 28, 54, 31, 45, 12, 117, 108, 50, 15, 9, 36, 26, 44, 96, 112, 18, 77, 38, 42, 77, 124, 0, 28, 82, 14, 8, 84, 0, 1, 0, 61, 47, 57, 107, 91, 75, 0, 0, 71, 103, 30, 3, 119, 14, 3, 85, 8, 114, 29, 63, 38, 118, 0, 0, 102, 114, 64, 32, 38, 85, 34, 0, 0, 116, 56, 94, 104, 82, 122, 1, 36, 23, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const uint32_t addrEdgeInCnBuffer_BG1_Z384[316] = {92160, 92544, 92928, 93312, 0, 75264, 81408, 61824, 88320, 81792, 75648, 62592, 43392, 62976, 63360, 44160, 44928, 45312, 8832, 46080, 9984, 10368, 11136, 11904, 12672, 13440, 13824, 1920, 2304, 15360, 93696, 94464, 94848, 384, 76032, 63744, 88704, 82560, 62208, 76416, 64512, 65280, 43776, 44544, 48000, 45696, 9216, 9600, 1152, 10752, 11520, 12288, 13056, 1536, 14208, 14592, 14976, 2688, 95232, 94080, 96000, 64128, 16128, 16896, 19200, 96768, 95616, 96384, 76800, 89088, 46464, 46848, 48384, 49152, 21120, 21504, 97152, 97536, 97920, 65664, 66048, 52224, 23808, 17280, 4224, 98304, 98688, 99072, 48768, 99840, 100608, 99456, 82176, 16512, 3072, 19968, 4608, 100224, 102144, 100992, 67584, 67968, 49536, 51072, 23424, 18432, 19584, 28032, 22272, 101760, 103680, 102528, 69504, 69888, 54144, 4992, 3840, 101376, 103296, 105216, 51456, 20736, 28416, 29184, 102912, 106752, 104064, 82944, 83328, 66432, 67200, 57216, 23040, 18048, 27648, 6528, 104448, 104832, 105600, 83712, 84096, 68352, 49920, 54528, 55296, 26112, 105984, 106368, 107136, 77568, 89472, 77184, 64896, 47616, 15744, 18816, 26880, 34560, 107520, 108288, 108672, 84480, 84864, 70272, 69120, 50688, 22656, 24960, 3456, 107904, 109824, 110208, 71424, 71808, 47232, 30336, 17664, 25728, 20352, 109056, 109440, 111360, 66816, 30720, 26496, 27264, 110592, 110976, 111744, 78336, 89856, 77952, 68736, 50304, 51840, 21888, 112512, 112896, 113280, 85248, 85632, 70656, 53376, 29568, 33408, 5760, 112128, 114432, 114816, 86016, 86400, 72192, 71040, 53760, 29952, 24576, 34176, 35328, 28800, 113664, 114048, 115968, 90240, 56832, 24192, 34944, 115200, 117504, 116352, 86784, 87168, 52608, 52992, 54912, 116736, 115584, 117888, 79104, 90624, 78720, 72576, 56448, 57984, 31104, 33024, 118272, 117120, 119424, 79872, 91008, 79488, 56064, 57600, 58368, 25344, 33792, 36096, 119808, 118656, 80256, 55680, 5376, 120192, 119040, 91392, 31872, 32640, 6144, 120576, 120960, 72960, 31488, 32256, 35712, 768, 80640, 87552, 73344, 91776, 87936, 73728, 81024, 74112, 58752, 74496, 74880, 59136, 59520, 59904, 60288, 60672, 61056, 36480, 36864, 61440, 37248, 37632, 6912, 38016, 38400, 38784, 39168, 39552, 39936, 40320, 40704, 41088, 7296, 41472, 41856, 7680, 42240, 8064, 42624, 43008, 8448};
|
||||
static const uint16_t cShift_BG1_Z384[316] = {307, 76, 205, 276, 332, 195, 278, 9, 307, 366, 48, 77, 313, 142, 241, 260, 145, 187, 30, 298, 71, 222, 159, 102, 230, 210, 185, 175, 113, 80, 19, 250, 87, 181, 14, 62, 179, 232, 101, 102, 186, 2, 13, 130, 213, 205, 24, 72, 194, 252, 100, 323, 320, 269, 258, 52, 113, 135, 50, 76, 328, 339, 89, 81, 8, 369, 73, 0, 115, 165, 177, 338, 206, 158, 93, 314, 288, 332, 275, 316, 274, 235, 76, 19, 14, 181, 144, 256, 102, 216, 161, 199, 257, 17, 194, 335, 149, 331, 267, 153, 333, 111, 266, 344, 383, 215, 148, 346, 78, 331, 160, 56, 290, 383, 242, 101, 37, 317, 178, 63, 264, 177, 139, 163, 288, 129, 132, 1, 321, 174, 210, 197, 61, 229, 289, 15, 109, 295, 305, 351, 133, 232, 57, 341, 339, 361, 17, 342, 231, 166, 18, 8, 248, 163, 11, 201, 2, 214, 357, 200, 341, 92, 57, 50, 318, 280, 233, 260, 82, 217, 88, 212, 114, 354, 303, 312, 5, 175, 313, 215, 99, 53, 137, 136, 202, 297, 106, 354, 304, 241, 39, 47, 89, 81, 328, 132, 114, 131, 300, 253, 303, 347, 358, 22, 312, 312, 242, 240, 271, 18, 63, 74, 55, 132, 27, 147, 21, 288, 114, 180, 331, 205, 224, 4, 244, 297, 330, 13, 39, 225, 82, 115, 289, 213, 346, 112, 357, 51, 368, 188, 12, 375, 97, 274, 105, 1, 0, 1, 157, 67, 334, 57, 59, 234, 258, 266, 274, 0, 0, 115, 370, 115, 0, 0, 170, 90, 287, 218, 0, 0, 269, 78, 256, 168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -848,13 +848,15 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
// For CN groups 3 to 6 no need to send the last BN back since it's single edge
|
||||
// and BN processing does not change the value already in the CN proc buf
|
||||
// The above is true if seperate buffers for BNs and CNs are used
|
||||
// However, with a common buffer we need to copy everything
|
||||
|
||||
// =====================================================================
|
||||
// CN group with 3 BNs
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[0]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<2; j++)
|
||||
for (j=0; j<3; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j*bitOffsetInGroup];
|
||||
for (i=0; i<lut_numCnInCnGroups[0]; i++)
|
||||
@@ -870,7 +872,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[1]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<3; j++)
|
||||
for (j=0; j<4; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[1] + j*bitOffsetInGroup];
|
||||
for (i=0; i<lut_numCnInCnGroups[1]; i++)
|
||||
@@ -886,7 +888,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[2]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<4; j++)
|
||||
for (j=0; j<5; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[2] + j*bitOffsetInGroup];
|
||||
for (i=0; i<lut_numCnInCnGroups[2]; i++)
|
||||
@@ -902,7 +904,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[3]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<5; j++)
|
||||
for (j=0; j<6; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[3] + j*bitOffsetInGroup];
|
||||
for (i=0; i<lut_numCnInCnGroups[3]; i++)
|
||||
@@ -995,13 +997,15 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
// For CN groups 3 to 19 no need to send the last BN back since it's single edge
|
||||
// and BN processing does not change the value already in the CN proc buf
|
||||
// The above is true if seperate buffers for BNs and CNs are used
|
||||
// However, with a common buffer we need to copy everything
|
||||
|
||||
// =====================================================================
|
||||
// CN group with 3 BNs
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0;j<2; j++)
|
||||
for (j=0;j<3; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j*bitOffsetInGroup];
|
||||
nrLDPC_circ_memcpy(p_cnProcBuf, &bnProcBufRes[lut_startAddrBnProcBuf_CNG3[j][0]], Z, lut_circShift_CNG3[j][0]);
|
||||
@@ -1012,7 +1016,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<3; j++)
|
||||
for (j=0; j<4; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[1] + j*bitOffsetInGroup];
|
||||
|
||||
@@ -1028,7 +1032,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<4; j++)
|
||||
for (j=0; j<5; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[2] + j*bitOffsetInGroup];
|
||||
|
||||
@@ -1045,7 +1049,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<5; j++)
|
||||
for (j=0; j<6; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[3] + j*bitOffsetInGroup];
|
||||
|
||||
@@ -1062,7 +1066,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<6; j++)
|
||||
for (j=0; j<7; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[4] + j*bitOffsetInGroup];
|
||||
|
||||
@@ -1080,7 +1084,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<7; j++)
|
||||
for (j=0; j<8; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[5] + j*bitOffsetInGroup];
|
||||
for (i=0; i<lut_numCnInCnGroups[5]; i++)
|
||||
@@ -1096,7 +1100,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<8; j++)
|
||||
for (j=0; j<9; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[6] + j*bitOffsetInGroup];
|
||||
|
||||
@@ -1113,7 +1117,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu
|
||||
|
||||
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX;
|
||||
|
||||
for (j=0; j<9; j++)
|
||||
for (j=0; j<10; j++)
|
||||
{
|
||||
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[7] + j*bitOffsetInGroup];
|
||||
|
||||
|
||||
@@ -86,14 +86,13 @@ void nrLDPC_bnProcPc_BG1_generator_AVX2(const char *dir, int R)
|
||||
fprintf(fd," __m128i* p_bnProcBuf; \n");
|
||||
fprintf(fd," __m128i* p_llrProcBuf;\n");
|
||||
fprintf(fd," __m256i* p_llrRes; \n");
|
||||
// fprintf(fd," __m256i* p_bnProcBufRes; \n");
|
||||
// fprintf(fd," __m256i* p_llrProcBuf256; \n");
|
||||
fprintf(fd," __m256i* p_bnProcBufRes; \n");
|
||||
fprintf(fd," __m256i* p_llrProcBuf256; \n");
|
||||
fprintf(fd," uint32_t M ;\n");
|
||||
|
||||
|
||||
fprintf(fd, "// Process group with 1 CNs \n");
|
||||
|
||||
/*
|
||||
// Process group with 1 CNs
|
||||
|
||||
// if (lut_numBnInBnGroups[0] > 0)
|
||||
@@ -109,9 +108,9 @@ void nrLDPC_bnProcPc_BG1_generator_AVX2(const char *dir, int R)
|
||||
|
||||
// Set pointers to start of group 2
|
||||
fprintf(fd," p_bnProcBuf = (__m128i*) &bnProcBuf [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
|
||||
// fprintf(fd," p_bnProcBufRes = (__m256i*) &bnProcBufRes [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
|
||||
fprintf(fd," p_bnProcBufRes = (__m256i*) &bnProcBufRes [%d];\n",lut_startAddrBnGroups[idxBnGroup]);
|
||||
fprintf(fd," p_llrProcBuf = (__m128i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]);
|
||||
// fprintf(fd," p_llrProcBuf256 = (__m256i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]);
|
||||
fprintf(fd," p_llrProcBuf256 = (__m256i*) &llrProcBuf [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]);
|
||||
fprintf(fd," p_llrRes = (__m256i*) &llrRes [%d];\n",lut_startAddrBnGroupsLlr[idxBnGroup]);
|
||||
|
||||
// Loop over BNs
|
||||
@@ -139,7 +138,7 @@ void nrLDPC_bnProcPc_BG1_generator_AVX2(const char *dir, int R)
|
||||
|
||||
fprintf(fd,"}\n");
|
||||
//}
|
||||
*/
|
||||
|
||||
// =====================================================================
|
||||
// Process group with 2 CNs
|
||||
|
||||
|
||||
@@ -86,13 +86,12 @@ void nrLDPC_bnProcPc_BG2_generator_AVX2(const char *dir, int R)
|
||||
fprintf(fd," __m128i* p_bnProcBuf; \n");
|
||||
fprintf(fd," __m128i* p_llrProcBuf;\n");
|
||||
fprintf(fd," __m256i* p_llrRes; \n");
|
||||
// fprintf(fd," __m256i* p_bnProcBufRes; \n");
|
||||
// fprintf(fd," __m256i* p_llrProcBuf256; \n");
|
||||
fprintf(fd," __m256i* p_bnProcBufRes; \n");
|
||||
fprintf(fd," __m256i* p_llrProcBuf256; \n");
|
||||
fprintf(fd," uint32_t M ;\n");
|
||||
|
||||
|
||||
fprintf(fd, "// Process group with 1 CNs \n");
|
||||
/*
|
||||
|
||||
// Process group with 1 CNs
|
||||
|
||||
@@ -139,7 +138,7 @@ void nrLDPC_bnProcPc_BG2_generator_AVX2(const char *dir, int R)
|
||||
|
||||
fprintf(fd,"}\n");
|
||||
//}
|
||||
*/ // =====================================================================
|
||||
// =====================================================================
|
||||
// Process group with 2 CNs
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ void nrLDPC_cnProc_BG2_generator_AVX2(const char* dir, int R)
|
||||
for (j=0; j<3; j++)
|
||||
{
|
||||
|
||||
fprintf(fd," for (int i=0;i<M;i+=2) {\n");
|
||||
fprintf(fd," for (int i=0;i<M;i++) {\n");
|
||||
// Abs and sign of 32 CNs (first BN)
|
||||
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
|
||||
fprintf(fd," ymm0 = ((__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]);
|
||||
@@ -121,14 +121,6 @@ void nrLDPC_cnProc_BG2_generator_AVX2(const char* dir, int R)
|
||||
// *p_cnProcBufResBit = simde_mm256_sign_epi8(min, sgn);
|
||||
// p_cnProcBufResBit++;
|
||||
fprintf(fd," ((__m256i*)cnProcBufRes)[%d+i] = simde_mm256_sign_epi8(min, sgn);\n",(lut_startAddrCnGroups[0]>>5)+(j*bitOffsetInGroup));
|
||||
|
||||
// Abs and sign of 32 CNs (first BN)
|
||||
// ymm0 = p_cnProcBuf[lut_idxCnProcG3[j][0] + i];
|
||||
fprintf(fd," ymm0 = ((__m256i*)cnProcBuf)[%d+i];\n",(lut_startAddrCnGroups[0]>>5)+lut_idxCnProcG3[j][0]+1);
|
||||
// sgn = simde_mm256_sign_epi8(ones, ymm0);
|
||||
fprintf(fd," sgn = simde_mm256_sign_epi8(ones, ymm0);\n");
|
||||
// min = simde_mm256_abs_epi8(ymm0);
|
||||
fprintf(fd," min = simde_mm256_abs_epi8(ymm0);\n");
|
||||
|
||||
fprintf(fd," }\n");
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ typedef struct nrLDPC_lut {
|
||||
const uint16_t* llr2llrProcBufAddr; /**< LUT for transferring input LLRs to LLR processing buffer */
|
||||
const uint8_t* llr2llrProcBufBnPos; /**< LUT BN position in BG */
|
||||
const uint8_t** posBnInCnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for llr2cnProcBuf */
|
||||
const uint32_t* addrEdgeInCnBuffer;
|
||||
const uint16_t* cShift;
|
||||
} t_nrLDPC_lut;
|
||||
|
||||
/**
|
||||
@@ -94,9 +96,20 @@ typedef struct nrLDPCoffload_params {
|
||||
*/
|
||||
#ifndef CODEGEN
|
||||
typedef struct nrLDPC_time_stats {
|
||||
time_stats_t ldpcInit; /**< Statistics for function nrLDPC_init */
|
||||
time_stats_t ldpcMemAlloc; /**< Statistics for LDPC memory allocation */
|
||||
time_stats_t llr2llrProcBuf; /**< Statistics for function llr2llrProcBuf */
|
||||
time_stats_t llr2CnProcBuf; /**< Statistics for function llr2CnProcBuf */
|
||||
time_stats_t cnProc; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng3; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng4; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng5; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng6; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng7; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng8; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng9; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng10; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcCng19; /**< Statistics for function cnProc */
|
||||
time_stats_t cnProcPc; /**< Statistics for function cnProcPc */
|
||||
time_stats_t bnProcPc; /**< Statistics for function bnProcPc */
|
||||
time_stats_t bnProc; /**< Statistics for function bnProc */
|
||||
|
||||
@@ -197,6 +197,7 @@ static const int8_t ones256_epi8[32] __attribute__ ((aligned(32))) = {1,1,1,1,1,
|
||||
static const int8_t zeros256_epi8[32] __attribute__ ((aligned(32))) = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
/** Vector of 32 '127' in int8 for application with AVX2 */
|
||||
static const int8_t maxLLR256_epi8[32] __attribute__ ((aligned(32))) = {127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127};
|
||||
static const int8_t minLLR256_epi8[32] __attribute__ ((aligned(32))) = {-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127};
|
||||
|
||||
/** Vector of 64 '1' in int8 for application with AVX512 */
|
||||
static const int8_t ones512_epi8[64] __attribute__ ((aligned(64))) = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
|
||||
|
||||
Reference in New Issue
Block a user