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 dramatically improve II.
#pragma HLS stable variable=<a>
- Specifies the name of the scalar or array variable to which the STABLE pragma is applied.
In the following example, without the STABLE pragma,
proc2 would be
synchronized to acknowledge the reading of their inputs (including
A). With the pragma,
A is no longer considered
as an input that needs synchronization.
void dataflow_region(int A[...], int B[…] ...
#pragma HLS stable variable=A
#pragma HLS dataflow