Use the fallback method for GRU and LSTM on ROCm if padded I/O is needed#17111
Merged
copybara-service[bot] merged 2 commits intokeras-team:masterfrom Oct 28, 2022
Merged
Conversation
593323a to
dd588d3
Compare
fchollet
reviewed
Oct 5, 2022
Collaborator
fchollet
left a comment
There was a problem hiding this comment.
Thanks for the PR! It makes sense.
fchollet
reviewed
Oct 6, 2022
keras/layers/rnn/lstm.py
Outdated
| # Under eager context, check the device placement and prefer | ||
| # the GPU implementation when GPU is available. | ||
| if can_use_gpu: | ||
| print("Accepted GPU version: ", mask, row_lengths) |
Collaborator
|
@ekuznetsov139 Can you please check @fchollet's comments and keep us posted ? Thank you! |
fab214f to
81790c0
Compare
fchollet
reviewed
Oct 25, 2022
keras/layers/rnn/lstm.py
Outdated
| # Under eager context, check the device placement and prefer | ||
| # the GPU implementation when GPU is available. | ||
| if can_use_gpu: | ||
| print("Accepted GPU version: ", mask, row_lengths) |
Collaborator
There was a problem hiding this comment.
Please remove debug line
81790c0 to
a3b3924
Compare
Reformatting Disabling a test that fails on fallback path
a3b3924 to
6fed911
Compare
This was referenced Feb 22, 2023
copybara-service bot
pushed a commit
that referenced
this pull request
Feb 23, 2023
Imported from GitHub PR #17587 A previous PR #17111 added some logic to use fallback implementations of GRU and LSTM on ROCm in situations where padded i/o is needed (since ROCm does not support padded i/o). That logic turns out to be too restrictive - it chooses the fallback path in cases where it is not really needed, which may result in significant performance degradations. This PR resolves the problem. Copybara import of the project: -- e78b4ab by Eugene Kuznetsov <eugene.kuznetsov@amd.com>: Less restrictive fallback logic Merging this change closes #17587 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17587 from ekuznetsov139:rocm_rnn_fallback_v2 e78b4ab PiperOrigin-RevId: 511817599
1 task
This file contains hidden or 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
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.
On ROCm, the low-end library that implements RNNs (MIOpen) does not support inputs with variable sequence lengths. At present, an attempt to pass such inputs to a RNN results in an exception. Because of this limitation, several Keras unit tests are disabled for ROCm and several others currently fail.
This change correctly switches from GPU-optimized RNNs (CudnnRNNV3) to the fallback implementation as needed.