Description
Arguments marked as stable cannot change during kernel execution. Inputs that only change when the kernel is not running, such as ports that provide configuration data, should be marked with a STABLE pragma or directive. The STABLE Pragma can only be used for Control-Driven task modeling because in Data-driven Task-level Parallelism there is no way to detect when the kernel is idle.
The STABLE pragma informs Vitis HLS of the following:
- The data applied to the port remains stable during normal operation but is not a constant value that can be optimized.
- The fanout from this port is not required to be registered.
Pragma STABLE pragma in DATAFLOW networks tells the compiler that input does not need to be read by the first dataflow process and that output does not need to be written by the last dataflow process in a network. This can improve II dramatically.
set_directive_stable <location> <variable>
-
<location>
is the function name or loop name where the directive is to be constrained. -
<variable>
is the name of the scalar or array variable to be constrained.
Examples
In the following example, without the STABLE directive, proc1
and proc2
would
be synchronized to acknowledge the reading of their inputs (including A
). With the directive, A
is no longer considered as an input that needs synchronization.
void dataflow_region(int A[...], int B[…] ...
proc1(...);
proc2(A, ...);
The directives for this example would be scripted as:
set_directive_stable dataflow_region variable=A
set_directive_dataflow dataflow_region