pytorch/xla

xs.make_mesh

Open

#8,838 opened on Mar 14, 2025

View on GitHub
 (1 comment) (0 reactions) (1 assignee)C++ (575 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (2,786 stars)
PR merge metrics
 (PR metrics pending)

Description

🚀 Feature

We should provide a xs.make_mesh method similar to JAX: https://docs.jax.dev/en/latest/_autosummary/jax.make_mesh.html

Motivation

The ordering of devices affects the performance of collective operations:

  • Weights are sharded differently and the layout of tensors after an all-gather is different.
  • The performance of a collective op itself depends on what network connections it uses.

Pitch

The xs.make_mesh method should attempt to create a reasonably optimized device ordering given a mesh shape referencing how JAX does it.

We could also deviate from JAX and add additional options that fit our own needs.

cc @yaochengji

Contributor guide