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).

Mojo struct

BundledBroadcast

struct BundledBroadcast

Registers the mo.bundled.broadcast graph op with the graph compiler.

The per-device form of mo.distributed.broadcast: one instance per GPU copies the root device's tensor into its own output. execute reads the root tensor through its live data pointer; build_graph reads it through a stable address slot (a Stable input), so the recorded device graph replays against whatever buffer the slot names at the time.

Implemented traits​

AnyType, Deinitable, Movable

Methods​

execute​

static def execute[Sigs: TypeList[Sigs.values], //, root: Int, _trace_name: StaticString, peer_rank: Optional[Int] = None](output: T, input: T, signal_buffers: TensorTuple[*Sigs.values], ctx: DeviceContext)

Per-device broadcast through live addresses.

Parameters:

  • ​Sigs (TypeList[values]): The element types of signal_buffers (inferred).
  • ​root (Int): Index of the root device in the signal buffer list.
  • ​_trace_name (StaticString): Trace name used for profiling and debugging.
  • ​peer_rank (Optional[Int]): THIS GPU's index in the signal buffer list; None takes it from the device id.

Args:

  • ​output (T): Output tensor for THIS GPU.
  • ​input (T): The root GPU's tensor.
  • ​signal_buffers (TensorTuple[*Sigs.values]): Signal buffers for ALL participating GPUs.
  • ​ctx (DeviceContext): Device context for THIS GPU.

build_graph​

static def build_graph[Sigs: TypeList[Sigs.values], //, root: Int, _trace_name: StaticString, peer_rank: Optional[Int] = None](output: T, input: T, signal_buffers: TensorTuple[*Sigs.values], builder: LegacyDeviceGraphBuilder)

Records the per-device broadcast into a device graph.

Parameters:

  • ​Sigs (TypeList[values]): The element types of signal_buffers (inferred).
  • ​root (Int): Index of the root device in the signal buffer list.
  • ​_trace_name (StaticString): Trace name used for profiling and debugging.
  • ​peer_rank (Optional[Int]): THIS GPU's index in the signal buffer list; None takes it from the device id.

Args:

  • ​output (T): Output tensor for THIS GPU.
  • ​input (T): The root GPU's tensor, read through its stable slot.
  • ​signal_buffers (TensorTuple[*Sigs.values]): Signal buffers for ALL participating GPUs.
  • ​builder (LegacyDeviceGraphBuilder): Device graph builder for THIS GPU.

Was this page helpful?