Description
Vitis HLS detects dependencies within loops. Dependencies within the same iteration of a loop are loop-independent dependencies. Dependencies between different iterations of a loop are loop-carried dependencies.
There is impact on the dependencies when you schedule operations (especially during function and loop pipelining).
- Loop-independent dependence
- Accesses the same element in a single loop
iteration.
for (i=1;i<N;i++) { A[i]=x; y=A[i]; } - Loop-carried dependence
- Accesses the same element from a different loop
iteration.
for (i=1;i<N;i++) { A[i]=A[i-1]*2; }
Under certain circumstances, the dependence analysis can be too conservative
and fail to filter out false dependencies. An example of this circumstance is during
variable dependent array indexing. Another example is when an external requirement needs to
be enforced (for example, two inputs do not share the same index). The syn.directive.dependence command allows you to explicitly define
the dependencies and eliminate a false dependence.
Syntax
syn.directive.dependence=[OPTIONS] <location>
-
<location> - The location in the code, specified as
function[/label], where the dependence is defined.
Options
-
class=(array | pointer) - Specifies a class of variables in which the dependence needs
clarification. This is mutually exclusive with the
variableoption. -
variable=<variable> - Defines a specific variable to apply the dependence directive.
Mutually exclusive with the
classoption.Important: You cannot specify adependencefor function arguments that are bundled with other arguments in anm_axiinterface. This is the default configuration form_axiinterfaces on the function. You also cannot specify a dependence for an element of a struct, unless the struct has been disaggregated. -
dependent=(true | false) - This argument should be specified to indicate whether a dependence is
trueand needs to be enforced, or isfalseand should be removed. However, when not specified, the tool will return a warning that the value was not specified and will assume a value offalse. -
direction=(RAW | WAR | WAW) -
Note: Relevant only for loop-carried dependencies.Specifies the direction for a dependence:
-
RAW(Read-After-Write - true dependence) - The write instruction uses a value used by the read instruction.
-
WAR(Write-After-Read - anti dependence) - The read instruction gets a value that is overwritten by the write instruction.
-
WAW(Write-After-Write - output dependence) - Two write instructions write to the same location, in a certain order.
-
-
distance=<integer> -
Note: Relevant only for loop-carried dependencies whereSpecifies the inter-iteration distance for array access.
-dependentis set totrue. -
type=(intra | inter) - Specifies whether the dependence is:
- Within the same loop iteration (
intra), or - Between different loop iterations (
inter) (default).
- Within the same loop iteration (
Examples
Removes the dependence between Var1 in the
same iterations of loop_1 in function func.
syn.directive.dependence=variable=Var1 type=intra \
dependent=false func/loop_1
The dependence on all arrays in loop_2 of
function func informs Vitis HLS that all reads must happen after
writes in the same loop iteration.
syn.directive.dependence=class=array type=intra \
dependent=true direction=RAW func/loop_2