Skip to content

Commit

Permalink
[HIPIFY] Sync with CUDA 12.2.0 - Part 1 - tests
Browse files Browse the repository at this point in the history
+ Updated the changed Driver types and the corresponding synthetic tests
+ Updated the regenerated `hipify-perl` and docs accordingly
  • Loading branch information
emankov committed Jul 4, 2023
1 parent eed4907 commit 98f9b7b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 10 deletions.
7 changes: 6 additions & 1 deletion bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ my %removed_funcs = (
"CUDNN_CONVOLUTION_BWD_FILTER_NO_WORKSPACE" => "8.0.1",
"CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT" => "8.0.1",
"CUDNN_CONVOLUTION_BWD_DATA_PREFER_FASTEST" => "8.0.1",
"CUDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE" => "8.0.1"
"CUDNN_CONVOLUTION_BWD_DATA_NO_WORKSPACE" => "8.0.1",
"CUDA_MEM_ALLOC_NODE_PARAMS_st" => "12.2"
);

my %experimental_funcs = (
Expand Down Expand Up @@ -3637,6 +3638,8 @@ sub simpleSubstitutions {
subst("CUDA_MEMSET_NODE_PARAMS_v1", "hipMemsetParams", "type");
subst("CUDA_MEM_ALLOC_NODE_PARAMS", "hipMemAllocNodeParams", "type");
subst("CUDA_MEM_ALLOC_NODE_PARAMS_st", "hipMemAllocNodeParams", "type");
subst("CUDA_MEM_ALLOC_NODE_PARAMS_v1", "hipMemAllocNodeParams", "type");
subst("CUDA_MEM_ALLOC_NODE_PARAMS_v1_st", "hipMemAllocNodeParams", "type");
subst("CUDA_RESOURCE_DESC", "HIP_RESOURCE_DESC", "type");
subst("CUDA_RESOURCE_DESC_st", "HIP_RESOURCE_DESC_st", "type");
subst("CUDA_RESOURCE_DESC_v1", "HIP_RESOURCE_DESC", "type");
Expand Down Expand Up @@ -8615,6 +8618,8 @@ sub warnUnsupportedFunctions {
"CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS",
"CUDA_NVSCISYNC_ATTR_WAIT",
"CUDA_NVSCISYNC_ATTR_SIGNAL",
"CUDA_MEM_ALLOC_NODE_PARAMS_v2_st",
"CUDA_MEM_ALLOC_NODE_PARAMS_v2",
"CUDA_MEMCPY3D_PEER_v1",
"CUDA_MEMCPY3D_PEER_st",
"CUDA_MEMCPY3D_PEER",
Expand Down
6 changes: 5 additions & 1 deletion docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@
|`CUDA_MEMSET_NODE_PARAMS_st`|10.0| | |`hipMemsetParams`|4.3.0| | | |
|`CUDA_MEMSET_NODE_PARAMS_v1`|11.3| | |`hipMemsetParams`|4.3.0| | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS`|11.4| | |`hipMemAllocNodeParams`|5.5.0| | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS_st`|11.4| | |`hipMemAllocNodeParams`|5.5.0| | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS_st`|11.4| |12.2|`hipMemAllocNodeParams`|5.5.0| | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS_v1`|12.2| | |`hipMemAllocNodeParams`|5.5.0| | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS_v1_st`|12.2| | |`hipMemAllocNodeParams`|5.5.0| | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS_v2`|12.2| | | | | | | |
|`CUDA_MEM_ALLOC_NODE_PARAMS_v2_st`|12.2| | | | | | | |
|`CUDA_NVSCISYNC_ATTR_SIGNAL`|10.2| | | | | | | |
|`CUDA_NVSCISYNC_ATTR_WAIT`|10.2| | | | | | | |
|`CUDA_POINTER_ATTRIBUTE_ACCESS_FLAGS`|11.1| | | | | | | |
Expand Down
12 changes: 10 additions & 2 deletions src/CUDA2HIP_Driver_API_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,12 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_TYPE_NAME_MAP {
{"CUexecAffinityParam_v1", {"hipExecAffinityParam", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES, HIP_UNSUPPORTED}},

// cudaMemAllocNodeParams
{"CUDA_MEM_ALLOC_NODE_PARAMS_st", {"hipMemAllocNodeParams", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES}},
{"CUDA_MEM_ALLOC_NODE_PARAMS_st", {"hipMemAllocNodeParams", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES, CUDA_REMOVED}},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v1_st", {"hipMemAllocNodeParams", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES}},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v2_st", {"hipMemAllocNodeParams_v2", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES, HIP_UNSUPPORTED}},
{"CUDA_MEM_ALLOC_NODE_PARAMS", {"hipMemAllocNodeParams", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES}},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v1", {"hipMemAllocNodeParams", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES}},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v2", {"hipMemAllocNodeParams_v2", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES, HIP_UNSUPPORTED}},

// cudaArrayMemoryRequirements
{"CUDA_ARRAY_MEMORY_REQUIREMENTS_st", {"hipArrayMemoryRequirements", "", CONV_TYPE, API_DRIVER, SEC::DATA_TYPES, HIP_UNSUPPORTED}},
Expand Down Expand Up @@ -3147,7 +3151,7 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_DRIVER_TYPE_NAME_VER_MAP {
{"CUDA_ERROR_MPS_SERVER_NOT_READY", {CUDA_114, CUDA_0, CUDA_0 }},
{"CUDA_ERROR_MPS_MAX_CLIENTS_REACHED", {CUDA_114, CUDA_0, CUDA_0 }},
{"CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED", {CUDA_114, CUDA_0, CUDA_0 }},
{"CUDA_MEM_ALLOC_NODE_PARAMS_st", {CUDA_114, CUDA_0, CUDA_0 }},
{"CUDA_MEM_ALLOC_NODE_PARAMS_st", {CUDA_114, CUDA_0, CUDA_122}},
{"CUDA_MEM_ALLOC_NODE_PARAMS", {CUDA_114, CUDA_0, CUDA_0 }},
{"CUgraphMem_attribute", {CUDA_114, CUDA_0, CUDA_0 }},
{"CUgraphMem_attribute_enum", {CUDA_114, CUDA_0, CUDA_0 }},
Expand Down Expand Up @@ -3405,6 +3409,10 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_DRIVER_TYPE_NAME_VER_MAP {
{"CU_COREDUMP_FILE", {CUDA_121, CUDA_0, CUDA_0 }},
{"CU_COREDUMP_PIPE", {CUDA_121, CUDA_0, CUDA_0 }},
{"CU_COREDUMP_MAX", {CUDA_121, CUDA_0, CUDA_0 }},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v1_st", {CUDA_122, CUDA_0, CUDA_0 }},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v1", {CUDA_122, CUDA_0, CUDA_0 }},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v2_st", {CUDA_122, CUDA_0, CUDA_0 }},
{"CUDA_MEM_ALLOC_NODE_PARAMS_v2", {CUDA_122, CUDA_0, CUDA_0 }},
};

const std::map<llvm::StringRef, hipAPIversions> HIP_DRIVER_TYPE_NAME_VER_MAP {
Expand Down
1 change: 1 addition & 0 deletions src/Statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ std::string Statistics::getCudaVersion(const cudaVersions& ver) {
case CUDA_118: return "11.8";
case CUDA_120: return "12.0";
case CUDA_121: return "12.1";
case CUDA_122: return "12.2";
case CUDNN_10: return "1.0.0";
case CUDNN_20: return "2.0.0";
case CUDNN_30: return "3.0.0";
Expand Down
3 changes: 2 additions & 1 deletion src/Statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ enum cudaVersions {
CUDA_118 = 11080,
CUDA_120 = 12000,
CUDA_121 = 12010,
CUDA_LATEST = CUDA_121,
CUDA_122 = 12020,
CUDA_LATEST = CUDA_122,
CUDNN_10 = 100,
CUDNN_20 = 200,
CUDNN_30 = 300,
Expand Down
9 changes: 6 additions & 3 deletions tests/unit_tests/synthetic/driver_functions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,11 @@ int main() {
result = cuGraphDebugDotPrint(graph, name.c_str(), flags);
#endif

#if CUDA_VERSION >= 11040 && CUDA_VERSION < 12020
// CHECK: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS_st;
CUDA_MEM_ALLOC_NODE_PARAMS_st MEM_ALLOC_NODE_PARAMS_st;
#endif

#if CUDA_VERSION >= 11040
// CUDA: CUresult CUDAAPI cuGraphInstantiateWithFlags(CUgraphExec *phGraphExec, CUgraph hGraph, unsigned long long flags);
// HIP: hipError_t hipGraphInstantiateWithFlags(hipGraphExec_t* pGraphExec, hipGraph_t graph, unsigned long long flags);
Expand All @@ -810,9 +815,7 @@ int main() {
// CHECK: result = hipDeviceGraphMemTrim(device);
result = cuDeviceGraphMemTrim(device);

// CHECK: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS_st;
// CHECK-NEXT: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS;
CUDA_MEM_ALLOC_NODE_PARAMS_st MEM_ALLOC_NODE_PARAMS_st;
// CHECK: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS;
CUDA_MEM_ALLOC_NODE_PARAMS MEM_ALLOC_NODE_PARAMS;

// CUDA: CUresult CUDAAPI cuGraphAddMemAllocNode(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS *nodeParams);
Expand Down
14 changes: 12 additions & 2 deletions tests/unit_tests/synthetic/driver_structs.cu
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,20 @@ int main() {
#endif

#if CUDA_VERSION >= 11040
// CHECK: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS;
CUDA_MEM_ALLOC_NODE_PARAMS MEM_ALLOC_NODE_PARAMS;
#endif

#if CUDA_VERSION >= 11040 && CUDA_VERSION < 12020
// CHECK: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS_st;
// CHECK-NEXT: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS;
CUDA_MEM_ALLOC_NODE_PARAMS_st MEM_ALLOC_NODE_PARAMS_st;
CUDA_MEM_ALLOC_NODE_PARAMS MEM_ALLOC_NODE_PARAMS;
#endif

#if CUDA_VERSION >= 12020
// CHECK: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS_v1_st;
// CHECK-NEXT: hipMemAllocNodeParams MEM_ALLOC_NODE_PARAMS_v1;
CUDA_MEM_ALLOC_NODE_PARAMS_v1_st MEM_ALLOC_NODE_PARAMS_v1_st;
CUDA_MEM_ALLOC_NODE_PARAMS_v1 MEM_ALLOC_NODE_PARAMS_v1;
#endif

return 0;
Expand Down

0 comments on commit 98f9b7b

Please sign in to comment.