From 33775256515ad0c1edb2303439663fa8b6c8371e Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Thu, 12 Dec 2024 19:55:11 +0100 Subject: [PATCH] [HIPIFY][SWDEV-501194][RT][6.4.0] Added experimental support for `hipGraphBatchMemOpNode(G|S)etParams` API + Updated synthetic tests, the regenerated `hipify-perl`, and `Driver` `CUDA2HIP` docs accordingly --- bin/hipify-perl | 6 ++++-- .../CUDA_Driver_API_functions_supported_by_HIP.md | 4 ++-- src/CUDA2HIP_Driver_API_functions.cpp | 10 ++++++---- tests/unit_tests/synthetic/driver_functions.cu | 10 ++++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index 9ead8270..9f23985d 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -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", @@ -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"); @@ -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"); diff --git a/docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md b/docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md index a2559132..0834ff28 100644 --- a/docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md +++ b/docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md @@ -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| | | | | | | | | | diff --git a/src/CUDA2HIP_Driver_API_functions.cpp b/src/CUDA2HIP_Driver_API_functions.cpp index 6b9850d4..75ac7458 100644 --- a/src/CUDA2HIP_Driver_API_functions.cpp +++ b/src/CUDA2HIP_Driver_API_functions.cpp @@ -810,10 +810,10 @@ const std::map 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 @@ -1667,6 +1667,8 @@ const std::map 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 CUDA_DRIVER_FUNCTION_CHANGED_VER_MAP { diff --git a/tests/unit_tests/synthetic/driver_functions.cu b/tests/unit_tests/synthetic/driver_functions.cu index 810c1d44..f9b43eac 100644 --- a/tests/unit_tests/synthetic/driver_functions.cu +++ b/tests/unit_tests/synthetic/driver_functions.cu @@ -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