Skip to content

Commit 80a17f2

Browse files
Liang (AIML-Compute) Hechanglan
authored andcommitted
Update default XLA flags for TPU 7x to mitigate loss lifting and add allow_split_physical_axes to split physical axes
GitOrigin-RevId: df14d6e
1 parent e9b882e commit 80a17f2

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

axlearn/common/compiler_options.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,11 @@ def default_xla_options(
157157
# v7x flags from MaxText, inclusing SparseCore configs
158158
# TODO(samuel-andersen): Move v7x SparseCore config below with v6e
159159
options.update(
160-
xla_tpu_enable_sparse_core_collective_offload_all_reduce="true",
161-
xla_tpu_enable_sparse_core_collective_offload_reduce_scatter="true",
160+
# TODO(lianghe): Re-enable after JAX 0.8.3 issues are resolved.
161+
# - all_reduce: causes abnormal loss in pretraining.
162+
# - reduce_scatter: causes abnormal loss in post-training (SFT).
163+
# xla_tpu_enable_sparse_core_collective_offload_all_reduce="true",
164+
# xla_tpu_enable_sparse_core_collective_offload_reduce_scatter="true",
162165
xla_tpu_enable_sparse_core_collective_offload_all_gather="true",
163166
xla_tpu_enable_sparse_core_collective_offload_2d_all_gather="true",
164167
xla_tpu_enable_sparse_core_reduce_scatter_v2="true",

axlearn/common/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,13 @@ def build_standard_mesh(mesh_shape: MeshShape, *, devices: np.ndarray) -> np.nda
16931693
mesh = mesh.reshape(mesh_shape)
16941694
logging.log_first_n(logging.INFO, "Using custom mesh: %s", 1, str(mesh))
16951695
return mesh
1696-
return mesh_utils.create_device_mesh(mesh_shape, devices=devices)
1696+
return mesh_utils.create_device_mesh(
1697+
mesh_shape,
1698+
devices=devices,
1699+
# Set allow_split_physical_axes to True to split physical axes.
1700+
# Reference: jax.experimental.mesh_utils.create_device_mesh docs.
1701+
allow_split_physical_axes=True,
1702+
)
16971703
except NotImplementedError as e:
16981704
logging.warning(
16991705
"mesh_utils.create_device_mesh cannot handle shape %s: %s. "

0 commit comments

Comments
 (0)