Having some issues
Thank you for providing this code.
I was having problems in my own code with the decoder returning all zeros, so I changed turbo_test.c to not pass the correct info to the decoder, but rather get the decoder to return the decoded bits in a separate array as follows:
static int error_test(const struct lte_test_vector *test,
int num_pkts, int iter, float snr)
{
int i, n, l, iber = 0, ober = 0, fer = 0;
int8_t *bs0, *bs1, *bs2;
uint8_t *in, *bu0, *bu1, *bu2, *decoded; // Added decoded array
in = malloc(sizeof(uint8_t) * MAX_LEN_BITS);
bu0 = malloc(sizeof(uint8_t) * MAX_LEN_BITS);
decoded = malloc(sizeof(uint8_t) * MAX_LEN_BITS); // Allocate space for the decoded bits
bu1 = malloc(sizeof(uint8_t) * MAX_LEN_BITS);
bu2 = malloc(sizeof(uint8_t) * MAX_LEN_BITS);
bs0 = malloc(sizeof(int8_t) * MAX_LEN_BITS);
bs1 = malloc(sizeof(int8_t) * MAX_LEN_BITS);
bs2 = malloc(sizeof(int8_t) * MAX_LEN_BITS);
struct tdecoder *tdec = alloc_tdec();
for (i = 0; i < num_pkts; i++) {
fill_random(in, test->in_len);
l = lte_turbo_encode(test->code, in, bu0, bu1, bu2);
if (l != test->out_len) {
printf("ERROR !\n");
fprintf(stderr, "[!] Failed encoding length check (%i)\n",
l);
return -1;
}
iber += uint8_to_err(bs0, bu0, LEN + 4, snr);
iber += uint8_to_err(bs1, bu1, LEN + 4, snr);
iber += uint8_to_err(bs2, bu2, LEN + 4, snr);
// Request the decoder put the decisions in the new decoded array
lte_turbo_decode_unpack(tdec, LEN, iter, decoded, bs0, bs1, bs2);
// Check for bit errors using new decoded array
for (n = 0; n < test->in_len; n++) {
if (in[n] != decoded[n])
ober++;
}
// Check for frame errors using new decoded array
if (memcmp(in, decoded, test->in_len))
fer++;
}
print_error_results(test, iber, ober, fer, num_pkts);
free(in);
free(bs0);
free(bs1);
free(bs2);
free(bu0);
free(bu1);
free(bu2);
return 0;
}
' Then I get:
/turbo_test -e
================================================= [+] Testing: 3GPP LTE turbo [.] Specs: (N=2, K=4), Length 10000
[.] BER test: [..] Testing: [..] Input BER.......................... 0.007483 [..] Output BER......................... 0.500183 [..] Output FER......................... 1.000000
which leads me to believe there is a problem, either with the build or with the code. Can you check this on your system? Do you see any problem with my new version of error_test?
I can confirm that the decoder is returning all zeros on my computer.
I am running Ubuntu 14.04.1 and my computer does support AVX2:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer xsave avx f16c rdrand lahf_lm abm epb invpcid_single kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt dtherm ida arat pln pts
It seems to work if I add
#undef HAVE_SSE41 #undef HAVE_AVX2 #define HAVE_SSE3
at the top of turbo_sse.h
but not if I switch to one of the other architectures.
The only SIMD requirement for the turbo decoder is SSE3. If SSE3 is not detected, then the NOP decoder is built - even if SSE 4.1 or AVX2 are enabled.
@jmshea wrote:
It seems to work if I add
#undef HAVE_SSE41 #undef HAVE_AVX2 #define HAVE_SSE3
at the top of turbo_sse.h
but not if I switch to one of the other architectures.
Are you disabling SSE3 when you switch to other architectures?
Also please see if m4 detection update c561b04322ce5877abeaa5378d2021d081b0120c resolves the issue.