Skip to content

Commit

Permalink
Fixes selection of cuDNN algorithm (pytorch#15881)
Browse files Browse the repository at this point in the history
Summary:
This PR updates the logic for using cudnnGet* and cudnnFind*. Current version of cudnn find and get (v7) returns a pair of best algorithm and the convDesc mathType. While we were using the returned algorithm, we didn't update the mathType. As a result, we ended up with a slow choice of algorithm and math type. Without this patch, we are seeing a 10x regression in group convolutions.

Changelist:
- Changed the template arguments to be `perf_t` instead of `algo_t` to unify cudnnFind and cudnnGet. Both cudnnFind and cudnnGet have the same purpose and hence, it made sense to unify them and get rid of `getAlgorithm`.
- Used cudnnGet*_v7 everywhere cudnnGet* was being used.
- Removed all cudnn6 paths (This PR depends on pytorch#15851)

Differential Revision: D13957944

Pulled By: ezyang

fbshipit-source-id: a88c39d80ae37f2d686665622302b62b50fab404
  • Loading branch information
syed-ahmed authored and facebook-github-bot committed Feb 5, 2019
1 parent c751cf8 commit 85ad011
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 140 deletions.
2 changes: 2 additions & 0 deletions aten/src/ATen/cudnn/Descriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ struct AT_CUDA_API ConvolutionDescriptor
AT_CUDNN_CHECK(cudnnSetConvolutionNdDescriptor(mut_desc(), dim, pad, stride, upscale,
CUDNN_CROSS_CORRELATION, mathType));
AT_CUDNN_CHECK(cudnnSetConvolutionGroupCount(mut_desc(), groups));
// See Note [behavior of cudnnFind and cudnnGet]
AT_CUDNN_CHECK(cudnnSetConvolutionMathType(mut_desc(), CUDNN_DEFAULT_MATH));
if(dataType == CUDNN_DATA_HALF)
AT_CUDNN_CHECK(cudnnSetConvolutionMathType(mut_desc(), CUDNN_TENSOR_OP_MATH));

}
};

Expand Down
Loading

0 comments on commit 85ad011

Please sign in to comment.