diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S index 8de50550b588441e6e86c475b627fdcc16467983..f265b9c6a8cfccc8b0ef9ad37f13fd63ab03ad41 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S +++ b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S @@ -1271,172 +1271,4 @@ loop5: bdnz loop5 blr - -.global _post_process_visibilities -_post_process_visibilities: - - li 11,-16 # push call-saved registers - stfpdux 14,1,11 - stfpdux 15,1,11 - stfpdux 16,1,11 - stfpdux 17,1,11 - stfpdux 18,1,11 - stfpdux 19,1,11 - - lis 7,(NR_BASELINES*NR_SUBBAND_CHANNELS/2)/65536 - ori 7,7,(NR_BASELINES*NR_SUBBAND_CHANNELS/2)%65536 - mtctr 7 - - li 0,0 - li 8,8 -#if SIZEOF_NR_VALID_SAMPLES == 1 - lbz 11,0(4) # load nrValidSamples -#elif SIZEOF_NR_VALID_SAMPLES == 2 - lhz 11,0(4) -#elif SIZEOF_NR_VALID_SAMPLES == 4 - lwz 11,0(4) -#endif - li 9,SIZEOF_NR_VALID_SAMPLES - li 10,4 - lfsx 18,0,6 # load threshold - addi 7,3,-8 - - lfpsx 0,0,3 - lfpsux 1,3,8 - lfpsux 2,3,8 - lfpsux 3,3,8 - -loop6: - slwi. 12,11,2 # if 4*nrValidSamples == 0, jump to invalid_2 -#if SIZEOF_NR_VALID_SAMPLES == 1 - lbzux 11,4,9 # load nrValidSamples -#elif SIZEOF_NR_VALID_SAMPLES == 2 - lhzux 11,4,9 -#elif SIZEOF_NR_VALID_SAMPLES == 4 - lwzux 11,4,9 -#endif - beq- 0,invalid_2 - - lfsx 16,5,12 # load weight - - fxpmul 0,16,0 ; lfpsux 8,3,8 - fxpmul 1,16,1 ; lfpsux 9,3,8 - fxpmul 2,16,2 ; lfpsux 10,3,8 - fxpmul 3,16,3 ; lfpsux 11,3,8 - - fmul 4,0,0 ; stfpsux 0,7,8 - fmul 5,1,1 ; stfpsux 1,7,8 - fmul 6,2,2 ; stfpsux 2,7,8 - fmul 7,3,3 ; stfpsux 3,7,8 - - fxcxma 4,0,0,4 ; lfsux 19,6,10 # load threshold - fxcxma 5,1,1,5 - fxcxma 6,2,2,6 - fxcxma 7,3,3,7 - - fcmpu 4,4,18 - fcmpu 5,5,18 - fcmpu 6,6,18 - fcmpu 7,7,18 - - mfcr 12 - andi. 12,12,0x4444 - bne- 0,invalid_1 - -L7: - slwi. 12,11,2 # if 4*nrValidSamples == 0, jump to invalid_4 -#if SIZEOF_NR_VALID_SAMPLES == 1 - lbzux 11,4,9 # load nrValidSamples -#elif SIZEOF_NR_VALID_SAMPLES == 2 - lhzux 11,4,9 -#elif SIZEOF_NR_VALID_SAMPLES == 4 - lwzux 11,4,9 -#endif - beq- 0,invalid_4 - - lfsx 17,5,12 # load weight - - fxpmul 8,17,8 ; lfpsux 0,3,8 - fxpmul 9,17,9 ; lfpsux 1,3,8 - fxpmul 10,17,10 ; lfpsux 2,3,8 - fxpmul 11,17,11 ; lfpsux 3,3,8 - - fmul 12,8,8 ; stfpsux 8,7,8 - fmul 13,9,9 ; stfpsux 9,7,8 - fmul 14,10,10 ; stfpsux 10,7,8 - fmul 15,11,11 ; stfpsux 11,7,8 - - fxcxma 12,8,8,12 ; lfsux 18,6,10 # load threshold - fxcxma 13,9,9,13 - fxcxma 14,10,10,14 - fxcxma 15,11,11,15 - - fcmpu 4,12,19 - fcmpu 5,13,19 - fcmpu 6,14,19 - fcmpu 7,15,19 - - mfcr 12 - andi. 12,12,0x4444 - bne- 0,invalid_3 - - bdnz loop6 - -end: li 11,16 # restore call-saved registers - lfpdx 19,1,11 - lfpdux 18,1,11 - lfpdux 17,1,11 - lfpdux 16,1,11 - lfpdux 15,1,11 - lfpdux 14,1,11 - - addi 1,1,16 # reset stack pointer - - blr - -invalid_1: -#if SIZEOF_NR_VALID_SAMPLES == 1 - stb 0,-1(4) -#elif SIZEOF_NR_VALID_SAMPLES == 2 - sth 0,-2(4) -#elif SIZEOF_NR_VALID_SAMPLES == 4 - stw 0,-4(4) -#endif - dcbz 0,7 - - b L7 - -invalid_2: - addi 6,6,4 ; lfpsux 8,3,8 - addi 7,7,32 ; lfpsux 9,3,8 - ; lfpsux 10,3,8 - ; lfpsux 11,3,8 - - ; dcbz 0,7 - b L7 - -invalid_3: -#if SIZEOF_NR_VALID_SAMPLES == 1 - stb 0,-1(4) -#elif SIZEOF_NR_VALID_SAMPLES == 2 - sth 0,-2(4) -#elif SIZEOF_NR_VALID_SAMPLES == 4 - stw 0,-4(4) -#endif - dcbz 0,7 - - bdnz loop6 - b end - -invalid_4: - addi 6,6,4 ; lfpsux 0,3,8 - addi 7,7,32 ; lfpsux 1,3,8 - ; lfpsux 2,3,8 - ; lfpsux 3,3,8 - - ; dcbz 0,7 - - bdnz loop6 - b end - #endif diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h index eedeb4763e2c1a5e95ceb3ccc165d282ea6b4608..4020db5999c69f7fe60c2272e1fcc3df44f37fb8 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h +++ b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h @@ -81,11 +81,10 @@ extern "C" { void _clear_correlation(CorrelatedOutputType *S0_S0); - void _post_process_visibilities( + void _weigh_visibilities( DH_Visibilities::AllVisibilitiesType *visibilities, DH_Visibilities::AllNrValidSamplesType *nrValidSamplesCounted, - const float correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1], - const float thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]); + const float correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1]); extern struct { unsigned nr_stations; diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc index 542f129becbb9352aba7ed02858013510c59e0b0..dc8c0987ec0ebe4e8668ff46f808f6604a519a8e 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc +++ b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc @@ -63,7 +63,6 @@ bitset<NR_SAMPLES_PER_INTEGRATION> WH_BGL_Processing::flags[NR_STATIONS] CACHE_A #endif unsigned WH_BGL_Processing::itsNrValidSamples[NR_BASELINES] CACHE_ALIGNED; float WH_BGL_Processing::correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1] CACHE_ALIGNED; -float WH_BGL_Processing::thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]; #if defined HAVE_BGL && !defined C_IMPLEMENTATION static BGL_Mutex *mutex; @@ -1221,12 +1220,6 @@ void WH_BGL_Processing::preprocess() #endif } - for (int bl = 0; bl < NR_BASELINES; bl ++) { - for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - thresholds[bl][ch] = 5.0e37; - } - } - #if defined HAVE_BGL && !defined C_IMPLEMENTATION mutex = rts_allocate_mutex(); #endif @@ -1573,9 +1566,6 @@ void WH_BGL_Processing::doCorrelate() sum += samples[ch][stat1][time][pol1] * conj(samples[ch][stat2][time][pol2]); } sum *= correlationWeights[itsNrValidSamples[bl]]; - if (real(sum) * real(sum) + imag(sum) * imag(sum) > thresholds[bl][ch]) { - goto invalid; // C++ lacks syntax to break from nested loop - } (*visibilities)[bl][ch][pol1][pol2] = sum; } } @@ -1583,12 +1573,12 @@ void WH_BGL_Processing::doCorrelate() } if (nrValid == 0) { - invalid: for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { - for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); + for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { + for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { + (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); + } } } - } (*nrValidSamples)[bl][ch] = nrValid; } } @@ -1707,31 +1697,15 @@ void WH_BGL_Processing::doCorrelate() #if 0 for (int bl = 0; bl < NR_BASELINES; bl ++) { for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - float weight = correlationWeights[(*nrValidSamples)[bl][ch]]; - bool invalid = false; - for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - fcomplex vis = (*visibilities)[bl][ch][pol1][pol2] * weight; - - (*visibilities)[bl][ch][pol1][pol2] = vis; - invalid |= real(vis) * real(vis) + imag(vis) * imag(vis) > thresholds[bl][ch]; - } - } - - if (invalid) { - (*nrValidSamples)[bl][ch] = 0; - for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { - for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); - } + (*visibilities)[bl][ch][pol1][pol2] *= correlationWeights[(*nrValidSamples)[bl][ch]]; } } } } #else - //_weigh_visibilities(visibilities, nrValidSamples, correlationWeights); - _post_process_visibilities(visibilities, nrValidSamples, correlationWeights, thresholds); + _weigh_visibilities(visibilities, nrValidSamples, correlationWeights); #endif weightTimer.stop(); #endif