- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I am wondering if setting a unroll factor that is not multiple of loop count is OK in Altera OpenCL? For example:# pragma unroll 10 for( int i = 0; i < n; i++){ ... } Here n is either a number not divisible by 10 (ex: 128) or not known at compilation time (ex: a variable passed in from host). I know this can be done on CPU or GPU but I am wondering if this will generate incorrect result or cause performance issues on FPGA. Thanks!Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, this will work. Depending on whether the iterations are independent or not, you may get performance increase because essentially FPGA hardware of the loop will be replicated 10 times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply!
So basically during the last unrolled iteration, only the reminder (in my example 128%10 = 8) number of the FPGA datapath will be used and the rest (again in my example 10 - 8 = 2) of the datapath will be bypassed right? --- Quote Start --- No, this will work. Depending on whether the iterations are independent or not, you may get performance increase because essentially FPGA hardware of the loop will be replicated 10 times. --- Quote End ---- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Thank you for the reply! So basically during the last unrolled iteration, only the reminder (in my example 128%10 = 8) number of the FPGA datapath will be used and the rest (again in my example 10 - 8 = 2) of the datapath will be bypassed right? --- Quote End --- Yes, this is correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Yes, this is correct. --- Quote End --- Thank you!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page