19.7. Remote buffers

class popxl.RemoteBuffer(tensor_shape, tensor_dtype, entries)
Parameters
Return type

None

__init__(tensor_shape, tensor_dtype, entries)

Store to or load from remote buffers residing in Streaming Memory.

This constructor will automatically assign a buffer ID and store the buffer information in the underlying remoteBufferInfoMap.

Parameters
  • tensor_shape (Tuple[int, ...]]) – The shape of the tensors to be stored in the buffer.

  • tensor_dtype (dtype) – The type of the tensors to be stored in the buffer.

  • entries (int) – Sets the size of the buffer to this number of tensors with the specified shape and type.

Raises

ValueError – If entries is a not a positive integer.

Return type

None

property entries: int

Return the number of entries that can be stored in the buffer.

Setting the value of this property will update the size of the buffer.

Returns

The number of tensors with the specified shape and type that can be stored in the buffer.

Return type

int

Raises

ValueError – If set to a value that is a not a positive integer.

property meta_shape: Tuple[int, ...]
property remote_buffer_id: int

Return the ID of the buffer.

Note that the ID is read only.

Returns

The ID of the buffer.

Return type

int

set_remote_buffer_info(tensor_dtype, tensor_shape, entries)

Store the buffer information in the underlying remoteBufferInfoMap.

Parameters
  • tensor_shape (Tuple[int, ...]]) – The shape of the tensors to be stored in the buffer.

  • tensor_dtype (dtype) – The type of the tensors to be stored in the buffer.

  • entries (int) – Sets the size of the buffer to this number of tensors with the specified shape and type.

Return type

None

property tensor_dtype: popxl.dtypes.dtype

Return the type of the tensors stored in the buffer.

The type cannot be changed after the buffer has been created.

Returns

The type of the tensors stored in the buffer.

Return type

dtype (dtype)

property tensor_shape: Tuple[int, ...]

Return the shape of the tensors stored in the buffer.

The shape cannot be changed after the buffer has been created.

Returns

The shape of the tensors stored in the buffer.

Return type

Tuple[int, …]

validate_tensor_matches_buffer(t, num_shards=1)

Validate whether the tensor information matches that of the buffer.

Parameters
  • t (Tensor) – Tensor to check.

  • num_shards (int) – The number of shards used.

Raises

ValueError – If the tensor does not match the buffer.

Return type

None

popxl.remote_buffer(tensor_shape, tensor_dtype, entries=1)

Return a remote buffer based on the current IR from the context.

Parameters
  • tensor_shape (Tuple[int, ...]]) – The shape of the tensors to be stored in the buffer.

  • tensor_dtype (dtype) – The type of the tensors to be stored in the buffer.

  • entries (int) – Sets the size of the buffer to this number of tensors with the specified shape and type. Defaults to 1.

Returns

The remote buffer based on the current IR from the context.

Return type

RemoteBuffer