Skip to content

Commit

Permalink
[HIPIFY][ROCm#584][DNN][MIOpen] cuDNN -> MIOpen - Part 6
Browse files Browse the repository at this point in the history
+ Continued supporting hipification to MIOpen based on `miopen.h`
+ Updated the synthetic test `cudnn2miopen.cu` accordingly
  • Loading branch information
emankov committed Nov 23, 2022
1 parent efbac47 commit 65c84fd
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 18 deletions.
14 changes: 7 additions & 7 deletions src/CUDA2HIP_DNN_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DNN_FUNCTION_MAP {
{"cudnnGetTensorNdDescriptor", {"hipdnnGetTensorNdDescriptor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetTensorSizeInBytes", {"hipdnnGetTensorSizeInBytes", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnDestroyTensorDescriptor", {"hipdnnDestroyTensorDescriptor", "miopenDestroyTensorDescriptor", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnTransformTensor", {"hipdnnTransformTensor", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnTransformTensor", {"hipdnnTransformTensor", "miopenTransformTensor", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnTransformTensorEx", {"hipdnnTransformTensorEx", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnInitTransformDest", {"hipdnnInitTransformDest", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnCreateTensorTransformDescriptor", {"hipdnnCreateTensorTransformDescriptor", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
Expand All @@ -79,8 +79,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DNN_FUNCTION_MAP {
{"cudnnGetReductionIndicesSize", {"hipdnnGetReductionIndicesSize", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnGetReductionWorkspaceSize", {"hipdnnGetReductionWorkspaceSize", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnReduceTensor", {"hipdnnReduceTensor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnSetTensor", {"hipdnnSetTensor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnScaleTensor", {"hipdnnScaleTensor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnSetTensor", {"hipdnnSetTensor", "miopenSetTensor", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnScaleTensor", {"hipdnnScaleTensor", "miopenScaleTensor", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnDeriveNormTensorDescriptor", {"hipdnnDeriveNormTensorDescriptor", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},

// cuDNN Filter functions
Expand All @@ -95,20 +95,20 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DNN_FUNCTION_MAP {
{"cudnnReorderFilterAndBias", {"hipdnnReorderFilterAndBias", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},

// cuDNN Convolution functions
{"cudnnCreateConvolutionDescriptor", {"hipdnnCreateConvolutionDescriptor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnCreateConvolutionDescriptor", {"hipdnnCreateConvolutionDescriptor", "miopenCreateConvolutionDescriptor", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnSetConvolutionMathType", {"hipdnnSetConvolutionMathType", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolutionMathType", {"hipdnnGetConvolutionMathType", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnSetConvolutionGroupCount", {"hipdnnSetConvolutionGroupCount", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnSetConvolutionGroupCount", {"hipdnnSetConvolutionGroupCount", "miopenSetConvolutionGroupCount", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolutionGroupCount", {"hipdnnGetConvolutionGroupCount", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnSetConvolutionReorderType", {"hipdnnSetConvolutionReorderType", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionReorderType", {"hipdnnGetConvolutionReorderType", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnSetConvolution2dDescriptor", {"hipdnnSetConvolution2dDescriptor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolution2dDescriptor", {"hipdnnGetConvolution2dDescriptor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolution2dForwardOutputDim", {"hipdnnGetConvolution2dForwardOutputDim", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolution2dForwardOutputDim", {"hipdnnGetConvolution2dForwardOutputDim", "miopenGetConvolutionForwardOutputDim", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnSetConvolutionNdDescriptor", {"hipdnnSetConvolutionNdDescriptor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolutionNdDescriptor", {"hipdnnGetConvolutionNdDescriptor", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnGetConvolutionNdForwardOutputDim", {"hipdnnGetConvolutionNdForwardOutputDim", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnDestroyConvolutionDescriptor", {"hipdnnDestroyConvolutionDescriptor", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnDestroyConvolutionDescriptor", {"hipdnnDestroyConvolutionDescriptor", "miopenDestroyConvolutionDescriptor", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnGetConvolutionForwardAlgorithmMaxCount", {"hipdnnGetConvolutionForwardAlgorithmMaxCount", "", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnFindConvolutionForwardAlgorithm", {"hipdnnFindConvolutionForwardAlgorithm", "", CONV_LIB_FUNC, API_DNN, 2}},
{"cudnnFindConvolutionForwardAlgorithmEx", {"hipdnnFindConvolutionForwardAlgorithmEx", "", CONV_LIB_FUNC, API_DNN, 2}},
Expand Down
23 changes: 12 additions & 11 deletions src/CUDA2HIP_DNN_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DNN_TYPE_NAME_MAP {
{"CUDNN_SEV_ERROR", {"HIPDNN_SEV_ERROR", "", CONV_NUMERIC_LITERAL, API_DNN, 1, HIP_UNSUPPORTED}}, // 1
{"CUDNN_SEV_WARNING", {"HIPDNN_SEV_WARNING", "", CONV_NUMERIC_LITERAL, API_DNN, 1, HIP_UNSUPPORTED}}, // 2
{"CUDNN_SEV_INFO", {"HIPDNN_SEV_INFO", "", CONV_NUMERIC_LITERAL, API_DNN, 1, HIP_UNSUPPORTED}}, // 3
{"cudnnConvolutionFwdAlgo_t", {"hipdnnConvolutionFwdAlgo_t", "", CONV_TYPE, API_DNN, 1}},
{"CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 0
{"CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 1
{"CUDNN_CONVOLUTION_FWD_ALGO_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 2
{"CUDNN_CONVOLUTION_FWD_ALGO_DIRECT", {"HIPDNN_CONVOLUTION_FWD_ALGO_DIRECT", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 3
{"CUDNN_CONVOLUTION_FWD_ALGO_FFT", {"HIPDNN_CONVOLUTION_FWD_ALGO_FFT", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 4
{"CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", {"HIPDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 5
{"CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", {"HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 6
{"CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", {"HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 7
{"CUDNN_CONVOLUTION_FWD_ALGO_COUNT", {"HIPDNN_CONVOLUTION_FWD_ALGO_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 8
{"cudnnConvolutionFwdAlgo_t", {"hipdnnConvolutionFwdAlgo_t", "miopenConvFwdAlgorithm_t", CONV_TYPE, API_DNN, 1}},
{"CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM", "miopenConvolutionFwdAlgoImplicitGEMM", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 0
{"CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM", "", CONV_NUMERIC_LITERAL, API_DNN, 1, ROC_UNSUPPORTED}}, // 1
{"CUDNN_CONVOLUTION_FWD_ALGO_GEMM", {"HIPDNN_CONVOLUTION_FWD_ALGO_GEMM", "miopenConvolutionFwdAlgoGEMM", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 2
{"CUDNN_CONVOLUTION_FWD_ALGO_DIRECT", {"HIPDNN_CONVOLUTION_FWD_ALGO_DIRECT", "miopenConvolutionFwdAlgoDirect", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 3
{"CUDNN_CONVOLUTION_FWD_ALGO_FFT", {"HIPDNN_CONVOLUTION_FWD_ALGO_FFT", "miopenConvolutionFwdAlgoFFT", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 4
{"CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", {"HIPDNN_CONVOLUTION_FWD_ALGO_FFT_TILING", "", CONV_NUMERIC_LITERAL, API_DNN, 1, ROC_UNSUPPORTED}}, // 5
{"CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", {"HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD", "miopenConvolutionFwdAlgoWinograd", CONV_NUMERIC_LITERAL, API_DNN, 1}}, // 6
{"CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", {"HIPDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED", "", CONV_NUMERIC_LITERAL, API_DNN, 1, ROC_UNSUPPORTED}}, // 7
{"CUDNN_CONVOLUTION_FWD_ALGO_COUNT", {"HIPDNN_CONVOLUTION_FWD_ALGO_COUNT", "", CONV_NUMERIC_LITERAL, API_DNN, 1, ROC_UNSUPPORTED}}, // 8
{"cudnnConvolutionFwdPreference_t", {"hipdnnConvolutionFwdPreference_t", "", CONV_TYPE, API_DNN, 1, CUDA_DEPRECATED | CUDA_REMOVED}},
{"CUDNN_CONVOLUTION_FWD_NO_WORKSPACE", {"HIPDNN_CONVOLUTION_FWD_NO_WORKSPACE", "", CONV_NUMERIC_LITERAL, API_DNN, 1, CUDA_DEPRECATED | CUDA_REMOVED}}, // 0
{"CUDNN_CONVOLUTION_FWD_PREFER_FASTEST", {"HIPDNN_CONVOLUTION_FWD_PREFER_FASTEST", "", CONV_NUMERIC_LITERAL, API_DNN, 1, CUDA_DEPRECATED | CUDA_REMOVED}}, // 1
Expand Down Expand Up @@ -781,7 +781,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DNN_TYPE_NAME_MAP {
{"cudnnPoolingStruct", {"hipdnnPoolingStruct", "", CONV_TYPE, API_DNN, 1, HIP_UNSUPPORTED}},
{"cudnnPoolingDescriptor_t", {"hipdnnPoolingDescriptor_t", "miopenPoolingDescriptor_t", CONV_TYPE, API_DNN, 1}},
{"cudnnFilterStruct", {"hipdnnFilterStruct", "", CONV_TYPE, API_DNN, 1, HIP_UNSUPPORTED}},
{"cudnnFilterDescriptor_t", {"hipdnnFilterDescriptor_t", "", CONV_TYPE, API_DNN, 1}},
// NOTE: both cudnnFilterDescriptor_t and cudnnTensorDescriptor_t are mapped to miopenTensorDescriptor_t
{"cudnnFilterDescriptor_t", {"hipdnnFilterDescriptor_t", "miopenTensorDescriptor_t", CONV_TYPE, API_DNN, 1}},
{"cudnnLRNStruct", {"hipdnnLRNStruct", "", CONV_TYPE, API_DNN, 1, HIP_UNSUPPORTED}},
{"cudnnLRNDescriptor_t", {"hipdnnLRNDescriptor_t", "miopenLRNDescriptor_t", CONV_TYPE, API_DNN, 1}},
{"cudnnActivationStruct", {"hipdnnActivationStruct", "", CONV_TYPE, API_DNN, 1, HIP_UNSUPPORTED}},
Expand Down
Loading

0 comments on commit 65c84fd

Please sign in to comment.