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: D13787601

Pulled By: ezyang

fbshipit-source-id: 81fe86727673d021306fe1c99c3e528b7c9ad17f
  • Loading branch information
syed-ahmed authored and facebook-github-bot committed Jan 23, 2019
1 parent 879bf65 commit 3837446
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 143 deletions.
3 changes: 0 additions & 3 deletions aten/src/ATen/cudnn/Descriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ 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));
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 3837446

Please sign in to comment.