We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Registered: ‎04-03-2018

execute one function 1024 times in parallel


I am trying to execute one function 1024 times in parallel. I do something like this:


func(ap_uint<46> &in, ap_uint<46> &out){

some code



main function:

ap_uint<46> in[1024];

#pragma HLS array_partition variable=in complete

ap_uint<46> out[1024];

#pragma HLS array_partition variable=out complete

   for (int I=0; I<1024; I++){

      #pragma HLS unroll

      func(in[I], out[I]);


   for (int I=0; I<1024; I++){
      #pragma HLS unroll
      if (out[I]==ref){





SDAccel (HLS) will pipeline functions, however, I want 1024 copy of func to run exactly at the same time. I think the access of multiple functions to one array or final if  is problem. How can I solve it?



when I remove if statement functions will be executed in the same time, Hence it seems that if statement is doing something that avoids parallel execution of functions. what is the solution?

Tags (3)
0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
Registered: ‎09-08-2011

Re: execute one function 1024 times in parallel

Hi yyyaaaaayyyy4,


     So you put the if statement around the function, it's not going to allow it to necessarily execute 1024 times, as it's a conditional check. I would suggest move the check into the functions. It might be more helpful to understand what the full code example is trying to do. As it might be what's in the function that prevents the expected behavior.


Could you share a simplied build able example that still shows the behavior depending on the if statement placement? I can provide more details why it's preventing what you expect.



If at first you don't succeed, try redefining success?