Commit 22dae457 authored by knopp's avatar knopp

additional SIMD optimizations

parent b336ddc6
......@@ -420,7 +420,7 @@ void applyFtoleft(t_nrPolar_params *pp,decoder_node_t *node) {
#ifdef DEBUG_NEW_IMPL
printf("betal[0] %d (%p)\n",betal[0],&betal[0]);
#endif
pp->nr_polar_u[node->first_leaf_index] = (betal[0]+1)>>1;
pp->nr_polar_u[node->first_leaf_index] = (1+betal[0])>>1;
#ifdef DEBUG_NEW_IMPL
printf("Setting bit %d to %d (LLR %d)\n",node->first_leaf_index,(betal[0]+1)>>1,alpha_l[0]);
#endif
......@@ -466,7 +466,7 @@ void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
}
if (node->Nv == 2) { // apply hard decision on right node
betar[0] = (alpha_r[0]>0) ? -1 : 1;
pp->nr_polar_u[node->first_leaf_index+1] = (betar[0]+1)>>1;
pp->nr_polar_u[node->first_leaf_index+1] = (1+betar[0])>>1;
#ifdef DEBUG_NEW_IMPL
printf("Setting bit %d to %d (LLR %d frozen_mask %d)\n",node->first_leaf_index+1,(betar[0]+1)>>1,alpha_r[0],frozen_mask);
#endif
......@@ -474,7 +474,6 @@ void applyGtoright(t_nrPolar_params *pp,decoder_node_t *node) {
}
}
void computeBeta(t_nrPolar_params *pp,decoder_node_t *node) {
int16_t *betav = node->beta;
......@@ -484,14 +483,31 @@ void computeBeta(t_nrPolar_params *pp,decoder_node_t *node) {
printf("Computing beta @ level %d first_leaf_index %d (all_frozen %d)\n",node->level,node->first_leaf_index,node->left->all_frozen);
#endif
if (node->left->all_frozen==0) { // if left node is not aggregation of frozen bits
for (int i=0;i<node->Nv/2;i++) {
betav[i] = (betal[i] != betar[i]) ? 1 : -1;
#ifdef DEBUG_NEW_IMPL
printf("COMPUTE betav[%d] %d (%p)\n",i,
betav[i],
&betav[i]);
#endif
/*#if defined(__AVX2__)
int avx2mod = (node->Nv/2)&15;
if (avx2mod == 0) {
int avx2len = node->Nv/2/16;
for (int i=0;i<avx2len;i++) {
((__m256i*)betav)[i] = _mm256_sign_epi16(((__m256i*)betar)[i],
((__m256i*)betal)[i]);
}
}
else if (avx2mod == 8) {
((__m128i*)betav)[0] = _mm_sign_epi16(((__m128i*)betar)[0],
((__m128i*)betal)[0]);
}
else if (avx2mod == 4) {
((__m64*)betav)[0] = _mm_sign_pi16(((__m64*)betar)[0],
((__m64*)betal)[0]);
}
else
#endif*/
{
for (int i=0;i<node->Nv/2;i++) {
betav[i] = (betal[i] != betar[i]) ? 1 : -1;
}
}
}
else memcpy((void*)&betav[0],betar,(node->Nv/2)*sizeof(int16_t));
memcpy((void*)&betav[node->Nv/2],betar,(node->Nv/2)*sizeof(int16_t));
......
......@@ -67,7 +67,7 @@ typedef struct decoder_node_t_s {
int first_leaf_index;
int all_frozen;
int16_t *alpha;
int8_t *beta;
int16_t *beta;
} decoder_node_t;
typedef struct decoder_tree_t_s {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment