set_directive_dependence - 2021.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
English (United States)
Release Date
2021.2 English


Vitis HLS detects dependencies within loops: dependencies within the same iteration of a loop are loop-independent dependencies, and dependencies between different iterations of a loop are loop-carried dependencies.

These dependencies are impacted when operations can be scheduled, especially during function and loop pipelining.

Loop-independent dependence
The same element is accessed in a single loop iteration.
for (i=0;i<N;i++) {
Loop-carried dependence
The same element is accessed from a different loop iteration.
for (i=0;i<N;i++) {

Under certain circumstances, such as variable dependent array indexing or when an external requirement needs to be enforced (for example, two inputs are never the same index), the dependence analysis might be too conservative and fail to filter out false dependencies. The set_directive_dependence command allows you to explicitly define the dependencies and eliminate a false dependence as described in Managing Pipeline Dependencies.

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.


set_directive_dependence -dependent <arg> [OPTIONS] <location>
-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.
The location in the code, specified as function[/label], where the dependence is defined.


-class (array | pointer)
Specifies a class of variables in which the dependence needs clarification. This is mutually exclusive with the -variable option.
-dependent (true | false)
Specify if a dependence needs to be enforced (true) or removed (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).
-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.


Removes the dependence between Var1 in the same iterations of loop_1 in function func.

set_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.

set_directive_dependence -class array -type intra \
-dependent true -direction RAW func/loop_2