syn.directive.performance - 2025.2 English - UG1702

Vitis Reference Guide (UG1702)

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

Description

Tip: syn.directive.performance applies to loops and loop nests, and requires a known loop tripcount to determine the performance. If your loop has a variable tripcount then you must also specify syn.directive.tripcount.

The syn.directive.performance lets you specify a high-level constraint, target_ti or target_tl. The directive allows you to define the number of clock cycles between successive starts of a loop. The directive lets the tool infer lower-level UNROLL, PIPELINE, ARRAY_PARTITION, and INLINE directives for achieving the desired result. The syn.directive.performance does not guarantee the specified value will be achieved, and so it is only a target.

The target_ti is the interval between successive starts of the loop. It is also the interval between the start of the first iteration of the loop, and the next start of the first iteration of the loop. In the following code example, a target_ti=T means the target interval for the start of loop L2 between two consecutive iterations of L1 is 100 cycles.

const int T = 100;
L1: for (int i=0; i<N; i++)
  L2: for (int j=0; j<M; j++){
   #pragma HLS PERFORMANCE target_ti=T
   ...
   }

The target_tl is the interval between start of the loop and end of the loop, or between the start of the first iteration of the loop and the completion of the last iteration of the loop. In the preceding code example a target_tl=T means the target completion of loop L2 for a single iteration of L1 should be 100 cycles.

Note: syn.directive.inline applies automatically to functions inside any pipelined loop with II=1 to improve throughput. If you apply the PERFORMANCE pragma, the tool also triggers auto-inline optimization. If you apply a directive that infers a pipeline with II=1, the tool also triggers auto-inline optimization. You can disable this for specific functions by using syn.directive.inline off.

The transaction interval is the initiation interval (II) of the loop times the number of iterations, or tripcount: target_ti = II * loop tripcount. Conversely, target_ti = FreqHz / Operations per second.

For example, assume an image processing function processes a single frame per invocation with a throughput goal of 60 fps. The target throughput for the function is 60 invocations per second. If the clock frequency is 180 MHz, then target_ti is 180M/60, or 3 million clock cycles per function invocation.

Syntax

Specify the directive for a labeled loop.

syn.directive.performance=<location> [Options]

Where:

<location> specifies the loop in the format function/loop_label.

Options

target_ti=<value>
Specifies a target transaction interval that is the number of clock cycles for the loop to complete an iteration. The transaction interval refers to the number of clock cycles from the first transaction of a loop, or nested loop to the start of the next transaction of the loop. The <value> can be an integer, floating point, or constant expression that is resolved by the tool as an integer.
Note: The tool returns a warning if truncation occurs.
target_tl=<value>

Specifies a target latency that is the number of clock cycles for the loop to complete all iterations. The transaction latency is the interval between the start of the first iteration of the loop, and the completion of the last iteration of the loop. The <value> can be an integer, floating point, or constant expression that is resolved by the tool as an integer.

unit=[sec | cycle]
Specifies the unit associated with the target_ti or target_tl values. The unit can either be seconds, or clock cycles. When the unit is specified as seconds, you can specify it with a value to indicate nanoseconds (ns), picoseconds (ps) or microseconds (us).

Example 1

The loop labeled loop_1 has a target transaction interval of 4 clock cycles:

syn.directive.performance=loop_1 target_ti=4