diff options
author | James Qin <jamesqin@google.com> | 2018-04-25 19:00:21 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-04-25 19:03:03 -0700 |
commit | 270a6e925493b6c2219b7a0152f6b81fbb88dfee (patch) | |
tree | f60074d1844c7bdcfbba029da834271c3c0d0b72 /tensorflow/stream_executor/dnn.cc | |
parent | ca634912e9b121d2e6b2ea04084886c73993e6aa (diff) |
Cudnn RNN v2 kernels with autotune capability
CudnnRNN V2 kernels run all applicable cudnn rnn algorithms and pick the best one for following runs.
* To enable autotune, TF_CUDNN_RNN_USE_AUTOTUNE and TF_CUDNN_RNN_USE_V2 need to be set to {"1" or unset}.
* TF_CUDNN_RNN_USE_AUTOTUNE does not work with existing CudnnRNN kernels.
* V2 kernels work with existing cudnn checkpoints, since it doesn't change persistence format.
This change
* Introduces v2 kernels as templates inheriting the v1 kernels.
* Profiles fwd and bak runs in v2 kernel (forward pass)
* Exposes the chosen algorithm as fwd op output and bak op input.
* Changes rnn descriptor cache key to include AlgorithmDesc (since cudnn rnn descriptor can't be reused across different algorithms)
* Updates unittests s.t. it tests both v1 and v2 kernels. When testing v2 kernels, autotune is turned on.
PiperOrigin-RevId: 194333948
Diffstat (limited to 'tensorflow/stream_executor/dnn.cc')
-rw-r--r-- | tensorflow/stream_executor/dnn.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/stream_executor/dnn.cc b/tensorflow/stream_executor/dnn.cc index 6edb572820..031c82d3f4 100644 --- a/tensorflow/stream_executor/dnn.cc +++ b/tensorflow/stream_executor/dnn.cc @@ -15,12 +15,17 @@ limitations under the License. #include "tensorflow/stream_executor/dnn.h" +#include "tensorflow/core/lib/hash/hash.h" #include "tensorflow/stream_executor/lib/strcat.h" #include "tensorflow/stream_executor/lib/stringprintf.h" namespace stream_executor { namespace dnn { +uint64 AlgorithmDesc::hash() const { + return ::tensorflow::Hash64Combine(algo_, tensor_ops_enabled_); +} + bool DnnSupport::GetConvolveAlgorithms( bool with_winograd_nonfused, int cc_major, int cc_minor, std::vector<AlgorithmDesc>* out_algorithms) { |