hls4ml.backends.oneapi package
Subpackages
- hls4ml.backends.oneapi.passes package
- Submodules
- hls4ml.backends.oneapi.passes.bn_quant module
- hls4ml.backends.oneapi.passes.clone_templates module
- hls4ml.backends.oneapi.passes.convolution_templates module
- hls4ml.backends.oneapi.passes.convolution_winograd module
- hls4ml.backends.oneapi.passes.core_templates module
ActivationConfigTemplate
ActivationFunctionTemplate
ActivationStreamFunctionTemplate
ActivationTaskSequenceTemplate
BatchNormalizationConfigTemplate
BatchNormalizationFunctionTemplate
BatchNormalizationStreamFunctionTemplate
BatchNormalizationTaskSequenceTemplate
DenseConfigTemplate
DenseFunctionTemplate
DenseStreamFunctionTemplate
DenseTaskSequenceTemplate
HardActivationConfigTemplate
PReLUActivationStreamFunctionTemplate
PReLUFunctionTemplate
ParamActivationConfigTemplate
ParametrizedActivationFunctionTemplate
ParametrizedActivationStreamFunctionTemplate
ParametrizedActivationTaskSequenceTemplate
SoftmaxConfigTemplate
- hls4ml.backends.oneapi.passes.embedding_templates module
- hls4ml.backends.oneapi.passes.merge_templates module
- hls4ml.backends.oneapi.passes.pointwise module
- hls4ml.backends.oneapi.passes.pooling_templates module
- hls4ml.backends.oneapi.passes.quantization_templates module
- hls4ml.backends.oneapi.passes.recurrent_templates module
- hls4ml.backends.oneapi.passes.reshaping_templates module
ReshapeConfigTemplate
ReshapeFunctionTemplate
ReshapeTaskSequenceTemplate
ReshapingStreamFunctionTemplate
ResizeConfigTemplate
ResizeFunctionTemplate
ResizeTaskSequenceTemplate
TransposeConfigTemplate
TransposeFunctionTemplate
TransposeTaskSequenceTemplate
ZeroPaddingConfigTemplate
ZeroPaddingFunctionTemplate
ZeroPaddingTaskSequenceTemplate
- hls4ml.backends.oneapi.passes.resource_strategy module
- hls4ml.backends.oneapi.passes.transform_types module
- Module contents
Submodules
hls4ml.backends.oneapi.oneapi_backend module
- class hls4ml.backends.oneapi.oneapi_backend.OneAPIBackend
Bases:
FPGABackend
- build(model, build_type='fpga_emu', run=False)
Builds the project using Intel DPC++ (oneAPI) compiler.
- Parameters:
model (ModelGraph) – The model to build
build_type – What to build (e.g. fpga_emu, fpga_sim, fpga, report)
optional – What to build (e.g. fpga_emu, fpga_sim, fpga, report)
run – Whether to run the testbench
optional – Whether to run the testbench
Errors raise exceptions
- compile(model)
Compile the generated project that can be linked into Python runtime.
- Parameters:
model (ModelGraph) – Model to compile.
- Raises:
Exception – If the project failed to compile
- Returns:
Returns the name of the compiled library.
- Return type:
string
- create_initial_config(part='Arria10', clock_period=5, io_type='io_parallel')
Create the minimal conversion config for the backend.
Subclasses should implement this method to provide the initial configuration for the conversion.
- get_default_flow()
The name of the default flow of the backend.
Default flow is used as the conversion target if the target flow has not been specified.
- get_writer_flow()
- init_activation(layer)
- init_base_layer(layer)
- init_conv1d(layer)
- init_conv2d(layer)
- init_dense(layer)
- init_embed(layer)
- init_gru(layer)
- init_lstm(layer)
- init_simple_rnn(layer)
- init_softmax(layer)
hls4ml.backends.oneapi.oneapi_template module
This package includes oneAPI-specific templates
- class hls4ml.backends.oneapi.oneapi_template.StreamFunctionCallTemplate(layer_class)
Bases:
Template
Base class for the streaming function call templates in oneAPI: provides the ‘stream_function_cpp’ attribute. This generally provides the async call to the task sequence that executes the streaming function.
Note: the include header files are specified in the regular FunctionCallTemplate, not here.
- Parameters:
layer_class (Layer or list, tuple, or set of Layers) – The Layers that this template handles.
- 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.oneapi.oneapi_template.TaskSequenceTemplate(layer_class)
Bases:
Template
Base class for the task sequence definition in oneAPI: provides the ‘task_sequence_cpp’ attribute. This defines the task sequence that is then called by the StreamFunctionCallTemplate.
- Parameters:
layer_class (Layer or list, tuple, or set of Layers) – The Layers that this template handles.
- 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.oneapi.oneapi_types module
This package includes oneAPI-specific customizations to the variable types
- class hls4ml.backends.oneapi.oneapi_types.ACExponentPrecisionDefinition
Bases:
PrecisionDefinition
- definition_cpp()
- class hls4ml.backends.oneapi.oneapi_types.AggregratedArrayVariableConverter(type_converter, prefix, definition_cls)
Bases:
object
This is a bit of an extension of the standard ArrayVariableConverter
- convert(tensor_var, pragma='', depth=0, n_pack=1)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIACTypeConverter
Bases:
FixedPrecisionConverter
- class hls4ml.backends.oneapi.oneapi_types.OneAPIArrayVariableConverter(type_converter)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIArrayVariableDefinition
Bases:
VariableDefinition
- definition_cpp(name_suffix='', as_reference=False)
- class hls4ml.backends.oneapi.oneapi_types.OneAPICompressedTypeConverter
Bases:
TypeDefinition
,TypePrecisionConverter
Use a tuple for storing a compressed type for oneAPI since it’s better supported. (Currently unused)
- convert_precision(precision_converter)
- definition_cpp()
tuple format is row_index, col_index, weight
- class hls4ml.backends.oneapi.oneapi_types.OneAPIExponentTypeConverter
Bases:
TypeDefinition
,TypePrecisionConverter
Use a pair for storing a exponent type for oneAPI since it’s better supported
- convert_precision(precision_converter)
- definition_cpp()
- class hls4ml.backends.oneapi.oneapi_types.OneAPIHLSTypeConverter(precision_converter)
Bases:
HLSTypeConverter
- class hls4ml.backends.oneapi.oneapi_types.OneAPIInplaceArrayVariableConverter(type_converter)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIInplaceArrayVariableDefinition
Bases:
VariableDefinition
- definition_cpp()
- class hls4ml.backends.oneapi.oneapi_types.OneAPIInplaceStreamVariableConverter(type_converter)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIInplaceStreamVariableDefinition
Bases:
VariableDefinition
- definition_cpp()
- class hls4ml.backends.oneapi.oneapi_types.OneAPIInterfaceVariableConverter(type_converter)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIInterfaceVariableDefinition
Bases:
VariableDefinition
- declare_cpp(pipe_min_size=0, indent='')
- definition_cpp(name_suffix='', as_reference=False)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIPackedTypeConverter
Bases:
TypeDefinition
,TypePrecisionConverter
- convert_precision(precision_converter)
- definition_cpp()
- class hls4ml.backends.oneapi.oneapi_types.OneAPIStaticWeightVariableConverter(type_converter)
Bases:
object
- convert(weight_var)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIStaticWeightVariableDefinition
Bases:
VariableDefinition
- definition_cpp(reuse_factor)
Write the appropriate weight definiiton
- class hls4ml.backends.oneapi.oneapi_types.OneAPIStreamVariableConverter(type_converter)
- class hls4ml.backends.oneapi.oneapi_types.OneAPIStreamVariableDefinition
Bases:
VariableDefinition
- declare_cpp(indent='')
- definition_cpp(name_suffix='', as_reference=True)