syn.directive.dependence - 2025.2 English - UG1399

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2025-11-20
Version
2025.2 English

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.

Important: Specifying a false dependency when the dependency is not false can result in incorrect hardware. Ensure dependencies are correct (true or false) before specifying them.

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 variable option.
variable=<variable>
Defines a specific variable to apply the dependence directive. Mutually exclusive with the class option.
Important: You cannot specify a dependence for function arguments that are bundled with other arguments in an m_axi interface. This is the default configuration for m_axi interfaces 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 true and needs to be enforced, or is false and should be removed. However, when not specified, the tool will return a warning that the value was not specified and will assume a value of false.
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 where -dependent is set to true.
Specifies the inter-iteration distance for array access.
type=(intra | inter)
Specifies whether the dependence is:
  • Within the same loop iteration (intra), or
  • Between different loop iterations (inter) (default).

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