[Roll forward -- Take 2] Optimize large JAX Mesh construction
Avoid intermediate tuple -> np.ndarray reallocation: Previously Mesh._create took flat_devices_tuple and reallocated an np.ndarray via np.array(flat_devices_tuple).reshape(device_shape). We now introduce _HashableDeviceArray wrapping the original np.ndarray and xc.DeviceList, avoiding the array reallocation.
Reuse xc.DeviceList: Cache _cached_device_list on the Mesh instance during construction and return it directly from the _internal_device_list property, avoiding redundant DeviceList allocations.
Reverts 008c954b905e7119157f55dc6ea7d16ee15ce05f
1 total changed file
Loading changes...
Review complete ๐ช
Thus concludes todayโs episode of โJust One Small Changeโ