Skip to content

Commit

Permalink
Merge pull request #1657 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][#584][#1624][MIOpen] Support for backend `graphAPI` direct translation from `cuDNN` to `MIOpen` - Part 10
  • Loading branch information
emankov authored Sep 19, 2024
2 parents 4554479 + 4f37d7e commit c0a89cd
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 51 deletions.
16 changes: 16 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,12 @@ sub rocSubstitutions {
subst("cublasZtrsv_v2", "rocblas_ztrsv", "library");
subst("cudnnActivationBackward", "miopenActivationBackward", "library");
subst("cudnnActivationForward", "miopenActivationForward", "library");
subst("cudnnBackendCreateDescriptor", "miopenBackendCreateDescriptor", "library");
subst("cudnnBackendDestroyDescriptor", "miopenBackendDestroyDescriptor", "library");
subst("cudnnBackendExecute", "miopenBackendExecute", "library");
subst("cudnnBackendFinalize", "miopenBackendFinalize", "library");
subst("cudnnBackendGetAttribute", "miopenBackendGetAttribute", "library");
subst("cudnnBackendSetAttribute", "miopenBackendSetAttribute", "library");
subst("cudnnBatchNormalizationBackward", "miopenBatchNormalizationBackward", "library");
subst("cudnnBatchNormalizationForwardInference", "miopenBatchNormalizationForwardInference", "library");
subst("cudnnBatchNormalizationForwardTraining", "miopenBatchNormalizationForwardTraining", "library");
Expand Down Expand Up @@ -2668,6 +2674,7 @@ sub rocSubstitutions {
subst("cudnnBackendAttributeType_t", "miopenBackendAttributeType_t", "type");
subst("cudnnBackendDescriptorType_t", "miopenBackendDescriptorType_t", "type");
subst("cudnnBackendDescriptor_t", "miopenBackendDescriptor_t", "type");
subst("cudnnBackendHeurMode_t", "miopenBackendHeurMode_t", "type");
subst("cudnnBatchNormMode_t", "miopenBatchNormMode_t", "type");
subst("cudnnCTCLossAlgo_t", "miopenCTCLossAlgo_t", "type");
subst("cudnnCTCLossDescriptor_t", "miopenCTCLossDescriptor_t", "type");
Expand Down Expand Up @@ -2701,6 +2708,7 @@ sub rocSubstitutions {
subst("cudnnReduceTensorDescriptor_t", "miopenReduceTensorDescriptor_t", "type");
subst("cudnnReduceTensorIndices_t", "miopenReduceTensorIndices_t", "type");
subst("cudnnReduceTensorOp_t", "miopenReduceTensorOp_t", "type");
subst("cudnnRngDistribution_t", "miopenRngDistribution_t", "type");
subst("cudnnSoftmaxAlgorithm_t", "miopenSoftmaxAlgorithm_t", "type");
subst("cudnnSoftmaxMode_t", "miopenSoftmaxMode_t", "type");
subst("cudnnStatus_t", "miopenStatus_t", "type");
Expand Down Expand Up @@ -3086,6 +3094,11 @@ sub rocSubstitutions {
subst("CUDNN_DATA_INT8", "miopenInt8", "numeric_literal");
subst("CUDNN_DATA_INT8x4", "miopenInt8x4", "numeric_literal");
subst("CUDNN_GRU", "miopenGRU", "numeric_literal");
subst("CUDNN_HEUR_MODES_COUNT", "MIOPEN_HEUR_MODES_COUNT", "numeric_literal");
subst("CUDNN_HEUR_MODE_A", "MIOPEN_HEUR_MODE_A", "numeric_literal");
subst("CUDNN_HEUR_MODE_B", "MIOPEN_HEUR_MODE_B", "numeric_literal");
subst("CUDNN_HEUR_MODE_FALLBACK", "MIOPEN_HEUR_MODE_FALLBACK", "numeric_literal");
subst("CUDNN_HEUR_MODE_INSTANT", "MIOPEN_HEUR_MODE_INSTANT", "numeric_literal");
subst("CUDNN_LINEAR_INPUT", "miopenRNNlinear", "numeric_literal");
subst("CUDNN_LRN_CROSS_CHANNEL_DIM1", "miopenLRNCrossChannel", "numeric_literal");
subst("CUDNN_LSTM", "miopenLSTM", "numeric_literal");
Expand Down Expand Up @@ -3156,6 +3169,9 @@ sub rocSubstitutions {
subst("CUDNN_REDUCE_TENSOR_NORM1", "MIOPEN_REDUCE_TENSOR_NORM1", "numeric_literal");
subst("CUDNN_REDUCE_TENSOR_NORM2", "MIOPEN_REDUCE_TENSOR_NORM2", "numeric_literal");
subst("CUDNN_REDUCE_TENSOR_NO_INDICES", "MIOPEN_REDUCE_TENSOR_NO_INDICES", "numeric_literal");
subst("CUDNN_RNG_DISTRIBUTION_BERNOULLI", "MIOPEN_RNG_DISTRIBUTION_BERNOULLI", "numeric_literal");
subst("CUDNN_RNG_DISTRIBUTION_NORMAL", "MIOPEN_RNG_DISTRIBUTION_NORMAL", "numeric_literal");
subst("CUDNN_RNG_DISTRIBUTION_UNIFORM", "MIOPEN_RNG_DISTRIBUTION_UNIFORM", "numeric_literal");
subst("CUDNN_RNN_ALGO_STANDARD", "miopenRNNdefault", "numeric_literal");
subst("CUDNN_RNN_DOUBLE_BIAS", "miopenRNNwithBias", "numeric_literal");
subst("CUDNN_RNN_NO_BIAS", "miopenRNNNoBias", "numeric_literal");
Expand Down
32 changes: 16 additions & 16 deletions docs/tables/CUDNN_API_supported_by_HIP_and_MIOPEN.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@
|`CUDNN_GENSTATS_SUM_SQSUM`|8.0.1| | | | | | | | | | | | | | | |
|`CUDNN_GROUP_NORM`|8.5.0| | | | | | | | | | | | | | | |
|`CUDNN_GRU`|5.0.0| | | |`HIPDNN_GRU`| | | | | |`miopenGRU`| | | | | |
|`CUDNN_HEUR_MODES_COUNT`|8.0.1| | | | | | | | | | | | | | | |
|`CUDNN_HEUR_MODE_A`|8.3.0| | | | | | | | | | | | | | | |
|`CUDNN_HEUR_MODE_B`|8.0.1| | | | | | | | | | | | | | | |
|`CUDNN_HEUR_MODE_FALLBACK`|8.3.0| | | | | | | | | | | | | | | |
|`CUDNN_HEUR_MODE_INSTANT`|8.0.1| | | | | | | | | | | | | | | |
|`CUDNN_HEUR_MODES_COUNT`|8.0.1| | | | | | | | | |`MIOPEN_HEUR_MODES_COUNT`| | | | | |
|`CUDNN_HEUR_MODE_A`|8.3.0| | | | | | | | | |`MIOPEN_HEUR_MODE_A`| | | | | |
|`CUDNN_HEUR_MODE_B`|8.0.1| | | | | | | | | |`MIOPEN_HEUR_MODE_B`| | | | | |
|`CUDNN_HEUR_MODE_FALLBACK`|8.3.0| | | | | | | | | |`MIOPEN_HEUR_MODE_FALLBACK`| | | | | |
|`CUDNN_HEUR_MODE_INSTANT`|8.0.1| | | | | | | | | |`MIOPEN_HEUR_MODE_INSTANT`| | | | | |
|`CUDNN_INSTANCE_NORM`|8.5.0| | | | | | | | | | | | | | | |
|`CUDNN_KNOB_TYPE_ARRAY_SIZE_PER_THREAD`|8.9.0| | | | | | | | | | | | | | | |
|`CUDNN_KNOB_TYPE_BLOCK_SIZE`|8.8.0| | | | | | | | | | | | | | | |
Expand Down Expand Up @@ -605,9 +605,9 @@
|`CUDNN_RESAMPLE_MAXPOOL`|8.3.0| | | | | | | | | | | | | | | |
|`CUDNN_RESAMPLE_NEAREST`|8.3.0| | | | | | | | | | | | | | | |
|`CUDNN_RMS_NORM`|8.9.6| | | | | | | | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_BERNOULLI`|8.7.0| | | | | | | | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_NORMAL`|8.7.0| | | | | | | | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_UNIFORM`|8.7.0| | | | | | | | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_BERNOULLI`|8.7.0| | | | | | | | | |`MIOPEN_RNG_DISTRIBUTION_BERNOULLI`| | | | | |
|`CUDNN_RNG_DISTRIBUTION_NORMAL`|8.7.0| | | | | | | | | |`MIOPEN_RNG_DISTRIBUTION_NORMAL`| | | | | |
|`CUDNN_RNG_DISTRIBUTION_UNIFORM`|8.7.0| | | | | | | | | |`MIOPEN_RNG_DISTRIBUTION_UNIFORM`| | | | | |
|`CUDNN_RNN_ALGO_COUNT`|7.1.3| | | | | | | | | | | | | | | |
|`CUDNN_RNN_ALGO_PERSIST_DYNAMIC`|6.0.0| | | |`HIPDNN_RNN_ALGO_PERSIST_DYNAMIC`| | | | | | | | | | | |
|`CUDNN_RNN_ALGO_PERSIST_STATIC`|6.0.0| | | |`HIPDNN_RNN_ALGO_PERSIST_STATIC`| | | | | | | | | | | |
Expand Down Expand Up @@ -765,7 +765,7 @@
|`cudnnBackendBehaviorNote_t`|8.2.0| | | | | | | | | | | | | | | |
|`cudnnBackendDescriptorType_t`|8.0.1| | | | | | | | | |`miopenBackendDescriptorType_t`| | | | | |
|`cudnnBackendDescriptor_t`|8.0.1| | | | | | | | | |`miopenBackendDescriptor_t`| | | | | |
|`cudnnBackendHeurMode_t`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendHeurMode_t`|8.0.1| | | | | | | | | |`miopenBackendHeurMode_t`| | | | | |
|`cudnnBackendKnobType_t`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendLayoutType_t`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendNormFwdPhase_t`|8.5.0| | | | | | | | | | | | | | | |
Expand Down Expand Up @@ -861,7 +861,7 @@
|`cudnnReduceTensorStruct`|6.0.0|9.0.0| | | | | | | | | | | | | | |
|`cudnnReorderType_t`|7.6.0|9.0.0| | | | | | | | | | | | | | |
|`cudnnResampleMode_t`|8.3.0| | | | | | | | | | | | | | | |
|`cudnnRngDistribution_t`|8.7.0| | | | | | | | | | | | | | | |
|`cudnnRngDistribution_t`|8.7.0| | | | | | | | | |`miopenRngDistribution_t`| | | | | |
|`cudnnRuntimeTag_t`|7.0.5|9.0.0| | | | | | | | | | | | | | |
|`cudnnSamplerType_t`|5.0.0| | | | | | | | | | | | | | | |
|`cudnnSeqDataAxis_t`|7.5.0| | | | | | | | | | | | | | | |
Expand Down Expand Up @@ -893,13 +893,13 @@
|`cudnnAdvInferVersionCheck`|8.0.1| | |9.0.0| | | | | | | | | | | | |
|`cudnnAdvTrainVersionCheck`|8.0.1| | |9.0.0| | | | | | | | | | | | |
|`cudnnAdvVersionCheck`|9.0.0| | | | | | | | | | | | | | | |
|`cudnnBackendCreateDescriptor`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendDestroyDescriptor`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendExecute`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendFinalize`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendGetAttribute`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendCreateDescriptor`|8.0.1| | | | | | | | | |`miopenBackendCreateDescriptor`| | | | | |
|`cudnnBackendDestroyDescriptor`|8.0.1| | | | | | | | | |`miopenBackendDestroyDescriptor`| | | | | |
|`cudnnBackendExecute`|8.0.1| | | | | | | | | |`miopenBackendExecute`| | | | | |
|`cudnnBackendFinalize`|8.0.1| | | | | | | | | |`miopenBackendFinalize`| | | | | |
|`cudnnBackendGetAttribute`|8.0.1| | | | | | | | | |`miopenBackendGetAttribute`| | | | | |
|`cudnnBackendInitialize`|8.0.1|9.3.0| | | | | | | | | | | | | | |
|`cudnnBackendSetAttribute`|8.0.1| | | | | | | | | | | | | | | |
|`cudnnBackendSetAttribute`|8.0.1| | | | | | | | | |`miopenBackendSetAttribute`| | | | | |
|`cudnnBatchNormalizationBackward`|4.0.0|9.0.0| | |`hipdnnBatchNormalizationBackward`| | | | | |`miopenBatchNormalizationBackward`| | | | | |
|`cudnnBatchNormalizationBackwardEx`|7.4.1|9.0.0| | | | | | | | | | | | | | |
|`cudnnBatchNormalizationForwardInference`|4.0.0|9.0.0| | |`hipdnnBatchNormalizationForwardInference`| | | | | |`miopenBatchNormalizationForwardInference`| | | | | |
Expand Down
32 changes: 16 additions & 16 deletions docs/tables/CUDNN_API_supported_by_MIOPEN.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@
|`CUDNN_GENSTATS_SUM_SQSUM`|8.0.1| | | | | | | | | |
|`CUDNN_GROUP_NORM`|8.5.0| | | | | | | | | |
|`CUDNN_GRU`|5.0.0| | | |`miopenGRU`| | | | | |
|`CUDNN_HEUR_MODES_COUNT`|8.0.1| | | | | | | | | |
|`CUDNN_HEUR_MODE_A`|8.3.0| | | | | | | | | |
|`CUDNN_HEUR_MODE_B`|8.0.1| | | | | | | | | |
|`CUDNN_HEUR_MODE_FALLBACK`|8.3.0| | | | | | | | | |
|`CUDNN_HEUR_MODE_INSTANT`|8.0.1| | | | | | | | | |
|`CUDNN_HEUR_MODES_COUNT`|8.0.1| | | |`MIOPEN_HEUR_MODES_COUNT`| | | | | |
|`CUDNN_HEUR_MODE_A`|8.3.0| | | |`MIOPEN_HEUR_MODE_A`| | | | | |
|`CUDNN_HEUR_MODE_B`|8.0.1| | | |`MIOPEN_HEUR_MODE_B`| | | | | |
|`CUDNN_HEUR_MODE_FALLBACK`|8.3.0| | | |`MIOPEN_HEUR_MODE_FALLBACK`| | | | | |
|`CUDNN_HEUR_MODE_INSTANT`|8.0.1| | | |`MIOPEN_HEUR_MODE_INSTANT`| | | | | |
|`CUDNN_INSTANCE_NORM`|8.5.0| | | | | | | | | |
|`CUDNN_KNOB_TYPE_ARRAY_SIZE_PER_THREAD`|8.9.0| | | | | | | | | |
|`CUDNN_KNOB_TYPE_BLOCK_SIZE`|8.8.0| | | | | | | | | |
Expand Down Expand Up @@ -605,9 +605,9 @@
|`CUDNN_RESAMPLE_MAXPOOL`|8.3.0| | | | | | | | | |
|`CUDNN_RESAMPLE_NEAREST`|8.3.0| | | | | | | | | |
|`CUDNN_RMS_NORM`|8.9.6| | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_BERNOULLI`|8.7.0| | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_NORMAL`|8.7.0| | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_UNIFORM`|8.7.0| | | | | | | | | |
|`CUDNN_RNG_DISTRIBUTION_BERNOULLI`|8.7.0| | | |`MIOPEN_RNG_DISTRIBUTION_BERNOULLI`| | | | | |
|`CUDNN_RNG_DISTRIBUTION_NORMAL`|8.7.0| | | |`MIOPEN_RNG_DISTRIBUTION_NORMAL`| | | | | |
|`CUDNN_RNG_DISTRIBUTION_UNIFORM`|8.7.0| | | |`MIOPEN_RNG_DISTRIBUTION_UNIFORM`| | | | | |
|`CUDNN_RNN_ALGO_COUNT`|7.1.3| | | | | | | | | |
|`CUDNN_RNN_ALGO_PERSIST_DYNAMIC`|6.0.0| | | | | | | | | |
|`CUDNN_RNN_ALGO_PERSIST_STATIC`|6.0.0| | | | | | | | | |
Expand Down Expand Up @@ -765,7 +765,7 @@
|`cudnnBackendBehaviorNote_t`|8.2.0| | | | | | | | | |
|`cudnnBackendDescriptorType_t`|8.0.1| | | |`miopenBackendDescriptorType_t`| | | | | |
|`cudnnBackendDescriptor_t`|8.0.1| | | |`miopenBackendDescriptor_t`| | | | | |
|`cudnnBackendHeurMode_t`|8.0.1| | | | | | | | | |
|`cudnnBackendHeurMode_t`|8.0.1| | | |`miopenBackendHeurMode_t`| | | | | |
|`cudnnBackendKnobType_t`|8.0.1| | | | | | | | | |
|`cudnnBackendLayoutType_t`|8.0.1| | | | | | | | | |
|`cudnnBackendNormFwdPhase_t`|8.5.0| | | | | | | | | |
Expand Down Expand Up @@ -861,7 +861,7 @@
|`cudnnReduceTensorStruct`|6.0.0|9.0.0| | | | | | | | |
|`cudnnReorderType_t`|7.6.0|9.0.0| | | | | | | | |
|`cudnnResampleMode_t`|8.3.0| | | | | | | | | |
|`cudnnRngDistribution_t`|8.7.0| | | | | | | | | |
|`cudnnRngDistribution_t`|8.7.0| | | |`miopenRngDistribution_t`| | | | | |
|`cudnnRuntimeTag_t`|7.0.5|9.0.0| | | | | | | | |
|`cudnnSamplerType_t`|5.0.0| | | | | | | | | |
|`cudnnSeqDataAxis_t`|7.5.0| | | | | | | | | |
Expand Down Expand Up @@ -893,13 +893,13 @@
|`cudnnAdvInferVersionCheck`|8.0.1| | |9.0.0| | | | | | |
|`cudnnAdvTrainVersionCheck`|8.0.1| | |9.0.0| | | | | | |
|`cudnnAdvVersionCheck`|9.0.0| | | | | | | | | |
|`cudnnBackendCreateDescriptor`|8.0.1| | | | | | | | | |
|`cudnnBackendDestroyDescriptor`|8.0.1| | | | | | | | | |
|`cudnnBackendExecute`|8.0.1| | | | | | | | | |
|`cudnnBackendFinalize`|8.0.1| | | | | | | | | |
|`cudnnBackendGetAttribute`|8.0.1| | | | | | | | | |
|`cudnnBackendCreateDescriptor`|8.0.1| | | |`miopenBackendCreateDescriptor`| | | | | |
|`cudnnBackendDestroyDescriptor`|8.0.1| | | |`miopenBackendDestroyDescriptor`| | | | | |
|`cudnnBackendExecute`|8.0.1| | | |`miopenBackendExecute`| | | | | |
|`cudnnBackendFinalize`|8.0.1| | | |`miopenBackendFinalize`| | | | | |
|`cudnnBackendGetAttribute`|8.0.1| | | |`miopenBackendGetAttribute`| | | | | |
|`cudnnBackendInitialize`|8.0.1|9.3.0| | | | | | | | |
|`cudnnBackendSetAttribute`|8.0.1| | | | | | | | | |
|`cudnnBackendSetAttribute`|8.0.1| | | |`miopenBackendSetAttribute`| | | | | |
|`cudnnBatchNormalizationBackward`|4.0.0|9.0.0| | |`miopenBatchNormalizationBackward`| | | | | |
|`cudnnBatchNormalizationBackwardEx`|7.4.1|9.0.0| | | | | | | | |
|`cudnnBatchNormalizationForwardInference`|4.0.0|9.0.0| | |`miopenBatchNormalizationForwardInference`| | | | | |
Expand Down
15 changes: 8 additions & 7 deletions src/CUDA2HIP_DNN_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,14 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DNN_FUNCTION_MAP {
{"cudnnFusedOpsExecute", {"hipdnnFusedOpsExecute", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED | CUDA_DEPRECATED}},

// cuDNN Backend
{"cudnnBackendCreateDescriptor", {"hipdnnBackendCreateDescriptor", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendDestroyDescriptor", {"hipdnnBackendDestroyDescriptor", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendInitialize", {"hipdnnBackendInitialize", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendFinalize", {"hipdnnBackendFinalize", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendSetAttribute", {"hipdnnBackendSetAttribute", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendGetAttribute", {"hipdnnBackendGetAttribute", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendExecute", {"hipdnnBackendExecute", "", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendCreateDescriptor", {"hipdnnBackendCreateDescriptor", "miopenBackendCreateDescriptor", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnBackendDestroyDescriptor", {"hipdnnBackendDestroyDescriptor", "miopenBackendDestroyDescriptor", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
// NOTE: cudnnBackendInitialize and miopenBackendInitialize have different signatures
{"cudnnBackendInitialize", {"hipdnnBackendInitialize", "miopenBackendInitialize", CONV_LIB_FUNC, API_DNN, 2, UNSUPPORTED}},
{"cudnnBackendFinalize", {"hipdnnBackendFinalize", "miopenBackendFinalize", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnBackendSetAttribute", {"hipdnnBackendSetAttribute", "miopenBackendSetAttribute", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnBackendGetAttribute", {"hipdnnBackendGetAttribute", "miopenBackendGetAttribute", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
{"cudnnBackendExecute", {"hipdnnBackendExecute", "miopenBackendExecute", CONV_LIB_FUNC, API_DNN, 2, HIP_UNSUPPORTED}},
};

const std::map<llvm::StringRef, cudaAPIversions> CUDA_DNN_FUNCTION_VER_MAP {
Expand Down
Loading

0 comments on commit c0a89cd

Please sign in to comment.