Post Go back to editing

Not reaching 8 MACs per cycle in SHARC-FX core processing

Thread Summary

The user is experiencing lower than expected MACs per cycle (6 instead of 8) when using PDX_MULA_MXF32 in a simplified FIR filtering project on the ADSP-SC835W-EV-SOM running at 1GHz with CCES 3.0.2. The final answer explains that the overhead from loop setup, accumulator reduction, and outer loop contributes to the inefficiency, with a detailed breakdown of the cycle count. Additional tools for instruction-level profiling are available but not specified in the thread.
AI Generated Content
Category: Hardware
Product Number: ADSP-SC835

Hello,

we are working on FIR filtering in the SHARC-FX Core, and after benchmarking different FIR functions available in the DSP library we found that none of them seems to reach the theoretical maximum of 8 MACs per cycle. 

We prepared a simplified project (attached) to verify in which conditions the processor can reach this efficiency

  • hardware: ADSP-SC835W-EV-SOM + breakout board, running at 1GHz, CCES 3.0.2. Measuring performance with GPIO toggles (their delay already considered) and CYC counters
  • project built in Release configuration,all optimizations enabled
  • firMacTest() executes 72 iterations of PDX_MULA_MXF32 (not FIR filter, just MACs), all signals located in L1 memory, aligned 
  • we are expecting that 72 iterations of PDX_MULA_MXF32 take approximately 72 cycles, achieving 8 MAC of 32 bit floats per cycle. But in reality the 72 iterations are taking in average 90 to 95 cycles, which translates approximately to 6 MAC of 32 bit floats per cycle
  • in our complete scheme we are using a modified version of adi_s1fir_fastf, and overall we are getting around 5 MAC per cycle, which is understandable, that's why we arrived to test specifically the simplest possible case of looped MACs with PDX_MULA_MXF32

Could you give us any hint on why this could be happening, or if indeed it is the expected behaviour? Is there a limitation that we are not considering here? 

Thanks,

Leopoldo

1157.8MAC_Core1.rar

Thread Notes

Parents
  • Hi Leopoldo,

    The main reasons why the code below does not get 1 PDX_MULA_MXF32 per cycle is because:

    1) There is inner loop overhead to set up and shut down the loop with some stalls
    2) There is a reduction of the unrolled accumulators to a single output vector, with more stalls
    3) A little outer loop overhead

    In the big picture, the issue is that the overhead outside the loop is significant compared to what happens inside the loop.

    Here's what the code looks like when all in-lined:
    // firInlineRun
    START_CYCLE_COUNT (var);
    for (int i=0; i<20; i++) {
      // macTest
      vectorSum = 0;
      for (int i=0; i<72; i++) {
        PDX_MULA_MXF32(vectorSum, inVectors[inChannel][i], coeffVectors[inChannel][i]);
      }
      outVectors[outChannel][0] = vectorSum;
    }
    STOP_CYCLE_COUNT (cyc, var);

    The cycle counter reports 2031 cycles to do 20*72=1440 MULAs, or 101 cycles per macTest. The inner loop really does take 72 cycles spinning on the MULAs, so there are 29 of overhead.

    The overall breakdown of one pass looks like:
    | Cyc | Phase |
    |-----|-----------------|
    |   8 | loop prologue |
    |  72 | loop |
    |   8 | loop epilogue |
    |   8 | unrolled accumulator reduction |
    |   4 | outer loop overhead |
    | 100 | total |

    14 are stalls. There is an extra cycle for an initial Icache miss.

    There are tools outside of CCES that can be used to profile this down to the instruction level, but let me describe those separately.

  • Hi  , any chance you could please elaborate on the tools that can be used to profile the code/instructions?
    Many thanks, 
    Simon

Reply Children
No Data

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.