jax
e2888439 - Cache IFRT HLO shardings per rank on C++ NamedSharding instances.

Commit
23 days ago
Cache IFRT HLO shardings per rank on C++ NamedSharding instances. `GetIfrtHloSharding` previously cached only `HloShardingSpec` by `(num_devices, xla::HloSharding)`, still calling Python `_to_xla_hlo_sharding` and allocating a new `xla::ifrt::HloSharding` on every `NamedSharding` lookup. In this CL we instead store a per-instance `(num_dimensions, xla::ifrt::ShardingRef)` cache on `jax::NamedSharding` (guarded by `ft_mutex`) and check it first in `GetIfrtHloSharding`. PiperOrigin-RevId: 1009915342
Parents
Loading