tenzr::NamedSharding¶
Pairs a device Mesh with a PartitionSpec to describe a tensor layout.
#include <named_sharding.h>
Public Functions¶
| Name | |
|---|---|
| NamedSharding() =default | |
| NamedSharding(Mesh mesh, PartitionSpec spec) | |
| const Mesh & | mesh() const The device mesh. |
| const PartitionSpec & | Spec() const The partition spec. |
| std::string | ToString() const Render the sharding as a string. |
| std::string | ToShardyString(std::string_view mesh_sym ="mesh") const Generate Shardy MLIR attribute string: #sdy.sharding<@mesh, [{"data"}, {}]> |
| std::string | ToShardyConstraint(std::string_view out_var, std::string_view in_var, std::string_view tensor_type, std::string_view mesh_sym ="mesh") const Generate Shardy MLIR sharding constraint operation: out = sdy.sharding_constraint in <@mesh, [...]> : tensor<...> |
| std::string | ToGspmdString(const Shape & tensor_shape) const Lower into OpenXLA / GSPMD device tile notation string: e.g. {devices=[4,2]<=8 last_tile_dim_replicate}. |
| bool | operator==(const NamedSharding & other) const |
| bool | operator!=(const NamedSharding & other) const |
Public Functions Documentation¶
function NamedSharding¶
function NamedSharding¶
function mesh¶
The device mesh.
function Spec¶
The partition spec.
function ToString¶
Render the sharding as a string.
function ToShardyString¶
Generate Shardy MLIR attribute string: #sdy.sharding<@mesh, [{"data"}, {}]>
function ToShardyConstraint¶
inline std::string ToShardyConstraint(
std::string_view out_var,
std::string_view in_var,
std::string_view tensor_type,
std::string_view mesh_sym ="mesh"
) const
Generate Shardy MLIR sharding constraint operation: out = sdy.sharding_constraint in <@mesh, [...]> : tensor<...>
function ToGspmdString¶
Lower into OpenXLA / GSPMD device tile notation string: e.g. {devices=[4,2]<=8 last_tile_dim_replicate}.