IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python class

SymmetricPool

SymmetricPool​

class max.driver.SymmetricPool

source

Bases: object

A driver-owned symmetric multicast pool shared by a set of devices.

The pool is a single fixed-capacity allocation, created once per device set and registered in the driver. It outlives this handle: dropping the Python object does not free device memory, and two handles for the same devices refer to the same allocation.

Not constructible directly. Use allocate() once during session setup, and lookup() afterwards.

allocate()​

allocate(devices: collections.abc.Sequence[max.driver.Device], byte_size: int) → max.driver.SymmetricPool

source

Allocates the pool over devices and registers it in the driver.

Parameters:

  • devices (Sequence[Device]) – The devices to span, at least two, in any order.
  • byte_size (int) – Usable bytes per device. The driver rounds the real allocation up to the multicast granularity.

Returns:

The newly registered pool.

Return type:

SymmetricPool

Raises:

RuntimeError – If a pool is already registered for these devices, fewer than two devices are given, a device lacks multicast support, or the allocation fails.

byte_size​

property byte_size

source

Usable bytes per device; the views are exactly this long.

is_supported()​

is_supported(devices: collections.abc.Sequence[max.driver.Device]) → bool

source

Returns whether devices can back a multicast pool.

Answers before any memory is committed. A device that cannot report its capability counts as unsupported.

Parameters:

devices (Sequence[Device]) – The devices a pool would span.

Returns:

True when every device supports multicast.

Return type:

bool

lookup()​

lookup(devices: collections.abc.Sequence[max.driver.Device]) → max.driver.SymmetricPool | None

source

Returns the pool registered for devices, or None.

A registry read, never an allocation.

Parameters:

devices (Sequence[Device]) – The devices the pool spans.

Returns:

The registered pool, if any.

Return type:

SymmetricPool | None

multicast_view()​

multicast_view(device: max.driver.Device) → max.driver.Buffer

source

Returns the multicast alias the switch reduces through.

Only meaningful to a kernel issuing multimem instructions; host loads and stores through it are undefined.

Parameters:

device (Device) – One of the devices the pool spans.

Returns:

A flat uint8 view, byte_size bytes long.

Return type:

Buffer

unicast_view()​

unicast_view(device: max.driver.Device) → max.driver.Buffer

source

Returns the device’s own view of the pool as a flat uint8 buffer.

The buffer is non-owning; the driver owns the memory. Retype a sub-region with Buffer.view().

Parameters:

device (Device) – One of the devices the pool spans.

Returns:

A flat uint8 view, byte_size bytes long.

Return type:

Buffer

Raises:

RuntimeError – If device is not one the pool spans.