hls4ml.backends.coyote.passes package

Submodules

hls4ml.backends.coyote.passes.fifo_depth_optimization module

class hls4ml.backends.coyote.passes.fifo_depth_optimization.FifoDepthOptimization

Bases: ConfigurableOptimizerPass, ModelOptimizerPass

transform(model)

Perform FIFO depth optimization between the FIFOs of all layers to reduce resource utilization as the initial FIFOs set by hls4ml might be larger than required. At the end of the optimization the FIFOs will have the largest depths achieved during co-simulation without causing any deadlocks between the layers (producer-consumer), thus no additional delays between the layers. In some cases, this optimization might lead to bigger FIFOs than initially set by the hls4ml tool in order to prevent deadlocks.

Parameters:

model (ModelGraph) – The model to which FIFO depth optimization is applied.

Raises:
  • ValueError – If the FIFO depth for profiling provided by the user is not a non-negative integer.

  • RuntimeError – If the IO type is not set to “io_stream”.

Returns:

The execution state of the Optimizer Pass

Return type:

bool

hls4ml.backends.coyote.passes.fifo_depth_optimization.execute_cosim_to_profile_fifos(model)

Execute a co-simulation with a test-bench that calls the top function to properly profile the max FIFO depths. Note that the top function needs to execute least twice, so user-provided input must have at least two samples.

Parameters:

model (ModelGraph) – The model to which FIFO depth optimization is applied.

hls4ml.backends.coyote.passes.fifo_depth_optimization.get_vitis_optimized_fifo_depths(model)

Parse the files generated by the co-simulation to retrieve the optimized depths for the FIFOs. Attention, only the FIFOs between the layers are profiled!

Parameters:

model (ModelGraph) – The model to which FIFO depth optimization is applied.

Returns:

A dictionary that contains the FIFO names as keys and the optimized depths as values.

Return type:

Dict[str, int]

Module contents