afe.backends.mpk.defines

Classes

AFEMPKData

Provides data that is needed for reconstructing the MPK JSON file.

TensorTypeMPKData

Provides the information about a tensor type.

InOutNodesMPKData

Provides the information about a node.

ModelInputMPKData

Provides the information about a Model input node.

ConfigParamsMPKData

Provides the configuration parameters for the plugin.

EV74ConfigParamsMPKData

Configuration parameters for EV74 plugin.

APUConfigParamsMPKData

Configuration parameters for APU plugin.

MLAConfigParamsMPKData

Configuration parameters for MLA plugin.

PluginInputNodeMPKData

Provides the information of the input node for plugin.

PluginResourcesMPKData

Provides information about resources used by plugin.

PluginMPKData

Provides data containing all information needed to generate MPK JSON data for a single plugin.

AwesomeNetMPKData

Provides data containing all information needed to generate the MPK JSON data for a single model.

Module Contents

class afe.backends.mpk.defines.AFEMPKData[source]

Provides data that is needed for reconstructing the MPK JSON file. The data is convertible to JSON format. All changes to these data structures must adhere to changes in MPK file specification.

class afe.backends.mpk.defines.TensorTypeMPKData[source]

Provides the information about a tensor type.

scalar[source]

The tensor’s scalar element type, as a string that numpy can interpret as a type.

shape[source]

The tensor’s shape.

scalar: str[source]
shape: list[int][source]
class afe.backends.mpk.defines.InOutNodesMPKData[source]

Provides the information about a node.

name[source]

Node name which uniquely identifies the node over the scope of one model file.

type[source]

Data type. From AFE’s perspective, the type of all nodes is β€œbuffer”.

size[source]

Node’s data size in bytes.

name: str[source]
type: str = 'buffer'[source]
size: int = 0[source]
class afe.backends.mpk.defines.ModelInputMPKData[source]

Provides the information about a Model input node.

name[source]

Node name which uniquely identifies the node over the scope of one model file.

type[source]

Data type. From AFE’s perspective, the type of all nodes is β€œbuffer”.

size[source]

Node’s data size in bytes.

input_range[source]

Input range of floating point tensors.

name: str[source]
type: str = 'buffer'[source]
size: int = 0[source]
input_range: list[float] | None = None[source]
class afe.backends.mpk.defines.ConfigParamsMPKData[source]

Provides the configuration parameters for the plugin. Specification depends on the plugin’s processor type.

class afe.backends.mpk.defines.EV74ConfigParamsMPKData[source]

Configuration parameters for EV74 plugin.

desired_batch_size[source]

Batch size requested by user.

actual_batch_size[source]

Batch size used in code generation.

kernel[source]

EV74 function.

params[source]

Parameters of the EV74 function.

desired_batch_size: int[source]
actual_batch_size: int[source]
kernel: str[source]
params: dict[str, Any][source]
class afe.backends.mpk.defines.APUConfigParamsMPKData[source]

Configuration parameters for APU plugin.

input_names[source]

Names of the parameters of the APU code’s entry point function. These names may be used when passing parameters at runtime. Must have the same length as input_types.

input_types[source]

Shapes of input tensors, as they should be interpreted by the APU code.

output_types[source]

Shapes of output tensors, as they should be interpreted by the APU code.

input_names: list[str][source]
input_types: list[TensorTypeMPKData][source]
output_types: list[TensorTypeMPKData][source]
class afe.backends.mpk.defines.MLAConfigParamsMPKData[source]

Configuration parameters for MLA plugin.

desired_batch_size[source]

Batch size requested by user.

actual_batch_size[source]

Batch size used in code generation.

number_of_quads_to_user[source]

Number of quads used in MLA Production Compiler. Must be 4, other values might be supported in the future.

desired_batch_size: int = 1[source]
actual_batch_size: int = 1[source]
number_of_quads_to_user: int = 4[source]
class afe.backends.mpk.defines.PluginInputNodeMPKData[source]

Provides the information of the input node for plugin.

name[source]

Node name which uniquely identifies the node over the scope of one model file.

size[source]

Size of the node’s data in bytes.

name: str[source]
size: int[source]
class afe.backends.mpk.defines.PluginResourcesMPKData[source]

Provides information about resources used by plugin.

executable[source]

Name of the generated executable file. The file format depends on

which backend the resource belongs to.
executable: str[source]
class afe.backends.mpk.defines.PluginMPKData[source]

Provides data containing all information needed to generate MPK JSON data for a single plugin.

name[source]

Plugin name.

sequence[source]

Plugin’s position in the model’s execution sequence.

processor[source]

Execution processor for the plugin. It can be either β€œMLA”, β€œEV74” or β€œA65”.

config_params[source]

Configuration parameters for the plugin.

input_nodes[source]

JSON objects providing information on the inputs for this plugin.

output_nodes[source]

JSON objects providing information on the outputs for this plugin.

type[source]

Plugin type. From the AFE’s perspective, it always has the value β€œsgpProcess”.

resources[source]

JSON object providing information about resources used by this plugin.

name: str[source]
sequence: int[source]
processor: str[source]
config_params: ConfigParamsMPKData[source]
input_nodes: list[PluginInputNodeMPKData][source]
output_nodes: list[InOutNodesMPKData][source]
type: str = 'sgpProcess'[source]
resources: PluginResourcesMPKData | None = None[source]
class afe.backends.mpk.defines.AwesomeNetMPKData[source]

Provides data containing all information needed to generate the MPK JSON data for a single model.

name[source]

Model name.

sequence[source]

Model’s position in an execution sequence.

model_path[source]

Original model path.

model_checksum[source]

Original model checksum.

input_nodes[source]

An array of JSON objects providing information on the pipeline’s input nodes.

plugins[source]

An array of JSON objects, each of which define an invocation of a plugin either on MLA, EV74 or A65.

name: str[source]
model_path: str[source]
model_checksum: str[source]
sequence: int = 1[source]
model_sdk_version: str[source]
input_nodes: list[ModelInputMPKData] = [][source]
plugins: list[PluginMPKData] = [][source]
get_actual_batch_size() int | None[source]

Returns actual batch size from plugins data. Returns None if all plugins are assigned to A65.

Display warnings if plugins have different actual batch sizes.

get_plugins_backend_distribution() dict[source]

Returns number of plugins assigned to MLA, EV74 and A65.