Skip to content

[ROCm] Disable MIOpen for empty tensors for RNN (#117672)#1388

Merged
pruthvistony merged 1 commit intorelease/2.2from
dnikolaev/disable_miopen_RNN_for_empty_tensors_release2.2
Apr 8, 2024
Merged

[ROCm] Disable MIOpen for empty tensors for RNN (#117672)#1388
pruthvistony merged 1 commit intorelease/2.2from
dnikolaev/disable_miopen_RNN_for_empty_tensors_release2.2

Conversation

@dnikolaev-amd
Copy link
Copy Markdown

Fix cherry-picked from upstream for release/2.2 branch

Some MIOpen RNN functions (lstm, rnn, gru) can't work with empty tensors and return error "MIOpen Error: Lengths must be > 0" This PR disables MIOpen tor empty tensors and force to use native methods.
Also fix test_nn.py::test_RNN_input_size_zero

Some MIOpen RNN functions (lstm, rnn, gru) can't work with empty tensors and return error "MIOpen Error: Lengths must be > 0"
This PR disables MIOpen tor empty tensors and force to use native methods
The solution is based on condition of using CUDNN https://github.com/pytorch/pytorch/blob/3a52147cc59b240737602d3d046080bbf6f567f1/aten/src/ATen/native/TensorProperties.cpp#L91
It also fix [test_nn.py::TestNN::test_RNN_input_size_zero](https://github.com/pytorch/pytorch/blob/29fa6fbc4eda6c02ecdfd73b74a8702187c4fc44/test/test_nn.py#L4592) on ROCM

Pull Request resolved: pytorch#117672
Approved by: https://github.com/cpuhrsch
@pruthvistony pruthvistony merged commit 64e703f into release/2.2 Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants