Skip to main content

Python class

AlwaysSignalBuffersMixin

AlwaysSignalBuffersMixinโ€‹

class max.pipelines.lib.AlwaysSignalBuffersMixin

source

Bases: object

Mixin for models that always require signal buffers.

Use this for models that use VocabParallelEmbedding or other distributed components that always perform allreduce, even on single-device setups.

Models using this mixin build graphs that always include signal buffer inputs, regardless of device count. This is typically because they use distributed embedding layers or other components that call allreduce operations unconditionally.

devicesโ€‹

devices: list[Device]

source

Device list that must be provided by the model class.

signal_buffersโ€‹

property signal_buffers: list[Buffer]

source

Override to always create signal buffers.

Models using this mixin have distributed components that always perform allreduce, even for single-device setups. Therefore, signal buffers are always required to match the graph inputs.

In compile-only mode (virtual device mode), returns an empty list to avoid GPU memory allocation which is not supported.

Returns:

List of signal buffer tensors, one per device, or empty list in compile-only mode.