-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
adjust lax.convert_element_type bind to avoid H2D transfers during tracing #6014
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mattjj
force-pushed
the
convert-element-type-bind
branch
2 times, most recently
from
March 10, 2021 21:15
848ac7e
to
c3e08e6
Compare
zhangqiaorjc
approved these changes
Mar 10, 2021
This was referenced Mar 10, 2021
mattjj
force-pushed
the
convert-element-type-bind
branch
3 times, most recently
from
March 17, 2021 01:38
2d05aa2
to
0803111
Compare
Co-authored-by: Qiao Zhang <zhangqiaorjc@google.com>
mattjj
force-pushed
the
convert-element-type-bind
branch
from
March 19, 2021 20:42
0803111
to
bf15ba5
Compare
copybara-service bot
pushed a commit
that referenced
this pull request
Mar 21, 2021
PiperOrigin-RevId: 364191893
copybara-service bot
pushed a commit
that referenced
this pull request
Mar 21, 2021
PiperOrigin-RevId: 364191893
copybara-service bot
pushed a commit
that referenced
this pull request
Mar 21, 2021
PiperOrigin-RevId: 364191893
copybara-service bot
pushed a commit
that referenced
this pull request
Mar 21, 2021
PiperOrigin-RevId: 364200195
NeilGirdhar
pushed a commit
to NeilGirdhar/jax
that referenced
this pull request
Apr 1, 2021
…ack. PiperOrigin-RevId: 364200195
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@jekbradbury and others noticed that we were performing H2D transfers while tracing, e.g. while tracing
random.split
. @zhangqiaorjc and I tracked it down to howlax.convert_element_type
would sometimes call a device_put function directly. The fix was tobind
theconvert_element_type
primitive in more cases. (See also the discussion thread on #5998 about the fix, which was moved from that PR to this one.)A downside of this fix is that it led to more
convert_element_type
primitive applications in jaxprs, especially for literals. That added visual clutter. This PR fixes that issue by tweaking_inline_literals
in partial_eval.py to constant-fold dtype conversion of literals at jaxpr formation time. (To do this, I movedconvert_element_type_p
to core.py so that partial_eval.py knows about it.)(This PR currently contains two commits from #5998, but once that's merged into master they'll disappear; only the diff from the last commit is relevant to this PR.)fixes #5308