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
EPCommInitializer
EPCommInitializer
class max.nn.comm.ep.EPCommInitializer(config)
Bases: object
Helper class for initializing buffers for Expert Parallelism (EP).
This class handles the initialization of the SHMEM communication infrastructure required for Expert Parallelism. It creates and manages atomic counters, initializes the SHMEM library, and allocates symmetric memory buffers.
Initialize the EP communication initializer.
-
Parameters:
-
config (EPConfig) – EP configuration.
atomic_counters
List of atomic counters used for synchronization.
config
config: EPConfig
EP configuration.
ep_init()
ep_init(session)
Initialize Expert Parallelism communication infrastructure.
-
Parameters:
-
session (InferenceSession) – Inference session used to compile and execute the graph.
-
Return type:
-
None
fused_moe_workspace
Bytes per device and token block of the one-launch fused MoE workspace
EP init set up, or None when it set none up.
init_model
init_model: Model
Compiled model that sets up the SHMEM library context for local GPUs and allocates the SHMEM memory for the send, receive, and receive count buffers.
model_inputs()
model_inputs()
Get the model inputs for the MoE model.
-
Returns:
-
List of all tensors needed as model inputs, in the order of
EPBatchManager.input_types(). -
Return type:
-
Raises:
-
ValueError – If EPLB is enabled but no placement was supplied.
recv_buf_ptrs
List of device pointers for the receive buffer.
recv_count_ptrs
List of device pointers for the receive count buffer.
send_buf_ptrs
List of device pointers for the send buffer.
set_eplb_placement()
set_eplb_placement(log2phy, logcnt)
Supplies the per-device EPLB tables model_inputs() returns.
-
Parameters:
-
Raises:
-
ValueError – If EPLB is disabled in the config or a list does not have one buffer per local GPU.
-
Return type:
-
None