Skip to content

Commit ff84853

Browse files
authored
Add missing driver & runtime bindings for functions new in CTK 13.1.0 (#1337)
* Add driver bindings for new functions in CTK 13.1 * Add runtime bindings for new functions in CTK 13.1 * Fix UnicodeDecodeError on Windows by using UTF-8 encoding in setup.py The generate_output function was reading .in files without specifying UTF-8 encoding, causing UnicodeDecodeError on Windows where Python defaults to cp1252 encoding. The generated .in files contain UTF-8 characters (smart quotes from CUDA documentation), which cannot be decoded with cp1252. This fix adds encoding='utf-8' to all file operations in generate_output to ensure proper handling of UTF-8 content on all platforms. * Add Phase 1 unit tests for CUDA 13.1+ graph/node ID functions Add comprehensive tests for the new graph and node ID getter functions introduced in CUDA 13.1: Driver API tests (test_cuda.py): - test_cuGraphGetId: Tests graph ID retrieval - test_cuGraphExecGetId: Tests graph execution ID retrieval - test_cuGraphNodeGetLocalId: Tests node local ID retrieval - test_cuGraphNodeGetToolsId: Tests node tools ID retrieval - test_cuGraphNodeGetContainingGraph: Tests containing graph retrieval Runtime API tests (test_cudart.py): - test_cudaGraphGetId: Tests graph ID retrieval - test_cudaGraphExecGetId: Tests graph execution ID retrieval - test_cudaGraphNodeGetLocalId: Tests node local ID retrieval - test_cudaGraphNodeGetToolsId: Tests node tools ID retrieval - test_cudaGraphNodeGetContainingGraph: Tests containing graph retrieval All tests include: - Version checks (CUDA 13.1+) - API availability checks - Proper resource cleanup - Validation of return types and uniqueness - Edge case testing (child graphs) All 92 tests pass successfully. * Add Phase 2 unit tests for CUDA 13.1+ resource management functions Add comprehensive tests for the new resource management functions introduced in CUDA 13.1: Driver API tests (test_cuda.py): - test_cuStreamGetDevResource: Tests getting device resource from stream Runtime API tests (test_cudart.py): - test_cudaStreamGetDevResource: Tests getting device resource from stream - test_cudaDeviceGetDevResource: Tests getting device resource from device - test_cudaExecutionCtxGetDevResource: Tests getting device resource from execution context - test_cudaExecutionCtxGetDevice: Tests getting device handle from execution context - test_cudaExecutionCtxGetId: Tests getting unique ID from execution context All tests include: - Version checks (CUDA 13.1+) - API availability checks - Proper resource cleanup - Validation of return types and values - Execution context handling using cudaDeviceGetExecutionCtx All 98 tests pass successfully (10 Phase 1 + 6 Phase 2 + 82 existing). * Add Phase 3 unit tests for CUDA 13.1+ complex resource functions Add comprehensive tests for the complex resource management and context functions introduced in CUDA 13.1: Driver API tests (test_cuda.py): - test_cuDevSmResourceSplit: Tests splitting SM resource into structured groups Runtime API tests (test_cudart.py): - test_cudaDevSmResourceSplit: Tests splitting SM resource into structured groups - test_cudaDevSmResourceSplitByCount: Tests splitting SM resource by count - test_cudaDevResourceGenerateDesc: Tests generating resource descriptor - test_cudaGreenCtxCreate: Tests creating green context with resources - test_cudaExecutionCtxStreamCreate: Tests creating stream for execution context - test_cudaGraphConditionalHandleCreate_v2: Tests creating conditional handle with execution context All tests include: - Version checks (CUDA 13.1+) - API availability checks - Proper resource cleanup - Validation of return types and values - Resource splitting and descriptor generation workflows - Green context creation and stream management All 105 tests pass successfully (10 Phase 1 + 6 Phase 2 + 7 Phase 3 + 82 existing). * Remove # Phase 1, 2, 3 comments (they will be more distracting than helpful after this PR is merged).
1 parent db6118e commit ff84853

18 files changed

+3206
-49
lines changed

cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,31 @@ cdef CUresult _cuGraphNodeFindInClone(CUgraphNode* phNode, CUgraphNode hOriginal
16091609
cdef CUresult _cuGraphNodeGetType(CUgraphNode hNode, CUgraphNodeType* typename) except ?CUDA_ERROR_NOT_FOUND nogil
16101610
{{endif}}
16111611

1612+
{{if 'cuGraphNodeGetContainingGraph' in found_functions}}
1613+
1614+
cdef CUresult _cuGraphNodeGetContainingGraph(CUgraphNode hNode, CUgraph* phGraph) except ?CUDA_ERROR_NOT_FOUND nogil
1615+
{{endif}}
1616+
1617+
{{if 'cuGraphNodeGetLocalId' in found_functions}}
1618+
1619+
cdef CUresult _cuGraphNodeGetLocalId(CUgraphNode hNode, unsigned int* nodeId) except ?CUDA_ERROR_NOT_FOUND nogil
1620+
{{endif}}
1621+
1622+
{{if 'cuGraphNodeGetToolsId' in found_functions}}
1623+
1624+
cdef CUresult _cuGraphNodeGetToolsId(CUgraphNode hNode, unsigned long long* toolsNodeId) except ?CUDA_ERROR_NOT_FOUND nogil
1625+
{{endif}}
1626+
1627+
{{if 'cuGraphGetId' in found_functions}}
1628+
1629+
cdef CUresult _cuGraphGetId(CUgraph hGraph, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil
1630+
{{endif}}
1631+
1632+
{{if 'cuGraphExecGetId' in found_functions}}
1633+
1634+
cdef CUresult _cuGraphExecGetId(CUgraphExec hGraphExec, unsigned int* graphId) except ?CUDA_ERROR_NOT_FOUND nogil
1635+
{{endif}}
1636+
16121637
{{if 'cuGraphGetNodes' in found_functions}}
16131638

16141639
cdef CUresult _cuGraphGetNodes(CUgraph hGraph, CUgraphNode* nodes, size_t* numNodes) except ?CUDA_ERROR_NOT_FOUND nogil
@@ -2174,6 +2199,11 @@ cdef CUresult _cuGreenCtxGetDevResource(CUgreenCtx hCtx, CUdevResource* resource
21742199
cdef CUresult _cuDevSmResourceSplitByCount(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, unsigned int minCount) except ?CUDA_ERROR_NOT_FOUND nogil
21752200
{{endif}}
21762201

2202+
{{if 'cuDevSmResourceSplit' in found_functions}}
2203+
2204+
cdef CUresult _cuDevSmResourceSplit(CUdevResource* result, unsigned int nbGroups, const CUdevResource* input, CUdevResource* remainder, unsigned int flags, CU_DEV_SM_RESOURCE_GROUP_PARAMS* groupParams) except ?CUDA_ERROR_NOT_FOUND nogil
2205+
{{endif}}
2206+
21772207
{{if 'cuDevResourceGenerateDesc' in found_functions}}
21782208

21792209
cdef CUresult _cuDevResourceGenerateDesc(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources) except ?CUDA_ERROR_NOT_FOUND nogil
@@ -2204,6 +2234,11 @@ cdef CUresult _cuGreenCtxStreamCreate(CUstream* phStream, CUgreenCtx greenCtx, u
22042234
cdef CUresult _cuGreenCtxGetId(CUgreenCtx greenCtx, unsigned long long* greenCtxId) except ?CUDA_ERROR_NOT_FOUND nogil
22052235
{{endif}}
22062236

2237+
{{if 'cuStreamGetDevResource' in found_functions}}
2238+
2239+
cdef CUresult _cuStreamGetDevResource(CUstream hStream, CUdevResource* resource, CUdevResourceType typename) except ?CUDA_ERROR_NOT_FOUND nogil
2240+
{{endif}}
2241+
22072242
{{if 'cuLogsRegisterCallback' in found_functions}}
22082243

22092244
cdef CUresult _cuLogsRegisterCallback(CUlogsCallback callbackFunc, void* userData, CUlogsCallbackHandle* callback_out) except ?CUDA_ERROR_NOT_FOUND nogil

cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in

Lines changed: 236 additions & 0 deletions
Large diffs are not rendered by default.

cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,31 @@ cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode
11861186
cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil
11871187
{{endif}}
11881188

1189+
{{if 'cudaGraphNodeGetContainingGraph' in found_functions}}
1190+
1191+
cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil
1192+
{{endif}}
1193+
1194+
{{if 'cudaGraphNodeGetLocalId' in found_functions}}
1195+
1196+
cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil
1197+
{{endif}}
1198+
1199+
{{if 'cudaGraphNodeGetToolsId' in found_functions}}
1200+
1201+
cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil
1202+
{{endif}}
1203+
1204+
{{if 'cudaGraphGetId' in found_functions}}
1205+
1206+
cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil
1207+
{{endif}}
1208+
1209+
{{if 'cudaGraphExecGetId' in found_functions}}
1210+
1211+
cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil
1212+
{{endif}}
1213+
11891214
{{if 'cudaGraphGetNodes' in found_functions}}
11901215

11911216
cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil
@@ -1381,6 +1406,11 @@ cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGrap
13811406
cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
13821407
{{endif}}
13831408

1409+
{{if 'cudaGraphConditionalHandleCreate_v2' in found_functions}}
1410+
1411+
cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
1412+
{{endif}}
1413+
13841414
{{if 'cudaGetDriverEntryPoint' in found_functions}}
13851415

13861416
cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil
@@ -1441,16 +1471,66 @@ cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned in
14411471
cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil
14421472
{{endif}}
14431473

1474+
{{if 'cudaDeviceGetDevResource' in found_functions}}
1475+
1476+
cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType typename) except ?cudaErrorCallRequiresNewerDriver nogil
1477+
{{endif}}
1478+
1479+
{{if 'cudaDevSmResourceSplitByCount' in found_functions}}
1480+
1481+
cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil
1482+
{{endif}}
1483+
1484+
{{if 'cudaDevSmResourceSplit' in found_functions}}
1485+
1486+
cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil
1487+
{{endif}}
1488+
1489+
{{if 'cudaDevResourceGenerateDesc' in found_functions}}
1490+
1491+
cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil
1492+
{{endif}}
1493+
1494+
{{if 'cudaGreenCtxCreate' in found_functions}}
1495+
1496+
cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
1497+
{{endif}}
1498+
14441499
{{if 'cudaExecutionCtxDestroy' in found_functions}}
14451500

14461501
cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil
14471502
{{endif}}
14481503

1504+
{{if 'cudaExecutionCtxGetDevResource' in found_functions}}
1505+
1506+
cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType typename) except ?cudaErrorCallRequiresNewerDriver nogil
1507+
{{endif}}
1508+
1509+
{{if 'cudaExecutionCtxGetDevice' in found_functions}}
1510+
1511+
cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil
1512+
{{endif}}
1513+
1514+
{{if 'cudaExecutionCtxGetId' in found_functions}}
1515+
1516+
cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil
1517+
{{endif}}
1518+
1519+
{{if 'cudaExecutionCtxStreamCreate' in found_functions}}
1520+
1521+
cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil
1522+
{{endif}}
1523+
14491524
{{if 'cudaExecutionCtxSynchronize' in found_functions}}
14501525

14511526
cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil
14521527
{{endif}}
14531528

1529+
{{if 'cudaStreamGetDevResource' in found_functions}}
1530+
1531+
cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType typename) except ?cudaErrorCallRequiresNewerDriver nogil
1532+
{{endif}}
1533+
14541534
{{if 'cudaExecutionCtxRecordEvent' in found_functions}}
14551535

14561536
cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil
@@ -1461,6 +1541,11 @@ cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEv
14611541
cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil
14621542
{{endif}}
14631543

1544+
{{if 'cudaDeviceGetExecutionCtx' in found_functions}}
1545+
1546+
cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil
1547+
{{endif}}
1548+
14641549
{{if 'cudaGetExportTable' in found_functions}}
14651550

14661551
cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil

cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,51 @@ cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType*
21502150
return cudaGraphNodeGetType(node, pType)
21512151
{{endif}}
21522152

2153+
{{if 'cudaGraphNodeGetContainingGraph' in found_functions}}
2154+
2155+
cdef cudaError_t _cudaGraphNodeGetContainingGraph(cudaGraphNode_t hNode, cudaGraph_t* phGraph) except ?cudaErrorCallRequiresNewerDriver nogil:
2156+
cdef bint usePTDS = cudaPythonInit()
2157+
if usePTDS:
2158+
return ptds._cudaGraphNodeGetContainingGraph(hNode, phGraph)
2159+
return cudaGraphNodeGetContainingGraph(hNode, phGraph)
2160+
{{endif}}
2161+
2162+
{{if 'cudaGraphNodeGetLocalId' in found_functions}}
2163+
2164+
cdef cudaError_t _cudaGraphNodeGetLocalId(cudaGraphNode_t hNode, unsigned int* nodeId) except ?cudaErrorCallRequiresNewerDriver nogil:
2165+
cdef bint usePTDS = cudaPythonInit()
2166+
if usePTDS:
2167+
return ptds._cudaGraphNodeGetLocalId(hNode, nodeId)
2168+
return cudaGraphNodeGetLocalId(hNode, nodeId)
2169+
{{endif}}
2170+
2171+
{{if 'cudaGraphNodeGetToolsId' in found_functions}}
2172+
2173+
cdef cudaError_t _cudaGraphNodeGetToolsId(cudaGraphNode_t hNode, unsigned long long* toolsNodeId) except ?cudaErrorCallRequiresNewerDriver nogil:
2174+
cdef bint usePTDS = cudaPythonInit()
2175+
if usePTDS:
2176+
return ptds._cudaGraphNodeGetToolsId(hNode, toolsNodeId)
2177+
return cudaGraphNodeGetToolsId(hNode, toolsNodeId)
2178+
{{endif}}
2179+
2180+
{{if 'cudaGraphGetId' in found_functions}}
2181+
2182+
cdef cudaError_t _cudaGraphGetId(cudaGraph_t hGraph, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil:
2183+
cdef bint usePTDS = cudaPythonInit()
2184+
if usePTDS:
2185+
return ptds._cudaGraphGetId(hGraph, graphID)
2186+
return cudaGraphGetId(hGraph, graphID)
2187+
{{endif}}
2188+
2189+
{{if 'cudaGraphExecGetId' in found_functions}}
2190+
2191+
cdef cudaError_t _cudaGraphExecGetId(cudaGraphExec_t hGraphExec, unsigned int* graphID) except ?cudaErrorCallRequiresNewerDriver nogil:
2192+
cdef bint usePTDS = cudaPythonInit()
2193+
if usePTDS:
2194+
return ptds._cudaGraphExecGetId(hGraphExec, graphID)
2195+
return cudaGraphExecGetId(hGraphExec, graphID)
2196+
{{endif}}
2197+
21532198
{{if 'cudaGraphGetNodes' in found_functions}}
21542199

21552200
cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil:
@@ -2501,6 +2546,15 @@ cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* p
25012546
return cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags)
25022547
{{endif}}
25032548

2549+
{{if 'cudaGraphConditionalHandleCreate_v2' in found_functions}}
2550+
2551+
cdef cudaError_t _cudaGraphConditionalHandleCreate_v2(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, cudaExecutionContext_t ctx, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
2552+
cdef bint usePTDS = cudaPythonInit()
2553+
if usePTDS:
2554+
return ptds._cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags)
2555+
return cudaGraphConditionalHandleCreate_v2(pHandle_out, graph, ctx, defaultLaunchValue, flags)
2556+
{{endif}}
2557+
25042558
{{if 'cudaGetDriverEntryPoint' in found_functions}}
25052559

25062560
cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil:
@@ -2609,6 +2663,51 @@ cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncA
26092663
return cudaKernelSetAttributeForDevice(kernel, attr, value, device)
26102664
{{endif}}
26112665

2666+
{{if 'cudaDeviceGetDevResource' in found_functions}}
2667+
2668+
cdef cudaError_t _cudaDeviceGetDevResource(int device, cudaDevResource* resource, cudaDevResourceType typename) except ?cudaErrorCallRequiresNewerDriver nogil:
2669+
cdef bint usePTDS = cudaPythonInit()
2670+
if usePTDS:
2671+
return ptds._cudaDeviceGetDevResource(device, resource, typename)
2672+
return cudaDeviceGetDevResource(device, resource, typename)
2673+
{{endif}}
2674+
2675+
{{if 'cudaDevSmResourceSplitByCount' in found_functions}}
2676+
2677+
cdef cudaError_t _cudaDevSmResourceSplitByCount(cudaDevResource* result, unsigned int* nbGroups, const cudaDevResource* input, cudaDevResource* remaining, unsigned int flags, unsigned int minCount) except ?cudaErrorCallRequiresNewerDriver nogil:
2678+
cdef bint usePTDS = cudaPythonInit()
2679+
if usePTDS:
2680+
return ptds._cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount)
2681+
return cudaDevSmResourceSplitByCount(result, nbGroups, input, remaining, flags, minCount)
2682+
{{endif}}
2683+
2684+
{{if 'cudaDevSmResourceSplit' in found_functions}}
2685+
2686+
cdef cudaError_t _cudaDevSmResourceSplit(cudaDevResource* result, unsigned int nbGroups, const cudaDevResource* input, cudaDevResource* remainder, unsigned int flags, cudaDevSmResourceGroupParams* groupParams) except ?cudaErrorCallRequiresNewerDriver nogil:
2687+
cdef bint usePTDS = cudaPythonInit()
2688+
if usePTDS:
2689+
return ptds._cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams)
2690+
return cudaDevSmResourceSplit(result, nbGroups, input, remainder, flags, groupParams)
2691+
{{endif}}
2692+
2693+
{{if 'cudaDevResourceGenerateDesc' in found_functions}}
2694+
2695+
cdef cudaError_t _cudaDevResourceGenerateDesc(cudaDevResourceDesc_t* phDesc, cudaDevResource* resources, unsigned int nbResources) except ?cudaErrorCallRequiresNewerDriver nogil:
2696+
cdef bint usePTDS = cudaPythonInit()
2697+
if usePTDS:
2698+
return ptds._cudaDevResourceGenerateDesc(phDesc, resources, nbResources)
2699+
return cudaDevResourceGenerateDesc(phDesc, resources, nbResources)
2700+
{{endif}}
2701+
2702+
{{if 'cudaGreenCtxCreate' in found_functions}}
2703+
2704+
cdef cudaError_t _cudaGreenCtxCreate(cudaExecutionContext_t* phCtx, cudaDevResourceDesc_t desc, int device, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
2705+
cdef bint usePTDS = cudaPythonInit()
2706+
if usePTDS:
2707+
return ptds._cudaGreenCtxCreate(phCtx, desc, device, flags)
2708+
return cudaGreenCtxCreate(phCtx, desc, device, flags)
2709+
{{endif}}
2710+
26122711
{{if 'cudaExecutionCtxDestroy' in found_functions}}
26132712

26142713
cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil:
@@ -2618,6 +2717,42 @@ cdef cudaError_t _cudaExecutionCtxDestroy(cudaExecutionContext_t ctx) except ?cu
26182717
return cudaExecutionCtxDestroy(ctx)
26192718
{{endif}}
26202719

2720+
{{if 'cudaExecutionCtxGetDevResource' in found_functions}}
2721+
2722+
cdef cudaError_t _cudaExecutionCtxGetDevResource(cudaExecutionContext_t ctx, cudaDevResource* resource, cudaDevResourceType typename) except ?cudaErrorCallRequiresNewerDriver nogil:
2723+
cdef bint usePTDS = cudaPythonInit()
2724+
if usePTDS:
2725+
return ptds._cudaExecutionCtxGetDevResource(ctx, resource, typename)
2726+
return cudaExecutionCtxGetDevResource(ctx, resource, typename)
2727+
{{endif}}
2728+
2729+
{{if 'cudaExecutionCtxGetDevice' in found_functions}}
2730+
2731+
cdef cudaError_t _cudaExecutionCtxGetDevice(int* device, cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil:
2732+
cdef bint usePTDS = cudaPythonInit()
2733+
if usePTDS:
2734+
return ptds._cudaExecutionCtxGetDevice(device, ctx)
2735+
return cudaExecutionCtxGetDevice(device, ctx)
2736+
{{endif}}
2737+
2738+
{{if 'cudaExecutionCtxGetId' in found_functions}}
2739+
2740+
cdef cudaError_t _cudaExecutionCtxGetId(cudaExecutionContext_t ctx, unsigned long long* ctxId) except ?cudaErrorCallRequiresNewerDriver nogil:
2741+
cdef bint usePTDS = cudaPythonInit()
2742+
if usePTDS:
2743+
return ptds._cudaExecutionCtxGetId(ctx, ctxId)
2744+
return cudaExecutionCtxGetId(ctx, ctxId)
2745+
{{endif}}
2746+
2747+
{{if 'cudaExecutionCtxStreamCreate' in found_functions}}
2748+
2749+
cdef cudaError_t _cudaExecutionCtxStreamCreate(cudaStream_t* phStream, cudaExecutionContext_t ctx, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil:
2750+
cdef bint usePTDS = cudaPythonInit()
2751+
if usePTDS:
2752+
return ptds._cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority)
2753+
return cudaExecutionCtxStreamCreate(phStream, ctx, flags, priority)
2754+
{{endif}}
2755+
26212756
{{if 'cudaExecutionCtxSynchronize' in found_functions}}
26222757

26232758
cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except ?cudaErrorCallRequiresNewerDriver nogil:
@@ -2627,6 +2762,15 @@ cdef cudaError_t _cudaExecutionCtxSynchronize(cudaExecutionContext_t ctx) except
26272762
return cudaExecutionCtxSynchronize(ctx)
26282763
{{endif}}
26292764

2765+
{{if 'cudaStreamGetDevResource' in found_functions}}
2766+
2767+
cdef cudaError_t _cudaStreamGetDevResource(cudaStream_t hStream, cudaDevResource* resource, cudaDevResourceType typename) except ?cudaErrorCallRequiresNewerDriver nogil:
2768+
cdef bint usePTDS = cudaPythonInit()
2769+
if usePTDS:
2770+
return ptds._cudaStreamGetDevResource(hStream, resource, typename)
2771+
return cudaStreamGetDevResource(hStream, resource, typename)
2772+
{{endif}}
2773+
26302774
{{if 'cudaExecutionCtxRecordEvent' in found_functions}}
26312775

26322776
cdef cudaError_t _cudaExecutionCtxRecordEvent(cudaExecutionContext_t ctx, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil:
@@ -2645,6 +2789,15 @@ cdef cudaError_t _cudaExecutionCtxWaitEvent(cudaExecutionContext_t ctx, cudaEven
26452789
return cudaExecutionCtxWaitEvent(ctx, event)
26462790
{{endif}}
26472791

2792+
{{if 'cudaDeviceGetExecutionCtx' in found_functions}}
2793+
2794+
cdef cudaError_t _cudaDeviceGetExecutionCtx(cudaExecutionContext_t* ctx, int device) except ?cudaErrorCallRequiresNewerDriver nogil:
2795+
cdef bint usePTDS = cudaPythonInit()
2796+
if usePTDS:
2797+
return ptds._cudaDeviceGetExecutionCtx(ctx, device)
2798+
return cudaDeviceGetExecutionCtx(ctx, device)
2799+
{{endif}}
2800+
26482801
{{if 'cudaGetExportTable' in found_functions}}
26492802

26502803
cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil:

0 commit comments

Comments
 (0)