07-20-2017 12:45 AM
I want to do optimization to the codes using the synthesis options in HLS ? Can anyone explain me the concept of the optimization?
1. How to perform optimization to the codes ?
2. How to enable optimization in HLS?
01-24-2019 03:02 PM
Hope that helps
If so, please mark as solution accepted to close the issue. Kudos also welcomed. :-)
01-25-2019 02:40 AM
Also see UG902, which is the HLS user guide. In answer to your questions:
(1a) First, don't think about this as "I take code written for a CPU and optimize it for HLS". Instead it's "I take code written for a CPU, understand what effect it has, and completely rewrite it in a HLS-friendly way". Even better is to skip the CPU part completely, find some research on the topic, and select (or develop) an algorithm that is inherently HLS-friendly.
(1b) When you've implemented the algorithm, go through UG902 and apply appropriate directives. You should know (from planning a HLS-friendly algorithm) which loops you want unrolled, which loops you want pipelined (probably all the ones that aren't unrolled), which arrays need to be partitioned (and how much), which interfaces will be needed, etc.
(1c) Once that's done, synthesize the design and see whether HLS actually did what you want. Modify directives and code as appropriate to get it closer to what you want.
(2) You don't. HLS doesn't have a "-O3" compiler option like GCC does. If you want optimization, you do it by hand. There are a couple of flags you can use to tell HLS to put in more effort, but the results are marginal.