afe.backends.backends

Classes

Backend

The Backend class contains all SiMa supported backends that can be partitioned via AFE's

BackendIR

IR of a computation that has been lowered to an external backend representation.

Module Contents

class afe.backends.backends.Backend[source]

The Backend class contains all SiMa supported backends that can be partitioned via AFE’s graph partitioning pass. During graph partitioning AFE will assign each IR in the graph to at least one of the backend type in this Backend class. The partitioned IRs will then be sent to its corresponding backend and runtime later.

Currently AFE support 4 different backends graph annotation:
  • MLA - SiMa.ai 1st Machine Learning Accerator

  • APU - x86 or ARM A65

  • EV - Synopsys’ DSP IP

  • CPU - compile on x86 for simulation purpose, used for unsupported operators

  • NONE - For operations outside of partitions like tuple and tuple_getitem

In the TVM, strings β€˜llvm’ and β€˜arm’ have special meaning, while others do not.

MLA = 'mla'[source]
APU = 'arm'[source]
EV = 'ev'[source]
CPU = 'llvm'[source]
NONE = 'none'[source]
classmethod get_backend_from_name(name: str) Backend | None[source]
class afe.backends.backends.BackendIR[source]

IR of a computation that has been lowered to an external backend representation. The computation has an input/output interface like a node.

Parameters:
  • graph – The lowered IR. The format of this IR depends on the backend. For Backend.MLA, it is a ModelGraph. For Backend.APU, it is a CompiledTVMObjectFile.

  • type – AwesomeNet type of the lowered IR

  • backend – Backend that the lowered IR is for.

  • tessellate_parameters – Tessellation parameters obtained while compiling the BackendIR for MLA backend. Currently unused.

  • detessellate_parameters – Detessellation parameters obtained while compiling the BackendIR for MLA backend. Used for creating a check file from untessellated data while executing the compiled BackendIR using N2ACompiledBackendRunner.

  • stage – Stage number of the graph. Every graph have a unique stage number that represents their order in AwesomeNet.

graph: Any[source]
type: afe.ir.tensor_type.NodeType[source]
backend: Backend[source]
pack_parameters: Any | None = None[source]
unpack_parameters: Any | None = None[source]
stage: int = 1[source]
get_type() afe.ir.tensor_type.NodeType | None[source]

Get the type that this code has when it is used as a model graph node.

Returns:

The node’s type

set_batch_size(batch_size: int)[source]

Modifies BackendIR’s internal parameters to accommodate for a given batch size.

Parameters:

batch_size – Integer value representing the batch size of the inputs to the AwesomeNet.