Skip to content

Commit 76ac1d2

Browse files
andersensamcamiloCienet
authored andcommitted
Merge branch 'jax_0.8.0_py3.12' into jax_py3.12_nightly.
1 parent 604674b commit 76ac1d2

12 files changed

Lines changed: 83 additions & 12 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ FROM base AS gpu
139139
# Enable the CUDA repository and install the required libraries (libnvrtc.so)
140140
RUN curl -o cuda-keyring_1.1-1_all.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \
141141
dpkg -i cuda-keyring_1.1-1_all.deb && \
142-
apt-get update && apt-get install -y cuda-libraries-dev-12-8 ibverbs-utils && \
142+
apt-get update && apt-get install -y cuda-libraries-dev-12-9 ibverbs-utils && \
143143
apt clean -y
144144
COPY pyproject.toml README.md /root/
145145
RUN uv pip install -qq .[core,gpu] && uv cache clean

axlearn/cloud/gcp/jobset_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def _build_pod(self) -> Nested[Any]:
685685
# TODO(samos123) support using reservation when using local launch
686686
# the local launch command automatically sets tier=disabled.
687687
logging.info("Found tier=%s in env. Using reservation=%s", tier, cfg.reservation)
688-
if tier == "0" and cfg.reservation is not None:
688+
if tier in ["0", "disabled"] and cfg.reservation is not None:
689689
logging.info("Found tier=%s in env. Using reservation=%s", tier, cfg.reservation)
690690
selector.update({"cloud.google.com/reservation-name": cfg.reservation})
691691
if cfg.reservation_project is not None:

axlearn/common/array_serialization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ async def _async_deserialize(
473473
context = serialization.TS_CONTEXT
474474
if os.getenv("ENABLE_GCS_GRPC", "false") == "true":
475475
tensorstore_spec, context = use_gcs_grpc(tensorstore_spec)
476-
477476
t = await ts.open(
478477
tensorstore_spec,
479478
open=True,

axlearn/common/array_serialization_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ def test_shard_info_partially_replicated(
483483
devices = mesh_utils.create_device_mesh((8,))
484484
mesh = jax.sharding.Mesh(devices.reshape((4, 2)), ("x", "y"))
485485
sharding = jax.sharding.NamedSharding(mesh, jax.sharding.PartitionSpec(None, "y"))
486-
487486
arr = jax.device_put(single_device_arr, sharding)
488487

489488
replica_count = _num_replicas_per_shard(arr)
@@ -504,7 +503,6 @@ def test_shard_info_fully_sharded(self, max_data_shard_degree: int, shard_thresh
504503
devices = mesh_utils.create_device_mesh((8,))
505504
mesh = jax.sharding.Mesh(devices.reshape((4, 2)), ("x", "y"))
506505
sharding = jax.sharding.NamedSharding(mesh, jax.sharding.PartitionSpec("x", "y"))
507-
508506
arr = jax.device_put(single_device_arr, sharding)
509507

510508
replica_count = _num_replicas_per_shard(arr)
@@ -564,6 +562,5 @@ def test_shard_coordinate(self, index, expected):
564562
expected,
565563
)
566564

567-
568565
if __name__ == "__main__":
569566
absltest.main()

axlearn/common/compiler_options.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,37 @@ def default_xla_options(
151151
xla_tpu_enable_ici_ag_pipelining="true",
152152
)
153153

154+
# v7x flags from MaxText, inclusing SparseCore configs
155+
# TODO(samuel-andersen): Move v7x SparseCore config below with v6e
156+
options.update(
157+
xla_tpu_enable_sparse_core_collective_offload_all_reduce="true",
158+
xla_tpu_enable_sparse_core_collective_offload_reduce_scatter="true",
159+
xla_tpu_enable_sparse_core_collective_offload_all_gather="true",
160+
xla_tpu_enable_sparse_core_collective_offload_2d_all_gather="true",
161+
xla_tpu_enable_sparse_core_reduce_scatter_v2="true",
162+
xla_tpu_enable_sparse_core_collective_offload_3d_all_gather="true",
163+
xla_tpu_use_single_sparse_core_for_all_gather_offload="true",
164+
xla_sc_disable_megacore_partitioning="true",
165+
xla_tpu_use_tc_device_shape_on_sc="true",
166+
)
167+
if version == "v7x":
168+
options.update(
169+
# Many of the v7x flags are similar to v6e
170+
xla_tpu_scoped_vmem_limit_kib=65536,
171+
xla_tpu_enable_all_gather_offload_tracing="true",
172+
xla_tpu_enable_async_collective_fusion_fuse_all_gather="false",
173+
xla_enable_async_all_gather="true",
174+
xla_tpu_prefer_async_allgather_to_allreduce="true",
175+
xla_tpu_bf16_emission_mode="NATIVE_EMISSION",
176+
)
177+
178+
# Ensure pipelining is properly configured
179+
options.update(
180+
xla_should_allow_loop_variant_parameter_in_chain="true",
181+
xla_should_add_loop_invariant_op_in_chain="true",
182+
xla_tpu_enable_ici_ag_pipelining="true",
183+
)
184+
154185
# v7x flags from MaxText, inclusing SparseCore configs
155186
# TODO(samuel-andersen): Move v7x SparseCore config below with v6e
156187
options.update(

axlearn/common/flash_attention/layer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ def enter_fn(_, value, default_kv):
414414
cfg.visit(visit_fn=visit_fn, enter_fn=enter_fn)
415415
return cfg
416416

417-
418417
class BackendOverrideModifier(ConfigModifier):
419418
"""Modifies the backend_overrides config of Flash Attention."""
420419

axlearn/common/layers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,9 @@ class Config(BaseLayer.Config):
882882
@classmethod
883883
def default_config(cls):
884884
cfg = super().default_config()
885-
cfg.param_partition_spec = (None, "model")
885+
# Prevent OOM on 405b
886+
# cfg.param_partition_spec = (None, "model")
887+
cfg.param_partition_spec = ("fsdp", "model")
886888
# By default, initialize to Gaussian with std=1/sqrt(dim), e.g., 0.036 when dim=768.
887889
#
888890
# This is the same as:

axlearn/common/optimizers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from absl import logging
3939
from jax import numpy as jnp
4040

41-
# from jax._src.sharding_impls import TransferToMemoryKind
4241
from optax._src import numerics
4342

4443
from axlearn.common import flax_struct, schedule

axlearn/common/state_builder_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ def _mock_bert_trainer_config(
293293
embedding_cfg=bert.bert_embedding_config(max_position_embeddings=max_len),
294294
stack_cfg=bert.bert_transformer_config(num_layers=3, num_heads=2),
295295
),
296+
mesh_axis_names=("fsdp", "model")
296297
)
297298

298299
def _mock_bert_trainer_config_and_state(

axlearn/common/trainer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def run(
630630
)
631631
self.vlog(3, "Done step %s", self.step)
632632
num_steps += 1
633-
if num_steps % 100 == 0:
633+
if num_steps % 1 == 0:
634634
now = time.perf_counter()
635635
average_step_time = (now - start_time) / num_steps
636636
self._step_log("Average step time: %s seconds", average_step_time)
@@ -1348,6 +1348,7 @@ def _maybe_stop_or_start_tracing(
13481348
cfg.start_trace_process_indices == "all"
13491349
or jax.process_index() in cfg.start_trace_process_indices
13501350
)
1351+
self._step_log(f"{should_start_tracing=}")
13511352
if should_start_tracing:
13521353
self._step_log("Start profiler tracing")
13531354
jax.profiler.start_trace(self.summary_writer.config.dir)

0 commit comments

Comments
 (0)