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 module
max.tensor.sharding.per_shard_dim
Wraps one Dim per device, so a dimension can vary by shard.
A PerShardDim bundles one Dim per mesh shard
(device index along a Sharded mesh axis). Arithmetic distributes
element-wise. make_per_shard_dim() collapses to its first cell when
every cell is equal, no global_dim is attached, and force_wrap is
false. Shape rules project each wrapper per shard before any
Dim.to_mlir() call, so a wrapper never reaches the MLIR graph.
Per-shard dimensions
PerShardDim | A Dim listing one cell per mesh shard. |
|---|
global_dim | Folds a PerShardDim into a single global Dim. |
|---|---|
global_shape | Returns the global shape by summing every PerShardDim axis. |
is_per_shard_dim | True if d is a PerShardDim. |
is_static | True if d's global extent is a static (compile-time) size. |
is_symbolic | True if d's global extent is a symbolic (named) dim. |
local_dim_at | Returns the dimension value at shard. |
local_shape_at | Projects every axis of shape onto a single shard index. |
make_per_shard_dim | Wraps per_shard in a PerShardDim, or collapses to a plain Dim. |