Skip to content

Commit

Permalink
Merge pull request #1789 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][SWDEV-501194][RT][6.4.0] Added experimental support for `hipGraphBatchMemOpNode(G|S)etParams` API
  • Loading branch information
emankov authored Dec 12, 2024
2 parents 43349da + 3377525 commit 1156258
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
6 changes: 4 additions & 2 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,8 @@ my %removed_funcs = (
my %experimental_funcs = (
"cuStreamBatchMemOp_v2" => "6.4.0",
"cuStreamBatchMemOp" => "6.4.0",
"cuGraphBatchMemOpNodeSetParams" => "6.4.0",
"cuGraphBatchMemOpNodeGetParams" => "6.4.0",
"cuGraphAddBatchMemOpNode" => "6.4.0",
"CUstreamBatchMemOpParams_v1" => "6.4.0",
"CUstreamBatchMemOpParams_union" => "6.4.0",
Expand Down Expand Up @@ -1550,6 +1552,8 @@ sub experimentalSubstitutions {
subst("cuStreamBatchMemOp", "hipStreamBatchMemOp", "stream_memory");
subst("cuStreamBatchMemOp_v2", "hipStreamBatchMemOp", "stream_memory");
subst("cuGraphAddBatchMemOpNode", "hipGraphAddBatchMemOpNode", "graph");
subst("cuGraphBatchMemOpNodeGetParams", "hipGraphBatchMemOpNodeGetParams", "graph");
subst("cuGraphBatchMemOpNodeSetParams", "hipGraphBatchMemOpNodeSetParams", "graph");
subst("CUDA_BATCH_MEM_OP_NODE_PARAMS", "hipBatchMemOpNodeParams", "type");
subst("CUDA_BATCH_MEM_OP_NODE_PARAMS_st", "hipBatchMemOpNodeParams", "type");
subst("CUDA_BATCH_MEM_OP_NODE_PARAMS_v1", "hipBatchMemOpNodeParams", "type");
Expand Down Expand Up @@ -4104,8 +4108,6 @@ sub simpleSubstitutions {
subst("cuGraphAddMemcpyNode", "hipDrvGraphAddMemcpyNode", "graph");
subst("cuGraphAddMemsetNode", "hipDrvGraphAddMemsetNode", "graph");
subst("cuGraphAddNode", "hipGraphAddNode", "graph");
subst("cuGraphBatchMemOpNodeGetParams", "hipGraphBatchMemOpNodeGetParams", "graph");
subst("cuGraphBatchMemOpNodeSetParams", "hipGraphBatchMemOpNodeSetParams", "graph");
subst("cuGraphChildGraphNodeGetGraph", "hipGraphChildGraphNodeGetGraph", "graph");
subst("cuGraphClone", "hipGraphClone", "graph");
subst("cuGraphCreate", "hipGraphCreate", "graph");
Expand Down
4 changes: 2 additions & 2 deletions docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1906,8 +1906,8 @@
|`cuGraphAddMemsetNode`|10.0| | | |`hipDrvGraphAddMemsetNode`|6.1.0| | | | |
|`cuGraphAddNode`|12.2| | | |`hipGraphAddNode`|6.2.0| | | | |
|`cuGraphAddNode_v2`|12.3| | | | | | | | | |
|`cuGraphBatchMemOpNodeGetParams`|11.7| | | |`hipGraphBatchMemOpNodeGetParams`| | | | | |
|`cuGraphBatchMemOpNodeSetParams`|11.7| | | |`hipGraphBatchMemOpNodeSetParams`| | | | | |
|`cuGraphBatchMemOpNodeGetParams`|11.7| | | |`hipGraphBatchMemOpNodeGetParams`|6.4.0| | | |6.4.0|
|`cuGraphBatchMemOpNodeSetParams`|11.7| | | |`hipGraphBatchMemOpNodeSetParams`|6.4.0| | | |6.4.0|
|`cuGraphChildGraphNodeGetGraph`|10.0| | | |`hipGraphChildGraphNodeGetGraph`|5.0.0| | | | |
|`cuGraphClone`|10.0| | | |`hipGraphClone`|5.0.0| | | | |
|`cuGraphConditionalHandleCreate`|12.3| | | | | | | | | |
Expand Down
10 changes: 6 additions & 4 deletions src/CUDA2HIP_Driver_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,10 +810,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuGraphInstantiateWithFlags", {"hipGraphInstantiateWithFlags", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// no analogue yet
{"cuGraphAddBatchMemOpNode", {"hipGraphAddBatchMemOpNode", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_EXPERIMENTAL}},
//
{"cuGraphBatchMemOpNodeGetParams", {"hipGraphBatchMemOpNodeGetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphBatchMemOpNodeSetParams", {"hipGraphBatchMemOpNodeSetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// no analogue yet
{"cuGraphBatchMemOpNodeGetParams", {"hipGraphBatchMemOpNodeGetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_EXPERIMENTAL}},
// no analogue yet
{"cuGraphBatchMemOpNodeSetParams", {"hipGraphBatchMemOpNodeSetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_EXPERIMENTAL}},
//
{"cuGraphExecBatchMemOpNodeSetParams", {"hipGraphExecBatchMemOpNodeSetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphInstantiateWithParams
Expand Down Expand Up @@ -1667,6 +1667,8 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_DRIVER_FUNCTION_VER_MAP {
{"hipDrvGraphExecMemsetNodeSetParams", {HIP_6030, HIP_0, HIP_0, }},
{"hipStreamBatchMemOp", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
{"hipGraphAddBatchMemOpNode", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
{"hipGraphBatchMemOpNodeGetParams", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
{"hipGraphBatchMemOpNodeSetParams", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_DRIVER_FUNCTION_CHANGED_VER_MAP {
Expand Down
10 changes: 10 additions & 0 deletions tests/unit_tests/synthetic/driver_functions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,16 @@ int main() {
// HIP: hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t *phGraphNode, hipGraph_t hGraph, const hipGraphNode_t* dependencies, size_t numDependencies, const hipBatchMemOpNodeParams* nodeParams);
// CHECK: result = hipGraphAddBatchMemOpNode(&graphNode, graph, &graphNode2, bytes, &BATCH_MEM_OP_NODE_PARAMS);
result = cuGraphAddBatchMemOpNode(&graphNode, graph, &graphNode2, bytes, &BATCH_MEM_OP_NODE_PARAMS);

// CUDA: CUresult CUDAAPI cuGraphBatchMemOpNodeGetParams(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams_out);
// HIP: hipError_t hipGraphBatchMemOpNodeGetParams(hipGraphNode_t hNode, hipBatchMemOpNodeParams* nodeParams_out);
// CHECK: result = hipGraphBatchMemOpNodeGetParams(graphNode, &BATCH_MEM_OP_NODE_PARAMS);
result = cuGraphBatchMemOpNodeGetParams(graphNode, &BATCH_MEM_OP_NODE_PARAMS);

// CUDA: CUresult CUDAAPI cuGraphBatchMemOpNodeSetParams(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams);
// HIP: hipError_t hipGraphBatchMemOpNodeSetParams(hipGraphNode_t hNode, hipBatchMemOpNodeParams* nodeParams);
// CHECK: result = hipGraphBatchMemOpNodeSetParams(graphNode, &BATCH_MEM_OP_NODE_PARAMS);
result = cuGraphBatchMemOpNodeSetParams(graphNode, &BATCH_MEM_OP_NODE_PARAMS);
#endif

#if CUDA_VERSION >= 12000
Expand Down

0 comments on commit 1156258

Please sign in to comment.