feat(nrLDPC_coding_segment_encoder): Dense Rate Matching and Dense and Concatenated Output
1. 3GPP Rate-matching/interleaving on 8-segment blocks, deinterleaving at output of multi-segment processing. 2. Bit-packing done in nrLDPC_coding_segment_encoder.c now instead of nr_scrambling. Interestingly, it improves performance significantly too. Tested for AVX512 only for now.
This commit is contained in:
committed by
Romain Beurdouche
parent
33078f9e3d
commit
bbbbda70f5
@@ -203,102 +203,8 @@ int LDPCencoder(uint8_t **input, uint8_t **output, encoder_implemparams_t *impp)
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if(impp->toutput != NULL) start_meas(impp->toutput);
|
||||
// information part and puncture columns
|
||||
/*
|
||||
memcpy(&output[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||
memcpy(&output[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||
*/
|
||||
#ifdef __AVX512F__
|
||||
|
||||
uint32_t l1 = (block_length-(2*Zc));
|
||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit);
|
||||
if ((((2*Zc)&63) == 0) && (((block_length-(2*Zc))&63) == 0)) {
|
||||
__m512i *c512p = (__m512i *)&cc[2*Zc];
|
||||
__m512i *d512p = (__m512i *)&dd[0];
|
||||
__m512i mask0 = _mm512_set1_epi8(0x1);
|
||||
|
||||
for (int i=0;i<l1>>6;i++)
|
||||
for (int j=macro_segment; j < macro_segment_end; j++)
|
||||
((__m512i *)output[j])[i] = _mm512_and_si512(_mm512_srai_epi16(c512p[i],j-macro_segment),mask0);
|
||||
for (int i1=0, i=l1>>6;i1<l2>>6;i1++,i++)
|
||||
for (int j=macro_segment; j < macro_segment_end; j++)
|
||||
((__m512i *)output[j])[i] = _mm512_and_si512(_mm512_srai_epi16(d512p[i1],j-macro_segment),mask0);
|
||||
}
|
||||
else if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
||||
uint32_t l1 = (block_length-(2*Zc))>>5;
|
||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
|
||||
simde__m256i *c256p = (simde__m256i *)&cc[2*Zc];
|
||||
simde__m256i *d256p = (simde__m256i *)&dd[0];
|
||||
// if (((block_length-(2*Zc))&31)>0) l1++;
|
||||
|
||||
for (int i=0;i<l1;i++)
|
||||
//for (j=0;j<n_segments;j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(c256p[i],j),masks[0]);
|
||||
for (int j=macro_segment; j < macro_segment_end; j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(c256p[i],j-macro_segment),masks[0]);
|
||||
|
||||
|
||||
// if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
|
||||
|
||||
for (int i1=0, i=l1;i1<l2;i1++,i++)
|
||||
//for (j=0;j<n_segments;j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(d256p[i1],j),masks[0]);
|
||||
for (int j=macro_segment; j < macro_segment_end; j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(d256p[i1],j-macro_segment),masks[0]);
|
||||
}
|
||||
#elif defined(__aarch64__)
|
||||
if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
||||
//AssertFatal(((2*Zc)&31) == 0,"2*Zc needs to be a multiple of 32 for now\n");
|
||||
//AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
|
||||
uint32_t l1 = (block_length-(2*Zc))>>4;
|
||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>4;
|
||||
simde__m128i *c128p = (simde__m128i *)&cc[2*Zc];
|
||||
simde__m128i *d128p = (simde__m128i *)&dd[0];
|
||||
// if (((block_length-(2*Zc))&31)>0) l1++;
|
||||
|
||||
for (int i=0;i<l1;i++)
|
||||
for (int j=macro_segment; j < macro_segment_end; j++) ((simde__m128i *)output[j])[i] = simde_mm_and_si128(simde_mm_srai_epi16(c128p[i],j-macro_segment),masks[0]);
|
||||
|
||||
|
||||
|
||||
for (int i1=0, i=l1;i1<l2;i1++,i++)
|
||||
for (int j=macro_segment; j < macro_segment_end; j++) ((simde__m128i *)output[j])[i] = simde_mm_and_si128(simde_mm_srai_epi16(d128p[i1],j-macro_segment),masks[0]);
|
||||
}
|
||||
#else
|
||||
if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
||||
//AssertFatal(((2*Zc)&31) == 0,"2*Zc needs to be a multiple of 32 for now\n");
|
||||
//AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
|
||||
uint32_t l1 = (block_length-(2*Zc))>>5;
|
||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
|
||||
simde__m256i *c256p = (simde__m256i *)&cc[2*Zc];
|
||||
simde__m256i *d256p = (simde__m256i *)&dd[0];
|
||||
// if (((block_length-(2*Zc))&31)>0) l1++;
|
||||
|
||||
for (int i=0;i<l1;i++)
|
||||
//for (j=0;j<n_segments;j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(c256p[i],j),masks[0]);
|
||||
for (int j=macro_segment; j < macro_segment_end; j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(c256p[i],j-macro_segment),masks[0]);
|
||||
|
||||
|
||||
// if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
|
||||
|
||||
for (int i1=0, i=l1;i1<l2;i1++,i++)
|
||||
//for (j=0;j<n_segments;j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(d256p[i1],j),masks[0]);
|
||||
for (int j=macro_segment; j < macro_segment_end; j++) ((simde__m256i *)output[j])[i] = simde_mm256_and_si256(simde_mm256_srai_epi16(d256p[i1],j-macro_segment),masks[0]);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
#ifdef DEBUG_LDPC
|
||||
LOG_W(PHY,"using non-optimized version\n");
|
||||
#endif
|
||||
// do non-SIMD version
|
||||
for (int i=0;i<(block_length-2*Zc);i++)
|
||||
//for (j=0; j<n_segments; j++)
|
||||
for (int j=macro_segment; j < macro_segment_end; j++)
|
||||
output[j][i] = (cc[2*Zc+i]>>(j-macro_segment))&1;
|
||||
for (int i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
|
||||
//for (j=0; j<n_segments; j++)
|
||||
for (int j=macro_segment; j < macro_segment_end; j++)
|
||||
output[j][block_length-2*Zc+i] = (dd[i]>>(j-macro_segment))&1;
|
||||
}
|
||||
|
||||
if(impp->toutput != NULL) stop_meas(impp->toutput);
|
||||
memcpy(output[0],&cc[2*Zc],(block_length-(2*Zc)));
|
||||
memcpy(output[0]+block_length-(2*Zc),dd,((nrows-no_punctured_columns) * Zc-removed_bit));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user