hls4ml.backends.vivado.passes package

Submodules

hls4ml.backends.vivado.passes.bn_quant module

class hls4ml.backends.vivado.passes.bn_quant.BatchNormalizationQuantizedTanhConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.bn_quant.BatchNormalizationQuantizedTanhFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.bn_quant.MergeBatchNormAndQuantizedTanh

Bases: OptimizerPass

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

class hls4ml.backends.vivado.passes.bn_quant.QuantizeDenseOutput

Bases: OptimizerPass

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.bn_quant.register_bn_quant(backend)

hls4ml.backends.vivado.passes.broadcast_stream module

class hls4ml.backends.vivado.passes.broadcast_stream.Broadcast(model, name, attributes, inputs, outputs=None)

Bases: Layer

Inserted between layers for broadcasting.

initialize()
class hls4ml.backends.vivado.passes.broadcast_stream.BroadcastConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.broadcast_stream.BroadcastFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.broadcast_stream.BroadcastStream

Bases: OptimizerPass

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.broadcast_stream.register_broadcast_stream(backend)

hls4ml.backends.vivado.passes.conv_same_pad module

class hls4ml.backends.vivado.passes.conv_same_pad.InsertZeroPaddingBeforeConv1D

Bases: OptimizerPass

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

name = 'insert_zero_padding_before_conv1d'
transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

class hls4ml.backends.vivado.passes.conv_same_pad.InsertZeroPaddingBeforeConv2D

Bases: OptimizerPass

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

name = 'insert_zero_padding_before_conv2d'
transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.conv_stream module

class hls4ml.backends.vivado.passes.conv_stream.GenerateConvStreamingInstructions

Bases: OptimizerPass

Generates the instructions for streaming implementation of CNNs

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.convolution_templates module

class hls4ml.backends.vivado.passes.convolution_templates.Conv1DConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.Conv1DFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.Conv2DConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.Conv2DFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.DepthwiseConv1DFunctionTemplate

Bases: Conv1DFunctionTemplate

class hls4ml.backends.vivado.passes.convolution_templates.DepthwiseConv2DFunctionTemplate

Bases: Conv2DFunctionTemplate

class hls4ml.backends.vivado.passes.convolution_templates.SeparableConv1DConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.SeparableConv1DFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.SeparableConv2DConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.convolution_templates.SeparableConv2DFunctionTemplate

Bases: FunctionCallTemplate

format(node)

hls4ml.backends.vivado.passes.core_templates module

class hls4ml.backends.vivado.passes.core_templates.ActivationConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.ActivationFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.BatchNormalizationConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.BatchNormalizationFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.DenseConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.DenseFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.HardActivationConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.PReLUFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.ParamActivationConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.ParametrizedActivationFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.core_templates.SoftmaxConfigTemplate

Bases: ActivationConfigTemplate

hls4ml.backends.vivado.passes.fifo_depth_optimization module

class hls4ml.backends.vivado.passes.fifo_depth_optimization.FifoDepthOptimization

Bases: ConfigurableOptimizerPass, ModelOptimizerPass

transform(model)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.fifo_depth_optimization.generate_max_depth_file(model, maxs)
hls4ml.backends.vivado.passes.fifo_depth_optimization.get_vcd_data(model)
hls4ml.backends.vivado.passes.fifo_depth_optimization.populate_values(values, name, data, depth)
hls4ml.backends.vivado.passes.fifo_depth_optimization.set_big_fifos(vars_to_profile, profiling_fifo_depth)
hls4ml.backends.vivado.passes.fifo_depth_optimization.set_fifo_depth(model, maxs)

hls4ml.backends.vivado.passes.garnet_templates module

class hls4ml.backends.vivado.passes.garnet_templates.GarNetConfigTemplate

Bases: LayerConfigTemplate

format(node)
get_transforms_config(node, params)
class hls4ml.backends.vivado.passes.garnet_templates.GarNetFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.garnet_templates.GarNetStackConfigTemplate

Bases: GarNetConfigTemplate

get_transforms_config(node, params)
class hls4ml.backends.vivado.passes.garnet_templates.GarNetStackFunctionTemplate

Bases: GarNetFunctionTemplate

hls4ml.backends.vivado.passes.merge_templates module

class hls4ml.backends.vivado.passes.merge_templates.ConcatenateConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.merge_templates.DotConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.merge_templates.MergeConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.merge_templates.MergeFunctionTemplate

Bases: FunctionCallTemplate

format(node)

hls4ml.backends.vivado.passes.pipeline_style module

class hls4ml.backends.vivado.passes.pipeline_style.SetPipelineStyle

Bases: ModelOptimizerPass

transform(model)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.pointwise module

class hls4ml.backends.vivado.passes.pointwise.OptimizePointwiseConv

Bases: OptimizerPass

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

class hls4ml.backends.vivado.passes.pointwise.PointwiseConv1DConfigTemplate

Bases: Conv1DConfigTemplate

class hls4ml.backends.vivado.passes.pointwise.PointwiseConv1DFunctionTemplate

Bases: Conv1DFunctionTemplate

class hls4ml.backends.vivado.passes.pointwise.PointwiseConv2DConfigTemplate

Bases: Conv2DConfigTemplate

class hls4ml.backends.vivado.passes.pointwise.PointwiseConv2DFunctionTemplate

Bases: Conv2DFunctionTemplate

hls4ml.backends.vivado.passes.pointwise.register_pointwise(backend)

hls4ml.backends.vivado.passes.pointwise_codegen module

class hls4ml.backends.vivado.passes.pointwise_codegen.GeneratePointwiseConv1D

Bases: OptimizerPass

Generates code for pointwise 1D convolution

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.pointwise_codegen.generate_pointwise_conv1d_fn(layer_idx, reuse_factor=1)

Generate a C++ function for a pointwise convolution layer.

Parameters:
  • layer_idx (int) – Index of layer (‘index’ attribute).

  • reuse_factor (int) – Number of partitions to divide the input into.

Returns:

Generated C++ function

Return type:

str

hls4ml.backends.vivado.passes.pooling_templates module

class hls4ml.backends.vivado.passes.pooling_templates.PoolingConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.pooling_templates.PoolingFunctionTemplate

Bases: FunctionCallTemplate

format(node)

hls4ml.backends.vivado.passes.quantization_templates module

class hls4ml.backends.vivado.passes.quantization_templates.ApplyAlphaConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.quantization_templates.ApplyAlphaFunctionTemplate

Bases: FunctionCallTemplate

format(node)

hls4ml.backends.vivado.passes.recurrent_templates module

class hls4ml.backends.vivado.passes.recurrent_templates.RecurrentConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.recurrent_templates.RecurrentFunctionTemplate

Bases: FunctionCallTemplate

format(node)

hls4ml.backends.vivado.passes.reshaping_templates module

class hls4ml.backends.vivado.passes.reshaping_templates.ResizeConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.reshaping_templates.ResizeFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.reshaping_templates.TransposeConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.reshaping_templates.TransposeFunctionTemplate

Bases: FunctionCallTemplate

format(node)
class hls4ml.backends.vivado.passes.reshaping_templates.ZeroPaddingConfigTemplate

Bases: LayerConfigTemplate

format(node)
class hls4ml.backends.vivado.passes.reshaping_templates.ZeroPaddingFunctionTemplate

Bases: FunctionCallTemplate

format(node)

hls4ml.backends.vivado.passes.resource_strategy module

class hls4ml.backends.vivado.passes.resource_strategy.ApplyResourceStrategy

Bases: OptimizerPass

Transposes the weights to use the dense_resource matrix multiply routine

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.transform_types module

class hls4ml.backends.vivado.passes.transform_types.TransformTypes

Bases: GlobalOptimizerPass

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

hls4ml.backends.vivado.passes.unrolled_codegen module

class hls4ml.backends.vivado.passes.unrolled_codegen.GenerateUnrolledDenseResource

Bases: OptimizerPass

Generates C++ code for unrolled Dense resource

match(node)

Predicate to match on a given node.

Parameters:

node (Layer) – Node in the model graph to try matching the optimizer on.

transform(model, node)

Transformation to apply if matching was successful.

Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).

Parameters:
  • model (ModelGraph) – Model to optimize

  • node (Layer) – The matched node in the model graph.

Module contents