-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add access to native mesh and layout distribution objects. #20897
base: master
Are you sure you want to change the base?
Conversation
- Added `backend_mesh` property to `keras.distribution.DeviceMesh` to access the native mesh object. - Added `backend_layout` property to `keras.distribution.TensorLayout` to access the native layout or sharding object. The values are cached. Changed the code to access these directly instead of calling the convertion functions every time. Made the following renames so that these functions can be used in backend agnostic code: - `_to_jax_device` to `_to_backend_device` - `_to_jax_mesh` and `_to_dtensor_mesh` to `_to_backend_mesh` - `_to_jax_layout` and `_to_dtensor_layout` to `_to_backend_layout`
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20897 +/- ##
=======================================
Coverage 82.25% 82.26%
=======================================
Files 561 561
Lines 52680 52690 +10
Branches 8144 8146 +2
=======================================
+ Hits 43334 43344 +10
Misses 7342 7342
Partials 2004 2004
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Why not mesh
and layout
? (not asking for a change, asking for clarification)
First, I'm not a big fan of the names But when for instance you have a mesh called A common use case is when you want the native mesh of a layout, you'd write I'm open to name suggestions:
|
backend_mesh
property tokeras.distribution.DeviceMesh
to access the native mesh object.backend_layout
property tokeras.distribution.TensorLayout
to access the native layout or sharding object.The values are cached. Changed the code to access these directly instead of calling the convertion functions every time.
Made the following renames so that these functions can be used in backend agnostic code:
_to_jax_device
to_to_backend_device
_to_jax_mesh
and_to_dtensor_mesh
to_to_backend_mesh
_to_jax_layout
and_to_dtensor_layout
to_to_backend_layout