Skip to content

Commit

Permalink
Merge pull request #1182 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY] Sync with CUDA 12.3.0 - Step 3 - Driver API functions
  • Loading branch information
emankov authored Dec 4, 2023
2 parents 200b6b9 + 0aeb22f commit 3826ea1
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -8169,12 +8169,15 @@ sub warnUnsupportedFunctions {
"cuSurfObjectGetResourceDesc",
"cuSurfObjectDestroy",
"cuSurfObjectCreate",
"cuStreamUpdateCaptureDependencies_v2",
"cuStreamSetAttribute",
"cuStreamGetId",
"cuStreamGetCtx",
"cuStreamGetCaptureInfo_v3",
"cuStreamGetAttribute",
"cuStreamCopyAttributes",
"cuStreamBeginCapture_ptsz",
"cuStreamBeginCaptureToGraph",
"cuStreamBatchMemOp_v2",
"cuStreamBatchMemOp",
"cuProfilerInitialize",
Expand Down Expand Up @@ -8238,6 +8241,7 @@ sub warnUnsupportedFunctions {
"cuLaunch",
"cuKernelSetCacheConfig",
"cuKernelSetAttribute",
"cuKernelGetName",
"cuKernelGetFunction",
"cuKernelGetAttribute",
"cuGraphicsVDPAURegisterVideoSurface",
Expand All @@ -8250,8 +8254,14 @@ sub warnUnsupportedFunctions {
"cuGraphicsD3D9RegisterResource",
"cuGraphicsD3D11RegisterResource",
"cuGraphicsD3D10RegisterResource",
"cuGraphRemoveDependencies_v2",
"cuGraphNodeGetDependencies_v2",
"cuGraphGetEdges_v2",
"cuGraphExecMemsetNodeSetParams",
"cuGraphExecMemcpyNodeSetParams",
"cuGraphConditionalHandleCreate",
"cuGraphAddNode_v2",
"cuGraphAddDependencies_v2",
"cuGetProcAddress",
"cuGLUnregisterBufferObject",
"cuGLUnmapBufferObjectAsync",
Expand All @@ -8267,6 +8277,7 @@ sub warnUnsupportedFunctions {
"cuFuncSetCacheConfig",
"cuFuncSetBlockShape",
"cuFuncSetAttribute",
"cuFuncGetName",
"cuFuncGetModule",
"cuFlushGPUDirectRDMAWrites",
"cuExternalMemoryGetMappedMipmappedArray",
Expand Down
11 changes: 11 additions & 0 deletions docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cuKernelGetAttribute`|12.0| | | | | | | | | |
|`cuKernelGetFunction`|12.0| | | | | | | | | |
|`cuKernelGetName`|12.3| | | | | | | | | |
|`cuKernelSetAttribute`|12.0| | | | | | | | | |
|`cuKernelSetCacheConfig`|12.0| | | | | | | | | |
|`cuLibraryGetGlobal`|12.0| | | | | | | | | |
Expand Down Expand Up @@ -1692,6 +1693,7 @@
|`cuStreamAddCallback`| | | | |`hipStreamAddCallback`|1.6.0| | | | |
|`cuStreamAttachMemAsync`| | | | |`hipStreamAttachMemAsync`|3.7.0| | | | |
|`cuStreamBeginCapture`|10.0| | | |`hipStreamBeginCapture`|4.3.0| | | | |
|`cuStreamBeginCaptureToGraph`|12.3| | | | | | | | | |
|`cuStreamBeginCapture_ptsz`|10.1| | | | | | | | | |
|`cuStreamBeginCapture_v2`|10.1| | | |`hipStreamBeginCapture`|4.3.0| | | | |
|`cuStreamCopyAttributes`|11.0| | | | | | | | | |
Expand All @@ -1703,6 +1705,7 @@
|`cuStreamGetAttribute`|11.0| | | | | | | | | |
|`cuStreamGetCaptureInfo`|10.1| | | |`hipStreamGetCaptureInfo`|5.0.0| | | | |
|`cuStreamGetCaptureInfo_v2`|11.3| | | |`hipStreamGetCaptureInfo_v2`|5.0.0| | | | |
|`cuStreamGetCaptureInfo_v3`|12.3| | | | | | | | | |
|`cuStreamGetCtx`|9.2| | | | | | | | | |
|`cuStreamGetFlags`| | | | |`hipStreamGetFlags`|1.6.0| | | | |
|`cuStreamGetId`|12.0| | | | | | | | | |
Expand All @@ -1712,6 +1715,7 @@
|`cuStreamSetAttribute`|11.0| | | | | | | | | |
|`cuStreamSynchronize`| | | | |`hipStreamSynchronize`|1.6.0| | | | |
|`cuStreamUpdateCaptureDependencies`|11.3| | | |`hipStreamUpdateCaptureDependencies`|5.0.0| | | | |
|`cuStreamUpdateCaptureDependencies_v2`|12.3| | | | | | | | | |
|`cuStreamWaitEvent`| | | | |`hipStreamWaitEvent`|1.6.0| | | | |
|`cuThreadExchangeStreamCaptureMode`|10.1| | | |`hipThreadExchangeStreamCaptureMode`|5.2.0| | | | |

Expand Down Expand Up @@ -1762,6 +1766,7 @@
|:--|:-:|:-:|:-:|:-:|:--|:-:|:-:|:-:|:-:|:-:|
|`cuFuncGetAttribute`| | | | |`hipFuncGetAttribute`|2.8.0| | | | |
|`cuFuncGetModule`|11.0| | | | | | | | | |
|`cuFuncGetName`|12.3| | | | | | | | | |
|`cuFuncSetAttribute`|9.0| | | | | | | | | |
|`cuFuncSetCacheConfig`| | | | | | | | | | |
|`cuFuncSetSharedMemConfig`| | | | | | | | | | |
Expand Down Expand Up @@ -1796,6 +1801,7 @@
|`cuGraphAddBatchMemOpNode`|11.7| | | |`hipGraphAddBatchMemOpNode`| | | | | |
|`cuGraphAddChildGraphNode`|10.0| | | |`hipGraphAddChildGraphNode`|5.0.0| | | | |
|`cuGraphAddDependencies`|10.0| | | |`hipGraphAddDependencies`|4.5.0| | | | |
|`cuGraphAddDependencies_v2`|12.3| | | | | | | | | |
|`cuGraphAddEmptyNode`|10.0| | | |`hipGraphAddEmptyNode`|4.5.0| | | | |
|`cuGraphAddEventRecordNode`|11.1| | | |`hipGraphAddEventRecordNode`|5.0.0| | | | |
|`cuGraphAddEventWaitNode`|11.1| | | |`hipGraphAddEventWaitNode`|5.0.0| | | | |
Expand All @@ -1808,10 +1814,12 @@
|`cuGraphAddMemcpyNode`|10.0| | | |`hipDrvGraphAddMemcpyNode`|6.0.0| | | | |
|`cuGraphAddMemsetNode`|10.0| | | |`hipGraphAddMemsetNode`|4.3.0| | | | |
|`cuGraphAddNode`|12.2| | | |`hipGraphAddNode`| | | | | |
|`cuGraphAddNode_v2`|12.3| | | | | | | | | |
|`cuGraphBatchMemOpNodeGetParams`|11.7| | | |`hipGraphBatchMemOpNodeGetParams`| | | | | |
|`cuGraphBatchMemOpNodeSetParams`|11.7| | | |`hipGraphBatchMemOpNodeSetParams`| | | | | |
|`cuGraphChildGraphNodeGetGraph`|10.0| | | |`hipGraphChildGraphNodeGetGraph`|5.0.0| | | | |
|`cuGraphClone`|10.0| | | |`hipGraphClone`|5.0.0| | | | |
|`cuGraphConditionalHandleCreate`|12.3| | | | | | | | | |
|`cuGraphCreate`|10.0| | | |`hipGraphCreate`|4.3.0| | | | |
|`cuGraphDebugDotPrint`|11.3| | | |`hipGraphDebugDotPrint`|5.5.0| | | | |
|`cuGraphDestroy`|10.0| | | |`hipGraphDestroy`|4.3.0| | | | |
Expand Down Expand Up @@ -1839,6 +1847,7 @@
|`cuGraphExternalSemaphoresWaitNodeGetParams`|11.2| | | |`hipGraphExternalSemaphoresWaitNodeGetParams`|6.0.0| | | | |
|`cuGraphExternalSemaphoresWaitNodeSetParams`|11.2| | | |`hipGraphExternalSemaphoresWaitNodeSetParams`|6.0.0| | | | |
|`cuGraphGetEdges`|10.0| | | |`hipGraphGetEdges`|5.0.0| | | | |
|`cuGraphGetEdges_v2`|12.3| | | | | | | | | |
|`cuGraphGetNodes`|10.0| | | |`hipGraphGetNodes`|4.5.0| | | | |
|`cuGraphGetRootNodes`|10.0| | | |`hipGraphGetRootNodes`|4.5.0| | | | |
|`cuGraphHostNodeGetParams`|10.0| | | |`hipGraphHostNodeGetParams`|5.0.0| | | | |
Expand All @@ -1861,13 +1870,15 @@
|`cuGraphMemsetNodeSetParams`|10.0| | | |`hipGraphMemsetNodeSetParams`|4.5.0| | | | |
|`cuGraphNodeFindInClone`|10.0| | | |`hipGraphNodeFindInClone`|5.0.0| | | | |
|`cuGraphNodeGetDependencies`|10.0| | | |`hipGraphNodeGetDependencies`|5.0.0| | | | |
|`cuGraphNodeGetDependencies_v2`|12.3| | | | | | | | | |
|`cuGraphNodeGetDependentNodes`|10.0| | | |`hipGraphNodeGetDependentNodes`|5.0.0| | | | |
|`cuGraphNodeGetEnabled`|11.6| | | |`hipGraphNodeGetEnabled`|5.5.0| | | | |
|`cuGraphNodeGetType`|10.0| | | |`hipGraphNodeGetType`|5.0.0| | | | |
|`cuGraphNodeSetEnabled`|11.6| | | |`hipGraphNodeSetEnabled`|5.5.0| | | | |
|`cuGraphNodeSetParams`|12.2| | | |`hipGraphNodeSetParams`| | | | | |
|`cuGraphReleaseUserObject`|11.3| | | |`hipGraphReleaseUserObject`|5.3.0| | | | |
|`cuGraphRemoveDependencies`|10.0| | | |`hipGraphRemoveDependencies`|5.0.0| | | | |
|`cuGraphRemoveDependencies_v2`|12.3| | | | | | | | | |
|`cuGraphRetainUserObject`|11.3| | | |`hipGraphRetainUserObject`|5.3.0| | | | |
|`cuGraphUpload`|11.1| | | |`hipGraphUpload`|5.3.0| | | | |
|`cuUserObjectCreate`|11.3| | | |`hipUserObjectCreate`|5.3.0| | | | |
Expand Down
32 changes: 32 additions & 0 deletions src/CUDA2HIP_Driver_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuKernelGetAttribute", {"hipKernelGetAttribute", "", CONV_LIBRARY, API_DRIVER, SEC::LIBRARY, HIP_UNSUPPORTED}},
{"cuKernelSetAttribute", {"hipKernelSetAttribute", "", CONV_LIBRARY, API_DRIVER, SEC::LIBRARY, HIP_UNSUPPORTED}},
{"cuKernelSetCacheConfig", {"hipKernelSetCacheConfig", "", CONV_LIBRARY, API_DRIVER, SEC::LIBRARY, HIP_UNSUPPORTED}},
{"cuKernelGetName", {"hipKernelGetName", "", CONV_LIBRARY, API_DRIVER, SEC::LIBRARY, HIP_UNSUPPORTED}},

// 13. Memory Management
// no analogue
Expand Down Expand Up @@ -458,6 +459,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuStreamBeginCapture", {"hipStreamBeginCapture", "", CONV_STREAM, API_DRIVER, SEC::STREAM}},
{"cuStreamBeginCapture_v2", {"hipStreamBeginCapture", "", CONV_STREAM, API_DRIVER, SEC::STREAM}},
{"cuStreamBeginCapture_ptsz", {"hipStreamBeginCapture_ptsz", "", CONV_STREAM, API_DRIVER, SEC::STREAM, HIP_UNSUPPORTED}},
//
{"cuStreamBeginCaptureToGraph", {"hipStreamBeginCaptureToGraph", "", CONV_STREAM, API_DRIVER, SEC::STREAM, HIP_UNSUPPORTED}},
// cudaStreamCopyAttributes
{"cuStreamCopyAttributes", {"hipStreamCopyAttributes", "", CONV_STREAM, API_DRIVER, SEC::STREAM, HIP_UNSUPPORTED}},
// cudaStreamCreateWithFlags
Expand All @@ -475,7 +478,11 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuStreamGetCaptureInfo", {"hipStreamGetCaptureInfo", "", CONV_STREAM, API_DRIVER, SEC::STREAM}},
{"cuStreamGetCaptureInfo_v2", {"hipStreamGetCaptureInfo_v2", "", CONV_STREAM, API_DRIVER, SEC::STREAM}},
//
{"cuStreamGetCaptureInfo_v3", {"hipStreamGetCaptureInfo_v3", "", CONV_STREAM, API_DRIVER, SEC::STREAM, HIP_UNSUPPORTED}},
//
{"cuStreamUpdateCaptureDependencies", {"hipStreamUpdateCaptureDependencies", "", CONV_STREAM, API_DRIVER, SEC::STREAM}},
//
{"cuStreamUpdateCaptureDependencies_v2", {"hipStreamUpdateCaptureDependencies_v2", "", CONV_STREAM, API_DRIVER, SEC::STREAM, HIP_UNSUPPORTED}},
// no analogue
{"cuStreamGetCtx", {"hipStreamGetContext", "", CONV_STREAM, API_DRIVER, SEC::STREAM, HIP_UNSUPPORTED}},
// cudaStreamGetFlags
Expand Down Expand Up @@ -589,6 +596,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
// no analogue
// NOTE: Not equal to cudaLaunchKernelExC due to different signatures
{"cuLaunchKernelEx", {"hipLaunchKernelEx", "", CONV_EXECUTION, API_DRIVER, SEC::EXECUTION, HIP_UNSUPPORTED}},
//
{"cuFuncGetName", {"hipFuncGetName", "", CONV_EXECUTION, API_DRIVER, SEC::EXECUTION, HIP_UNSUPPORTED}},

// 23. Execution Control [DEPRECATED]
// no analogue
Expand Down Expand Up @@ -618,6 +627,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuGraphAddChildGraphNode", {"hipGraphAddChildGraphNode", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphAddDependencies
{"cuGraphAddDependencies", {"hipGraphAddDependencies", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphAddDependencies_v2", {"hipGraphAddDependencies_v2", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_UNSUPPORTED}},
// cudaGraphAddEmptyNode
{"cuGraphAddEmptyNode", {"hipGraphAddEmptyNode", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphAddHostNode
Expand Down Expand Up @@ -650,6 +661,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuGraphExecDestroy", {"hipGraphExecDestroy", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphGetEdges
{"cuGraphGetEdges", {"hipGraphGetEdges", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphGetEdges_v2", {"hipGraphGetEdges_v2", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_UNSUPPORTED}},
// cudaGraphGetNodes
{"cuGraphGetNodes", {"hipGraphGetNodes", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphGetRootNodes
Expand Down Expand Up @@ -687,6 +700,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuGraphNodeFindInClone", {"hipGraphNodeFindInClone", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphNodeGetDependencies
{"cuGraphNodeGetDependencies", {"hipGraphNodeGetDependencies", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphNodeGetDependencies_v2", {"hipGraphNodeGetDependencies_v2", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_UNSUPPORTED}},
// cudaGraphNodeGetDependentNodes
{"cuGraphNodeGetDependentNodes", {"hipGraphNodeGetDependentNodes", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphNodeGetEnabled
Expand All @@ -697,6 +712,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuGraphNodeSetEnabled", {"hipGraphNodeSetEnabled", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphRemoveDependencies
{"cuGraphRemoveDependencies", {"hipGraphRemoveDependencies", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphRemoveDependencies_v2", {"hipGraphRemoveDependencies_v2", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_UNSUPPORTED}},
// no analogue
// NOTE: Not equal to cudaGraphExecMemcpyNodeSetParams due to different signatures:
// DRIVER: CUresult CUDAAPI cuGraphExecMemcpyNodeSetParams(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D *copyParams, CUcontext ctx);
Expand Down Expand Up @@ -788,10 +805,14 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
{"cuGraphExecGetFlags", {"hipGraphExecGetFlags", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphAddNode
{"cuGraphAddNode", {"hipGraphAddNode", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphAddNode_v2", {"hipGraphAddNode_v2", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_UNSUPPORTED}},
// cudaGraphNodeSetParams
{"cuGraphNodeSetParams", {"hipGraphNodeSetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
// cudaGraphExecNodeSetParams
{"cuGraphExecNodeSetParams", {"hipGraphExecNodeSetParams", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH}},
//
{"cuGraphConditionalHandleCreate", {"hipGraphConditionalHandleCreate", "", CONV_GRAPH, API_DRIVER, SEC::GRAPH, HIP_UNSUPPORTED}},

// 25. Occupancy
// cudaOccupancyAvailableDynamicSMemPerBlock
Expand Down Expand Up @@ -1399,6 +1420,17 @@ const std::map<llvm::StringRef, cudaAPIversions> CUDA_DRIVER_FUNCTION_VER_MAP {
{"cuGraphAddNode", {CUDA_122, CUDA_0, CUDA_0 }},
{"cuGraphNodeSetParams", {CUDA_122, CUDA_0, CUDA_0 }},
{"cuGraphExecNodeSetParams", {CUDA_122, CUDA_0, CUDA_0 }},
{"cuKernelGetName", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuStreamBeginCaptureToGraph", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuStreamGetCaptureInfo_v3", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuStreamUpdateCaptureDependencies_v2", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuFuncGetName", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuGraphGetEdges_v2", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuGraphNodeGetDependencies_v2", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuGraphAddDependencies_v2", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuGraphRemoveDependencies_v2", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuGraphAddNode_v2", {CUDA_123, CUDA_0, CUDA_0 }},
{"cuGraphConditionalHandleCreate", {CUDA_123, CUDA_0, CUDA_0 }},
};

const std::map<llvm::StringRef, hipAPIversions> HIP_DRIVER_FUNCTION_VER_MAP {
Expand Down

0 comments on commit 3826ea1

Please sign in to comment.