Optimised AVX512 LDPC decoder hard decision

This commit is contained in:
Xavier Arteaga 2021-04-14 19:43:29 +02:00 committed by Xavier Arteaga
parent 422d479852
commit 6c5e28bc19
3 changed files with 19 additions and 6 deletions

View File

@ -232,9 +232,7 @@ int extract_ldpc_message_c_avx512(void* p, uint8_t* message, uint16_t liftK)
int ini = 0;
for (int i = 0; i < liftK; i = i + vp->ls) {
for (int k = 0; k < vp->ls; k++) {
message[i + k] = (vp->soft_bits.c[ini + k] < 0);
}
fec_avx512_hard_decision_c(&vp->soft_bits.c[ini], &message[i], vp->ls);
ini = ini + SRSRAN_AVX512_B_SIZE;
}

View File

@ -292,9 +292,7 @@ int extract_ldpc_message_c_avx512long(void* p, uint8_t* message, uint16_t liftK)
int ini = 0;
for (int i = 0; i < liftK; i = i + vp->ls) {
for (int k = 0; k < vp->ls; k++) {
message[i + k] = (vp->soft_bits->c[ini + k] < 0);
}
fec_avx512_hard_decision_c(&vp->soft_bits->c[ini], &message[i], vp->ls);
ini = ini + vp->node_size;
}

View File

@ -26,4 +26,21 @@
#define SRSRAN_AVX512_B_SIZE 64 /*!< \brief Number of packed bytes in an AVX512 instruction. */
#define SRSRAN_AVX512_B_SIZE_LOG 6 /*!< \brief \f$\log_2\f$ of \ref SRSRAN_AVX512_B_SIZE. */
#ifdef LV_HAVE_AVX512
#include <immintrin.h>
static inline void fec_avx512_hard_decision_c(const int8_t* llr, uint8_t* message, int nof_llr)
{
int k = 0;
for (; k < nof_llr - (SRSRAN_AVX512_B_SIZE - 1); k += SRSRAN_AVX512_B_SIZE) {
__mmask64 mask = _mm512_cmpge_epi8_mask(_mm512_load_si512((__m512i*)&llr[k]), _mm512_set1_epi8(0));
_mm512_storeu_si512((__m512i*)&message[k], _mm512_mask_blend_epi8(mask, _mm512_set1_epi8(1), _mm512_set1_epi8(0)));
}
for (; k < nof_llr; k++) {
message[k] = (llr[k] < 0);
}
}
#endif // LV_HAVE_AVX512
#endif // SRSRAN_UTILS_AVX512_H