jaxlib/gpu/rnn_kernels.cc: remove premature input_tensor_desc destruction (ROCM-21859)#765
Draft
srinivamd wants to merge 3 commits into
Draft
jaxlib/gpu/rnn_kernels.cc: remove premature input_tensor_desc destruction (ROCM-21859)#765srinivamd wants to merge 3 commits into
srinivamd wants to merge 3 commits into
Conversation
…ensor_desc destruction
PR#726 ("Fix HIP memory leaks in RNN kernels") introduced
gpudnnDestroyTensorDescriptor(input_tensor_desc) in DnnRNNForward_ and
DnnRNNBackward_ cleanup blocks. MIOpen requires input_tensor_desc to
remain valid through gpudnnRNNBackwardWeights because it uses the
descriptor as part of its execution buffer; destroying it early triggers
miopenStatusUnknownError on gfx1201 (RDNA4).
Remove the two premature destroy calls. The descriptor is stack-allocated
so it is freed when the function returns.
Fixes: ROCM-21859 (test_lstm1, test_lstm9 on gfx1201)
Regressed-by: #726
Equivalent to: #729 (targeting v0.9.0)
…or_desc destroy The previous commit accidentally introduced an extra } after DnnRNNForward_. Remove it and also remove the premature gpudnnDestroyTensorDescriptor(input_tensor_desc) from DnnRNNBackward_.
…tion (ROCM-21859)
PR#726 ("Fix HIP memory leaks in RNN kernels", 2026-03-05) introduced
gpudnnDestroyTensorDescriptor(input_tensor_desc) in the cleanup blocks of
both DnnRNNForward_ and DnnRNNBackward_. MIOpen requires input_tensor_desc
to remain valid throughout gpudnnRNNBackwardWeights because it uses the
descriptor as part of its execution buffer; destroying it early triggers
miopenStatusUnknownError on gfx1201 (RDNA4, Navi48).
Remove the two premature destroy calls. input_tensor_desc is stack-allocated
so MIOpen owns no persistent reference beyond the call; it is automatically
released when the function returns.
Fixes test_lstm1 and test_lstm9 failures on gfx1201 (image 1317).
Regressed-by: #726
Equivalent-to: #729 (targeting v0.9.0)
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.
Problem
PR #726 ("Fix HIP memory leaks in RNN kernels", merged 2026-03-05) added
gpudnnDestroyTensorDescriptor(input_tensor_desc)inside the#ifdef JAX_GPU_HIPcleanup blocks at the end of both
DnnRNNForward_andDnnRNNBackward_.MIOpen requires
input_tensor_descto remain valid throughout thegpudnnRNNBackwardWeightscall — it uses the descriptor as part of itsexecution buffer. Destroying it in the forward / workspace-sizing path before
BackwardWeightscompletes triggersmiopenStatusUnknownErroron gfx1201(Navi48 / RDNA4).
This regressed
experimental_rnn_test::test_lstm1andtest_lstm9on gfx1201(first seen in image 1317, built 2026-04-29, ROCm 7.13.0). The same root cause
was independently identified by PR #729 / PR #730.
Fix
Remove the two
gpudnnDestroyTensorDescriptor(input_tensor_desc)lines fromthe
#ifdef JAX_GPU_HIPcleanup blocks inDnnRNNForward_andDnnRNNBackward_.input_tensor_desclifetime is managed by MIOpen internally; the explicit destroyhere is both premature and incorrect.
Tests
tests/experimental_rnn_test.py::RNNTest::test_lstm1tests/experimental_rnn_test.py::RNNTest::test_lstm9References