cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mimc
Visitor
Visitor
983 Views
Registered: ‎03-04-2019

Partial unrolling does not allow for flattening

Hello, I've experienced that when I do partial loop unroolling, HLS cannot flatten the innermost loop, but when the next loop in the hierarchy is pipelined (and consequently, the nested loop is fully unrolled and pipelined) there is no problem with flattening.

LOOP_I:  for (int i = 0; i < A;   i++) {
LOOP_J:  for (int j = 0; j < B;  j++) {       // pipelining here fully unrolls and pipelines LOOP_K and is very efficient
LOOP_K: for (int k = 0; k < C; k++) {     // unrolling+pipelining here gives high iteration latency for LOOP_K

     // perform computation

    }
  }
}

Also, using the pragmas unroll and pipeline to fully unroll and pipeline the innermost loop does not yield the same results as pipelining the next loop in the hieerarchy.

Is there something I'm missing? I've tried using loop flatten in the innermost loop, but get this message:

@W [XFORM-542] Cannot flatten a loop nest 'LOOP_J'  in function 'my_func' : the outer loop is not a perfect loop.

** all loop bounds are fixed (not variable) at compile time and there is only code in the innermost loop.

Thanks.

0 Kudos
2 Replies
nithink
Xilinx Employee
Xilinx Employee
914 Views
Registered: ‎09-04-2017

Hi,

  when you pipeline the second loop, the inner most loop is fully unrolled, that's the reason you see high performance. If you only unroll/pipeline the inner most loop, the second loop is still sequential.

Thanks,

Nithin

0 Kudos
aoifem
Moderator
Moderator
861 Views
Registered: ‎11-21-2018

Hi @mimc 

If your question is answered or your issue is solved, please kindly mark the response which helped as solution (click on "Accept as solution" button below the reply).

 

If this is not solved/answered, please reply in the topic giving more information on your current status.

 

Thanks and Regards,

Aoife
Product Application Engineer - Xilinx Technical Support EMEA


**~ Got a minute? Answer our Vitis HLS survey here! ~**

**~ Don't forget to reply, give kudos, and accept as solution.~**
0 Kudos