Deeploy.TilingExtension.AsyncDma.AnydimAsyncDmaTransferAdapter

class Deeploy.TilingExtension.AsyncDma.AnydimAsyncDmaTransferAdapter(dma: AsyncDma)

Bases: object

Methods

__init__(dma: AsyncDma) None

__init__(dma)

nearestSupportedTransferRank(transfer_rank)

transfer(ctxt, externalBuffer, localBuffer, ...)

Attributes

offsetPtrTemplate

class NestedForLoopOpenTemplate(depth: int)

Bases: NodeTemplate

alignToContext(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, Dict[str, str | Any], List[str]]

Helper method to extract Mako template expressions used in the backend’s code generation step. Also hoists transient buffers.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext. Modifying is allowed within this method.

  • operatorRepresentation (OperatorRepresentation) – Current node representation. Modifying is allowed within this method.

Returns:

Tuple of the updated NetworkContext, operatorRepresentation and a list of the names of hoisted transient buffers

Return type:

Tuple[NetworkContext, OperatorRepresentation, List[str]]

computeTransientBuffersSize(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) List[Tuple[str, int | IntVar]]

Computes the size of transient buffers hoisted by this template given expressions for each variable added by the operator’s parser.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • operatorRepresentation (OperatorRepresentation) – The parser’s node representation

Returns:

Returns a list of tuples containing the hoisted buffer’s name and either a symbolic expression or an integer representing its size.

Return type:

List[Tuple[str, Union[int, IntVar]]]

generate(operatorRepresentation={}, **kwargs) str

Generated the operator’s C implementation

Parameters:

operatorRepresentation (The parser's node representation)

Returns:

Returns the operator’s C implementation

Return type:

str

Raises:

KeyError – Raises an error whenever an expression in the NodeTemplate’s templateString is not matched against the available expressions in the operatorRepresentation

hoistTransientBuffers(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, Dict[str, str | Any], List[str]]

Registers the transient buffers required by this template. If tiling is applied, this method is called AFTER tiling.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • operatorRepresentation (OperatorRepresentation) – The parser’s node representation

Returns:

Tuple containing the updated NetworkContext object, updated node representation and a list of names of all hoisted TransientBuffers

Return type:

Tuple[NetworkContext, OperatorRepresentation, List[str]]

internalSize() int

Return the byte size of internal memory buffers used by this template

Returns:

byte size of all transient internal buffers

Return type:

int

class NestedForLoopCloseTemplate(depth: int)

Bases: NodeTemplate

alignToContext(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, Dict[str, str | Any], List[str]]

Helper method to extract Mako template expressions used in the backend’s code generation step. Also hoists transient buffers.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext. Modifying is allowed within this method.

  • operatorRepresentation (OperatorRepresentation) – Current node representation. Modifying is allowed within this method.

Returns:

Tuple of the updated NetworkContext, operatorRepresentation and a list of the names of hoisted transient buffers

Return type:

Tuple[NetworkContext, OperatorRepresentation, List[str]]

computeTransientBuffersSize(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) List[Tuple[str, int | IntVar]]

Computes the size of transient buffers hoisted by this template given expressions for each variable added by the operator’s parser.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • operatorRepresentation (OperatorRepresentation) – The parser’s node representation

Returns:

Returns a list of tuples containing the hoisted buffer’s name and either a symbolic expression or an integer representing its size.

Return type:

List[Tuple[str, Union[int, IntVar]]]

generate(operatorRepresentation={}, **kwargs) str

Generated the operator’s C implementation

Parameters:

operatorRepresentation (The parser's node representation)

Returns:

Returns the operator’s C implementation

Return type:

str

Raises:

KeyError – Raises an error whenever an expression in the NodeTemplate’s templateString is not matched against the available expressions in the operatorRepresentation

hoistTransientBuffers(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, Dict[str, str | Any], List[str]]

Registers the transient buffers required by this template. If tiling is applied, this method is called AFTER tiling.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • operatorRepresentation (OperatorRepresentation) – The parser’s node representation

Returns:

Tuple containing the updated NetworkContext object, updated node representation and a list of names of all hoisted TransientBuffers

Return type:

Tuple[NetworkContext, OperatorRepresentation, List[str]]

internalSize() int

Return the byte size of internal memory buffers used by this template

Returns:

byte size of all transient internal buffers

Return type:

int

class OffsetCalculationTemplate(name: str, depth: int)

Bases: NodeTemplate

alignToContext(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, Dict[str, str | Any], List[str]]

Helper method to extract Mako template expressions used in the backend’s code generation step. Also hoists transient buffers.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext. Modifying is allowed within this method.

  • operatorRepresentation (OperatorRepresentation) – Current node representation. Modifying is allowed within this method.

Returns:

Tuple of the updated NetworkContext, operatorRepresentation and a list of the names of hoisted transient buffers

Return type:

Tuple[NetworkContext, OperatorRepresentation, List[str]]

computeTransientBuffersSize(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) List[Tuple[str, int | IntVar]]

Computes the size of transient buffers hoisted by this template given expressions for each variable added by the operator’s parser.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • operatorRepresentation (OperatorRepresentation) – The parser’s node representation

Returns:

Returns a list of tuples containing the hoisted buffer’s name and either a symbolic expression or an integer representing its size.

Return type:

List[Tuple[str, Union[int, IntVar]]]

generate(operatorRepresentation={}, **kwargs) str

Generated the operator’s C implementation

Parameters:

operatorRepresentation (The parser's node representation)

Returns:

Returns the operator’s C implementation

Return type:

str

Raises:

KeyError – Raises an error whenever an expression in the NodeTemplate’s templateString is not matched against the available expressions in the operatorRepresentation

hoistTransientBuffers(ctxt: NetworkContext, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, Dict[str, str | Any], List[str]]

Registers the transient buffers required by this template. If tiling is applied, this method is called AFTER tiling.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • operatorRepresentation (OperatorRepresentation) – The parser’s node representation

Returns:

Tuple containing the updated NetworkContext object, updated node representation and a list of names of all hoisted TransientBuffers

Return type:

Tuple[NetworkContext, OperatorRepresentation, List[str]]

internalSize() int

Return the byte size of internal memory buffers used by this template

Returns:

byte size of all transient internal buffers

Return type:

int