Vitis HLS detects dependencies within loops (loop-independent dependency), and between different iterations of a loop (loop-carry dependency).

These dependencies impact 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-carry 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 lets you explicitly specify the dependence, and resolve a false dependence.

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


set_directive_dependence [OPTIONS] <location>
  • <location> is 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)

Specifies whether a dependence is true and needs to be enforced, or is false and should be removed. The default is true.

-direction (RAW | WAR | WAW)
Note: Relevant only for loop-carry 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-carry 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 foo.

set_directive_dependence -variable Var1 -type intra \
-dependent false foo/loop_1

The dependence on all arrays in loop_2 of function foo 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 foo/loop_2

See Also