Skip to content

'profiler' Submodule

Introduction

from streamtensor import profiler

Vitis HLS profiling tool for StreamTensor tasks.

This module provides a high-level interface to the Vitis HLS profiler for StreamTensor tasks. It exposes a single class Profiler that takes a serialized MLIR module and a set of options, and returns the performance data for the tasks in the module.

Profiler(synthesizer)

Vitis HLS profiler for StreamTensor tasks.

Attributes:

Name Type Description
synthesizer Synthesizer

The synthesizer instance.

Parameters:

Name Type Description Default
synthesizer Synthesizer

The synthesizer instance.

required

get_module_performance_map(modules) staticmethod

Parses the module performance data from the given XML data.

The returned dictionary is a mapping from the module name to a dictionary of performance data.

The performance data dictionary contains the following keys
  • module_bram: The module BRAM usage.
  • module_uram: The module URAM usage.
  • module_dsp: The module DSP usage.
  • module_latency: The module latency.
  • module_interval: The module initiation interval.
  • loop_name: The loop name.
  • loop_trip_count: The loop trip count.
  • loop_latency: The loop latency.
  • loop_type: The loop pipeline type.
  • loop_ii: The loop initiation interval.
  • loop_depth: The loop initiation depth.
  • loop_instance: The loop instance name.

Parameters:

Name Type Description Default
modules List[Element]

The list of module elements from the XML data.

required

Returns:

Type Description
Dict[str, Dict[str, str | int]]

A dictionary of module performance data.

Raises:

Type Description
AssertionError

If the XML data is invalid.

get_task_performance_map(modules, tasks) staticmethod

Gets the performance data for the given tasks.

This method adds the following keys to the performance data dictionary
  • task_module_name: The module name of the task.

Parameters:

Name Type Description Default
modules List[Element]

The list of module elements from the XML data.

required
tasks List[TaskOp]

The list of tasks to profile.

required

Returns:

Type Description
Dict[TaskOp, Dict[str, str | int]]

A dictionary of task performance data.

Raises:

Type Description
AssertionError

If the XML data is invalid.

profile_tasks(module)

Profiles the tasks in the given module.

This method triggers the HLS synthesis for each task concurrently and collects the performance data from the generated Vitis HLS reports. This method may task a long time to execute depending on the number of tasks in the module.

Parameters:

Name Type Description Default
module Module

The module to profile.

required

Returns:

Type Description
Dict[TaskOp, Dict[str, str | int]]

A dictionary of task performance data.

apply_task_profiling(module, work_path='.', config=SynthesisConfig())

Applies task profiling to the given module.

Parameters:

Name Type Description Default
module Module

The module to profile.

required
work_path str

The working directory path.

'.'
config SynthesisConfig

The synthesis configuration.

SynthesisConfig()

Returns:

Type Description
None

None. The profiling results are annotated as attributes in the tasks.