| 4870 | } |
| 4871 | |
| 4872 | bool CudnnSupport::GetConvolveAlgorithms( |
| 4873 | bool with_winograd_nonfused, int cc_major, int cc_minor, |
| 4874 | std::vector<dnn::AlgorithmDesc>* out_algorithms) { |
| 4875 | #if CUDNN_MAJOR >= 8 && (CUDNN_MINOR > 0 || CUDNN_PATCHLEVEL >= 4) |
| 4876 | cudnnOpsInferVersionCheck(); |
| 4877 | cudnnCnnInferVersionCheck(); |
| 4878 | #endif |
| 4879 | bool tensor_op_math_available = TensorOpMathAvailable(cc_major); |
| 4880 | out_algorithms->clear(); |
| 4881 | |
| 4882 | std::vector<dnn::AlgorithmDesc::Index> algo_types = { |
| 4883 | // clang-format off |
| 4884 | CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM, |
| 4885 | CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM, |
| 4886 | CUDNN_CONVOLUTION_FWD_ALGO_GEMM, |
| 4887 | CUDNN_CONVOLUTION_FWD_ALGO_DIRECT, |
| 4888 | CUDNN_CONVOLUTION_FWD_ALGO_FFT, |
| 4889 | CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD, |
| 4890 | // clang-format on |
| 4891 | }; |
| 4892 | if (CudnnEnvVar<FftTilingForward>::IsEnabled()) { |
| 4893 | algo_types.push_back(CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING); |
| 4894 | } |
| 4895 | if (CudnnEnvVar<WinogradNonfused>::IsEnabled() && with_winograd_nonfused) { |
| 4896 | algo_types.push_back(CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED); |
| 4897 | } |
| 4898 | |
| 4899 | // The algorithms are intentionally ordered for deterministic operation |
| 4900 | for (auto i : algo_types) { |
| 4901 | if (tensor_op_math_available) { |
| 4902 | out_algorithms->push_back({i, /*use_tensor_ops=*/true}); |
| 4903 | } |
| 4904 | out_algorithms->push_back({i, /*use_tensor_ops=*/false}); |
| 4905 | } |
| 4906 | |
| 4907 | return true; |
| 4908 | } |
| 4909 | |
| 4910 | bool CudnnSupport::GetRnnAlgorithms( |
| 4911 | std::vector<dnn::AlgorithmDesc>* out_algorithms) { |
nothing calls this directly
no test coverage detected