IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Python class

Signals

Signals

class max.nn.Signals(devices)

source

Bases: object

Signal buffers used for peer-to-peer communication in allreduce.

Device code uses these buffers by enabling peer-to-peer access. Then thread blocks use the buffers to implement barriers for synchronization, and to hold intermediate communication results.

Args: num_gpus: Number of GPUs involved in the allreduce.

Parameters:

devices (list[DeviceRef])

NUM_BYTES

NUM_BYTES = 294387728

source

The size of the signal buffers used for communication in allreduce.

allocate()

static allocate(devices)

source

Allocates one fully initialized signal buffer per device.

This is the single chokepoint for signal-buffer allocation: it enables peer-to-peer access, zeroes the buffers (the correct init for the barrier counters and lamport_state), sentinel-initializes the Lamport comm region, and synchronizes so the buffers are ready for use when this method returns.

Parameters:

devices (Sequence[Device]) – Driver devices to allocate a buffer on, one each.

Returns:

One initialized signal buffer per device, in devices order.

Return type:

list[Buffer]

buffers()

buffers()

source

Allocates and returns buffers used for communication in allreduce.

Thin adapter over allocate() that maps this instance’s graph DeviceRefs to the driver accelerators the allocator needs.

Return type:

list[Buffer]

devices

devices: list[DeviceRef]

source

List of graph devices that these signals communicate between.

input_types()

input_types()

source

Gets graph input types corresponding to these signal buffers.

Return type:

list[BufferType]