From 9ffb2c9981b4141b18cf56f5a20e9b9506a82dd0 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 13 Mar 2025 15:14:40 -0700 Subject: [PATCH 01/15] Statically link to CUDA Runtime --- .gitignore | 5 + .../cuda/bindings/_bindings/cyruntime.pxd.in | 1480 +++++ .../bindings/_lib/cyruntime/cyruntime.pxd.in | 299 +- .../bindings/_lib/cyruntime/cyruntime.pyx.in | 5080 +---------------- .../cuda/bindings/_lib/cyruntime/utils.pxd.in | 111 +- .../cuda/bindings/_lib/cyruntime/utils.pyx.in | 2923 +--------- cuda_bindings/cuda/bindings/cydriver.pyx.in | 116 +- cuda_bindings/cuda/bindings/cyruntime.pxd.in | 6 +- cuda_bindings/cuda/bindings/cyruntime.pyx.in | 1487 ++--- cuda_bindings/cuda/bindings/runtime.pyx.in | 6 +- .../docs/source/release/12.X.Y-notes.rst | 2 + 11 files changed, 2326 insertions(+), 9189 deletions(-) create mode 100644 cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in diff --git a/.gitignore b/.gitignore index 1c73b74fd..bd3d4eb64 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,11 @@ __pycache__/ # CUDA Python specific (auto-generated) cuda_bindings/cuda/bindings/_bindings/cydriver.pxd cuda_bindings/cuda/bindings/_bindings/cydriver.pyx +cuda_bindings/cuda/bindings/_bindings/cyruntime.pxi +cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd +cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx +cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pxd +cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pyx cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx cuda_bindings/cuda/bindings/_internal/nvjitlink.pyx diff --git a/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in new file mode 100644 index 000000000..334d58a13 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in @@ -0,0 +1,1480 @@ +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. +# +# Please refer to the NVIDIA end user license agreement (EULA) associated +# with this source code for terms and conditions that govern your use of +# this software. Any use, reproduction, disclosure, or distribution of +# this software and related documentation outside the terms of the EULA +# is strictly prohibited. +# +# This code was automatically generated with version 12.8.0. Do not modify it directly. +from cuda.bindings.cyruntime cimport * + +cdef extern from "cuda_runtime_api.h": + + {{if 'cudaDeviceReset' in found_functions}} + + cudaError_t _cudaDeviceReset "cudaDeviceReset"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceSynchronize' in found_functions}} + + cudaError_t _cudaDeviceSynchronize "cudaDeviceSynchronize"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceSetLimit' in found_functions}} + + cudaError_t _cudaDeviceSetLimit "cudaDeviceSetLimit"(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetLimit' in found_functions}} + + cudaError_t _cudaDeviceGetLimit "cudaDeviceGetLimit"(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} + + cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth "cudaDeviceGetTexture1DLinearMaxWidth"(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetCacheConfig' in found_functions}} + + cudaError_t _cudaDeviceGetCacheConfig "cudaDeviceGetCacheConfig"(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} + + cudaError_t _cudaDeviceGetStreamPriorityRange "cudaDeviceGetStreamPriorityRange"(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceSetCacheConfig' in found_functions}} + + cudaError_t _cudaDeviceSetCacheConfig "cudaDeviceSetCacheConfig"(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetByPCIBusId' in found_functions}} + + cudaError_t _cudaDeviceGetByPCIBusId "cudaDeviceGetByPCIBusId"(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetPCIBusId' in found_functions}} + + cudaError_t _cudaDeviceGetPCIBusId "cudaDeviceGetPCIBusId"(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaIpcGetEventHandle' in found_functions}} + + cudaError_t _cudaIpcGetEventHandle "cudaIpcGetEventHandle"(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaIpcOpenEventHandle' in found_functions}} + + cudaError_t _cudaIpcOpenEventHandle "cudaIpcOpenEventHandle"(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaIpcGetMemHandle' in found_functions}} + + cudaError_t _cudaIpcGetMemHandle "cudaIpcGetMemHandle"(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaIpcOpenMemHandle' in found_functions}} + + cudaError_t _cudaIpcOpenMemHandle "cudaIpcOpenMemHandle"(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaIpcCloseMemHandle' in found_functions}} + + cudaError_t _cudaIpcCloseMemHandle "cudaIpcCloseMemHandle"(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} + + cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites "cudaDeviceFlushGPUDirectRDMAWrites"(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + + cudaError_t _cudaDeviceRegisterAsyncNotification "cudaDeviceRegisterAsyncNotification"(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} + + cudaError_t _cudaDeviceUnregisterAsyncNotification "cudaDeviceUnregisterAsyncNotification"(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetSharedMemConfig' in found_functions}} + + cudaError_t _cudaDeviceGetSharedMemConfig "cudaDeviceGetSharedMemConfig"(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceSetSharedMemConfig' in found_functions}} + + cudaError_t _cudaDeviceSetSharedMemConfig "cudaDeviceSetSharedMemConfig"(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetLastError' in found_functions}} + + cudaError_t _cudaGetLastError "cudaGetLastError"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaPeekAtLastError' in found_functions}} + + cudaError_t _cudaPeekAtLastError "cudaPeekAtLastError"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetErrorName' in found_functions}} + + const char* _cudaGetErrorName "cudaGetErrorName"(cudaError_t error) except ?NULL nogil + {{endif}} + + {{if 'cudaGetErrorString' in found_functions}} + + const char* _cudaGetErrorString "cudaGetErrorString"(cudaError_t error) except ?NULL nogil + {{endif}} + + {{if 'cudaGetDeviceCount' in found_functions}} + + cudaError_t _cudaGetDeviceCount "cudaGetDeviceCount"(int* count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetDeviceProperties_v2' in found_functions}} + + cudaError_t _cudaGetDeviceProperties_v2 "cudaGetDeviceProperties_v2"(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetAttribute' in found_functions}} + + cudaError_t _cudaDeviceGetAttribute "cudaDeviceGetAttribute"(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetDefaultMemPool' in found_functions}} + + cudaError_t _cudaDeviceGetDefaultMemPool "cudaDeviceGetDefaultMemPool"(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceSetMemPool' in found_functions}} + + cudaError_t _cudaDeviceSetMemPool "cudaDeviceSetMemPool"(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetMemPool' in found_functions}} + + cudaError_t _cudaDeviceGetMemPool "cudaDeviceGetMemPool"(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} + + cudaError_t _cudaDeviceGetNvSciSyncAttributes "cudaDeviceGetNvSciSyncAttributes"(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetP2PAttribute' in found_functions}} + + cudaError_t _cudaDeviceGetP2PAttribute "cudaDeviceGetP2PAttribute"(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaChooseDevice' in found_functions}} + + cudaError_t _cudaChooseDevice "cudaChooseDevice"(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaInitDevice' in found_functions}} + + cudaError_t _cudaInitDevice "cudaInitDevice"(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaSetDevice' in found_functions}} + + cudaError_t _cudaSetDevice "cudaSetDevice"(int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetDevice' in found_functions}} + + cudaError_t _cudaGetDevice "cudaGetDevice"(int* device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaSetDeviceFlags' in found_functions}} + + cudaError_t _cudaSetDeviceFlags "cudaSetDeviceFlags"(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetDeviceFlags' in found_functions}} + + cudaError_t _cudaGetDeviceFlags "cudaGetDeviceFlags"(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamCreate' in found_functions}} + + cudaError_t _cudaStreamCreate "cudaStreamCreate"(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamCreateWithFlags' in found_functions}} + + cudaError_t _cudaStreamCreateWithFlags "cudaStreamCreateWithFlags"(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamCreateWithPriority' in found_functions}} + + cudaError_t _cudaStreamCreateWithPriority "cudaStreamCreateWithPriority"(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetPriority' in found_functions}} + + cudaError_t _cudaStreamGetPriority "cudaStreamGetPriority"(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetFlags' in found_functions}} + + cudaError_t _cudaStreamGetFlags "cudaStreamGetFlags"(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetId' in found_functions}} + + cudaError_t _cudaStreamGetId "cudaStreamGetId"(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetDevice' in found_functions}} + + cudaError_t _cudaStreamGetDevice "cudaStreamGetDevice"(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaCtxResetPersistingL2Cache' in found_functions}} + + cudaError_t _cudaCtxResetPersistingL2Cache "cudaCtxResetPersistingL2Cache"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamCopyAttributes' in found_functions}} + + cudaError_t _cudaStreamCopyAttributes "cudaStreamCopyAttributes"(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetAttribute' in found_functions}} + + cudaError_t _cudaStreamGetAttribute "cudaStreamGetAttribute"(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamSetAttribute' in found_functions}} + + cudaError_t _cudaStreamSetAttribute "cudaStreamSetAttribute"(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamDestroy' in found_functions}} + + cudaError_t _cudaStreamDestroy "cudaStreamDestroy"(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamWaitEvent' in found_functions}} + + cudaError_t _cudaStreamWaitEvent "cudaStreamWaitEvent"(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamAddCallback' in found_functions}} + + cudaError_t _cudaStreamAddCallback "cudaStreamAddCallback"(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamSynchronize' in found_functions}} + + cudaError_t _cudaStreamSynchronize "cudaStreamSynchronize"(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamQuery' in found_functions}} + + cudaError_t _cudaStreamQuery "cudaStreamQuery"(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamAttachMemAsync' in found_functions}} + + cudaError_t _cudaStreamAttachMemAsync "cudaStreamAttachMemAsync"(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamBeginCapture' in found_functions}} + + cudaError_t _cudaStreamBeginCapture "cudaStreamBeginCapture"(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamBeginCaptureToGraph' in found_functions}} + + cudaError_t _cudaStreamBeginCaptureToGraph "cudaStreamBeginCaptureToGraph"(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} + + cudaError_t _cudaThreadExchangeStreamCaptureMode "cudaThreadExchangeStreamCaptureMode"(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamEndCapture' in found_functions}} + + cudaError_t _cudaStreamEndCapture "cudaStreamEndCapture"(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamIsCapturing' in found_functions}} + + cudaError_t _cudaStreamIsCapturing "cudaStreamIsCapturing"(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + + cudaError_t _cudaStreamGetCaptureInfo_v2 "cudaStreamGetCaptureInfo_v2"(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} + + cudaError_t _cudaStreamGetCaptureInfo_v3 "cudaStreamGetCaptureInfo_v3"(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} + + cudaError_t _cudaStreamUpdateCaptureDependencies "cudaStreamUpdateCaptureDependencies"(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} + + cudaError_t _cudaStreamUpdateCaptureDependencies_v2 "cudaStreamUpdateCaptureDependencies_v2"(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventCreate' in found_functions}} + + cudaError_t _cudaEventCreate "cudaEventCreate"(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventCreateWithFlags' in found_functions}} + + cudaError_t _cudaEventCreateWithFlags "cudaEventCreateWithFlags"(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventRecord' in found_functions}} + + cudaError_t _cudaEventRecord "cudaEventRecord"(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventRecordWithFlags' in found_functions}} + + cudaError_t _cudaEventRecordWithFlags "cudaEventRecordWithFlags"(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventQuery' in found_functions}} + + cudaError_t _cudaEventQuery "cudaEventQuery"(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventSynchronize' in found_functions}} + + cudaError_t _cudaEventSynchronize "cudaEventSynchronize"(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventDestroy' in found_functions}} + + cudaError_t _cudaEventDestroy "cudaEventDestroy"(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventElapsedTime' in found_functions}} + + cudaError_t _cudaEventElapsedTime "cudaEventElapsedTime"(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaEventElapsedTime_v2' in found_functions}} + + cudaError_t _cudaEventElapsedTime_v2 "cudaEventElapsedTime_v2"(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaImportExternalMemory' in found_functions}} + + cudaError_t _cudaImportExternalMemory "cudaImportExternalMemory"(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} + + cudaError_t _cudaExternalMemoryGetMappedBuffer "cudaExternalMemoryGetMappedBuffer"(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} + + cudaError_t _cudaExternalMemoryGetMappedMipmappedArray "cudaExternalMemoryGetMappedMipmappedArray"(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDestroyExternalMemory' in found_functions}} + + cudaError_t _cudaDestroyExternalMemory "cudaDestroyExternalMemory"(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaImportExternalSemaphore' in found_functions}} + + cudaError_t _cudaImportExternalSemaphore "cudaImportExternalSemaphore"(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + + cudaError_t _cudaSignalExternalSemaphoresAsync_v2 "cudaSignalExternalSemaphoresAsync_v2"(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + + cudaError_t _cudaWaitExternalSemaphoresAsync_v2 "cudaWaitExternalSemaphoresAsync_v2"(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDestroyExternalSemaphore' in found_functions}} + + cudaError_t _cudaDestroyExternalSemaphore "cudaDestroyExternalSemaphore"(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFuncSetCacheConfig' in found_functions}} + + cudaError_t _cudaFuncSetCacheConfig "cudaFuncSetCacheConfig"(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFuncGetAttributes' in found_functions}} + + cudaError_t _cudaFuncGetAttributes "cudaFuncGetAttributes"(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFuncSetAttribute' in found_functions}} + + cudaError_t _cudaFuncSetAttribute "cudaFuncSetAttribute"(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLaunchHostFunc' in found_functions}} + + cudaError_t _cudaLaunchHostFunc "cudaLaunchHostFunc"(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFuncSetSharedMemConfig' in found_functions}} + + cudaError_t _cudaFuncSetSharedMemConfig "cudaFuncSetSharedMemConfig"(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + + cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor "cudaOccupancyMaxActiveBlocksPerMultiprocessor"(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + + cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock "cudaOccupancyAvailableDynamicSMemPerBlock"(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + + cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocManaged' in found_functions}} + + cudaError_t _cudaMallocManaged "cudaMallocManaged"(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMalloc' in found_functions}} + + cudaError_t _cudaMalloc "cudaMalloc"(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocHost' in found_functions}} + + cudaError_t _cudaMallocHost "cudaMallocHost"(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocPitch' in found_functions}} + + cudaError_t _cudaMallocPitch "cudaMallocPitch"(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocArray' in found_functions}} + + cudaError_t _cudaMallocArray "cudaMallocArray"(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFree' in found_functions}} + + cudaError_t _cudaFree "cudaFree"(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFreeHost' in found_functions}} + + cudaError_t _cudaFreeHost "cudaFreeHost"(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFreeArray' in found_functions}} + + cudaError_t _cudaFreeArray "cudaFreeArray"(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFreeMipmappedArray' in found_functions}} + + cudaError_t _cudaFreeMipmappedArray "cudaFreeMipmappedArray"(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaHostAlloc' in found_functions}} + + cudaError_t _cudaHostAlloc "cudaHostAlloc"(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaHostRegister' in found_functions}} + + cudaError_t _cudaHostRegister "cudaHostRegister"(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaHostUnregister' in found_functions}} + + cudaError_t _cudaHostUnregister "cudaHostUnregister"(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaHostGetDevicePointer' in found_functions}} + + cudaError_t _cudaHostGetDevicePointer "cudaHostGetDevicePointer"(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaHostGetFlags' in found_functions}} + + cudaError_t _cudaHostGetFlags "cudaHostGetFlags"(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMalloc3D' in found_functions}} + + cudaError_t _cudaMalloc3D "cudaMalloc3D"(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMalloc3DArray' in found_functions}} + + cudaError_t _cudaMalloc3DArray "cudaMalloc3DArray"(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocMipmappedArray' in found_functions}} + + cudaError_t _cudaMallocMipmappedArray "cudaMallocMipmappedArray"(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetMipmappedArrayLevel' in found_functions}} + + cudaError_t _cudaGetMipmappedArrayLevel "cudaGetMipmappedArrayLevel"(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy3D' in found_functions}} + + cudaError_t _cudaMemcpy3D "cudaMemcpy3D"(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy3DPeer' in found_functions}} + + cudaError_t _cudaMemcpy3DPeer "cudaMemcpy3DPeer"(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy3DAsync' in found_functions}} + + cudaError_t _cudaMemcpy3DAsync "cudaMemcpy3DAsync"(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy3DPeerAsync' in found_functions}} + + cudaError_t _cudaMemcpy3DPeerAsync "cudaMemcpy3DPeerAsync"(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemGetInfo' in found_functions}} + + cudaError_t _cudaMemGetInfo "cudaMemGetInfo"(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaArrayGetInfo' in found_functions}} + + cudaError_t _cudaArrayGetInfo "cudaArrayGetInfo"(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaArrayGetPlane' in found_functions}} + + cudaError_t _cudaArrayGetPlane "cudaArrayGetPlane"(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaArrayGetMemoryRequirements' in found_functions}} + + cudaError_t _cudaArrayGetMemoryRequirements "cudaArrayGetMemoryRequirements"(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} + + cudaError_t _cudaMipmappedArrayGetMemoryRequirements "cudaMipmappedArrayGetMemoryRequirements"(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaArrayGetSparseProperties' in found_functions}} + + cudaError_t _cudaArrayGetSparseProperties "cudaArrayGetSparseProperties"(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} + + cudaError_t _cudaMipmappedArrayGetSparseProperties "cudaMipmappedArrayGetSparseProperties"(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy' in found_functions}} + + cudaError_t _cudaMemcpy "cudaMemcpy"(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyPeer' in found_functions}} + + cudaError_t _cudaMemcpyPeer "cudaMemcpyPeer"(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2D' in found_functions}} + + cudaError_t _cudaMemcpy2D "cudaMemcpy2D"(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2DToArray' in found_functions}} + + cudaError_t _cudaMemcpy2DToArray "cudaMemcpy2DToArray"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2DFromArray' in found_functions}} + + cudaError_t _cudaMemcpy2DFromArray "cudaMemcpy2DFromArray"(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2DArrayToArray' in found_functions}} + + cudaError_t _cudaMemcpy2DArrayToArray "cudaMemcpy2DArrayToArray"(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyAsync' in found_functions}} + + cudaError_t _cudaMemcpyAsync "cudaMemcpyAsync"(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyPeerAsync' in found_functions}} + + cudaError_t _cudaMemcpyPeerAsync "cudaMemcpyPeerAsync"(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyBatchAsync' in found_functions}} + + cudaError_t _cudaMemcpyBatchAsync "cudaMemcpyBatchAsync"(void** dsts, void** srcs, size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy3DBatchAsync' in found_functions}} + + cudaError_t _cudaMemcpy3DBatchAsync "cudaMemcpy3DBatchAsync"(size_t numOps, cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2DAsync' in found_functions}} + + cudaError_t _cudaMemcpy2DAsync "cudaMemcpy2DAsync"(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2DToArrayAsync' in found_functions}} + + cudaError_t _cudaMemcpy2DToArrayAsync "cudaMemcpy2DToArrayAsync"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} + + cudaError_t _cudaMemcpy2DFromArrayAsync "cudaMemcpy2DFromArrayAsync"(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemset' in found_functions}} + + cudaError_t _cudaMemset "cudaMemset"(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemset2D' in found_functions}} + + cudaError_t _cudaMemset2D "cudaMemset2D"(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemset3D' in found_functions}} + + cudaError_t _cudaMemset3D "cudaMemset3D"(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemsetAsync' in found_functions}} + + cudaError_t _cudaMemsetAsync "cudaMemsetAsync"(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemset2DAsync' in found_functions}} + + cudaError_t _cudaMemset2DAsync "cudaMemset2DAsync"(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemset3DAsync' in found_functions}} + + cudaError_t _cudaMemset3DAsync "cudaMemset3DAsync"(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPrefetchAsync' in found_functions}} + + cudaError_t _cudaMemPrefetchAsync "cudaMemPrefetchAsync"(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPrefetchAsync_v2' in found_functions}} + + cudaError_t _cudaMemPrefetchAsync_v2 "cudaMemPrefetchAsync_v2"(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemAdvise' in found_functions}} + + cudaError_t _cudaMemAdvise "cudaMemAdvise"(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemAdvise_v2' in found_functions}} + + cudaError_t _cudaMemAdvise_v2 "cudaMemAdvise_v2"(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemRangeGetAttribute' in found_functions}} + + cudaError_t _cudaMemRangeGetAttribute "cudaMemRangeGetAttribute"(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemRangeGetAttributes' in found_functions}} + + cudaError_t _cudaMemRangeGetAttributes "cudaMemRangeGetAttributes"(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyToArray' in found_functions}} + + cudaError_t _cudaMemcpyToArray "cudaMemcpyToArray"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyFromArray' in found_functions}} + + cudaError_t _cudaMemcpyFromArray "cudaMemcpyFromArray"(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyArrayToArray' in found_functions}} + + cudaError_t _cudaMemcpyArrayToArray "cudaMemcpyArrayToArray"(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyToArrayAsync' in found_functions}} + + cudaError_t _cudaMemcpyToArrayAsync "cudaMemcpyToArrayAsync"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemcpyFromArrayAsync' in found_functions}} + + cudaError_t _cudaMemcpyFromArrayAsync "cudaMemcpyFromArrayAsync"(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocAsync' in found_functions}} + + cudaError_t _cudaMallocAsync "cudaMallocAsync"(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaFreeAsync' in found_functions}} + + cudaError_t _cudaFreeAsync "cudaFreeAsync"(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolTrimTo' in found_functions}} + + cudaError_t _cudaMemPoolTrimTo "cudaMemPoolTrimTo"(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolSetAttribute' in found_functions}} + + cudaError_t _cudaMemPoolSetAttribute "cudaMemPoolSetAttribute"(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolGetAttribute' in found_functions}} + + cudaError_t _cudaMemPoolGetAttribute "cudaMemPoolGetAttribute"(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolSetAccess' in found_functions}} + + cudaError_t _cudaMemPoolSetAccess "cudaMemPoolSetAccess"(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolGetAccess' in found_functions}} + + cudaError_t _cudaMemPoolGetAccess "cudaMemPoolGetAccess"(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolCreate' in found_functions}} + + cudaError_t _cudaMemPoolCreate "cudaMemPoolCreate"(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolDestroy' in found_functions}} + + cudaError_t _cudaMemPoolDestroy "cudaMemPoolDestroy"(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMallocFromPoolAsync' in found_functions}} + + cudaError_t _cudaMallocFromPoolAsync "cudaMallocFromPoolAsync"(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolExportToShareableHandle' in found_functions}} + + cudaError_t _cudaMemPoolExportToShareableHandle "cudaMemPoolExportToShareableHandle"(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} + + cudaError_t _cudaMemPoolImportFromShareableHandle "cudaMemPoolImportFromShareableHandle"(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolExportPointer' in found_functions}} + + cudaError_t _cudaMemPoolExportPointer "cudaMemPoolExportPointer"(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaMemPoolImportPointer' in found_functions}} + + cudaError_t _cudaMemPoolImportPointer "cudaMemPoolImportPointer"(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaPointerGetAttributes' in found_functions}} + + cudaError_t _cudaPointerGetAttributes "cudaPointerGetAttributes"(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceCanAccessPeer' in found_functions}} + + cudaError_t _cudaDeviceCanAccessPeer "cudaDeviceCanAccessPeer"(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceEnablePeerAccess' in found_functions}} + + cudaError_t _cudaDeviceEnablePeerAccess "cudaDeviceEnablePeerAccess"(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceDisablePeerAccess' in found_functions}} + + cudaError_t _cudaDeviceDisablePeerAccess "cudaDeviceDisablePeerAccess"(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsUnregisterResource' in found_functions}} + + cudaError_t _cudaGraphicsUnregisterResource "cudaGraphicsUnregisterResource"(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} + + cudaError_t _cudaGraphicsResourceSetMapFlags "cudaGraphicsResourceSetMapFlags"(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsMapResources' in found_functions}} + + cudaError_t _cudaGraphicsMapResources "cudaGraphicsMapResources"(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsUnmapResources' in found_functions}} + + cudaError_t _cudaGraphicsUnmapResources "cudaGraphicsUnmapResources"(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} + + cudaError_t _cudaGraphicsResourceGetMappedPointer "cudaGraphicsResourceGetMappedPointer"(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} + + cudaError_t _cudaGraphicsSubResourceGetMappedArray "cudaGraphicsSubResourceGetMappedArray"(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} + + cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray "cudaGraphicsResourceGetMappedMipmappedArray"(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetChannelDesc' in found_functions}} + + cudaError_t _cudaGetChannelDesc "cudaGetChannelDesc"(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaCreateChannelDesc' in found_functions}} + + cudaChannelFormatDesc _cudaCreateChannelDesc "cudaCreateChannelDesc"(int x, int y, int z, int w, cudaChannelFormatKind f) nogil + {{endif}} + + {{if 'cudaCreateTextureObject' in found_functions}} + + cudaError_t _cudaCreateTextureObject "cudaCreateTextureObject"(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDestroyTextureObject' in found_functions}} + + cudaError_t _cudaDestroyTextureObject "cudaDestroyTextureObject"(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetTextureObjectResourceDesc' in found_functions}} + + cudaError_t _cudaGetTextureObjectResourceDesc "cudaGetTextureObjectResourceDesc"(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetTextureObjectTextureDesc' in found_functions}} + + cudaError_t _cudaGetTextureObjectTextureDesc "cudaGetTextureObjectTextureDesc"(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} + + cudaError_t _cudaGetTextureObjectResourceViewDesc "cudaGetTextureObjectResourceViewDesc"(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaCreateSurfaceObject' in found_functions}} + + cudaError_t _cudaCreateSurfaceObject "cudaCreateSurfaceObject"(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDestroySurfaceObject' in found_functions}} + + cudaError_t _cudaDestroySurfaceObject "cudaDestroySurfaceObject"(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} + + cudaError_t _cudaGetSurfaceObjectResourceDesc "cudaGetSurfaceObjectResourceDesc"(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDriverGetVersion' in found_functions}} + + cudaError_t _cudaDriverGetVersion "cudaDriverGetVersion"(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaRuntimeGetVersion' in found_functions}} + + cudaError_t _cudaRuntimeGetVersion "cudaRuntimeGetVersion"(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphCreate' in found_functions}} + + cudaError_t _cudaGraphCreate "cudaGraphCreate"(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddKernelNode' in found_functions}} + + cudaError_t _cudaGraphAddKernelNode "cudaGraphAddKernelNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphKernelNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphKernelNodeGetParams "cudaGraphKernelNodeGetParams"(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphKernelNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphKernelNodeSetParams "cudaGraphKernelNodeSetParams"(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} + + cudaError_t _cudaGraphKernelNodeCopyAttributes "cudaGraphKernelNodeCopyAttributes"(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} + + cudaError_t _cudaGraphKernelNodeGetAttribute "cudaGraphKernelNodeGetAttribute"(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} + + cudaError_t _cudaGraphKernelNodeSetAttribute "cudaGraphKernelNodeSetAttribute"(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddMemcpyNode' in found_functions}} + + cudaError_t _cudaGraphAddMemcpyNode "cudaGraphAddMemcpyNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddMemcpyNode1D' in found_functions}} + + cudaError_t _cudaGraphAddMemcpyNode1D "cudaGraphAddMemcpyNode1D"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphMemcpyNodeGetParams "cudaGraphMemcpyNodeGetParams"(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphMemcpyNodeSetParams "cudaGraphMemcpyNodeSetParams"(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} + + cudaError_t _cudaGraphMemcpyNodeSetParams1D "cudaGraphMemcpyNodeSetParams1D"(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddMemsetNode' in found_functions}} + + cudaError_t _cudaGraphAddMemsetNode "cudaGraphAddMemsetNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemsetNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphMemsetNodeGetParams "cudaGraphMemsetNodeGetParams"(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemsetNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphMemsetNodeSetParams "cudaGraphMemsetNodeSetParams"(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddHostNode' in found_functions}} + + cudaError_t _cudaGraphAddHostNode "cudaGraphAddHostNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphHostNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphHostNodeGetParams "cudaGraphHostNodeGetParams"(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphHostNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphHostNodeSetParams "cudaGraphHostNodeSetParams"(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddChildGraphNode' in found_functions}} + + cudaError_t _cudaGraphAddChildGraphNode "cudaGraphAddChildGraphNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} + + cudaError_t _cudaGraphChildGraphNodeGetGraph "cudaGraphChildGraphNodeGetGraph"(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddEmptyNode' in found_functions}} + + cudaError_t _cudaGraphAddEmptyNode "cudaGraphAddEmptyNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddEventRecordNode' in found_functions}} + + cudaError_t _cudaGraphAddEventRecordNode "cudaGraphAddEventRecordNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} + + cudaError_t _cudaGraphEventRecordNodeGetEvent "cudaGraphEventRecordNodeGetEvent"(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} + + cudaError_t _cudaGraphEventRecordNodeSetEvent "cudaGraphEventRecordNodeSetEvent"(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddEventWaitNode' in found_functions}} + + cudaError_t _cudaGraphAddEventWaitNode "cudaGraphAddEventWaitNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} + + cudaError_t _cudaGraphEventWaitNodeGetEvent "cudaGraphEventWaitNodeGetEvent"(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} + + cudaError_t _cudaGraphEventWaitNodeSetEvent "cudaGraphEventWaitNodeSetEvent"(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} + + cudaError_t _cudaGraphAddExternalSemaphoresSignalNode "cudaGraphAddExternalSemaphoresSignalNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams "cudaGraphExternalSemaphoresSignalNodeGetParams"(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams "cudaGraphExternalSemaphoresSignalNodeSetParams"(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} + + cudaError_t _cudaGraphAddExternalSemaphoresWaitNode "cudaGraphAddExternalSemaphoresWaitNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams "cudaGraphExternalSemaphoresWaitNodeGetParams"(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams "cudaGraphExternalSemaphoresWaitNodeSetParams"(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddMemAllocNode' in found_functions}} + + cudaError_t _cudaGraphAddMemAllocNode "cudaGraphAddMemAllocNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphMemAllocNodeGetParams "cudaGraphMemAllocNodeGetParams"(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddMemFreeNode' in found_functions}} + + cudaError_t _cudaGraphAddMemFreeNode "cudaGraphAddMemFreeNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} + + cudaError_t _cudaGraphMemFreeNodeGetParams "cudaGraphMemFreeNodeGetParams"(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGraphMemTrim' in found_functions}} + + cudaError_t _cudaDeviceGraphMemTrim "cudaDeviceGraphMemTrim"(int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} + + cudaError_t _cudaDeviceGetGraphMemAttribute "cudaDeviceGetGraphMemAttribute"(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} + + cudaError_t _cudaDeviceSetGraphMemAttribute "cudaDeviceSetGraphMemAttribute"(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphClone' in found_functions}} + + cudaError_t _cudaGraphClone "cudaGraphClone"(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeFindInClone' in found_functions}} + + cudaError_t _cudaGraphNodeFindInClone "cudaGraphNodeFindInClone"(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeGetType' in found_functions}} + + cudaError_t _cudaGraphNodeGetType "cudaGraphNodeGetType"(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphGetNodes' in found_functions}} + + cudaError_t _cudaGraphGetNodes "cudaGraphGetNodes"(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphGetRootNodes' in found_functions}} + + cudaError_t _cudaGraphGetRootNodes "cudaGraphGetRootNodes"(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphGetEdges' in found_functions}} + + cudaError_t _cudaGraphGetEdges "cudaGraphGetEdges"(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphGetEdges_v2' in found_functions}} + + cudaError_t _cudaGraphGetEdges_v2 "cudaGraphGetEdges_v2"(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeGetDependencies' in found_functions}} + + cudaError_t _cudaGraphNodeGetDependencies "cudaGraphNodeGetDependencies"(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} + + cudaError_t _cudaGraphNodeGetDependencies_v2 "cudaGraphNodeGetDependencies_v2"(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeGetDependentNodes' in found_functions}} + + cudaError_t _cudaGraphNodeGetDependentNodes "cudaGraphNodeGetDependentNodes"(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} + + cudaError_t _cudaGraphNodeGetDependentNodes_v2 "cudaGraphNodeGetDependentNodes_v2"(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddDependencies' in found_functions}} + + cudaError_t _cudaGraphAddDependencies "cudaGraphAddDependencies"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddDependencies_v2' in found_functions}} + + cudaError_t _cudaGraphAddDependencies_v2 "cudaGraphAddDependencies_v2"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphRemoveDependencies' in found_functions}} + + cudaError_t _cudaGraphRemoveDependencies "cudaGraphRemoveDependencies"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphRemoveDependencies_v2' in found_functions}} + + cudaError_t _cudaGraphRemoveDependencies_v2 "cudaGraphRemoveDependencies_v2"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphDestroyNode' in found_functions}} + + cudaError_t _cudaGraphDestroyNode "cudaGraphDestroyNode"(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphInstantiate' in found_functions}} + + cudaError_t _cudaGraphInstantiate "cudaGraphInstantiate"(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphInstantiateWithFlags' in found_functions}} + + cudaError_t _cudaGraphInstantiateWithFlags "cudaGraphInstantiateWithFlags"(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphInstantiateWithParams' in found_functions}} + + cudaError_t _cudaGraphInstantiateWithParams "cudaGraphInstantiateWithParams"(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecGetFlags' in found_functions}} + + cudaError_t _cudaGraphExecGetFlags "cudaGraphExecGetFlags"(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecKernelNodeSetParams "cudaGraphExecKernelNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecMemcpyNodeSetParams "cudaGraphExecMemcpyNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} + + cudaError_t _cudaGraphExecMemcpyNodeSetParams1D "cudaGraphExecMemcpyNodeSetParams1D"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecMemsetNodeSetParams "cudaGraphExecMemsetNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecHostNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecHostNodeSetParams "cudaGraphExecHostNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecChildGraphNodeSetParams "cudaGraphExecChildGraphNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} + + cudaError_t _cudaGraphExecEventRecordNodeSetEvent "cudaGraphExecEventRecordNodeSetEvent"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} + + cudaError_t _cudaGraphExecEventWaitNodeSetEvent "cudaGraphExecEventWaitNodeSetEvent"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams "cudaGraphExecExternalSemaphoresSignalNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams "cudaGraphExecExternalSemaphoresWaitNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeSetEnabled' in found_functions}} + + cudaError_t _cudaGraphNodeSetEnabled "cudaGraphNodeSetEnabled"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeGetEnabled' in found_functions}} + + cudaError_t _cudaGraphNodeGetEnabled "cudaGraphNodeGetEnabled"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecUpdate' in found_functions}} + + cudaError_t _cudaGraphExecUpdate "cudaGraphExecUpdate"(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphUpload' in found_functions}} + + cudaError_t _cudaGraphUpload "cudaGraphUpload"(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphLaunch' in found_functions}} + + cudaError_t _cudaGraphLaunch "cudaGraphLaunch"(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecDestroy' in found_functions}} + + cudaError_t _cudaGraphExecDestroy "cudaGraphExecDestroy"(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphDestroy' in found_functions}} + + cudaError_t _cudaGraphDestroy "cudaGraphDestroy"(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphDebugDotPrint' in found_functions}} + + cudaError_t _cudaGraphDebugDotPrint "cudaGraphDebugDotPrint"(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaUserObjectCreate' in found_functions}} + + cudaError_t _cudaUserObjectCreate "cudaUserObjectCreate"(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaUserObjectRetain' in found_functions}} + + cudaError_t _cudaUserObjectRetain "cudaUserObjectRetain"(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaUserObjectRelease' in found_functions}} + + cudaError_t _cudaUserObjectRelease "cudaUserObjectRelease"(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphRetainUserObject' in found_functions}} + + cudaError_t _cudaGraphRetainUserObject "cudaGraphRetainUserObject"(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphReleaseUserObject' in found_functions}} + + cudaError_t _cudaGraphReleaseUserObject "cudaGraphReleaseUserObject"(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddNode' in found_functions}} + + cudaError_t _cudaGraphAddNode "cudaGraphAddNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphAddNode_v2' in found_functions}} + + cudaError_t _cudaGraphAddNode_v2 "cudaGraphAddNode_v2"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphNodeSetParams "cudaGraphNodeSetParams"(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphExecNodeSetParams' in found_functions}} + + cudaError_t _cudaGraphExecNodeSetParams "cudaGraphExecNodeSetParams"(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGraphConditionalHandleCreate' in found_functions}} + + cudaError_t _cudaGraphConditionalHandleCreate "cudaGraphConditionalHandleCreate"(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetDriverEntryPoint' in found_functions}} + + cudaError_t _cudaGetDriverEntryPoint "cudaGetDriverEntryPoint"(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetDriverEntryPointByVersion' in found_functions}} + + cudaError_t _cudaGetDriverEntryPointByVersion "cudaGetDriverEntryPointByVersion"(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryLoadData' in found_functions}} + + cudaError_t _cudaLibraryLoadData "cudaLibraryLoadData"(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryLoadFromFile' in found_functions}} + + cudaError_t _cudaLibraryLoadFromFile "cudaLibraryLoadFromFile"(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryUnload' in found_functions}} + + cudaError_t _cudaLibraryUnload "cudaLibraryUnload"(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryGetKernel' in found_functions}} + + cudaError_t _cudaLibraryGetKernel "cudaLibraryGetKernel"(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryGetGlobal' in found_functions}} + + cudaError_t _cudaLibraryGetGlobal "cudaLibraryGetGlobal"(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryGetManaged' in found_functions}} + + cudaError_t _cudaLibraryGetManaged "cudaLibraryGetManaged"(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryGetUnifiedFunction' in found_functions}} + + cudaError_t _cudaLibraryGetUnifiedFunction "cudaLibraryGetUnifiedFunction"(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryGetKernelCount' in found_functions}} + + cudaError_t _cudaLibraryGetKernelCount "cudaLibraryGetKernelCount"(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaLibraryEnumerateKernels' in found_functions}} + + cudaError_t _cudaLibraryEnumerateKernels "cudaLibraryEnumerateKernels"(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaKernelSetAttributeForDevice' in found_functions}} + + cudaError_t _cudaKernelSetAttributeForDevice "cudaKernelSetAttributeForDevice"(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetExportTable' in found_functions}} + + cudaError_t _cudaGetExportTable "cudaGetExportTable"(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaGetKernel' in found_functions}} + + cudaError_t _cudaGetKernel "cudaGetKernel"(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + +cdef extern from "cuda_runtime.h": + + {{if 'make_cudaPitchedPtr' in found_functions}} + + cudaPitchedPtr _make_cudaPitchedPtr "make_cudaPitchedPtr"(void* d, size_t p, size_t xsz, size_t ysz) nogil + {{endif}} + + {{if 'make_cudaPos' in found_functions}} + + cudaPos _make_cudaPos "make_cudaPos"(size_t x, size_t y, size_t z) nogil + {{endif}} + + {{if 'make_cudaExtent' in found_functions}} + + cudaExtent _make_cudaExtent "make_cudaExtent"(size_t w, size_t h, size_t d) nogil + {{endif}} + + +cdef extern from "cuda_profiler_api.h": + + {{if 'cudaProfilerStart' in found_functions}} + + cudaError_t _cudaProfilerStart "cudaProfilerStart"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + {{if 'cudaProfilerStop' in found_functions}} + + cudaError_t _cudaProfilerStop "cudaProfilerStop"() except ?cudaErrorCallRequiresNewerDriver nogil + {{endif}} + + diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in index c760f0220..53e7cd3b3 100644 --- a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in @@ -1,282 +1,22 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. -cimport cuda.bindings.cydriver as cydriver from cuda.bindings.cyruntime cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp -from libcpp cimport bool -{{if 'cudaMemcpy' in found_functions}}cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCreate' in found_functions}}cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventCreate' in found_functions}}cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventQuery' in found_functions}}cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCreateChannelDesc' in found_functions}}cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) noexcept nogil{{endif}} -{{if 'cudaDriverGetVersion' in found_functions}}cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaRuntimeGetVersion' in found_functions}}cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}}cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocHost' in found_functions}}cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocPitch' in found_functions}}cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocMipmappedArray' in found_functions}}cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2D' in found_functions}}cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DAsync' in found_functions}}cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyAsync' in found_functions}}cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemcpyNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}}cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}}cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}}cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDriverEntryPoint' in found_functions}}cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemsetNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncGetAttributes' in found_functions}}cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocArray' in found_functions}}cdef cudaError_t _cudaMallocArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMalloc3D' in found_functions}}cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMalloc3DArray' in found_functions}}cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetErrorString' in found_functions}}cdef const char* _cudaGetErrorString(cudaError_t error) except ?NULL nogil{{endif}} -{{if 'cudaStreamAddCallback' in found_functions}}cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}}cdef cudaError_t _cudaStreamGetCaptureInfo_v2(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaImportExternalSemaphore' in found_functions}}cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}}cdef cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}}cdef cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetInfo' in found_functions}}cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DToArray' in found_functions}}cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DFromArray' in found_functions}}cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DArrayToArray' in found_functions}}cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset3D' in found_functions}}cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset3DAsync' in found_functions}}cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyToArray' in found_functions}}cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyFromArray' in found_functions}}cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyToArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyFromArrayAsync' in found_functions}}cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaPointerGetAttributes' in found_functions}}cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDeviceFlags' in found_functions}}cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3D' in found_functions}}cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DAsync' in found_functions}}cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolSetAccess' in found_functions}}cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceReset' in found_functions}}cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetLastError' in found_functions}}cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaPeekAtLastError' in found_functions}}cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDevice' in found_functions}}cdef cudaError_t _cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaSetDevice' in found_functions}}cdef cudaError_t _cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDeviceProperties_v2' in found_functions}}cdef cudaError_t _cudaGetDeviceProperties_v2(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaChooseDevice' in found_functions}}cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyArrayToArray' in found_functions}}cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetChannelDesc' in found_functions}}cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCreateTextureObject' in found_functions}}cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}}cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}}cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetExportTable' in found_functions}}cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DPeer' in found_functions}}cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DPeerAsync' in found_functions}}cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'make_cudaPitchedPtr' in found_functions}}cdef cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) noexcept nogil{{endif}} -{{if 'make_cudaPos' in found_functions}}cdef cudaPos _make_cudaPos(size_t x, size_t y, size_t z) noexcept nogil{{endif}} -{{if 'make_cudaExtent' in found_functions}}cdef cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) noexcept nogil{{endif}} -{{if 'cudaSetDeviceFlags' in found_functions}}cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemAllocNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemAdvise' in found_functions}}cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemRangeGetAttribute' in found_functions}}cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemRangeGetAttributes' in found_functions}}cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDeviceCount' in found_functions}}cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetAttribute' in found_functions}}cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}}cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetByPCIBusId' in found_functions}}cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetPCIBusId' in found_functions}}cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetP2PAttribute' in found_functions}}cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetSparseProperties' in found_functions}}cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}}cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceCanAccessPeer' in found_functions}}cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyPeer' in found_functions}}cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyPeerAsync' in found_functions}}cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceEnablePeerAccess' in found_functions}}cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceDisablePeerAccess' in found_functions}}cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}}cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}}cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}}cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaImportExternalMemory' in found_functions}}cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCreateSurfaceObject' in found_functions}}cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}}cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsEGLRegisterImage' in found_functions}}cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetMemoryRequirements' in found_functions}}cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}}cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetAttribute' in found_functions}}cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamSetAttribute' in found_functions}}cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSynchronize' in found_functions}}cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetLimit' in found_functions}}cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetLimit' in found_functions}}cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetCacheConfig' in found_functions}}cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}}cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetCacheConfig' in found_functions}}cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}}cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcGetEventHandle' in found_functions}}cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcOpenEventHandle' in found_functions}}cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcGetMemHandle' in found_functions}}cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcOpenMemHandle' in found_functions}}cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaIpcCloseMemHandle' in found_functions}}cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}}cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}}cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetMemPool' in found_functions}}cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetMemPool' in found_functions}}cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}}cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCreateWithFlags' in found_functions}}cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCreateWithPriority' in found_functions}}cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetPriority' in found_functions}}cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetFlags' in found_functions}}cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}}cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamCopyAttributes' in found_functions}}cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamDestroy' in found_functions}}cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamWaitEvent' in found_functions}}cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamSynchronize' in found_functions}}cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamQuery' in found_functions}}cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamAttachMemAsync' in found_functions}}cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamBeginCapture' in found_functions}}cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}}cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}}cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamEndCapture' in found_functions}}cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamIsCapturing' in found_functions}}cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}}cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventCreateWithFlags' in found_functions}}cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventRecord' in found_functions}}cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventRecordWithFlags' in found_functions}}cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventSynchronize' in found_functions}}cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventDestroy' in found_functions}}cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventElapsedTime' in found_functions}}cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroyExternalMemory' in found_functions}}cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroyExternalSemaphore' in found_functions}}cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncSetCacheConfig' in found_functions}}cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncSetSharedMemConfig' in found_functions}}cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFuncSetAttribute' in found_functions}}cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLaunchHostFunc' in found_functions}}cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}}cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}}cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}}cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocManaged' in found_functions}}cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMalloc' in found_functions}}cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFree' in found_functions}}cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeHost' in found_functions}}cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeArray' in found_functions}}cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeMipmappedArray' in found_functions}}cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostAlloc' in found_functions}}cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostRegister' in found_functions}}cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostUnregister' in found_functions}}cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostGetDevicePointer' in found_functions}}cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaHostGetFlags' in found_functions}}cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetMipmappedArrayLevel' in found_functions}}cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemGetInfo' in found_functions}}cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaArrayGetPlane' in found_functions}}cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset' in found_functions}}cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset2D' in found_functions}}cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemsetAsync' in found_functions}}cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemset2DAsync' in found_functions}}cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPrefetchAsync' in found_functions}}cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocAsync' in found_functions}}cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaFreeAsync' in found_functions}}cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolTrimTo' in found_functions}}cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolSetAttribute' in found_functions}}cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolGetAttribute' in found_functions}}cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolGetAccess' in found_functions}}cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolCreate' in found_functions}}cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolDestroy' in found_functions}}cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMallocFromPoolAsync' in found_functions}}cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}}cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}}cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolExportPointer' in found_functions}}cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPoolImportPointer' in found_functions}}cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsUnregisterResource' in found_functions}}cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}}cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsMapResources' in found_functions}}cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsUnmapResources' in found_functions}}cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}}cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}}cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}}cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroyTextureObject' in found_functions}}cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDestroySurfaceObject' in found_functions}}cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphCreate' in found_functions}}cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddKernelNode' in found_functions}}cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}}cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddHostNode' in found_functions}}cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphHostNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphHostNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddChildGraphNode' in found_functions}}cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}}cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddEmptyNode' in found_functions}}cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddEventRecordNode' in found_functions}}cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddEventWaitNode' in found_functions}}cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}}cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}}cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddMemFreeNode' in found_functions}}cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGraphMemTrim' in found_functions}}cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}}cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}}cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphClone' in found_functions}}cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeFindInClone' in found_functions}}cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetType' in found_functions}}cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetNodes' in found_functions}}cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetRootNodes' in found_functions}}cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetEdges' in found_functions}}cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependencies' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddDependencies' in found_functions}}cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphRemoveDependencies' in found_functions}}cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphDestroyNode' in found_functions}}cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphInstantiate' in found_functions}}cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphInstantiateWithFlags' in found_functions}}cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}}cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeSetEnabled' in found_functions}}cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetEnabled' in found_functions}}cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecUpdate' in found_functions}}cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphUpload' in found_functions}}cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphLaunch' in found_functions}}cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecDestroy' in found_functions}}cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphDestroy' in found_functions}}cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphDebugDotPrint' in found_functions}}cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaUserObjectCreate' in found_functions}}cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaUserObjectRetain' in found_functions}}cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaUserObjectRelease' in found_functions}}cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphRetainUserObject' in found_functions}}cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphReleaseUserObject' in found_functions}}cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} @@ -286,40 +26,3 @@ from libcpp cimport bool {{if True}}cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaInitDevice' in found_functions}}cdef cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetId' in found_functions}}cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphInstantiateWithParams' in found_functions}}cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecGetFlags' in found_functions}}cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetKernel' in found_functions}}cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddNode' in found_functions}}cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphExecNodeSetParams' in found_functions}}cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemPrefetchAsync_v2' in found_functions}}cdef cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemAdvise_v2' in found_functions}}cdef cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphConditionalHandleCreate' in found_functions}}cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}}cdef cudaError_t _cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}}cdef cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphGetEdges_v2' in found_functions}}cdef cudaError_t _cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}}cdef cudaError_t _cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddDependencies_v2' in found_functions}}cdef cudaError_t _cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}}cdef cudaError_t _cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGraphAddNode_v2' in found_functions}}cdef cudaError_t _cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if True}}cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}}cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}}cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}}cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryLoadData' in found_functions}}cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryLoadFromFile' in found_functions}}cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryUnload' in found_functions}}cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryGetKernel' in found_functions}}cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryGetGlobal' in found_functions}}cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryGetManaged' in found_functions}}cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryGetUnifiedFunction' in found_functions}}cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryGetKernelCount' in found_functions}}cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaLibraryEnumerateKernels' in found_functions}}cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaKernelSetAttributeForDevice' in found_functions}}cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaStreamGetDevice' in found_functions}}cdef cudaError_t _cudaStreamGetDevice(cudaStream_t stream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaEventElapsedTime_v2' in found_functions}}cdef cudaError_t _cudaEventElapsedTime_v2(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpyBatchAsync' in found_functions}}cdef cudaError_t _cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} -{{if 'cudaMemcpy3DBatchAsync' in found_functions}}cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx.in b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx.in index b66f0c0c8..0f2685b99 100644 --- a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx.in +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -7,5122 +7,244 @@ # is strictly prohibited. from cuda.bindings.cyruntime cimport * from cuda.bindings._lib.cyruntime.utils cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp -from libcpp cimport bool +from libc.string cimport memset cimport cuda.bindings._bindings.cydriver as cydriver -cdef cudaPythonGlobal m_global = globalGetInstance() - -{{if 'cudaMemcpy' in found_functions}} - -cdef cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyDispatch(dst, src, count, kind) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaStreamCreate' in found_functions}} - -cdef cudaError_t _cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamCreate(pStream, 0) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaEventCreate' in found_functions}} - -cdef cudaError_t _cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventCreate(event, cydriver.CUevent_flags_enum.CU_EVENT_DEFAULT) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaEventQuery' in found_functions}} - -cdef cudaError_t _cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuEventQuery(event) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaCreateChannelDesc' in found_functions}} - -cdef cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) noexcept nogil: - cdef cudaChannelFormatDesc desc - desc.x = x - desc.y = y - desc.z = z - desc.w = w - desc.f = f - return desc - - -{{endif}} -{{if 'cudaDriverGetVersion' in found_functions}} - -cdef cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuDriverGetVersion(driverVersion) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaRuntimeGetVersion' in found_functions}} - -cdef cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - runtimeVersion[0] = m_global._CUDART_VERSION - return cudaSuccess - - -{{endif}} -{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} - -cdef cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - if fmtDesc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUarray_format fmt - cdef int numChannels = 0 - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - err = getDescInfo(fmtDesc, &numChannels, &fmt) - if err == cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmt, numChannels, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocHost' in found_functions}} - -cdef cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - if ptr == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocHost(size, ptr, 0) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocPitch' in found_functions}} - -cdef cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - if devPtr == NULL or pitch == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocPitch(width, height, 1, devPtr, pitch) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if mipmappedArray == NULL or desc == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocMipmappedArray(mipmappedArray, desc, extent.depth, extent.height, extent.width, numLevels, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2D' in found_functions}} - -cdef cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DPtr(dst, dpitch, src, spitch, width, height, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DPtr(dst, dpitch, src, spitch, width, height, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyAsyncDispatch(dst, src, count, kind, stream) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemcpyNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUcontext context - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaError_t err = cudaSuccess - - if pCopyParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - err = toDriverMemCopy3DParams(pCopyParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUcontext context - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaMemcpy3DParms copyParams - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - copy1DConvertTo3DParams(dst, src, count, kind, ©Params) - - err = toDriverMemCopy3DParams(©Params, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t _cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaMemcpy3DParms copyParams - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - copy1DConvertTo3DParams(dst, src, count, kind, ©Params) - - err = toDriverMemCopy3DParams(©Params, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuGraphMemcpyNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUcontext context - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaError_t err = cudaSuccess - - if pNodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - err = toDriverMemCopy3DParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuGraphExecMemcpyNodeSetParams(hGraphExec, node, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} - -cdef cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUcontext context - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaMemcpy3DParms copyParams - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - copy1DConvertTo3DParams(dst, src, count, kind, ©Params) - - err = toDriverMemCopy3DParams(©Params, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuGraphExecMemcpyNodeSetParams(hGraphExec, node, &driverNodeParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetDriverEntryPoint' in found_functions}} - -cdef cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuGetProcAddress_v2(symbol, funcPtr, m_global._CUDART_VERSION, flags, driverStatus) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemsetNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUcontext context - cdef cydriver.CUDA_MEMSET_NODE_PARAMS driverParams - cdef cudaError_t err = cudaSuccess - - if pMemsetParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - toDriverMemsetNodeParams(pMemsetParams, &driverParams) - - err = cydriver._cuGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, &driverParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUcontext context - cdef cydriver.CUDA_MEMSET_NODE_PARAMS driverParams - cdef cudaError_t err = cudaSuccess - - if pNodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - toDriverMemsetNodeParams(pNodeParams, &driverParams) - - err = cydriver._cuGraphExecMemsetNodeSetParams(hGraphExec, node, &driverParams, context) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - cdef cudaError_t err = cudaSuccess - - if pNodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = toDriverMemCopy3DParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuGraphMemcpyNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUDA_MEMCPY3D_v2 driverNodeParams - - if p == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphMemcpyNodeGetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = toCudartMemCopy3DParams(&driverNodeParams, p) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaFuncGetAttributes' in found_functions}} - -cdef cudaError_t _cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if NULL == attr: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef int bytes = 0 - memset(attr, 0, sizeof(cudaFuncAttributes)) - err = cydriver._cuFuncGetAttribute(&attr[0].maxThreadsPerBlock, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuFuncGetAttribute(&attr[0].numRegs, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_NUM_REGS, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuFuncGetAttribute(&attr[0].ptxVersion, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PTX_VERSION, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuFuncGetAttribute(&attr[0].binaryVersion, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_BINARY_VERSION, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuFuncGetAttribute(&bytes, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].sharedSizeBytes = bytes - err = cydriver._cuFuncGetAttribute(&bytes, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].constSizeBytes = bytes - err = cydriver._cuFuncGetAttribute(&bytes, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].localSizeBytes = bytes - err = cydriver._cuFuncGetAttribute(&attr[0].cacheModeCA, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_CACHE_MODE_CA, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuFuncGetAttribute(&bytes, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, func) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuFuncGetAttribute(&attr[0].preferredShmemCarveout, cydriver.CUfunction_attribute_enum.CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT, func) - if err != cudaSuccess: - _setLastError(err) - return err - attr[0].maxDynamicSharedSizeBytes = bytes - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMallocArray' in found_functions}} - -cdef cudaError_t _cudaMallocArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if arrayPtr == NULL or desc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocArray(arrayPtr, desc, 0, height, width, 0, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMalloc3D' in found_functions}} - -cdef cudaError_t _cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - if pitchedDevPtr == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocPitch(extent.width, extent.height, extent.depth, &pitchedDevPtr[0].ptr, &pitchedDevPtr[0].pitch) - if err != cudaSuccess: - _setLastError(err) - return err - pitchedDevPtr[0].xsize = extent.width - pitchedDevPtr[0].ysize = extent.height - return err - - -{{endif}} -{{if 'cudaMalloc3DArray' in found_functions}} - -cdef cudaError_t _cudaMalloc3DArray(cudaArray_t* arrayPtr, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if arrayPtr == NULL or desc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = mallocArray(arrayPtr, desc, extent.depth, extent.height, extent.width, 0, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetErrorString' in found_functions}} - -cdef const char* _cudaGetErrorString(cudaError_t error) except ?NULL nogil: - cdef const char* pStr = NULL - cdef cudaError_t err = cudaSuccess - - err = cydriver._cuGetErrorString(error, &pStr) - if err != cudaSuccess: - _setLastError(err) - if err == cudaErrorInvalidValue: - pStr = "unrecognized error code" - return pStr - - -{{endif}} -{{if 'cudaStreamAddCallback' in found_functions}} - -cdef cudaError_t _cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamAddCallbackCommon(stream, callback, userData, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} - -cdef cudaError_t _cudaStreamGetCaptureInfo_v2(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamGetCaptureInfoCommon(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaImportExternalSemaphore' in found_functions}} - -cdef cudaError_t _cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC driverSemHandleDesc - - if semHandleDesc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - memset(&driverSemHandleDesc, 0, sizeof(driverSemHandleDesc)) - - if semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueFd: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD - driverSemHandleDesc.handle.fd = semHandleDesc.handle.fd - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D12Fence: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeD3D11Fence: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeNvSciSync: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NVSCISYNC - driverSemHandleDesc.handle.nvSciSyncObj = semHandleDesc.handle.nvSciSyncObj - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutex: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeKeyedMutexKmt: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_KEYED_MUTEX_KMT - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD - driverSemHandleDesc.handle.fd = semHandleDesc.handle.fd - elif semHandleDesc.type == cudaExternalSemaphoreHandleType.cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32: - driverSemHandleDesc.type = cydriver.CUexternalSemaphoreHandleType_enum.CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 - driverSemHandleDesc.handle.win32.handle = semHandleDesc.handle.win32.handle - driverSemHandleDesc.handle.win32.name = semHandleDesc.handle.win32.name - driverSemHandleDesc.flags = semHandleDesc.flags - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuImportExternalSemaphore(extSem_out, &driverSemHandleDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuSignalExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) - if err != cudaSuccess: - _setLastError(err) - return err - return cudaSuccess - - -{{endif}} -{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} - -cdef cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuWaitExternalSemaphoresAsync(extSemArray, paramsArray, numExtSems, stream) - if err != cudaSuccess: - _setLastError(err) - return err - return cudaSuccess - - -{{endif}} -{{if 'cudaArrayGetInfo' in found_functions}} - -cdef cudaError_t _cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 driverDesc - cdef size_t width = 0 - cdef size_t height = 0 - cdef size_t depth = 0 - - # Zero out parameters in case cuArray3DGetDescriptor fails - if flags: - flags[0] = 0 - - if desc: - memset(desc, 0, sizeof(desc[0])) - - - if extent: - memset(extent, 0, sizeof(extent[0])) - - err = cydriver._cuArray3DGetDescriptor_v2(&driverDesc, array) - if err != cudaSuccess: - _setLastError(err) - return err - - # Flags are copied directly from the driver API - if flags: - flags[0] = driverDesc.Flags - - # Convert from driver API types to runtime API types. extent.Depth = 0 - # indicates a 2D array. - if desc: - width = 0 - height = 0 - depth = 0 - - err = getChannelFormatDescFromDriverDesc(desc, &depth, &height, &width, &driverDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - if extent: - extent.width = driverDesc.Width - extent.height = driverDesc.Height - extent.depth = driverDesc.Depth - - return cudaSuccess - - -{{endif}} -{{if 'cudaMemcpy2DToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DToArray(dst, hOffset, wOffset, src, spitch, width, height, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DFromArray' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DFromArray(dst, dpitch, src, hOffset, wOffset, width, height, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DArrayToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DArrayToArray(dst, hOffsetDst, wOffsetDst, src, hOffsetSrc, wOffsetSrc, width, height, kind) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DToArray(dst, hOffset, wOffset, src, spitch, width, height, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy2DFromArray(dst, dpitch, src, hOffset, wOffset, width, height, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemset3D' in found_functions}} - -cdef cudaError_t _cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memset3DPtr(pitchedDevPtr, value, extent, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemset3DAsync' in found_functions}} - -cdef cudaError_t _cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memset3DPtr(pitchedDevPtr, value, extent, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyToArray(dst, hOffset, wOffset, src, count, kind, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyFromArray' in found_functions}} - -cdef cudaError_t _cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyFromArray(dst, src, hOffset, wOffset, count, kind, NULL, 0) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyToArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyToArray(dst, hOffset, wOffset, src, count, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpyFromArrayAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyFromArray(dst, src, hOffset, wOffset, count, kind, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaPointerGetAttributes' in found_functions}} - -cdef cudaError_t _cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPointerAttributes attrib - cdef cydriver.CUcontext driverContext = NULL - cdef cydriver.CUmemorytype driverMemoryType - cdef int isManaged = 0 - cdef cydriver.CUpointer_attribute[6] query - query[0] = cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_CONTEXT - query[1] = cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE - query[2] = cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER - query[3] = cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_HOST_POINTER - query[4] = cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_MANAGED - query[5] = cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL - - memset(&attrib, 0, sizeof(attrib)) - memset(&driverMemoryType, 0, sizeof(driverMemoryType)) - - cdef void** data = [ - &driverContext, - &driverMemoryType, - &attrib.devicePointer, - &attrib.hostPointer, - &isManaged, - &attrib.device - ] - - if attributes == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - # Get all the attributes we need - err = cydriver._cuPointerGetAttributes((sizeof(query)/sizeof(query[0])), query, data, ptr) - if err != cudaSuccess: - if attributes != NULL: - memset(attributes, 0, sizeof(attributes[0])) - attributes[0].device = -1 - _setLastError(err) - return err - - if driverMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST: - if isManaged: - attrib.type = cudaMemoryTypeManaged - else: - attrib.type = cudaMemoryTypeHost - elif driverMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE: - if isManaged: - attrib.type = cudaMemoryTypeManaged - else: - attrib.type = cudaMemoryTypeDevice - else: - if driverMemoryType == 0: - attrib.type = cudaMemoryTypeUnregistered - else: - if attributes != NULL: - memset(attributes, 0, sizeof(attributes[0])) - attributes[0].device = -1 - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - # copy to user structure - attributes[0] = attrib - - return cudaSuccess - - -{{endif}} -{{if 'cudaGetDeviceFlags' in found_functions}} - -cdef cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - if flags == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cydriver.CUcontext driverContext - err = cydriver._cuCtxGetCurrent(&driverContext) - if err != cudaSuccess: - _setLastError(err) - return err - - # Get the flags from the current context - if driverContext != NULL: - err = cydriver._cuCtxGetFlags(flags) - if err != cudaSuccess: - _setLastError(err) - return err - - # Assume first valid device and get its implicit flags - cdef cudaPythonDevice* device - cdef unsigned int pcFlags - cdef int pcActive - device = m_global.getDevice(0) - err = cydriver._cuDevicePrimaryCtxGetState(device[0].driverDevice, &pcFlags, &pcActive) - if err != cudaSuccess: - _setLastError(err) - return err - flags[0] = pcFlags | cudaDeviceMapHost - return cudaSuccess - - -{{endif}} -{{if 'cudaMemcpy3D' in found_functions}} - -cdef cudaError_t _cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy3D(p, False, 0, 0, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy3DAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpy3D(p, False, 0, 0, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemPoolSetAccess' in found_functions}} - -cdef cudaError_t _cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - cdef size_t MAX_DEVICES = 32 - cdef cydriver.CUmemAccessDesc localList[32] - cdef cydriver.CUmemAccessDesc *cuDescList - cdef size_t i = 0 - - if (count > MAX_DEVICES): - cuDescList = calloc(sizeof(cydriver.CUmemAccessDesc), count) - else: - cuDescList = localList - - if cuDescList == NULL: - _setLastError(cudaErrorMemoryAllocation) - return cudaErrorMemoryAllocation - - while i < count: - cuDescList[i].location.type = descList[i].location.type - cuDescList[i].location.id = descList[i].location.id - cuDescList[i].flags = descList[i].flags - i += 1 - - err = cydriver._cuMemPoolSetAccess(memPool, cuDescList, count) - if err != cudaSuccess: - _setLastError(err) - return err - - if count > MAX_DEVICES: - free(cuDescList) - - return cudaSuccess - - -{{endif}} -{{if 'cudaDeviceReset' in found_functions}} - -cdef cudaError_t _cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef int deviceOrdinal = 0 - cdef cudaError_t err = cudaSuccess - if not m_global._lazyInitDriver: - return cudaSuccess - - cdef cydriver.CUcontext context - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - cdef cudaPythonDevice* device - device = m_global.getDeviceFromPrimaryCtx(context) - if device != NULL: - err = resetPrimaryContext(device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetLastError' in found_functions}} - -cdef cudaError_t _cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t last_err = m_global._lastError - m_global._lastError = cudaSuccess - return last_err - - -{{endif}} -{{if 'cudaPeekAtLastError' in found_functions}} - -cdef cudaError_t _cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - return m_global._lastError - - -{{endif}} -{{if 'cudaGetDevice' in found_functions}} - -cdef cudaError_t _cudaGetDevice(int* deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUdevice driverDevice = 0 - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - cdef cudaPythonDevice *cudaDevice - err = cydriver._cuCtxGetDevice(&driverDevice) - if err == cudaSuccess: - cudaDevice = m_global.getDeviceFromDriver(driverDevice) - deviceOrdinal[0] = cudaDevice[0].deviceOrdinal - elif err == cudaErrorDeviceUninitialized: - # Like C Runtime, default to first device and let context creation happen in another call - # By default, device 0 would initialized - deviceOrdinal[0] = 0 - err = cudaSuccess - return err - - -{{endif}} -{{if 'cudaSetDevice' in found_functions}} - -cdef cudaError_t _cudaSetDevice(int deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - device = m_global.getDevice(deviceOrdinal) - if device == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - - if device.primaryContext == NULL: - initPrimaryContext(device) - - err = cydriver._cuCtxSetCurrent(device.primaryContext) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetDeviceProperties_v2' in found_functions}} - -cdef cudaError_t _cudaGetDeviceProperties_v2(cudaDeviceProp* prop, int deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - device = m_global.getDevice(deviceOrdinal) - if device == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.kernelExecTimeoutEnabled), cydriver.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.computeMode), cydriver.CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.clockRate), cydriver.CU_DEVICE_ATTRIBUTE_CLOCK_RATE, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryClockRate), cydriver.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.singleToDoublePrecisionPerfRatio), cydriver.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO, device[0].driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - prop[0] = device[0].deviceProperties - - return cudaSuccess - - -{{endif}} -{{if 'cudaChooseDevice' in found_functions}} - -cdef cudaError_t _cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: - if device == NULL or prop == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - cdef int best = -1 - cdef int maxrank = -1 - cdef int rank = 0 - cdef char* dontCare_name = [b'\0'] - cdef int dontCare_major = -1 - cdef int dontCare_minor = -1 - cdef size_t dontCare_totalGlobalMem = 0 - cdef int deviceOrdinal = 0 - cdef cudaDeviceProp *devProp - - for deviceOrdinal in range(m_global._numDevices): - devProp = &m_global._deviceList[deviceOrdinal].deviceProperties - rank = 0 - if (strncmp(prop[0].name, dontCare_name, sizeof(prop[0].name)) != 0): - rank += strncmp(prop[0].name, devProp[0].name, sizeof(prop[0].name)) == 0 - if (prop[0].major != dontCare_major): - rank += prop[0].major <= devProp[0].major - if (prop[0].major == devProp[0].major and prop[0].minor != dontCare_minor): - rank += prop[0].minor <= devProp[0].minor - if (prop[0].totalGlobalMem != dontCare_totalGlobalMem): - rank += prop[0].totalGlobalMem <= devProp[0].totalGlobalMem - if (rank > maxrank): - maxrank = rank - best = deviceOrdinal - - device[0] = best - return cudaSuccess - - -{{endif}} -{{if 'cudaMemcpyArrayToArray' in found_functions}} - -cdef cudaError_t _cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = memcpyArrayToArray(dst, hOffsetDst, wOffsetDst, src, hOffsetSrc, wOffsetSrc, count, kind) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetChannelDesc' in found_functions}} - -cdef cudaError_t _cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if desc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = getChannelDesc(array, desc) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaCreateTextureObject' in found_functions}} - -cdef cudaError_t _cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if pResDesc == NULL or pTexDesc == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cydriver.CUDA_RESOURCE_DESC rd - cdef cydriver.CUDA_TEXTURE_DESC td - cdef cydriver.CUDA_RESOURCE_VIEW_DESC rvd - cdef cudaTextureDesc texDesc - memcpy(&texDesc, pTexDesc, sizeof(cudaTextureDesc)) - texDesc.seamlessCubemap = 0 - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if pResViewDesc: - err = getDriverResDescFromResDesc(&rd, pResDesc, &td, &texDesc, &rvd, pResViewDesc) - else: - err = getDriverResDescFromResDesc(&rd, pResDesc, &td, &texDesc, NULL, pResViewDesc) - if err != cudaSuccess: - _setLastError(err) - return err - if pResViewDesc: - err = cydriver._cuTexObjectCreate(pTexObject, &rd, &td, &rvd) - else: - err = cydriver._cuTexObjectCreate(pTexObject, &rd, &td, NULL) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} - -cdef cudaError_t _cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - cdef cudaResourceDesc resDesc - cdef cydriver.CUDA_RESOURCE_DESC rd - cdef cydriver.CUDA_TEXTURE_DESC td - cdef cudaTextureDesc texDesc - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuTexObjectGetResourceDesc(&rd, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuTexObjectGetTextureDesc(&td, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = getResDescFromDriverResDesc(&resDesc, &rd, &texDesc, &td, NULL, NULL) - if err != cudaSuccess: - _setLastError(err) - return err - memcpy(pTexDesc, &texDesc, sizeof(cudaTextureDesc)) - - return cudaSuccess - -{{endif}} -{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} - -cdef cudaError_t _cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaResourceDesc resDesc - cdef cydriver.CUDA_RESOURCE_DESC rd - cdef cydriver.CUDA_RESOURCE_VIEW_DESC rvd - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver.cuTexObjectGetResourceDesc(&rd, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver.cuTexObjectGetResourceViewDesc(&rvd, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - err = getResDescFromDriverResDesc(&resDesc, &rd, NULL, NULL, pResViewDesc, &rvd) - if err != cudaSuccess: - _setLastError(err) - return err - - return cudaSuccess - - -{{endif}} -{{if 'cudaGetExportTable' in found_functions}} - -cdef cudaError_t _cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - err = cydriver._cuGetExportTable(ppExportTable, pExportTableId) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemcpy3DPeer' in found_functions}} - -cdef cudaError_t _cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - cdef cudaMemcpy3DParms cp - memset(&cp, 0, sizeof(cp)) - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cp.srcArray = p[0].srcArray - cp.srcPos = p[0].srcPos - cp.srcPtr = p[0].srcPtr - cp.dstArray = p[0].dstArray - cp.dstPos = p[0].dstPos - cp.dstPtr = p[0].dstPtr - cp.extent = p[0].extent - cp.kind = cudaMemcpyKind.cudaMemcpyDeviceToDevice - - err = memcpy3D(&cp, True, p[0].srcDevice, p[0].dstDevice, NULL, False) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemcpy3DPeerAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - if p == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - cdef cudaError_t err = cudaSuccess - cdef cudaMemcpy3DParms cp - memset(&cp, 0, sizeof(cp)) - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cp.srcArray = p[0].srcArray - cp.srcPos = p[0].srcPos - cp.srcPtr = p[0].srcPtr - cp.dstArray = p[0].dstArray - cp.dstPos = p[0].dstPos - cp.dstPtr = p[0].dstPtr - cp.extent = p[0].extent - cp.kind = cudaMemcpyKind.cudaMemcpyDeviceToDevice - - err = memcpy3D(&cp, True, p[0].srcDevice, p[0].dstDevice, stream, True) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'make_cudaPitchedPtr' in found_functions}} - -cdef cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) noexcept nogil: - cdef cudaPitchedPtr s - s.ptr = d - s.pitch = p - s.xsize = xsz - s.ysize = ysz - return s - - -{{endif}} -{{if 'make_cudaPos' in found_functions}} - -cdef cudaPos _make_cudaPos(size_t x, size_t y, size_t z) noexcept nogil: - cdef cudaPos p - p.x = x - p.y = y - p.z = z - return p - - -{{endif}} -{{if 'make_cudaExtent' in found_functions}} - -cdef cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) noexcept nogil: - cdef cudaExtent e - e.width = w - e.height = h - e.depth = d - return e - - -{{endif}} -{{if 'cudaSetDeviceFlags' in found_functions}} - -cdef cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - flags &= ~cudaDeviceMapHost - if flags & ~cudaDeviceMask: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef unsigned int scheduleFlags = flags & cudaDeviceScheduleMask - if scheduleFlags and (scheduleFlags != cudaDeviceScheduleSpin and - scheduleFlags != cudaDeviceScheduleYield and - scheduleFlags != cudaDeviceScheduleBlockingSync): - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - - cdef cydriver.CUcontext context - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - - cdef cudaPythonDevice* device - device = m_global.getDeviceFromPrimaryCtx(context) - if device == NULL: - # We don't know if context provided is primary or not - # cudaSetDevice may need to be called before retrying call - return cudaErrorIncompatibleDriverContext - - err = cydriver._cuDevicePrimaryCtxSetFlags_v2(device[0].driverDevice, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphAddMemAllocNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if params_out == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphMemAllocNodeGetParams(node, params_out) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if dptr_out == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphMemFreeNodeGetParams(node, dptr_out) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemAdvise' in found_functions}} - -cdef cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemAdvise(devPtr, count, advice, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemAdvise_v2' in found_functions}} - -cdef cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUmemLocation _driver_location - _driver_location.type = location.type - _driver_location.id = location.id - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemAdvise_v2(devPtr, count, advice, _driver_location) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemRangeGetAttribute' in found_functions}} - -cdef cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMemRangeGetAttributes' in found_functions}} - -cdef cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaGetDeviceCount' in found_functions}} - -cdef cudaError_t _cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - count[0] = m_global._numDevices - return cudaSuccess - - -{{endif}} -{{if 'cudaDeviceGetAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuDeviceGetAttribute(value, attr, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxSetSharedMemConfig(config) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceGetByPCIBusId' in found_functions}} - -cdef cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuDeviceGetByPCIBusId(device, pciBusId) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceGetPCIBusId' in found_functions}} - -cdef cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuDeviceGetPCIBusId(pciBusId, length, device) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceGetP2PAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t _cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES _driver_sparseProperties - if not sparseProperties: - _setLastError(cudaErrorInvalidValue) - return cudaError.cudaErrorInvalidValue - memset(sparseProperties, 0, sizeof(cudaArraySparseProperties)) - - err = cydriver._cuArrayGetSparseProperties(&_driver_sparseProperties, array) - if err == cudaSuccess: - sparseProperties[0].miptailFirstLevel = _driver_sparseProperties.miptailFirstLevel - sparseProperties[0].miptailSize = _driver_sparseProperties.miptailSize - sparseProperties[0].flags = _driver_sparseProperties.flags - sparseProperties[0].tileExtent.width = _driver_sparseProperties.tileExtent.width - sparseProperties[0].tileExtent.height = _driver_sparseProperties.tileExtent.height - sparseProperties[0].tileExtent.depth = _driver_sparseProperties.tileExtent.depth - - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} - -cdef cudaError_t _cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES _driver_sparseProperties - if not sparseProperties: - _setLastError(cudaErrorInvalidValue) - return cudaError.cudaErrorInvalidValue - memset(sparseProperties, 0, sizeof(cudaArraySparseProperties)) - - err = cydriver._cuMipmappedArrayGetSparseProperties(&_driver_sparseProperties, mipmap) - if err == cudaSuccess: - sparseProperties[0].miptailFirstLevel = _driver_sparseProperties.miptailFirstLevel - sparseProperties[0].miptailSize = _driver_sparseProperties.miptailSize - sparseProperties[0].flags = _driver_sparseProperties.flags - sparseProperties[0].tileExtent.width = _driver_sparseProperties.tileExtent.width - sparseProperties[0].tileExtent.height = _driver_sparseProperties.tileExtent.height - sparseProperties[0].tileExtent.depth = _driver_sparseProperties.tileExtent.depth - - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceCanAccessPeer' in found_functions}} - -cdef cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - cdef cudaPythonDevice *driverDevice - cdef cudaPythonDevice *driverPeerDevice - driverDevice = m_global.getDevice(device) - driverPeerDevice = m_global.getDevice(peerDevice) - if driverDevice == NULL or driverPeerDevice == NULL: - return cudaErrorInvalidDevice - - err = cydriver._cuDeviceCanAccessPeer(canAccessPeer, driverDevice.driverDevice, driverPeerDevice.driverDevice) - if err != cudaSuccess: - _setLastError(err) - return err - if device == peerDevice: - canAccessPeer[0] = 0 - return err - - -{{endif}} -{{if 'cudaMemcpyPeer' in found_functions}} - -cdef cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - cdef cudaPythonDevice *peerDevice - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if count > 0: - peerDevice = m_global.getDevice(dstDevice) - device = m_global.getDevice(srcDevice) - if device == NULL or peerDevice == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - err = initPrimaryContext(peerDevice) - if err != cudaSuccess: - _setLastError(err) - return err - err = initPrimaryContext(device) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuMemcpyPeer(dst, peerDevice[0].primaryContext, src, device[0].primaryContext, count) - if err != cudaSuccess: - _setLastError(err) - return err - return err - - -{{endif}} -{{if 'cudaMemcpyPeerAsync' in found_functions}} - -cdef cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - cdef cudaPythonDevice *peerDevice - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if count > 0: - peerDevice = m_global.getDevice(dstDevice) - device = m_global.getDevice(srcDevice) - if device == NULL or peerDevice == NULL: - _setLastError(err) - return cudaErrorInvalidDevice - err = initPrimaryContext(peerDevice) - if err != cudaSuccess: - _setLastError(err) - return err - err = initPrimaryContext(device) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuMemcpyPeerAsync(dst, peerDevice[0].primaryContext, src, device[0].primaryContext, count, stream) - if err != cudaSuccess: - _setLastError(err) - return err - return err - - -{{endif}} -{{if 'cudaDeviceEnablePeerAccess' in found_functions}} - -cdef cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUcontext context - cdef cudaPythonDevice *dev - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - dev = m_global.getDeviceFromPrimaryCtx(context) - if dev == NULL: - # We don't know if context provided is primary or not - # cudaSetDevice may need to be called before retrying call - _setLastError(cudaErrorIncompatibleDriverContext) - return cudaErrorIncompatibleDriverContext - dev = m_global.getDevice(peerDevice) - if dev == NULL: - return cudaErrorInvalidDevice - err = initPrimaryContext(dev) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuCtxEnablePeerAccess(dev.primaryContext, flags) - if err != cudaSuccess: - _setLastError(err) - return err - - -{{endif}} -{{if 'cudaDeviceDisablePeerAccess' in found_functions}} - -cdef cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUcontext context - cdef cudaPythonDevice *dev - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - dev = m_global.getDeviceFromPrimaryCtx(context) - if dev == NULL: - # We don't know if context provided is primary or not - # cudaSetDevice may need to be called before retrying call - _setLastError(cudaErrorIncompatibleDriverContext) - return cudaErrorIncompatibleDriverContext - dev = m_global.getDevice(peerDevice) - if dev == NULL: - return cudaErrorInvalidDevice - err = initPrimaryContext(dev) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuCtxDisablePeerAccess(dev.primaryContext) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC _driver_mipmapDesc - memset(&_driver_mipmapDesc, 0, sizeof(_driver_mipmapDesc)) - _driver_mipmapDesc.offset = mipmapDesc[0].offset - _driver_mipmapDesc.arrayDesc.Width = mipmapDesc[0].extent.width - _driver_mipmapDesc.arrayDesc.Height = mipmapDesc[0].extent.height - _driver_mipmapDesc.arrayDesc.Depth = mipmapDesc[0].extent.depth - err_rt = getDescInfo(&mipmapDesc[0].formatDesc, &_driver_mipmapDesc.arrayDesc.NumChannels, &_driver_mipmapDesc.arrayDesc.Format) - if err_rt != cudaError.cudaSuccess: - _setLastError(err_rt) - return err_rt - _driver_mipmapDesc.arrayDesc.Flags = mipmapDesc[0].flags - _driver_mipmapDesc.numLevels = mipmapDesc[0].numLevels - - if err != cudaSuccess: - return err - err = cydriver._cuExternalMemoryGetMappedMipmappedArray(mipmap, extMem, &_driver_mipmapDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} - -cdef cudaError_t _cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUDA_RESOURCE_DESC _driver_pResDesc - - if err != cudaSuccess: - return err - err = cydriver._cuSurfObjectGetResourceDesc(&_driver_pResDesc, surfObject) - memset(pResDesc, 0, sizeof(cudaResourceDesc)) - if _driver_pResDesc.resType == cydriver.CU_RESOURCE_TYPE_ARRAY: - pResDesc[0].resType = cudaResourceType.cudaResourceTypeArray - pResDesc[0].res.array.array = _driver_pResDesc.res.array.hArray - elif _driver_pResDesc.resType == cydriver.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY: - pResDesc[0].resType = cudaResourceType.cudaResourceTypeMipmappedArray - pResDesc[0].res.mipmap.mipmap = _driver_pResDesc.res.mipmap.hMipmappedArray - elif _driver_pResDesc.resType == cydriver.CU_RESOURCE_TYPE_LINEAR: - pResDesc[0].resType = cudaResourceType.cudaResourceTypeLinear - pResDesc[0].res.linear.devPtr = _driver_pResDesc.res.linear.devPtr - pResDesc[0].res.linear.sizeInBytes = _driver_pResDesc.res.linear.sizeInBytes - elif _driver_pResDesc.resType == cydriver.CU_RESOURCE_TYPE_PITCH2D: - pResDesc[0].resType = cudaResourceType.cudaResourceTypePitch2D - pResDesc[0].res.pitch2D.devPtr = _driver_pResDesc.res.pitch2D.devPtr - pResDesc[0].res.pitch2D.pitchInBytes = _driver_pResDesc.res.pitch2D.pitchInBytes - pResDesc[0].res.pitch2D.width = _driver_pResDesc.res.pitch2D.width - pResDesc[0].res.pitch2D.height = _driver_pResDesc.res.pitch2D.height - if _driver_pResDesc.resType == cydriver.CU_RESOURCE_TYPE_LINEAR or _driver_pResDesc.resType == cydriver.CU_RESOURCE_TYPE_PITCH2D: - channel_size = 0 - if _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_UNSIGNED_INT8: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 8 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_UNSIGNED_INT16: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 16 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 32 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_SIGNED_INT8: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 8 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_SIGNED_INT16: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 16 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_SIGNED_INT32: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 32 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_HALF: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 16 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_FLOAT: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 32 - elif _driver_pResDesc.res.linear.format == cydriver.CU_AD_FORMAT_NV12: - pResDesc[0].res.linear.desc.f = cudaChannelFormatKind.cudaChannelFormatKindNV12 - channel_size = 8 - else: - _setLastError(cudaErrorInvalidChannelDescriptor) - return cudaError.cudaErrorInvalidChannelDescriptor - pResDesc[0].res.linear.desc.x = 0 - pResDesc[0].res.linear.desc.y = 0 - pResDesc[0].res.linear.desc.z = 0 - pResDesc[0].res.linear.desc.w = 0 - if _driver_pResDesc.res.linear.numChannels >= 4: - pResDesc[0].res.linear.desc.w = channel_size - if _driver_pResDesc.res.linear.numChannels >= 3: - pResDesc[0].res.linear.desc.z = channel_size - if _driver_pResDesc.res.linear.numChannels >= 2: - pResDesc[0].res.linear.desc.y = channel_size - if _driver_pResDesc.res.linear.numChannels >= 1: - pResDesc[0].res.linear.desc.x = channel_size - if _driver_pResDesc.res.linear.numChannels < 1 or _driver_pResDesc.res.linear.numChannels >= 5: - _setLastError(cudaErrorInvalidChannelDescriptor) - return cudaError.cudaErrorInvalidChannelDescriptor - - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUDA_KERNEL_NODE_PARAMS driverNodeParams - - if err != cudaSuccess: - return err - err = cydriver._cuGraphKernelNodeGetParams_v2(node, &driverNodeParams) - pNodeParams[0].func = driverNodeParams.func - pNodeParams[0].gridDim.x = driverNodeParams.gridDimX - pNodeParams[0].gridDim.y = driverNodeParams.gridDimY - pNodeParams[0].gridDim.z = driverNodeParams.gridDimZ - pNodeParams[0].blockDim.x = driverNodeParams.blockDimX - pNodeParams[0].blockDim.y = driverNodeParams.blockDimY - pNodeParams[0].blockDim.z = driverNodeParams.blockDimZ - pNodeParams[0].sharedMemBytes = driverNodeParams.sharedMemBytes - pNodeParams[0].kernelParams = driverNodeParams.kernelParams - pNodeParams[0].extra = driverNodeParams.extra - - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} - -cdef cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC _driver_bufferDesc - memset(&_driver_bufferDesc, 0, sizeof(_driver_bufferDesc)) - _driver_bufferDesc.offset = bufferDesc[0].offset - _driver_bufferDesc.size = bufferDesc[0].size - _driver_bufferDesc.flags = bufferDesc[0].flags - - if err != cudaSuccess: - return err - err = cydriver._cuExternalMemoryGetMappedBuffer(devPtr, extMem, &_driver_bufferDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaImportExternalMemory' in found_functions}} - -cdef cudaError_t _cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC _driver_memHandleDesc - memset(&_driver_memHandleDesc, 0, sizeof(_driver_memHandleDesc)) - - if memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueFd: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD - _driver_memHandleDesc.handle.fd = memHandleDesc[0].handle.fd - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeOpaqueWin32Kmt: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Heap: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D12Resource: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11Resource: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeD3D11ResourceKmt: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_RESOURCE_KMT - _driver_memHandleDesc.handle.win32.handle = memHandleDesc[0].handle.win32.handle - _driver_memHandleDesc.handle.win32.name = memHandleDesc[0].handle.win32.name - elif memHandleDesc[0].type == cudaExternalMemoryHandleType.cudaExternalMemoryHandleTypeNvSciBuf: - _driver_memHandleDesc.type = cydriver.CUexternalMemoryHandleType_enum.CU_EXTERNAL_MEMORY_HANDLE_TYPE_NVSCIBUF - _driver_memHandleDesc.handle.nvSciBufObject = memHandleDesc[0].handle.nvSciBufObject - _driver_memHandleDesc.size = memHandleDesc[0].size - _driver_memHandleDesc.flags = memHandleDesc[0].flags - - if err != cudaSuccess: - return err - err = cydriver._cuImportExternalMemory(extMem_out, &_driver_memHandleDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaCreateSurfaceObject' in found_functions}} - -cdef cudaError_t _cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_RESOURCE_DESC _driver_pResDesc - memset(&_driver_pResDesc, 0, sizeof(_driver_pResDesc)) - err = toDriverCudaResourceDesc(&_driver_pResDesc, pResDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuSurfObjectCreate(pSurfObject, &_driver_pResDesc) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} - -cdef cudaError_t _cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_RESOURCE_DESC _driver_pResDesc - memset(&_driver_pResDesc, 0, sizeof(_driver_pResDesc)) - err = toDriverCudaResourceDesc(&_driver_pResDesc, pResDesc) - if err != cudaSuccess: - _setLastError(err) - return err - - err = cydriver._cuTexObjectGetResourceDesc(&_driver_pResDesc, texObject) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUeglFrame cueglFrame - err = getDriverEglFrame(&cueglFrame, eglframe) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuEGLStreamProducerPresentFrame(conn, cueglFrame, pStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - if eglframe == NULL: - err = cudaErrorInvalidResourceHandle - _setLastError(err) - return err - cdef cydriver.CUeglFrame cueglFrame - err = cydriver._cuEGLStreamProducerReturnFrame(conn, &cueglFrame, pStream) - if err != cudaSuccess: - _setLastError(err) - return err - err = getRuntimeEglFrame(eglframe, cueglFrame) - if err != cudaSuccess: - _setLastError(err) - return err - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUeglFrame cueglFrame - memset(&cueglFrame, 0, sizeof(cueglFrame)) - err = cydriver._cuGraphicsResourceGetMappedEglFrame(&cueglFrame, resource, index, mipLevel) - if err != cudaSuccess: - _setLastError(err) - return err - err = getRuntimeEglFrame(eglFrame, cueglFrame) - if err != cudaSuccess: - _setLastError(err) - return err - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - return cudaErrorNotSupported - -{{endif}} -{{if 'cudaArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t _cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS driverMemoryRequirements - if memoryRequirements == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - memset(memoryRequirements, 0, sizeof(memoryRequirements[0])) - err = cydriver._cuArrayGetMemoryRequirements(&driverMemoryRequirements, array, device) - if err != cudaSuccess: - _setLastError(err) - return err - - memoryRequirements[0].size = driverMemoryRequirements.size - memoryRequirements[0].alignment = driverMemoryRequirements.alignment - return cudaSuccess - -{{endif}} -{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} - -cdef cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS driverMemoryRequirements - if memoryRequirements == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - memset(memoryRequirements, 0, sizeof(memoryRequirements[0])) - err = cydriver._cuMipmappedArrayGetMemoryRequirements(&driverMemoryRequirements, mipmap, device) - if err != cudaSuccess: - _setLastError(err) - return err - - memoryRequirements[0].size = driverMemoryRequirements.size - memoryRequirements[0].alignment = driverMemoryRequirements.alignment - return cudaSuccess - -{{endif}} -{{if 'cudaStreamGetAttribute' in found_functions}} - -cdef cudaError_t _cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamGetAttribute(hStream, attr, value_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamSetAttribute' in found_functions}} - -cdef cudaError_t _cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamSetAttribute(hStream, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphKernelNodeGetAttribute(hNode, attr, value_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphKernelNodeSetAttribute(hNode, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsGLRegisterImage(resource, image, target, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsGLRegisterBuffer(resource, buffer, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSynchronize' in found_functions}} - -cdef cudaError_t _cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxSynchronize() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetLimit' in found_functions}} - -cdef cudaError_t _cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxSetLimit(limit, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetLimit' in found_functions}} - -cdef cudaError_t _cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxGetLimit(pValue, limit) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetCacheConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxGetCacheConfig(pCacheConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} - -cdef cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxGetStreamPriorityRange(leastPriority, greatestPriority) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetCacheConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxSetCacheConfig(cacheConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} - -cdef cudaError_t _cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxGetSharedMemConfig(pConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcGetEventHandle' in found_functions}} - -cdef cudaError_t _cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuIpcGetEventHandle(handle, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcOpenEventHandle' in found_functions}} - -cdef cudaError_t _cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUipcEventHandle _driver_handle - memcpy(&_driver_handle, &handle, sizeof(_driver_handle)) - if err != cudaSuccess: - return err - err = cydriver._cuIpcOpenEventHandle(event, _driver_handle) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcGetMemHandle' in found_functions}} - -cdef cudaError_t _cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuIpcGetMemHandle(handle, devPtr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcOpenMemHandle' in found_functions}} - -cdef cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - cdef cydriver.CUipcMemHandle _driver_handle - memcpy(&_driver_handle, &handle, sizeof(_driver_handle)) - if err != cudaSuccess: - return err - err = cydriver._cuIpcOpenMemHandle_v2(devPtr, _driver_handle, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaIpcCloseMemHandle' in found_functions}} - -cdef cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuIpcCloseMemHandle(devPtr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} - -cdef cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuFlushGPUDirectRDMAWrites(target, scope) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} - -cdef cudaError_t _cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceGetDefaultMemPool(memPool, device) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetMemPool' in found_functions}} - -cdef cudaError_t _cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceSetMemPool(device, memPool) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetMemPool' in found_functions}} - -cdef cudaError_t _cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceGetMemPool(memPool, device) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} - -cdef cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamCreateWithFlags' in found_functions}} - -cdef cudaError_t _cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamCreate(pStream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamCreateWithPriority' in found_functions}} - -cdef cudaError_t _cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamCreateWithPriority(pStream, flags, priority) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamGetPriority' in found_functions}} - -cdef cudaError_t _cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamGetPriority(hStream, priority) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamGetFlags' in found_functions}} - -cdef cudaError_t _cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamGetFlags(hStream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} - -cdef cudaError_t _cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuCtxResetPersistingL2Cache() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamCopyAttributes' in found_functions}} - -cdef cudaError_t _cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamCopyAttributes(dst, src) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamDestroy' in found_functions}} - -cdef cudaError_t _cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamDestroy_v2(stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamWaitEvent' in found_functions}} - -cdef cudaError_t _cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamWaitEvent(stream, event, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamSynchronize' in found_functions}} - -cdef cudaError_t _cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamSynchronize(stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamQuery' in found_functions}} - -cdef cudaError_t _cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamQuery(stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamAttachMemAsync' in found_functions}} - -cdef cudaError_t _cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamAttachMemAsync(stream, devPtr, length, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamBeginCapture' in found_functions}} - -cdef cudaError_t _cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamBeginCapture_v2(stream, mode) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} - -cdef cudaError_t _cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} - -cdef cudaError_t _cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuThreadExchangeStreamCaptureMode(mode) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamEndCapture' in found_functions}} - -cdef cudaError_t _cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamEndCapture(stream, pGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamIsCapturing' in found_functions}} - -cdef cudaError_t _cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamIsCapturing(stream, pCaptureStatus) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} - -cdef cudaError_t _cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventCreateWithFlags' in found_functions}} - -cdef cudaError_t _cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventCreate(event, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventRecord' in found_functions}} - -cdef cudaError_t _cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventRecord(event, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventRecordWithFlags' in found_functions}} - -cdef cudaError_t _cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventRecordWithFlags(event, stream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventSynchronize' in found_functions}} - -cdef cudaError_t _cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventSynchronize(event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventDestroy' in found_functions}} - -cdef cudaError_t _cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventDestroy_v2(event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaEventElapsedTime' in found_functions}} - -cdef cudaError_t _cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventElapsedTime(ms, start, end) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroyExternalMemory' in found_functions}} - -cdef cudaError_t _cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDestroyExternalMemory(extMem) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroyExternalSemaphore' in found_functions}} - -cdef cudaError_t _cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDestroyExternalSemaphore(extSem) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFuncSetCacheConfig' in found_functions}} - -cdef cudaError_t _cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuFuncSetCacheConfig(func, cacheConfig) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFuncSetSharedMemConfig' in found_functions}} - -cdef cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuFuncSetSharedMemConfig(func, config) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFuncSetAttribute' in found_functions}} - -cdef cudaError_t _cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuFuncSetAttribute(func, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaLaunchHostFunc' in found_functions}} - -cdef cudaError_t _cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = streamAddHostCallbackCommon(stream, fn, userData) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - -cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - -cdef cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - -cdef cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMallocManaged' in found_functions}} - -cdef cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemAllocManaged(devPtr, size, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMalloc' in found_functions}} - -cdef cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemAlloc_v2(devPtr, size) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFree' in found_functions}} - -cdef cudaError_t _cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemFree_v2(devPtr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeHost' in found_functions}} - -cdef cudaError_t _cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemFreeHost(ptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeArray' in found_functions}} - -cdef cudaError_t _cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuArrayDestroy(array) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMipmappedArrayDestroy(mipmappedArray) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostAlloc' in found_functions}} - -cdef cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemHostAlloc(pHost, size, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostRegister' in found_functions}} - -cdef cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemHostRegister_v2(ptr, size, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostUnregister' in found_functions}} - -cdef cudaError_t _cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemHostUnregister(ptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostGetDevicePointer' in found_functions}} - -cdef cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemHostGetDevicePointer_v2(pDevice, pHost, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaHostGetFlags' in found_functions}} - -cdef cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemHostGetFlags(pFlags, pHost) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetMipmappedArrayLevel' in found_functions}} - -cdef cudaError_t _cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMipmappedArrayGetLevel(levelArray, mipmappedArray, level) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemGetInfo' in found_functions}} - -cdef cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemGetInfo_v2(free, total) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaArrayGetPlane' in found_functions}} - -cdef cudaError_t _cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuArrayGetPlane(pPlaneArray, hArray, planeIdx) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemset' in found_functions}} - -cdef cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemsetD8_v2(devPtr, value, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemset2D' in found_functions}} - -cdef cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemsetD2D8_v2(devPtr, pitch, value, width, height) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemsetAsync' in found_functions}} - -cdef cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemsetD8Async(devPtr, value, count, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemset2DAsync' in found_functions}} - -cdef cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemsetD2D8Async(devPtr, pitch, value, width, height, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPrefetchAsync' in found_functions}} - -cdef cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPrefetchAsync(devPtr, count, dstDevice, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPrefetchAsync_v2' in found_functions}} - -cdef cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUmemLocation _driver_location - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - _driver_location.type = location.type - _driver_location.id = location.id - err = cydriver._cuMemPrefetchAsync_v2(devPtr, count, _driver_location, flags, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMallocAsync' in found_functions}} - -cdef cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemAllocAsync(devPtr, size, hStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaFreeAsync' in found_functions}} - -cdef cudaError_t _cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemFreeAsync(devPtr, hStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolTrimTo' in found_functions}} - -cdef cudaError_t _cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolTrimTo(memPool, minBytesToKeep) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolSetAttribute' in found_functions}} - -cdef cudaError_t _cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolSetAttribute(memPool, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolGetAttribute' in found_functions}} - -cdef cudaError_t _cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolGetAttribute(memPool, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolGetAccess' in found_functions}} - -cdef cudaError_t _cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolGetAccess(flags, memPool, location) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolCreate' in found_functions}} - -cdef cudaError_t _cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolCreate(memPool, poolProps) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolDestroy' in found_functions}} - -cdef cudaError_t _cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolDestroy(memPool) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMallocFromPoolAsync' in found_functions}} - -cdef cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemAllocFromPoolAsync(ptr, size, memPool, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} - -cdef cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} - -cdef cudaError_t _cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolExportPointer' in found_functions}} - -cdef cudaError_t _cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolExportPointer(exportData, ptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaMemPoolImportPointer' in found_functions}} - -cdef cudaError_t _cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuMemPoolImportPointer(ptr, memPool, exportData) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsUnregisterResource' in found_functions}} - -cdef cudaError_t _cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsUnregisterResource(resource) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} - -cdef cudaError_t _cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsResourceSetMapFlags_v2(resource, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsMapResources' in found_functions}} - -cdef cudaError_t _cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsMapResources(count, resources, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsUnmapResources' in found_functions}} - -cdef cudaError_t _cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsUnmapResources(count, resources, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} - -cdef cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsResourceGetMappedPointer_v2(devPtr, size, resource) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} - -cdef cudaError_t _cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} - -cdef cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroyTextureObject' in found_functions}} - -cdef cudaError_t _cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuTexObjectDestroy(texObject) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDestroySurfaceObject' in found_functions}} - -cdef cudaError_t _cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuSurfObjectDestroy(surfObject) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphCreate' in found_functions}} - -cdef cudaError_t _cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphCreate(pGraph, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddKernelNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_KERNEL_NODE_PARAMS driverNodeParams - err = toDriverKernelNodeParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddKernelNode_v2(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_KERNEL_NODE_PARAMS driverNodeParams - err = toDriverKernelNodeParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - return err - err = cydriver._cuGraphKernelNodeSetParams_v2(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} - -cdef cudaError_t _cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphKernelNodeCopyAttributes(hSrc, hDst) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphMemsetNodeGetParams(node, pNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphMemsetNodeSetParams(node, pNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddHostNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_HOST_NODE_PARAMS driverNodeParams - toDriverHostNodeParams(pNodeParams, &driverNodeParams) - err = cydriver._cuGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphHostNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphHostNodeGetParams(node, pNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphHostNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_HOST_NODE_PARAMS driverNodeParams - toDriverHostNodeParams(pNodeParams, &driverNodeParams) - err = cydriver._cuGraphHostNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddChildGraphNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} - -cdef cudaError_t _cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphChildGraphNodeGetGraph(node, pGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddEmptyNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddEventRecordNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphEventRecordNodeGetEvent(node, event_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphEventRecordNodeSetEvent(node, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddEventWaitNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphEventWaitNodeGetEvent(node, event_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphEventWaitNodeSetEvent(node, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddMemFreeNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGraphMemTrim' in found_functions}} - -cdef cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceGraphMemTrim(device) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceGetGraphMemAttribute(device, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} - -cdef cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuDeviceSetGraphMemAttribute(device, attr, value) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphClone' in found_functions}} - -cdef cudaError_t _cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphClone(pGraphClone, originalGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeFindInClone' in found_functions}} - -cdef cudaError_t _cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeFindInClone(pNode, originalNode, clonedGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetType' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeGetType(node, pType) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetNodes' in found_functions}} - -cdef cudaError_t _cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphGetNodes(graph, nodes, numNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetRootNodes' in found_functions}} - -cdef cudaError_t _cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphGetEdges' in found_functions}} - -cdef cudaError_t _cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphGetEdges(graph, from_, to, numEdges) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependencies' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeGetDependencies(node, pDependencies, pNumDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphAddDependencies' in found_functions}} - -cdef cudaError_t _cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphAddDependencies(graph, from_, to, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphRemoveDependencies' in found_functions}} - -cdef cudaError_t _cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphRemoveDependencies(graph, from_, to, numDependencies) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphDestroyNode' in found_functions}} - -cdef cudaError_t _cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphDestroyNode(node) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphInstantiate' in found_functions}} - -cdef cudaError_t _cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) - -{{endif}} -{{if 'cudaGraphInstantiateWithFlags' in found_functions}} - -cdef cudaError_t _cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphInstantiateWithFlags(pGraphExec, graph, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_KERNEL_NODE_PARAMS driverNodeParams - err = toDriverKernelNodeParams(pNodeParams, &driverNodeParams) - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecKernelNodeSetParams_v2(hGraphExec, node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - cdef cydriver.CUDA_HOST_NODE_PARAMS driverNodeParams - toDriverHostNodeParams(pNodeParams, &driverNodeParams) - err = cydriver._cuGraphExecHostNodeSetParams(hGraphExec, node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} - -cdef cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeSetEnabled' in found_functions}} - -cdef cudaError_t _cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetEnabled' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecUpdate' in found_functions}} - -cdef cudaError_t _cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecUpdate_v2(hGraphExec, hGraph, resultInfo) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphUpload' in found_functions}} - -cdef cudaError_t _cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphUpload(graphExec, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphLaunch' in found_functions}} - -cdef cudaError_t _cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphLaunch(graphExec, stream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecDestroy' in found_functions}} - -cdef cudaError_t _cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecDestroy(graphExec) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphDestroy' in found_functions}} - -cdef cudaError_t _cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphDestroy(graph) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphDebugDotPrint' in found_functions}} - -cdef cudaError_t _cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphDebugDotPrint(graph, path, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaUserObjectCreate' in found_functions}} - -cdef cudaError_t _cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaUserObjectRetain' in found_functions}} - -cdef cudaError_t _cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuUserObjectRetain(object, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaUserObjectRelease' in found_functions}} - -cdef cudaError_t _cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuUserObjectRelease(object, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphRetainUserObject' in found_functions}} - -cdef cudaError_t _cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphRetainUserObject(graph, object, count, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphReleaseUserObject' in found_functions}} - -cdef cudaError_t _cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphReleaseUserObject(graph, object, count) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuProfilerStart() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuProfilerStop() - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphicsEGLRegisterImage(pCudaResource, image, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEGLStreamConsumerConnect(conn, eglStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEGLStreamConsumerDisconnect(conn) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} {{if True}} -cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuEGLStreamProducerConnect(conn, eglStream, width, height) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if True}} - -cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + cdef cydriver.CUeglFrame cueglFrame + err = getDriverEglFrame(&cueglFrame, eglframe) if err != cudaSuccess: return err - err = cydriver._cuEGLStreamProducerDisconnect(conn) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamProducerPresentFrame(conn, cueglFrame, pStream) return err {{endif}} {{if True}} -cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuEventCreateFromEGLSync(phEvent, eglSync, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaInitDevice' in found_functions}} - -cdef cudaError_t _cudaInitDevice(int deviceOrdinal, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaPythonDevice *device - cdef unsigned int scheduleFlags - - err = m_global.lazyInitDriver() - if err != cudaSuccess: - return err - - device = m_global.getDevice(deviceOrdinal) - if device == NULL: - _setLastError(cudaErrorInvalidDevice) - return cudaErrorInvalidDevice - - if device.primaryContext == NULL: - initPrimaryContext(device) - - if flags & cudaInitDeviceFlagsAreValid: - scheduleFlags = deviceFlags & cudaDeviceScheduleMask - deviceFlags &= ~cudaDeviceMapHost - if deviceFlags & ~cudaDeviceMask: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - if scheduleFlags: - if scheduleFlags != cudaDeviceScheduleSpin and scheduleFlags != cudaDeviceScheduleYield and scheduleFlags != cudaDeviceScheduleBlockingSync: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - - err = cydriver._cuDevicePrimaryCtxSetFlags_v2(device[0].driverDevice, deviceFlags) - if err != cudaSuccess: - _setLastError(err) - return err - return cudaSuccess - -{{endif}} -{{if 'cudaStreamGetId' in found_functions}} - -cdef cudaError_t _cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamGetId(hStream, streamId) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphInstantiateWithParams' in found_functions}} - -cdef cudaError_t _cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphExecGetFlags' in found_functions}} - -cdef cudaError_t _cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphExecGetFlags(graphExec, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetKernel' in found_functions}} - -cdef cudaError_t _cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: - if kernelPtr == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - if entryFuncAddr == NULL: - _setLastError(cudaErrorInvalidDeviceFunction) - return cudaErrorInvalidDeviceFunction - - kernelPtr[0] = entryFuncAddr; - return cudaSuccess - -{{endif}} -{{if 'cudaGraphAddNode' in found_functions}} - -cdef cudaError_t _cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef cydriver.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams) - return cudaSuccess - -{{endif}} -{{if 'cudaGraphNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef cydriver.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuGraphNodeSetParams(node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams); - return cudaSuccess - -{{endif}} -{{if 'cudaGraphExecNodeSetParams' in found_functions}} - -cdef cudaError_t _cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef cydriver.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuGraphExecNodeSetParams(graphExec, node, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams); - return cudaSuccess - -{{endif}} -{{if 'cudaGraphConditionalHandleCreate' in found_functions}} - -cdef cudaError_t _cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - cdef cydriver.CUcontext context - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuGraphConditionalHandleCreate(pHandle_out, graph, context, defaultLaunchValue, flags) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} - -cdef cudaError_t _cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: + if eglframe == NULL: + err = cudaErrorInvalidResourceHandle return err - err = streamGetCaptureInfoCommon_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} - -cdef cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + cdef cydriver.CUeglFrame cueglFrame + err = cydriver._cuEGLStreamProducerReturnFrame(conn, &cueglFrame, pStream) if err != cudaSuccess: return err - err = cydriver._cuStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) - if err != cudaSuccess: - _setLastError(err) + err = getRuntimeEglFrame(eglframe, cueglFrame) return err {{endif}} -{{if 'cudaGraphGetEdges_v2' in found_functions}} +{{if True}} -cdef cudaError_t _cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} - -cdef cudaError_t _cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + cdef cydriver.CUeglFrame cueglFrame + memset(&cueglFrame, 0, sizeof(cueglFrame)) + err = cydriver._cuGraphicsResourceGetMappedEglFrame(&cueglFrame, resource, index, mipLevel) if err != cudaSuccess: return err - err = cydriver._cuGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) - if err != cudaSuccess: - _setLastError(err) + err = getRuntimeEglFrame(eglFrame, cueglFrame) return err {{endif}} -{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} +{{if True}} -cdef cudaError_t _cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) - if err != cudaSuccess: - _setLastError(err) - return err +cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: + return cudaErrorNotSupported {{endif}} -{{if 'cudaGraphAddDependencies_v2' in found_functions}} +{{if True}} -cdef cudaError_t _cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) return err {{endif}} -{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} +{{if True}} -cdef cudaError_t _cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) return err -{{endif}} -{{if 'cudaGraphAddNode_v2' in found_functions}} - -cdef cudaError_t _cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - if nodeParams == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() - if err != cudaSuccess: - _setLastError(err) - return err - cdef cydriver.CUgraphNodeParams driverNodeParams - err = toDriverGraphNodeParams(nodeParams, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - err = cydriver._cuGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, &driverNodeParams) - if err != cudaSuccess: - _setLastError(err) - return err - toCudartGraphNodeOutParams(&driverNodeParams, nodeParams) - return cudaSuccess - {{endif}} {{if True}} -{{if 'Windows' != platform.system()}} -cimport cuda.bindings._lib.dlfcn as dlfcn -{{endif}} - -cdef cudaError_t _getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - {{if 'Windows' == platform.system()}} - with gil: - raise NotImplementedError('"getLocalRuntimeVersion" is unsupported on Windows') - {{else}} - # Load - handle = dlfcn.dlopen('libcudart.so.12', dlfcn.RTLD_NOW) - if handle == NULL: - with gil: - raise RuntimeError(f'Failed to dlopen libcudart.so.12') - - __cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion') - - if __cudaRuntimeGetVersion == NULL: - with gil: - raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in libcudart.so.12') - - # Call - cdef cudaError_t err = cudaSuccess - err = ( __cudaRuntimeGetVersion)(runtimeVersion) - - # Unload - dlfcn.dlclose(handle) - - # Return - return err - {{endif}} -{{endif}} -{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} - -cdef cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = DeviceRegisterAsyncNotificationCommon(device, callbackFunc, userData, callback) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} - -cdef cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = DeviceUnregisterAsyncNotificationCommon(device, callback) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} - -cdef cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuGetProcAddress_v2(symbol, funcPtr, cudaVersion, flags, driverStatus) - if err != cudaSuccess: - _setLastError(err) - return err - -{{endif}} -{{if 'cudaLibraryLoadData' in found_functions}} - -cdef cudaError_t _cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) return err {{endif}} -{{if 'cudaLibraryLoadFromFile' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) return err {{endif}} -{{if 'cudaLibraryUnload' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryUnload(library) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuGraphicsGLRegisterImage(resource, image, target, flags) return err {{endif}} -{{if 'cudaLibraryGetKernel' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryGetKernel(pKernel, library, name) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuGraphicsGLRegisterBuffer(resource, buffer, flags) return err {{endif}} -{{if 'cudaLibraryGetGlobal' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryGetGlobal(dptr, numbytes, library, name) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuGraphicsEGLRegisterImage(pCudaResource, image, flags) return err {{endif}} -{{if 'cudaLibraryGetManaged' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryGetManaged(dptr, numbytes, library, name) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamConsumerConnect(conn, eglStream) return err {{endif}} -{{if 'cudaLibraryGetUnifiedFunction' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryGetUnifiedFunction(fptr, library, symbol) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) return err {{endif}} -{{if 'cudaLibraryGetKernelCount' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryGetKernelCount(count, lib) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamConsumerDisconnect(conn) return err {{endif}} -{{if 'cudaLibraryEnumerateKernels' in found_functions}} +{{if True}} -cdef cudaError_t _cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuLibraryEnumerateKernels(kernels, numKernels, lib) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) return err {{endif}} -{{if 'cudaKernelSetAttributeForDevice' in found_functions}} +{{if True}} -cdef cudaError_t _cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuKernelSetAttribute(attr, value, kernel, device) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) return err {{endif}} -{{if 'cudaStreamGetDevice' in found_functions}} +{{if True}} -cdef cudaError_t _cudaStreamGetDevice(cudaStream_t stream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - cdef cydriver.CUdevice driverDevice = 0 - if stream == NULL or stream == cudaStreamLegacy or stream == cudaStreamPerThread: - err = m_global.lazyInitContextState() - if err != cudaSuccess: - return err - err = cydriver._cuStreamGetDevice(stream, &driverDevice) + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: - _setLastError(err) return err - cudaDevice = m_global.getDeviceFromDriver(driverDevice) - device[0] = cudaDevice[0].deviceOrdinal - return cudaSuccess - -{{endif}} -{{if 'cudaEventElapsedTime_v2' in found_functions}} - -cdef cudaError_t _cudaEventElapsedTime_v2(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if ms == NULL: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - err = cydriver._cuEventElapsedTime_v2(ms, start, end) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamProducerConnect(conn, eglStream, width, height) return err {{endif}} -{{if 'cudaMemcpyBatchAsync' in found_functions}} +{{if True}} -cdef cudaError_t _cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver._cuMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, failIdx, stream) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEGLStreamProducerDisconnect(conn) return err {{endif}} -{{if 'cudaMemcpy3DBatchAsync' in found_functions}} +{{if True}} -cdef cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: +cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess - err = m_global.lazyInitContextState() + # cudaFree(0) is a NOP operations that initializes the context state + err = cudaFree(0) if err != cudaSuccess: return err - err = cydriver.cuMemcpy3DBatchAsync(numOps, opList, failIdx, flags, stream) - if err != cudaSuccess: - _setLastError(err) + err = cydriver._cuEventCreateFromEGLSync(phEvent, eglSync, flags) return err {{endif}} diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in b/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in index 7b219cbf9..68ec2ea22 100644 --- a/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -6,116 +6,7 @@ # this software and related documentation outside the terms of the EULA # is strictly prohibited. from cuda.bindings.cyruntime cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp -from libcpp cimport bool -from libcpp.map cimport map cimport cuda.bindings._bindings.cydriver as cydriver -ctypedef struct cudaAsyncCallbackData_st: - cudaAsyncCallback callback - void *userData - -ctypedef cudaAsyncCallbackData_st cudaAsyncCallbackData - -cdef struct cudaPythonDevice: - cydriver.CUdevice driverDevice - cydriver.CUcontext primaryContext - bool primaryContextRetained - int deviceOrdinal - cudaDeviceProp deviceProperties - -cdef class cudaPythonGlobal: - cdef bint _lazyInitDriver - cdef int _numDevices - cdef cudaPythonDevice* _deviceList - cdef cudaError_t _lastError - cdef int _CUDART_VERSION - cdef map[cudaAsyncCallbackHandle_t, cudaAsyncCallbackData*] _asyncCallbackDataMap - - cdef cudaError_t lazyInitDriver(self) except ?cudaErrorCallRequiresNewerDriver nogil - cdef cudaError_t lazyInitContextState(self) except ?cudaErrorCallRequiresNewerDriver nogil - cdef cudaPythonDevice* getDevice(self, int deviceOrdinal) noexcept nogil - cdef cudaPythonDevice* getDeviceFromDriver(self, cydriver.CUdevice driverDevice) noexcept nogil - cdef cudaPythonDevice* getDeviceFromPrimaryCtx(self, cydriver.CUcontext context) noexcept nogil - -cdef cudaError_t initPrimaryContext(cudaPythonDevice *device) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t resetPrimaryContext(cudaPythonDevice* device) except ?cudaErrorCallRequiresNewerDriver nogil - -cdef cudaPythonGlobal globalGetInstance() -cdef cudaError_t _setLastError(cudaError_t err) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getDescInfo(const cudaChannelFormatDesc* d, int *numberOfChannels, cydriver.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamAddCallbackCommon(cudaStream_t stream, cudaStreamCallback_t callback, void *userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamAddHostCallbackCommon(cudaStream_t stream, cudaHostFn_t callback, void *userData) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamGetCaptureInfoCommon(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long *id_out, cudaGraph_t *graph_out, const cudaGraphNode_t **dependencies_out, size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t streamGetCaptureInfoCommon_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long *id_out, cudaGraph_t *graph_out, const cudaGraphNode_t **dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getChannelFormatDescFromDriverDesc(cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, const cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t spitch, size_t width, size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromDevice2D(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t srcOffset, - size_t spitch, size_t width, size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t dpitch, size_t width, - size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToDevice2D(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *dst, size_t dstOffset, size_t dpitch, - size_t width, size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToArray2D(cudaArray_const_t thisArray, size_t hOffsetSrc, size_t wOffsetSrc, cudaArray_t dst, - size_t hOffsetDst, size_t wOffsetDst, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getChannelDesc(cudaArray_const_t thisArray, cudaChannelFormatDesc *outDesc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getDriverResDescFromResDesc(cydriver.CUDA_RESOURCE_DESC *rdDst, const cudaResourceDesc *rdSrc, - cydriver.CUDA_TEXTURE_DESC *tdDst, const cudaTextureDesc *tdSrc, - cydriver.CUDA_RESOURCE_VIEW_DESC *rvdDst, const cudaResourceViewDesc *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t getResDescFromDriverResDesc(cudaResourceDesc *rdDst, const cydriver.CUDA_RESOURCE_DESC *rdSrc, - cudaTextureDesc *tdDst, const cydriver.CUDA_TEXTURE_DESC *tdSrc, - cudaResourceViewDesc *rvdDst, const cydriver.CUDA_RESOURCE_VIEW_DESC *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memsetPtr(char *mem, int c, size_t count, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memset2DPtr(char *mem, size_t pitch, int c, size_t width, size_t height, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t count, - cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyFromDevice(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, - const char *src, size_t srcOffset, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copyToDevice(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, - const char *dst, size_t dstOffset, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t copy1DConvertTo3DParams(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil -cdef void toDriverMemsetNodeParams(const cudaMemsetParams *pRuntimeParams, cydriver.CUDA_MEMSET_NODE_PARAMS *pDriverParams) noexcept nogil -cdef cudaError_t toDriverMemCopy3DParams(const cudaMemcpy3DParms *p, cydriver.CUDA_MEMCPY3D *cd) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocArray(cudaArray_t *arrayPtr, const cudaChannelFormatDesc *desc, size_t depth, size_t height, - size_t width, int corr2D, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocHost(size_t size, void **mem, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocPitch(size_t width, size_t height, size_t depth, void **mem, size_t *pitch) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t mallocMipmappedArray(cudaMipmappedArray_t *mipmappedArrayPtr, const cudaChannelFormatDesc *desc, - size_t depth, size_t height, size_t width, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DPtr(char *dst, size_t dpitch, const char *src, size_t spitch, size_t width, - size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy3D(const cudaMemcpy3DParms *p, bool peer, int srcDevice, int dstDevice, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyAsyncDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t toCudartMemCopy3DParams(const cydriver.CUDA_MEMCPY3D_v2 *cd, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DFromArray(char *dst, size_t dpitch, cudaArray_const_t src, size_t hOffset, - size_t wOffset, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpy2DArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memset3DPtr(cudaPitchedPtr p, int val, cudaExtent e, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyFromArray(char *dst, cudaArray_const_t src, size_t hOffset, size_t wOffset, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t memcpyArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t toDriverCudaResourceDesc(cydriver.CUDA_RESOURCE_DESC *_driver_pResDesc, const cudaResourceDesc *pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil cdef cudaError_t getDriverEglFrame(cydriver.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, cydriver.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t toDriverGraphNodeParams(const cudaGraphNodeParams *rtParams, cydriver.CUgraphNodeParams *driverParams) except ?cudaErrorCallRequiresNewerDriver nogil -cdef void toCudartGraphNodeOutParams(const cydriver.CUgraphNodeParams *driverParams, cudaGraphNodeParams *rtParams) noexcept nogil -cdef cudaError_t toDriverKernelNodeParams(const cudaKernelNodeParams *nodeParams, cydriver.CUDA_KERNEL_NODE_PARAMS *driverNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil -cdef void toDriverHostNodeParams(const cudaHostNodeParams *pRuntimeNodeParams, cydriver.CUDA_HOST_NODE_PARAMS *pDriverNodeParams) noexcept nogil -cdef cudaError_t DeviceRegisterAsyncNotificationCommon(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil -cdef cudaError_t DeviceUnregisterAsyncNotificationCommon(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pyx.in b/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pyx.in index bdcc37b74..990cbe25b 100644 --- a/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pyx.in +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -7,658 +7,9 @@ # is strictly prohibited. import cython from cuda.bindings.cyruntime cimport * -from libc.stdlib cimport malloc, free, calloc -from libc.string cimport memset, memcpy, strncmp, memcmp -from libcpp cimport bool +from libc.string cimport memset cimport cuda.bindings._bindings.cydriver as cydriver -cdef struct cudaArrayLocalState: - cydriver.CUarray array - cudaChannelFormatDesc desc - size_t depth - size_t height - size_t width - size_t elementSize - size_t widthInBytes - -ctypedef struct cudaStreamCallbackData_st: - cudaStreamCallback_t callback - void *userData - -ctypedef cudaStreamCallbackData_st cudaStreamCallbackData - -ctypedef struct cudaStreamHostCallbackData_st: - cudaHostFn_t callback - void *userData - -ctypedef cudaStreamHostCallbackData_st cudaStreamHostCallbackData - -cdef class cudaPythonGlobal: - def __cinit__(self): - self._lazyInitDriver = False - self._numDevices = 0 - self._deviceList = NULL - self._CUDART_VERSION = CUDART_VERSION - - def __dealloc__(self): - if self._deviceList is not NULL: - free(self._deviceList) - for item in self._asyncCallbackDataMap: - free(item.second) - self._asyncCallbackDataMap.clear() - - cdef cudaError_t lazyInitDriver(self) except ?cudaErrorCallRequiresNewerDriver nogil: - if self._lazyInitDriver: - return cudaSuccess - - cdef cudaError_t err = cudaSuccess - err = cydriver._cuInit(0) - if err != cudaSuccess: - return err - err = cydriver._cuDeviceGetCount(&self._numDevices) - if err != cudaSuccess: - return err - - self._deviceList = calloc(self._numDevices, sizeof(cudaPythonDevice)) - if self._deviceList == NULL: - return cudaErrorMemoryAllocation - - for deviceOrdinal in range(self._numDevices): - err = initDevice(&self._deviceList[deviceOrdinal], deviceOrdinal) - if err != cudaSuccess: - free(self._deviceList) - return err - - self._lazyInitDriver = True - - cdef cudaError_t lazyInitContextState(self) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUcontext driverContext - cdef cudaPythonDevice *device - - err = self.lazyInitDriver() - if err != cudaSuccess: - return err - - err = cydriver._cuCtxGetCurrent(&driverContext) - if err != cudaSuccess: - return err - device = self.getDeviceFromPrimaryCtx(driverContext) - - # 1. Context + device - if driverContext != NULL and device != NULL: - err = initPrimaryContext(device) - if err != cudaSuccess: - return err - - # 2. Context + no device - cdef unsigned int version - if driverContext != NULL: - # If the context exists, but is non-primary, make sure it can be used with the CUDA 3.2 API, - # then return immediately - err = cydriver._cuCtxGetApiVersion(driverContext, &version) - if err == cudaErrorContextIsDestroyed: - return cudaErrorIncompatibleDriverContext - elif err != cudaSuccess: - return err - elif version < 3020: - return cudaErrorIncompatibleDriverContext - return cudaSuccess - - # 3. No context + device - # (impossible) - - # 4. No context + no device - # Default to first device - device = self.getDevice(0) - err = initPrimaryContext(device) - if err != cudaSuccess: - return err - err = cydriver._cuCtxSetCurrent(device.primaryContext) - return err - - cdef cudaPythonDevice* getDevice(self, int deviceOrdinal) noexcept nogil: - if deviceOrdinal < 0 or deviceOrdinal >= m_global._numDevices: - return NULL - return &self._deviceList[deviceOrdinal] - - cdef cudaPythonDevice* getDeviceFromDriver(self, cydriver.CUdevice driverDevice) noexcept nogil: - for i in range(self._numDevices): - if self._deviceList[i].driverDevice == driverDevice: - return &self._deviceList[i] - return NULL - - cdef cudaPythonDevice* getDeviceFromPrimaryCtx(self, cydriver.CUcontext context) noexcept nogil: - if context == NULL: - return NULL - for i in range(self._numDevices): - if self._deviceList[i].primaryContext == context: - return &self._deviceList[i] - return NULL - -cdef cudaPythonGlobal m_global = cudaPythonGlobal() - - -cdef cudaError_t initDevice(cudaPythonDevice *device, int deviceOrdinal) except ?cudaErrorCallRequiresNewerDriver nogil: - # cydriver.CUcontext primaryContext - device[0].primaryContext = NULL - # bool primaryContextRetained - device[0].primaryContextRetained = False - # int deviceOrdinal - device[0].deviceOrdinal = deviceOrdinal - - # cydriver.CUdevice driverDevice - err = cydriver._cuDeviceGet(&device[0].driverDevice, deviceOrdinal) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - # cudaDeviceProp deviceProperties - err = cydriver._cuDeviceGetName(device[0].deviceProperties.name, sizeof(device[0].deviceProperties.name), deviceOrdinal) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceTotalMem_v2(&(device[0].deviceProperties.totalGlobalMem), deviceOrdinal) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceTotalMem_v2(&(device[0].deviceProperties.totalGlobalMem), deviceOrdinal) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.major), cydriver.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.minor), cydriver.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.deviceOverlap), cydriver.CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.asyncEngineCount), cydriver.CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.multiProcessorCount), cydriver.CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.kernelExecTimeoutEnabled), cydriver.CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.integrated), cydriver.CU_DEVICE_ATTRIBUTE_INTEGRATED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.canMapHostMemory), cydriver.CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1D), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DMipmap), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DLinear), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2D[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2D[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DMipmap[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DMipmap[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLinear[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLinear[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLinear[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DGather[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DGather[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3D[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3D[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3D[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3DAlt[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3DAlt[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture3DAlt[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTextureCubemap), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DLayered[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture1DLayered[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLayered[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLayered[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTexture2DLayered[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTextureCubemapLayered[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxTextureCubemapLayered[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface1D), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2D[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2D[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface3D[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface3D[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface3D[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface1DLayered[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface1DLayered[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2DLayered[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2DLayered[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurface2DLayered[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurfaceCubemap), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurfaceCubemapLayered[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxSurfaceCubemapLayered[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.concurrentKernels), cydriver.CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.ECCEnabled), cydriver.CU_DEVICE_ATTRIBUTE_ECC_ENABLED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.pciBusID), cydriver.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.pciDeviceID), cydriver.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.pciDomainID), cydriver.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.tccDriver), cydriver.CU_DEVICE_ATTRIBUTE_TCC_DRIVER, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.unifiedAddressing), cydriver.CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryClockRate), cydriver.CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryBusWidth), cydriver.CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.l2CacheSize), cydriver.CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.persistingL2CacheMaxSize), cydriver.CU_DEVICE_ATTRIBUTE_MAX_PERSISTING_L2_CACHE_SIZE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsPerMultiProcessor), cydriver.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int surfaceAlignment - err = cydriver._cuDeviceGetAttribute(&(surfaceAlignment), cydriver.CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.surfaceAlignment = surfaceAlignment - - cdef int texturePitchAlignment - err = cydriver._cuDeviceGetAttribute(&texturePitchAlignment, cydriver.CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.texturePitchAlignment = texturePitchAlignment - - cdef int sharedMemPerBlock - err = cydriver._cuDeviceGetAttribute(&sharedMemPerBlock, cydriver.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.sharedMemPerBlock = sharedMemPerBlock - - cdef int sharedMemPerBlockOptin - err = cydriver._cuDeviceGetAttribute(&sharedMemPerBlockOptin, cydriver.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.sharedMemPerBlockOptin = sharedMemPerBlockOptin - - cdef int sharedMemPerMultiprocessor - err = cydriver._cuDeviceGetAttribute(&sharedMemPerMultiprocessor, cydriver.CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.sharedMemPerMultiprocessor = sharedMemPerMultiprocessor - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.regsPerBlock), cydriver.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.regsPerMultiprocessor), cydriver.CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.warpSize), cydriver.CU_DEVICE_ATTRIBUTE_WARP_SIZE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int memPitch - err = cydriver._cuDeviceGetAttribute(&memPitch, cydriver.CU_DEVICE_ATTRIBUTE_MAX_PITCH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.memPitch = memPitch - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsPerBlock), cydriver.CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsDim[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsDim[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxThreadsDim[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxGridSize[0]), cydriver.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxGridSize[1]), cydriver.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxGridSize[2]), cydriver.CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int totalConstMem - err = cydriver._cuDeviceGetAttribute(&totalConstMem, cydriver.CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.totalConstMem = totalConstMem - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.clockRate), cydriver.CU_DEVICE_ATTRIBUTE_CLOCK_RATE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int textureAlignment - err = cydriver._cuDeviceGetAttribute(&textureAlignment, cydriver.CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.textureAlignment = textureAlignment - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.streamPrioritiesSupported), cydriver.CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.globalL1CacheSupported), cydriver.CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.localL1CacheSupported), cydriver.CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.managedMemory), cydriver.CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.isMultiGpuBoard), cydriver.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.multiGpuBoardGroupID), cydriver.CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.hostNativeAtomicSupported), cydriver.CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.singleToDoublePrecisionPerfRatio), cydriver.CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.pageableMemoryAccess), cydriver.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.concurrentManagedAccess), cydriver.CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.computePreemptionSupported), cydriver.CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.canUseHostPointerForRegisteredMem), cydriver.CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.cooperativeLaunch), cydriver.CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.cooperativeMultiDeviceLaunch), cydriver.CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.pageableMemoryAccessUsesHostPageTables), cydriver.CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.directManagedMemAccessFromHost), cydriver.CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetUuid((&(device[0].deviceProperties.uuid)), deviceOrdinal) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.maxBlocksPerMultiProcessor), cydriver.CU_DEVICE_ATTRIBUTE_MAX_BLOCKS_PER_MULTIPROCESSOR, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.accessPolicyMaxWindowSize), cydriver.CU_DEVICE_ATTRIBUTE_MAX_ACCESS_POLICY_WINDOW_SIZE, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.hostRegisterSupported), cydriver.CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.sparseCudaArraySupported), cydriver.CU_DEVICE_ATTRIBUTE_SPARSE_CUDA_ARRAY_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.hostRegisterReadOnlySupported), cydriver.CU_DEVICE_ATTRIBUTE_READ_ONLY_HOST_REGISTER_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.timelineSemaphoreInteropSupported), cydriver.CU_DEVICE_ATTRIBUTE_TIMELINE_SEMAPHORE_INTEROP_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.memoryPoolsSupported), cydriver.CU_DEVICE_ATTRIBUTE_MEMORY_POOLS_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.gpuDirectRDMASupported), cydriver.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int gpuDirectRDMAFlushWritesOptions - err = cydriver._cuDeviceGetAttribute(&gpuDirectRDMAFlushWritesOptions, cydriver.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_FLUSH_WRITES_OPTIONS, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.gpuDirectRDMAFlushWritesOptions = gpuDirectRDMAFlushWritesOptions - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.gpuDirectRDMAWritesOrdering), cydriver.CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WRITES_ORDERING, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int memoryPoolSupportedHandleTypes - err = cydriver._cuDeviceGetAttribute(&memoryPoolSupportedHandleTypes, cydriver.CU_DEVICE_ATTRIBUTE_MEMPOOL_SUPPORTED_HANDLE_TYPES, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.memoryPoolSupportedHandleTypes = memoryPoolSupportedHandleTypes; - - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.deferredMappingCudaArraySupported), cydriver.CU_DEVICE_ATTRIBUTE_DEFERRED_MAPPING_CUDA_ARRAY_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.ipcEventSupported), cydriver.CU_DEVICE_ATTRIBUTE_IPC_EVENT_SUPPORTED, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - err = cydriver._cuDeviceGetAttribute(&(device[0].deviceProperties.clusterLaunch), cydriver.CU_DEVICE_ATTRIBUTE_CLUSTER_LAUNCH, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - - cdef int reservedSharedMemPerBlock - err = cydriver._cuDeviceGetAttribute(&reservedSharedMemPerBlock, cydriver.CU_DEVICE_ATTRIBUTE_RESERVED_SHARED_MEMORY_PER_BLOCK, (deviceOrdinal)) - if err != cydriver.cudaError_enum.CUDA_SUCCESS: - return cudaErrorInitializationError - device[0].deviceProperties.reservedSharedMemPerBlock = reservedSharedMemPerBlock - - return cudaSuccess - - -cdef cudaError_t initPrimaryContext(cudaPythonDevice *device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - # If we have context retained we need to check if it is not reset - cdef unsigned int version - if device[0].primaryContextRetained: - err = cydriver._cuCtxGetApiVersion(device[0].primaryContext, &version) - if err == cudaErrorDeviceUninitialized: - err = cydriver.cuDevicePrimaryCtxRelease(device[0].driverDevice) - if err != cudaSuccess: - return err - device[0].primaryContextRetained = False - elif err != cudaSuccess: - return err - - # If we don't or it is invalid we need to recreate it - if not device[0].primaryContextRetained: - err = cydriver._cuDevicePrimaryCtxRetain(&device[0].primaryContext, device[0].driverDevice) - if err != cudaSuccess: - return err - device[0].primaryContextRetained = True - return err - -cdef cudaError_t resetPrimaryContext(cudaPythonDevice* device) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef unsigned int version - - err = cydriver._cuCtxGetApiVersion(device[0].primaryContext, &version) - if err == cudaSuccess: - if not device[0].primaryContextRetained: - err = cydriver._cuDevicePrimaryCtxRetain(&device[0].primaryContext, device[0].driverDevice) - if err != cudaSuccess: - return err - device[0].primaryContextRetained = True - cydriver._cuDevicePrimaryCtxReset_v2(device[0].driverDevice) - return cudaSuccess - elif err == cudaErrorDeviceUninitialized: - return cudaSuccess - else: - return err - - -cdef cudaPythonGlobal globalGetInstance(): - return m_global - - -cdef cudaError_t _setLastError(cudaError_t err) except ?cudaErrorCallRequiresNewerDriver nogil: - if err != cudaSuccess: - m_global._lastError = err - cdef int case_desc(const cudaChannelFormatDesc* d, int x, int y, int z, int w, int f) except ?cudaErrorCallRequiresNewerDriver nogil: return d[0].x == x and d[0].y == y and d[0].z == z and d[0].w == w and d[0].f == f @@ -846,1984 +197,189 @@ cdef cudaError_t getDescInfo(const cudaChannelFormatDesc* d, int *numberOfChanne format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_UNORM elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4): numberOfChannels[0] = 1 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM - elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5): - numberOfChannels[0] = 2 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM - elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5): - numberOfChannels[0] = 2 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H): - numberOfChannels[0] = 3 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16 - elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H): - numberOfChannels[0] = 3 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16 - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7): - numberOfChannels[0] = 4 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM - elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB): - numberOfChannels[0] = 4 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB - elif case_desc(d, 10, 10, 10, 2, cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102): - numberOfChannels[0] = 4 - format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT_101010_2 - else: - return cudaErrorInvalidChannelDescriptor - - if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12, - cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, - cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,): - if numberOfChannels[0] != 3: - return cudaErrorInvalidChannelDescriptor - else: - if (numberOfChannels[0] != 1) and (numberOfChannels[0] != 2) and (numberOfChannels[0] != 4): - return cudaErrorInvalidChannelDescriptor - return cudaSuccess - - -@cython.show_performance_hints(False) -cdef void cudaStreamRtCallbackWrapper(cydriver.CUstream stream, cydriver.CUresult status, void *data) nogil: - cdef cudaStreamCallbackData *cbData = data - cdef cudaError_t err = status - with gil: - cbData.callback(stream, err, cbData.userData) - free(cbData) - - -cdef cudaError_t streamAddCallbackCommon( - cudaStream_t stream, - cudaStreamCallback_t callback, - void *userData, - unsigned int flags -) except ?cudaErrorCallRequiresNewerDriver nogil: - if callback == NULL: - return cudaErrorInvalidValue - - cdef cudaStreamCallbackData *cbData = NULL - cdef cudaError_t err = cudaSuccess - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return cudaErrorMemoryAllocation - - cbData.callback = callback - cbData.userData = userData - err = cydriver._cuStreamAddCallback(stream, cudaStreamRtCallbackWrapper, cbData, flags) - if err != cudaSuccess: - free(cbData) - return err - - -@cython.show_performance_hints(False) -cdef void cudaStreamRtHostCallbackWrapper(void *data) nogil: - cdef cudaStreamHostCallbackData *cbData = data - with gil: - cbData.callback(cbData.userData) - free(cbData) - - -cdef cudaError_t streamAddHostCallbackCommon( - cudaStream_t stream, - cudaHostFn_t callback, - void *userData -) except ?cudaErrorCallRequiresNewerDriver nogil: - if callback == NULL: - return cudaErrorInvalidValue - - cdef cudaStreamHostCallbackData *cbData = NULL - cdef cudaError_t err = cudaSuccess - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return cudaErrorMemoryAllocation - - cbData.callback = callback - cbData.userData = userData - err = cydriver._cuLaunchHostFunc(stream, cudaStreamRtHostCallbackWrapper, cbData) - if err != cudaSuccess: - free(cbData) - return err - - -cdef cudaError_t toRuntimeStreamCaptureStatus(cydriver.CUstreamCaptureStatus driverCaptureStatus, cudaStreamCaptureStatus *runtimeStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - if driverCaptureStatus == cydriver.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_NONE: - runtimeStatus[0] = cudaStreamCaptureStatus.cudaStreamCaptureStatusNone - elif driverCaptureStatus == cydriver.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_ACTIVE: - runtimeStatus[0] = cudaStreamCaptureStatus.cudaStreamCaptureStatusActive - elif driverCaptureStatus == cydriver.CUstreamCaptureStatus_enum.CU_STREAM_CAPTURE_STATUS_INVALIDATED: - runtimeStatus[0] = cudaStreamCaptureStatus.cudaStreamCaptureStatusInvalidated - else: - return cudaErrorUnknown - return cudaSuccess - - -cdef cudaError_t streamGetCaptureInfoCommon( - cudaStream_t stream, - cudaStreamCaptureStatus* captureStatus_out, - unsigned long long *id_out, - cudaGraph_t *graph_out, - const cudaGraphNode_t **dependencies_out, - size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if captureStatus_out == NULL: - return cudaErrorInvalidValue - - cdef cydriver.CUstreamCaptureStatus driverCaptureStatus - - err = cydriver._cuStreamGetCaptureInfo_v2(stream, &driverCaptureStatus, id_out, - graph_out, dependencies_out, numDependencies_out) - if err != cudaSuccess: - return err - - return toRuntimeStreamCaptureStatus(driverCaptureStatus, captureStatus_out) - - -cdef cudaError_t streamGetCaptureInfoCommon_v3( - cudaStream_t stream, - cudaStreamCaptureStatus* captureStatus_out, - unsigned long long *id_out, - cudaGraph_t *graph_out, - const cudaGraphNode_t **dependencies_out, - const cudaGraphEdgeData** edgeData_out, - size_t *numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - - if captureStatus_out == NULL: - return cudaErrorInvalidValue - - cdef cydriver.CUstreamCaptureStatus driverCaptureStatus - - err = cydriver._cuStreamGetCaptureInfo_v3(stream, &driverCaptureStatus, id_out, - graph_out, dependencies_out, edgeData_out, numDependencies_out) - if err != cudaSuccess: - return err - - return toRuntimeStreamCaptureStatus(driverCaptureStatus, captureStatus_out) - - -cdef cydriver.CUDA_MEMCPY3D_v2 memCopy3DInit(cydriver.CUmemorytype_enum dstType, cydriver.CUmemorytype_enum srcType) noexcept nogil: - cdef cydriver.CUDA_MEMCPY3D_v2 cp - memset(&cp, 0, sizeof(cp)) - cp.dstMemoryType = dstType - cp.srcMemoryType = srcType - cp.WidthInBytes = 0 - cp.Height = 1 - cp.Depth = 1 - return cp - - -cdef cydriver.CUDA_MEMCPY2D_v2 memCopy2DInit(cydriver.CUmemorytype_enum dstType, cydriver.CUmemorytype_enum srcType) noexcept nogil: - cdef cydriver.CUDA_MEMCPY2D_v2 cp - memset(&cp, 0, sizeof(cp)) - cp.dstMemoryType = dstType - cp.srcMemoryType = srcType - cp.WidthInBytes = 0 - cp.Height = 1 - return cp - - -cdef cudaError_t bytesPerElement(size_t *bytes, int numberOfChannels, cydriver.CUarray_format format) except ?cudaErrorCallRequiresNewerDriver nogil: - if format in (cydriver.CU_AD_FORMAT_FLOAT, - cydriver.CU_AD_FORMAT_UNSIGNED_INT32, - cydriver.CU_AD_FORMAT_SIGNED_INT32): - bytes[0] = numberOfChannels * 4 - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_HALF, - cydriver.CU_AD_FORMAT_SIGNED_INT16, - cydriver.CU_AD_FORMAT_UNSIGNED_INT16): - bytes[0] = numberOfChannels * 2 - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_SIGNED_INT8, - cydriver.CU_AD_FORMAT_UNSIGNED_INT8, - cydriver.CU_AD_FORMAT_NV12): - bytes[0] = numberOfChannels - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_SNORM_INT8X1, - cydriver.CU_AD_FORMAT_UNORM_INT8X1): - bytes[0] = 1 - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_SNORM_INT8X2, - cydriver.CU_AD_FORMAT_UNORM_INT8X2, - cydriver.CU_AD_FORMAT_SNORM_INT16X1, - cydriver.CU_AD_FORMAT_UNORM_INT16X1): - bytes[0] = 2 - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_SNORM_INT8X4, - cydriver.CU_AD_FORMAT_UNORM_INT8X4, - cydriver.CU_AD_FORMAT_SNORM_INT16X2, - cydriver.CU_AD_FORMAT_UNORM_INT16X2, - cydriver.CU_AD_FORMAT_UNORM_INT_101010_2): - bytes[0] = 4 - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_SNORM_INT16X4, - cydriver.CU_AD_FORMAT_UNORM_INT16X4): - bytes[0] = 8 - return cudaSuccess - elif format in (cydriver.CU_AD_FORMAT_BC2_UNORM, - cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC3_UNORM, - cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC5_UNORM, - cydriver.CU_AD_FORMAT_BC5_SNORM, - cydriver.CU_AD_FORMAT_BC6H_UF16, - cydriver.CU_AD_FORMAT_BC6H_SF16, - cydriver.CU_AD_FORMAT_BC7_UNORM, - cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB): - bytes[0] = 16 - return cudaSuccess - return cudaErrorInvalidChannelDescriptor - - -cdef cudaError_t getChannelFormatDescFromDriverDesc( - cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, - const cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - - cdef int channel_size = 0 - if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT8: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned - channel_size = 32 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT8: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT32: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned - channel_size = 32 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_HALF: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_FLOAT: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat - channel_size = 32 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_NV12: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindNV12 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1 - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2 - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4 - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X1: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1 - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2 - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X4: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4 - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_SNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_SNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_UF16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_SF16: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H - channel_size = 16 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7 - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB - channel_size = 8 - elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2: - pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102 - else: - return cudaErrorInvalidChannelDescriptor - - # populate bits per channel - pRuntimeDesc[0].x = 0 - pRuntimeDesc[0].y = 0 - pRuntimeDesc[0].z = 0 - pRuntimeDesc[0].w = 0 - - if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2 and pDriverDesc[0].NumChannels == 4: - pRuntimeDesc[0].w = 2 - pRuntimeDesc[0].z = 10 - pRuntimeDesc[0].y = 10 - pRuntimeDesc[0].x = 10 - else: - if pDriverDesc[0].NumChannels >= 4: - pRuntimeDesc[0].w = channel_size - if pDriverDesc[0].NumChannels >= 3: - pRuntimeDesc[0].z = channel_size - if pDriverDesc[0].NumChannels >= 2: - pRuntimeDesc[0].y = channel_size - if pDriverDesc[0].NumChannels >= 1: - pRuntimeDesc[0].x = channel_size - - if pDriverDesc[0].NumChannels not in (4, 3, 2, 1): - return cudaErrorInvalidChannelDescriptor - - # populate dimensions - if pDepth != NULL: - pDepth[0] = pDriverDesc[0].Depth - if pHeight != NULL: - pHeight[0] = pDriverDesc[0].Height - if pWidth != NULL: - pWidth[0] = pDriverDesc[0].Width - return cudaSuccess - - -cdef cudaError_t getArrayBlockExtent(cudaExtent *blockExtent, cydriver.CUarray_format format) except ?cudaErrorCallRequiresNewerDriver nogil: - if format in (cydriver.CU_AD_FORMAT_FLOAT, - cydriver.CU_AD_FORMAT_UNSIGNED_INT32, - cydriver.CU_AD_FORMAT_SIGNED_INT32, - cydriver.CU_AD_FORMAT_HALF, - cydriver.CU_AD_FORMAT_SIGNED_INT16, - cydriver.CU_AD_FORMAT_UNSIGNED_INT16, - cydriver.CU_AD_FORMAT_SIGNED_INT8, - cydriver.CU_AD_FORMAT_UNSIGNED_INT8, - cydriver.CU_AD_FORMAT_NV12, - cydriver.CU_AD_FORMAT_SNORM_INT8X1, - cydriver.CU_AD_FORMAT_UNORM_INT8X1, - cydriver.CU_AD_FORMAT_SNORM_INT8X2, - cydriver.CU_AD_FORMAT_UNORM_INT8X2, - cydriver.CU_AD_FORMAT_SNORM_INT16X1, - cydriver.CU_AD_FORMAT_UNORM_INT16X1, - cydriver.CU_AD_FORMAT_SNORM_INT8X4, - cydriver.CU_AD_FORMAT_UNORM_INT8X4, - cydriver.CU_AD_FORMAT_SNORM_INT16X2, - cydriver.CU_AD_FORMAT_UNORM_INT16X2, - cydriver.CU_AD_FORMAT_SNORM_INT16X4, - cydriver.CU_AD_FORMAT_UNORM_INT16X4, - cydriver.CU_AD_FORMAT_UNORM_INT_101010_2): - blockExtent[0].width = 1 - blockExtent[0].height = 1 - blockExtent[0].depth = 1 - elif format in (cydriver.CU_AD_FORMAT_BC1_UNORM, - cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC4_UNORM, - cydriver.CU_AD_FORMAT_BC4_SNORM, - cydriver.CU_AD_FORMAT_BC2_UNORM, - cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC3_UNORM, - cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC5_UNORM, - cydriver.CU_AD_FORMAT_BC5_SNORM, - cydriver.CU_AD_FORMAT_BC6H_UF16, - cydriver.CU_AD_FORMAT_BC6H_SF16, - cydriver.CU_AD_FORMAT_BC7_UNORM, - cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB): - blockExtent[0].width = 4 - blockExtent[0].height = 4 - blockExtent[0].depth = 1 - else: - return cudaErrorInvalidChannelDescriptor - return cudaSuccess - - -cdef cudaError_t getLocalState(cudaArrayLocalState *state, cudaArray_const_t thisArray) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - memset(&arrayState, 0, sizeof(arrayState)) - arrayState.array = thisArray - - cdef cudaExtent compBlockExtent - compBlockExtent.width = 1 - compBlockExtent.height = 1 - compBlockExtent.depth = 1 - cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 driverDesc - memset(&driverDesc, 0, sizeof(driverDesc)) - err = cydriver._cuArray3DGetDescriptor_v2(&driverDesc, arrayState.array) - if err != cudaSuccess: - return err - err = getChannelFormatDescFromDriverDesc(&arrayState.desc, &arrayState.depth, &arrayState.height, &arrayState.width, &driverDesc) - if err != cudaSuccess: - return err - err = bytesPerElement(&arrayState.elementSize, driverDesc.NumChannels, driverDesc.Format) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&compBlockExtent, driverDesc.Format) - if err != cudaSuccess: - return err - arrayState.widthInBytes = ((arrayState.width + compBlockExtent.width - 1) / compBlockExtent.width) * arrayState.elementSize - - state[0] = arrayState - return cudaSuccess - - -cdef cudaError_t copyFromHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t spitch, size_t width, size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaArrayLocalState arrayState - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src - cp.srcPitch = spitch - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - return err - - -cdef cudaError_t copyFromDevice2D(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t srcOffset, - size_t spitch, size_t width, size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cudaArrayLocalState arrayState - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, type) - - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = src - cp.srcPitch = spitch - cp.srcXInBytes = srcOffset % spitch - cp.srcY = (srcOffset / spitch) - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToHost2D(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t dpitch, size_t width, - size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - cp.dstHost = dst - cp.dstPitch = dpitch - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToDevice2D(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *dst, size_t dstOffset, size_t dpitch, - size_t width, size_t height, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(type, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - cp.dstDevice = dst - cp.dstPitch = dpitch - cp.dstXInBytes = dstOffset % dpitch - cp.dstY = (dstOffset / dpitch) - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToArray2D(cudaArray_const_t thisArray, size_t hOffsetSrc, size_t wOffsetSrc, cudaArray_t dst, - size_t hOffsetDst, size_t wOffsetDst, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - cp.dstArray = dst - cp.dstXInBytes = wOffsetDst - cp.dstY = hOffsetDst - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffsetSrc - cp.srcY = hOffsetSrc - - cp.Height = height - cp.WidthInBytes = width - - err = driverMemcpy3D(&cp, NULL, False) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToArray(cudaArray_const_t thisArray, size_t hOffsetSrc, size_t wOffsetSrc, cudaArray_t dst, size_t hOffsetDst, - size_t wOffsetDst, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef void *tmp - cdef cudaError_t err = cudaSuccess - err = cudaMalloc(&tmp, count) - if err != cudaSuccess: - return err - - err = cudaMemcpyFromArray(tmp, thisArray, wOffsetSrc, hOffsetSrc, count, cudaMemcpyDeviceToDevice) - if err != cudaSuccess: - return err - err = cudaMemcpyToArray(dst, wOffsetDst, hOffsetDst, tmp, count, cudaMemcpyDeviceToDevice) - if err != cudaSuccess: - return err - err = cudaFree(tmp) - if err != cudaSuccess: - return err - return cudaSuccess - - -cdef cudaError_t memcpyArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - if kind != cudaMemcpyDeviceToDevice and kind != cudaMemcpyDefault: - return cudaErrorInvalidMemcpyDirection - return copyToArray(src, hOffsetSrc, wOffsetSrc, dst, hOffsetDst, wOffsetDst, count) - - -cdef cudaError_t getChannelDesc(cudaArray_const_t thisArray, cudaChannelFormatDesc *outDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - outDesc[0] = arrayState.desc - return cudaSuccess - - -cdef cudaError_t getFormat(cudaArray_const_t thisArray, int &numberOfChannels, cydriver.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - return getDescInfo(&arrayState.desc, &numberOfChannels, format) - - -cdef cudaError_t getDriverResDescFromResDesc(cydriver.CUDA_RESOURCE_DESC *rdDst, const cudaResourceDesc *rdSrc, - cydriver.CUDA_TEXTURE_DESC *tdDst, const cudaTextureDesc *tdSrc, - cydriver.CUDA_RESOURCE_VIEW_DESC *rvdDst, const cudaResourceViewDesc *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef int i = 0 - cdef int numChannels = 0 - cdef cydriver.CUarray_format format - cdef cydriver.CUarray hArray = NULL - cdef cudaError_t err = cudaSuccess - i = 0 - - memset(rdDst, 0, sizeof(rdDst[0])) - - if rdSrc[0].resType == cudaResourceType.cudaResourceTypeArray: - rdDst[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY - rdDst[0].res.array.hArray = rdSrc[0].res.array.array - err = getFormat(rdSrc[0].res.array.array, numChannels, &format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cudaResourceType.cudaResourceTypeMipmappedArray: - rdDst[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY - rdDst[0].res.mipmap.hMipmappedArray = rdSrc[0].res.mipmap.mipmap - err = cydriver._cuMipmappedArrayGetLevel(&hArray, rdDst[0].res.mipmap.hMipmappedArray, 0) - if err != cudaSuccess: - return err - err = getFormat(hArray, numChannels, &format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cudaResourceType.cudaResourceTypeLinear: - rdDst[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR - rdDst[0].res.linear.devPtr = rdSrc[0].res.linear.devPtr - rdDst[0].res.linear.sizeInBytes = rdSrc[0].res.linear.sizeInBytes - err = getDescInfo(&rdSrc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - return err - rdDst[0].res.linear.format = format - rdDst[0].res.linear.numChannels = numChannels - elif rdSrc[0].resType == cudaResourceType.cudaResourceTypePitch2D: - rdDst[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D - rdDst[0].res.pitch2D.devPtr = rdSrc[0].res.pitch2D.devPtr - rdDst[0].res.pitch2D.pitchInBytes = rdSrc[0].res.pitch2D.pitchInBytes - rdDst[0].res.pitch2D.width = rdSrc[0].res.pitch2D.width - rdDst[0].res.pitch2D.height = rdSrc[0].res.pitch2D.height - err = getDescInfo(&rdSrc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - return err - rdDst[0].res.pitch2D.format = format - rdDst[0].res.pitch2D.numChannels = numChannels - else: - return cudaErrorInvalidValue - - - rdDst[0].flags = 0 - - if tdDst and tdSrc: - memset(tdDst, 0, sizeof(tdDst[0])) - - while (i < 3): - tdDst[0].addressMode[i] = tdSrc[0].addressMode[i] - i += 1 - - tdDst[0].filterMode = tdSrc[0].filterMode - tdDst[0].mipmapFilterMode = tdSrc[0].mipmapFilterMode - tdDst[0].mipmapLevelBias = tdSrc[0].mipmapLevelBias - tdDst[0].minMipmapLevelClamp = tdSrc[0].minMipmapLevelClamp - tdDst[0].maxMipmapLevelClamp = tdSrc[0].maxMipmapLevelClamp - tdDst[0].maxAnisotropy = tdSrc[0].maxAnisotropy - i = 0 - while (i < 4): - tdDst[0].borderColor[i] = tdSrc[0].borderColor[i] - i += 1 - - if tdSrc[0].sRGB: - tdDst[0].flags |= cydriver.CU_TRSF_SRGB - else: - tdDst[0].flags |= 0 - - if tdSrc[0].normalizedCoords: - tdDst[0].flags |= cydriver.CU_TRSF_NORMALIZED_COORDINATES - else: - tdDst[0].flags |= 0 - - if tdSrc[0].disableTrilinearOptimization: - tdDst[0].flags |= cydriver.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION - else: - tdDst[0].flags |= 0 - - if tdSrc[0].seamlessCubemap: - tdDst[0].flags |= cydriver.CU_TRSF_SEAMLESS_CUBEMAP - else: - tdDst[0].flags |= 0 - - if format in (cydriver.CU_AD_FORMAT_SNORM_INT8X1, - cydriver.CU_AD_FORMAT_SNORM_INT8X2, - cydriver.CU_AD_FORMAT_SNORM_INT8X4, - cydriver.CU_AD_FORMAT_UNORM_INT8X1, - cydriver.CU_AD_FORMAT_UNORM_INT8X2, - cydriver.CU_AD_FORMAT_UNORM_INT8X4, - cydriver.CU_AD_FORMAT_SNORM_INT16X1, - cydriver.CU_AD_FORMAT_SNORM_INT16X2, - cydriver.CU_AD_FORMAT_SNORM_INT16X4, - cydriver.CU_AD_FORMAT_UNORM_INT16X1, - cydriver.CU_AD_FORMAT_UNORM_INT16X2, - cydriver.CU_AD_FORMAT_UNORM_INT16X4, - cydriver.CU_AD_FORMAT_BC1_UNORM, - cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC2_UNORM, - cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC3_UNORM, - cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC4_UNORM, - cydriver.CU_AD_FORMAT_BC4_SNORM, - cydriver.CU_AD_FORMAT_BC5_UNORM, - cydriver.CU_AD_FORMAT_BC5_SNORM, - cydriver.CU_AD_FORMAT_BC7_UNORM, - cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB): - if tdSrc[0].readMode != cudaTextureReadMode.cudaReadModeNormalizedFloat: - return cudaErrorInvalidNormSetting - elif format in (cydriver.CU_AD_FORMAT_SIGNED_INT8, - cydriver.CU_AD_FORMAT_SIGNED_INT16, - cydriver.CU_AD_FORMAT_UNSIGNED_INT8, - cydriver.CU_AD_FORMAT_UNSIGNED_INT16): - if tdSrc[0].readMode == cudaReadModeElementType: - if tdSrc[0].filterMode == cudaTextureFilterMode.cudaFilterModeLinear: - return cudaErrorInvalidFilterSetting - tdDst[0].flags |= cydriver.CU_TRSF_READ_AS_INTEGER - elif format == cydriver.CU_AD_FORMAT_NV12: - return cudaErrorInvalidValue - elif format == cydriver.CU_AD_FORMAT_SIGNED_INT32 or format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32: - if tdSrc[0].filterMode == cudaTextureFilterMode.cudaFilterModeLinear: - return cudaErrorInvalidFilterSetting - if tdSrc[0].readMode == cudaTextureReadMode.cudaReadModeNormalizedFloat: - return cudaErrorInvalidNormSetting - else: - if tdSrc[0].readMode == cudaTextureReadMode.cudaReadModeNormalizedFloat: - return cudaErrorInvalidNormSetting - - if rvdDst and rvdSrc: - memset(rvdDst, 0, sizeof(rvdDst[0])) - - rvdDst[0].format = rvdSrc[0].format - rvdDst[0].width = rvdSrc[0].width - rvdDst[0].height = rvdSrc[0].height - rvdDst[0].depth = rvdSrc[0].depth - rvdDst[0].firstMipmapLevel = rvdSrc[0].firstMipmapLevel - rvdDst[0].lastMipmapLevel = rvdSrc[0].lastMipmapLevel - rvdDst[0].firstLayer = rvdSrc[0].firstLayer - rvdDst[0].lastLayer = rvdSrc[0].lastLayer - - return cudaSuccess - - -cdef cudaError_t getResDescFromDriverResDesc(cudaResourceDesc *rdDst, const cydriver.CUDA_RESOURCE_DESC *rdSrc, - cudaTextureDesc *tdDst, const cydriver.CUDA_TEXTURE_DESC *tdSrc, - cudaResourceViewDesc *rvdDst, const cydriver.CUDA_RESOURCE_VIEW_DESC *rvdSrc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef int i = 0 - cdef int numChannels = 0 - cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - cdef cydriver.CUarray hArray - - memset(rdDst, 0, sizeof(rdDst[0])) - memset(&ad, 0, sizeof(ad)) - memset(&hArray, 0, sizeof(hArray)) - - if rdSrc[0].resType == cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY: - rdDst[0].resType = cudaResourceType.cudaResourceTypeArray - rdDst[0].res.array.array = rdSrc[0].res.array.hArray - err = getFormat(rdDst[0].res.array.array, numChannels, &ad.Format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY: - rdDst[0].resType = cudaResourceType.cudaResourceTypeMipmappedArray - rdDst[0].res.mipmap.mipmap = rdSrc[0].res.mipmap.hMipmappedArray - err = cydriver._cuMipmappedArrayGetLevel(&hArray, rdSrc[0].res.mipmap.hMipmappedArray, 0) - if err != cudaSuccess: - return err - err = getFormat(hArray, numChannels, &ad.Format) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR: - rdDst[0].resType = cudaResourceType.cudaResourceTypeLinear - rdDst[0].res.linear.devPtr = rdSrc[0].res.linear.devPtr - rdDst[0].res.linear.sizeInBytes = rdSrc[0].res.linear.sizeInBytes - ad.Format = rdSrc[0].res.linear.format - ad.NumChannels = rdSrc[0].res.linear.numChannels - err = getChannelFormatDescFromDriverDesc(&rdDst[0].res.linear.desc, - NULL, NULL, NULL, - &ad) - if err != cudaSuccess: - return err - elif rdSrc[0].resType == cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D: - rdDst[0].resType = cudaResourceType.cudaResourceTypePitch2D - rdDst[0].res.pitch2D.devPtr = rdSrc[0].res.pitch2D.devPtr - rdDst[0].res.pitch2D.pitchInBytes = rdSrc[0].res.pitch2D.pitchInBytes - rdDst[0].res.pitch2D.width = rdSrc[0].res.pitch2D.width - rdDst[0].res.pitch2D.height = rdSrc[0].res.pitch2D.height - ad.Format = rdSrc[0].res.linear.format - ad.NumChannels = rdSrc[0].res.linear.numChannels - err = getChannelFormatDescFromDriverDesc(&rdDst[0].res.linear.desc, - NULL, NULL, NULL, - &ad) - if err != cudaSuccess: - return err - else: - return cudaErrorInvalidValue - - if tdDst and tdSrc: - memset(tdDst, 0, sizeof(tdDst[0])) - i = 0 - while i < 3: - tdDst[0].addressMode[i] = tdSrc[0].addressMode[i] - i += 1 - - tdDst[0].filterMode = tdSrc[0].filterMode - tdDst[0].mipmapFilterMode = tdSrc[0].mipmapFilterMode - tdDst[0].mipmapLevelBias = tdSrc[0].mipmapLevelBias - tdDst[0].minMipmapLevelClamp = tdSrc[0].minMipmapLevelClamp - tdDst[0].maxMipmapLevelClamp = tdSrc[0].maxMipmapLevelClamp - tdDst[0].maxAnisotropy = tdSrc[0].maxAnisotropy - i = 0 - while i < 4: - tdDst[0].borderColor[i] = tdSrc[0].borderColor[i] - i += 1 - - if tdSrc[0].flags & cydriver.CU_TRSF_SRGB: - tdDst[0].sRGB = 1 - else: - tdDst[0].sRGB = 0 - - if tdSrc[0].flags & cydriver.CU_TRSF_NORMALIZED_COORDINATES: - tdDst[0].normalizedCoords = 1 - else: - tdDst[0].normalizedCoords = 0 - - if tdSrc[0].flags & cydriver.CU_TRSF_DISABLE_TRILINEAR_OPTIMIZATION: - tdDst[0].disableTrilinearOptimization = 1 - else: - tdDst[0].disableTrilinearOptimization = 0 - - if tdSrc[0].flags & cydriver.CU_TRSF_SEAMLESS_CUBEMAP: - tdDst[0].seamlessCubemap |= 1 - else: - tdDst[0].seamlessCubemap |= 0 - - if ad.Format in (cydriver.CU_AD_FORMAT_SNORM_INT8X1, - cydriver.CU_AD_FORMAT_SNORM_INT8X2, - cydriver.CU_AD_FORMAT_SNORM_INT8X4, - cydriver.CU_AD_FORMAT_UNORM_INT8X1, - cydriver.CU_AD_FORMAT_UNORM_INT8X2, - cydriver.CU_AD_FORMAT_UNORM_INT8X4, - cydriver.CU_AD_FORMAT_SNORM_INT16X1, - cydriver.CU_AD_FORMAT_SNORM_INT16X2, - cydriver.CU_AD_FORMAT_SNORM_INT16X4, - cydriver.CU_AD_FORMAT_UNORM_INT16X1, - cydriver.CU_AD_FORMAT_UNORM_INT16X2, - cydriver.CU_AD_FORMAT_UNORM_INT16X4, - cydriver.CU_AD_FORMAT_BC1_UNORM, - cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC2_UNORM, - cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC3_UNORM, - cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB, - cydriver.CU_AD_FORMAT_BC4_UNORM, - cydriver.CU_AD_FORMAT_BC4_SNORM, - cydriver.CU_AD_FORMAT_BC5_UNORM, - cydriver.CU_AD_FORMAT_BC5_SNORM, - cydriver.CU_AD_FORMAT_BC7_UNORM, - cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB): - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeNormalizedFloat - elif ad.Format in (cydriver.CU_AD_FORMAT_SIGNED_INT8, - cydriver.CU_AD_FORMAT_SIGNED_INT16, - cydriver.CU_AD_FORMAT_UNSIGNED_INT8, - cydriver.CU_AD_FORMAT_UNSIGNED_INT16): - with gil: - if (tdSrc[0].flags & cydriver.CU_TRSF_READ_AS_INTEGER): - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeElementType - else: - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeNormalizedFloat - else: - tdDst[0].readMode = cudaTextureReadMode.cudaReadModeElementType - - if rvdDst and rvdSrc: - memset(rvdDst, 0, sizeof(rvdDst[0])) - - rvdDst[0].format = rvdSrc[0].format - rvdDst[0].width = rvdSrc[0].width - rvdDst[0].height = rvdSrc[0].height - rvdDst[0].depth = rvdSrc[0].depth - rvdDst[0].firstMipmapLevel = rvdSrc[0].firstMipmapLevel - rvdDst[0].lastMipmapLevel = rvdSrc[0].lastMipmapLevel - rvdDst[0].firstLayer = rvdSrc[0].firstLayer - rvdDst[0].lastLayer = rvdSrc[0].lastLayer - - return cudaSuccess - - -cdef cudaError_t memsetPtr(char *mem, int c, size_t count, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - - if not async: - return cydriver._cuMemsetD8_v2(mem, c, count) - else: - return cydriver._cuMemsetD8Async(mem, c, count, sid) - - -cdef cudaError_t memset2DPtr(char *mem, size_t pitch, int c, size_t width, size_t height, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - - if not async: - return cydriver._cuMemsetD2D8_v2(mem, pitch, c, width, height) - else: - return cydriver._cuMemsetD2D8Async(mem, pitch, c, width, height, sid) - - -cdef cudaError_t copyFromHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src + copied - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcHost = src + copied - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = 0 - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyFromDevice(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *src, size_t srcOffset, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY, type) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = src - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = srcOffset - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = (src + copied) - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = srcOffset - cp.srcY = 0 - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstArray = arrayState.array - cp.dstXInBytes = wOffset - cp.dstY = hOffset - - cp.srcDevice = (src + copied) - cp.srcPitch = arrayState.widthInBytes - cp.srcXInBytes = srcOffset - cp.srcY = 0 - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copyToHost(cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, char *dst, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstHost = dst - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstHost = dst + copied - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstHost = dst + copied - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = 0 - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t driverMemcpy3DPeer(cydriver.CUDA_MEMCPY3D_PEER *cp, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if async: - return cydriver._cuMemcpy3DPeerAsync(cp, stream) - else: - return cydriver._cuMemcpy3DPeer(cp) - - -cdef cudaError_t driverMemcpy3D(cydriver.CUDA_MEMCPY3D_v2 *cp, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if async: - return cydriver._cuMemcpy3DAsync_v2(cp, stream) - else: - return cydriver._cuMemcpy3D_v2(cp) - - -cdef cudaError_t memcpy3D(const cudaMemcpy3DParms *p, bool peer, int srcDevice, int dstDevice, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUDA_MEMCPY3D_v2 cd - cdef cydriver.CUDA_MEMCPY3D_PEER cdPeer - cdef cudaPythonDevice *srcDev - cdef cudaPythonDevice *dstDev - - memset(&cdPeer, 0, sizeof(cdPeer)) - - cdef cudaError_t err = toDriverMemCopy3DParams(p, &cd) - if err != cudaSuccess: - return err - - # Execute the copy - if peer: - srcDev = m_global.getDevice(srcDevice) - dstDev = m_global.getDevice(dstDevice) - if srcDev == NULL or dstDev == NULL: - return cudaErrorInvalidDevice - cdPeer.srcXInBytes = cd.srcXInBytes - cdPeer.srcY = cd.srcY - cdPeer.srcZ = cd.srcZ - cdPeer.srcLOD = cd.srcLOD - cdPeer.srcMemoryType = cd.srcMemoryType - cdPeer.srcHost = cd.srcHost - cdPeer.srcDevice = cd.srcDevice - cdPeer.srcArray = cd.srcArray - cdPeer.srcContext = srcDev.primaryContext - cdPeer.srcPitch = cd.srcPitch - cdPeer.srcHeight = cd.srcHeight - cdPeer.dstXInBytes = cd.dstXInBytes - cdPeer.dstY = cd.dstY - cdPeer.dstZ = cd.dstZ - cdPeer.dstLOD = cd.dstLOD - cdPeer.dstMemoryType = cd.dstMemoryType - cdPeer.dstHost = cd.dstHost - cdPeer.dstDevice = cd.dstDevice - cdPeer.dstArray = cd.dstArray - cdPeer.dstContext = dstDev.primaryContext - cdPeer.dstPitch = cd.dstPitch - cdPeer.dstHeight = cd.dstHeight - cdPeer.WidthInBytes = cd.WidthInBytes - cdPeer.Height = cd.Height - cdPeer.Depth = cd.Depth - err = driverMemcpy3DPeer(&cdPeer, sid, async) - else: - err = driverMemcpy3D(&cd, sid, async) - return err - - -cdef cudaError_t copyToDevice(cydriver.CUmemorytype type, cudaArray_const_t thisArray, size_t hOffset, size_t wOffset, const char *dst, size_t dstOffset, size_t count, cydriver.CUstream stream, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaArrayLocalState arrayState - cdef cudaError_t err = cudaSuccess - memset(&arrayState, 0, sizeof(arrayState)) - err = getLocalState(&arrayState, thisArray) - if err != cudaSuccess: - return err - cdef size_t copied = 0 - cdef cydriver.CUDA_MEMCPY3D_v2 cp = memCopy3DInit(type, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - - if (wOffset > 0) and (count >= arrayState.widthInBytes - wOffset): - cp.dstDevice = dst - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = dstOffset - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = arrayState.widthInBytes - wOffset - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied >= arrayState.widthInBytes): - cp.dstDevice = (dst + copied) - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = dstOffset - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = ((count - copied) / arrayState.widthInBytes) - cp.WidthInBytes = arrayState.widthInBytes - - copied += cp.Height * cp.WidthInBytes - hOffset += cp.Height - wOffset = 0 - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - if (count - copied > 0): - cp.dstDevice = (dst + copied) - cp.dstPitch = arrayState.widthInBytes - cp.dstXInBytes = dstOffset - cp.dstY = 0 - - cp.srcArray = arrayState.array - cp.srcXInBytes = wOffset - cp.srcY = hOffset - - cp.Height = 1 - cp.WidthInBytes = count - copied - - err = driverMemcpy3D(&cp, stream, async) - if err != cudaSuccess: - return err - - return cudaSuccess - - -cdef cudaError_t copy1DConvertTo3DParams(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil: - memset(p, 0, sizeof(cudaMemcpy3DParms)) - p[0].extent.width = count - p[0].extent.height = 1 - p[0].extent.depth = 1 - p[0].dstPtr.ptr = dst - p[0].srcPtr.ptr = src - p[0].kind = kind - - -cdef void toDriverMemsetNodeParams(const cudaMemsetParams *pRuntimeParams, cydriver.CUDA_MEMSET_NODE_PARAMS *pDriverParams) noexcept nogil: - pDriverParams[0].dst = pRuntimeParams[0].dst - pDriverParams[0].pitch = pRuntimeParams[0].pitch - pDriverParams[0].value = pRuntimeParams[0].value - pDriverParams[0].elementSize = pRuntimeParams[0].elementSize - pDriverParams[0].width = pRuntimeParams[0].width - pDriverParams[0].height = pRuntimeParams[0].height - - -cdef cudaError_t getElementSize(size_t *elementSize, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR driverDesc - cdef cudaError_t err = cudaSuccess - err = cydriver._cuArray3DGetDescriptor_v2(&driverDesc, array) - if err != cudaSuccess: - return err - if (driverDesc.Format == cydriver.CU_AD_FORMAT_FLOAT or - driverDesc.Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32 or - driverDesc.Format == cydriver.CU_AD_FORMAT_SIGNED_INT32): - elementSize[0] = driverDesc.NumChannels * 4 - return cudaSuccess - elif (driverDesc.Format == cydriver.CU_AD_FORMAT_HALF or - driverDesc.Format == cydriver.CU_AD_FORMAT_SIGNED_INT16 or - driverDesc.Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT16): - elementSize[0] = driverDesc.NumChannels * 2 - return cudaSuccess - elif (driverDesc.Format == cydriver.CU_AD_FORMAT_SIGNED_INT8 or - driverDesc.Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT8 or - driverDesc.Format == cydriver.CU_AD_FORMAT_NV12): - elementSize[0] = driverDesc.NumChannels - return cudaSuccess - return cudaErrorInvalidChannelDescriptor - - -cdef cudaError_t toDriverMemCopy3DParams(const cudaMemcpy3DParms *p, cydriver.CUDA_MEMCPY3D *cd) except ?cudaErrorCallRequiresNewerDriver nogil: - memset(cd, 0, sizeof(cydriver.CUDA_MEMCPY3D)) - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].WidthInBytes = 0 - cd[0].Height = 1 - cd[0].Depth = 1 - cdef size_t srcElementSize = 0 - cdef size_t dstElementSize = 0 - cdef cudaError_t err = cudaSuccess - - cdef cudaExtent srcBlockExtent - cdef cudaExtent dstBlockExtent - cdef cudaExtent copyBlockExtent - cdef cydriver.CUarray_format srcFmt - cdef cydriver.CUarray_format dstFmt - cdef int numChannels = 0 - srcBlockExtent.width = srcBlockExtent.height = srcBlockExtent.depth = 1 - dstBlockExtent.width = dstBlockExtent.height = dstBlockExtent.depth = 1 - copyBlockExtent.width = copyBlockExtent.height = copyBlockExtent.depth = 1 - - if p[0].extent.width == 0 or p[0].extent.height == 0 or p[0].extent.depth == 0: - return cudaSuccess - - if p[0].kind == cudaMemcpyHostToHost: - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST - elif p[0].kind == cudaMemcpyHostToDevice: - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - elif p[0].kind == cudaMemcpyDeviceToHost: - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST - elif p[0].kind == cudaMemcpyDeviceToDevice: - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - elif p[0].kind == cudaMemcpyDefault: - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED - else: - return cudaErrorInvalidMemcpyDirection - - if p[0].srcArray: - err = getFormat(p[0].srcArray, numChannels, &srcFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&srcBlockExtent, srcFmt) - if err != cudaSuccess: - return err - copyBlockExtent = srcBlockExtent - if p[0].dstArray: - err = getFormat(p[0].dstArray, numChannels, &dstFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&dstBlockExtent, dstFmt) - if err != cudaSuccess: - return err - if not p[0].srcArray: - copyBlockExtent = dstBlockExtent - - if p[0].srcArray: - if NULL != p[0].srcPtr.ptr or cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST == cd[0].srcMemoryType: - return cudaErrorInvalidValue - cd[0].srcMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY - cd[0].srcArray = p[0].srcArray - err = getElementSize(&srcElementSize, p[0].srcArray) - if err != cudaSuccess: - return err - else: - if NULL == p[0].srcPtr.ptr: - return cudaErrorInvalidValue - if (p[0].extent.height > 1 or p[0].extent.depth > 1) and (p[0].extent.width > p[0].srcPtr.pitch): - return cudaErrorInvalidPitchValue - if p[0].extent.depth > 1: - adjustedSrcHeight = p[0].srcPtr.ysize * copyBlockExtent.height - if p[0].extent.height > adjustedSrcHeight: - return cudaErrorInvalidPitchValue - - if cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST == cd[0].srcMemoryType: - cd[0].srcHost = p[0].srcPtr.ptr - else: - cd[0].srcDevice = (p[0].srcPtr.ptr) - cd[0].srcPitch = p[0].srcPtr.pitch - cd[0].srcHeight = p[0].srcPtr.ysize - - if p[0].dstArray: - if NULL != p[0].dstPtr.ptr: - return cudaErrorInvalidValue - cd[0].dstMemoryType = cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY - cd[0].dstArray = p[0].dstArray - err = getElementSize(&dstElementSize, p[0].dstArray) - if err != cudaSuccess: - return err - else: - if NULL == p[0].dstPtr.ptr: - return cudaErrorInvalidValue - if (p[0].extent.height > 1 or p[0].extent.depth > 1) and (p[0].extent.width > p[0].dstPtr.pitch): - return cudaErrorInvalidPitchValue - if p[0].extent.depth > 1: - adjustedDstHeight = p[0].dstPtr.ysize * copyBlockExtent.height - if p[0].extent.height > adjustedDstHeight: - return cudaErrorInvalidPitchValue - - if cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST == cd[0].dstMemoryType: - cd[0].dstHost = p[0].dstPtr.ptr - else: - cd[0].dstDevice = (p[0].dstPtr.ptr) - cd[0].dstPitch = p[0].dstPtr.pitch - cd[0].dstHeight = p[0].dstPtr.ysize - - if srcElementSize and dstElementSize and srcElementSize != dstElementSize: - return cudaErrorInvalidValue - - cdef size_t elementSize = sizeof(char) - if srcElementSize: - elementSize = srcElementSize - if dstElementSize: - elementSize = dstElementSize - srcElementSize = elementSize - dstElementSize = elementSize - - # Determine the extent of the transfer - cd[0].WidthInBytes = ((p[0].extent.width + copyBlockExtent.width - 1) / copyBlockExtent.width) * elementSize - cd[0].Height = ((p[0].extent.height + copyBlockExtent.height - 1) / copyBlockExtent.height) - cd[0].Depth = p[0].extent.depth - - # Populate bloated src copy origin - cd[0].srcXInBytes = (p[0].srcPos.x / srcBlockExtent.width) * elementSize - cd[0].srcY = (p[0].srcPos.y / srcBlockExtent.height) - cd[0].srcZ = p[0].srcPos.z - - # Populate bloated dst copy origin - cd[0].dstXInBytes = (p[0].dstPos.x / dstBlockExtent.width) * elementSize - cd[0].dstY = (p[0].dstPos.y / dstBlockExtent.height) - cd[0].dstZ = p[0].dstPos.z - - return cudaSuccess - - -cdef cudaError_t mallocArray(cudaArray_t *arrayPtr, const cudaChannelFormatDesc *desc, - size_t depth, size_t height, size_t width, int corr2D, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if arrayPtr == NULL: - return cudaErrorInvalidValue - - cdef cydriver.CUarray array = NULL - cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - cdef cudaError_t err = cudaSuccess - arrayPtr[0] = NULL - if (((width == 0)) or - ((height == 0) and (depth != 0) and not (flags & cudaArrayLayered)) or - ((flags & cudaArrayLayered) and (depth == 0)) or - ((flags & cudaArrayCubemap) and not (flags & cudaArrayLayered) and ((width != height) or (depth != 6))) or - ((flags & cudaArrayLayered) and (flags & cudaArrayCubemap) and ((width != height) or (depth % 6 != 0)))): - return cudaErrorInvalidValue - else: - memset(&ad, 0, sizeof(ad)) - err = getDescInfo(desc, &ad.NumChannels, &ad.Format) - if err != cudaSuccess: - return err - ad.Height = height - ad.Width = width - ad.Depth = (depth - corr2D) - ad.Flags = flags - err = cydriver._cuArray3DCreate_v2(&array, &ad) - if err != cudaSuccess: - return err - - arrayPtr[0] = array - return cudaSuccess - - -cdef cudaError_t memcpy2DToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - if height > 1 and width > spitch: - return cudaErrorInvalidPitchValue - - cdef cudaError_t err = cudaSuccess - if kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - err = copyFromHost2D(dst, hOffset, wOffset, src, spitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - err = copyFromDevice2D(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, dst, hOffset, wOffset, src, 0, spitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - err = copyFromDevice2D(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, dst, hOffset, wOffset, src, 0, spitch, width, height, sid, async) - else: - return cudaErrorInvalidMemcpyDirection - return err - - -cdef cudaError_t memcpy2DPtr(char *dst, size_t dpitch, const char *src, size_t spitch, size_t width, - size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - if height > 1 and width > dpitch: - return cudaErrorInvalidPitchValue - if height > 1 and width > spitch: - return cudaErrorInvalidPitchValue - - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUDA_MEMCPY2D_v2 cp - memset(&cp, 0, sizeof(cp)) - - if kind == cudaMemcpyKind.cudaMemcpyHostToHost: - cp = memCopy2DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - cp.dstHost = dst - cp.srcHost = src - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - cp = memCopy2DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE) - cp.dstHost = dst - cp.srcDevice = src - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - cp = memCopy2DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST) - cp.dstDevice = dst - cp.srcHost = src - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - cp = memCopy2DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE) - cp.dstDevice = dst - cp.srcDevice = src - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - cp = memCopy2DInit(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED) - cp.dstDevice = dst - cp.srcDevice = src - else: - err = cudaErrorInvalidMemcpyDirection - - if err != cudaSuccess: - return err - - cp.dstPitch = dpitch - cp.srcPitch = spitch - cp.WidthInBytes = width - cp.Height = height - - if async: - err = cydriver._cuMemcpy2DAsync_v2(&cp, sid) - else: - err = cydriver._cuMemcpy2DUnaligned_v2(&cp) - return err - - -cdef cudaError_t memcpyDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - if size == 0: - return cudaSuccess - - cdef cudaError_t err = cudaSuccess - if kind == cudaMemcpyKind.cudaMemcpyHostToHost: - return memcpy2DPtr(dst, size, src, size, size, 1, kind, NULL, 0) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - err = cydriver._cuMemcpyDtoH_v2(dst, src, size) - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - err = cydriver._cuMemcpyHtoD_v2(dst, src, size) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - err = cydriver._cuMemcpyDtoD_v2(dst, src, size) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - err = cydriver._cuMemcpy(dst, src, size) - else: - return cudaErrorInvalidMemcpyDirection - - -cdef cudaError_t mallocHost(size_t size, void **mem, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if size == 0: - if mem == NULL: - return cudaErrorInvalidValue - mem[0] = NULL - return cudaSuccess - else: - return cydriver._cuMemHostAlloc(mem, size, flags) - - -cdef cudaError_t mallocPitch(size_t width, size_t height, size_t depth, void **mem, size_t *pitch) except ?cudaErrorCallRequiresNewerDriver nogil: - height *= depth - - if width == 0 or height == 0: - if mem == NULL or pitch == NULL: - return cudaErrorInvalidValue - mem[0] = NULL - pitch[0] = 0 - else: - return cydriver._cuMemAllocPitch_v2(mem, pitch, width, height, 4) - return cudaSuccess - - -cdef cudaError_t mallocMipmappedArray(cudaMipmappedArray_t *mipmappedArray, const cudaChannelFormatDesc *desc, - size_t depth, size_t height, size_t width, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - if mipmappedArray == NULL: - return cudaErrorInvalidValue - - cdef cydriver.CUmipmappedArray mipmap = NULL - cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 ad - memset(&ad, 0, sizeof(ad)) - - mipmappedArray[0] = NULL - if (((width == 0)) or - ((height == 0) and (depth != 0) and not (flags & cudaArrayLayered)) or - ((flags & cudaArrayLayered) and (depth == 0)) or - ((flags & cudaArrayCubemap) and not (flags & cudaArrayLayered) and ((width != height) or (depth != 6))) or - ((flags & cudaArrayLayered) and (flags & cudaArrayCubemap) and ((width != height) or (depth % 6 != 0)))): - return cudaErrorInvalidValue - else: - err = getDescInfo(desc, &ad.NumChannels, &ad.Format) - if err != cudaSuccess: - return err - ad.Height = height - ad.Width = width - ad.Depth = depth - ad.Flags = flags - err = cydriver._cuMipmappedArrayCreate(&mipmap, &ad, numLevels) - if err != cudaSuccess: - return err - mipmappedArray[0] = mipmap - return cudaSuccess - - -cdef cudaError_t memcpyAsyncDispatch(void *dst, const void *src, size_t size, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - if size == 0: - return cudaSuccess - elif kind == cudaMemcpyKind.cudaMemcpyHostToHost: - return memcpy2DPtr(dst, size, src, size, size, 1, kind, stream, True) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - return cydriver._cuMemcpyDtoHAsync_v2(dst, src, size, stream) - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - returncydriver._cuMemcpyHtoDAsync_v2(dst, src, size, stream) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - returncydriver._cuMemcpyDtoDAsync_v2(dst, src, size, stream) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - returncydriver._cuMemcpyAsync(dst, src, size, stream) - return cudaErrorInvalidMemcpyDirection - - -cdef cudaError_t toCudartMemCopy3DParams(const cydriver.CUDA_MEMCPY3D_v2 *cd, cudaMemcpy3DParms *p) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaExtent srcBlockExtent - cdef cudaExtent dstBlockExtent - cdef cudaExtent copyBlockExtent - cdef cydriver.CUarray_format srcFmt - cdef cydriver.CUarray_format dstFmt - cdef int numChannels = 0 - srcBlockExtent.width = srcBlockExtent.height = srcBlockExtent.depth = 1 - dstBlockExtent.width = dstBlockExtent.height = dstBlockExtent.depth = 1 - copyBlockExtent.width = copyBlockExtent.height = copyBlockExtent.depth = 1 - - memset(p, 0, sizeof(cudaMemcpy3DParms)) - p[0].srcPtr.xsize = 0 - p[0].dstPtr.xsize = 0 - - if (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST and cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST): - p[0].kind = cudaMemcpyHostToHost - - p[0].srcPtr.ptr = cd[0].srcHost - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstPtr.ptr = cd[0].dstHost - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST - and (cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE - or cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY)): - p[0].kind = cudaMemcpyHostToDevice - - p[0].srcPtr.ptr = cd[0].srcHost - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - if (cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].dstArray = cd[0].dstArray - else: - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif ((cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE or cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - and cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_HOST): - p[0].kind = cudaMemcpyDeviceToHost - - if (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].srcArray = cd[0].srcArray - else: - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstPtr.ptr = cd[0].dstHost - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif ((cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE or cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY) - and (cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE or cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY)): - p[0].kind = cudaMemcpyDeviceToDevice - - if (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].srcArray = cd[0].srcArray - else: - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - if (cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].dstArray = cd[0].dstArray - else: - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED and cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED): - p[0].kind = cudaMemcpyDefault - - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight - elif (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED and cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - p[0].kind = cudaMemcpyDefault - - p[0].srcPtr.ptr = cd[0].srcDevice - p[0].srcPtr.pitch = cd[0].srcPitch - p[0].srcPtr.ysize = cd[0].srcHeight - - p[0].dstArray = cd[0].dstArray - elif (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY and cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED): - p[0].kind = cudaMemcpyDefault - - p[0].srcArray = cd[0].srcArray - - p[0].dstPtr.ptr = cd[0].dstDevice - p[0].dstPtr.pitch = cd[0].dstPitch - p[0].dstPtr.ysize = cd[0].dstHeight + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM + elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM + elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5): + numberOfChannels[0] = 2 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16 + elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H): + numberOfChannels[0] = 3 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16 + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM + elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB + elif case_desc(d, 10, 10, 10, 2, cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102): + numberOfChannels[0] = 4 + format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT_101010_2 else: - return cudaErrorUnknown - - cdef size_t srcElementSize = 0 - cdef size_t dstElementSize = 0 - cdef cudaError_t err = cudaSuccess - - if (cd[0].srcMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - err = getFormat(cd[0].srcArray, numChannels, &srcFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&srcBlockExtent, srcFmt) - if err != cudaSuccess: - return err - err = getElementSize(&srcElementSize, cd[0].srcArray) - if err != cudaSuccess: - return err - copyBlockExtent = srcBlockExtent - - if (cd[0].dstMemoryType == cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY): - err = getFormat(cd[0].dstArray, numChannels, &dstFmt) - if err != cudaSuccess: - return err - err = getArrayBlockExtent(&dstBlockExtent, dstFmt) - if err != cudaSuccess: - return err - err = getElementSize(&dstElementSize, cd[0].dstArray) - if err != cudaSuccess: - return err - if cd[0].srcMemoryType != cydriver.CUmemorytype_enum.CU_MEMORYTYPE_ARRAY: - copyBlockExtent = dstBlockExtent - - if (srcElementSize and dstElementSize and srcElementSize != dstElementSize): - return cudaErrorInvalidValue - - cdef size_t elementSize = sizeof(char) - if (srcElementSize): - elementSize = srcElementSize - if (dstElementSize): - elementSize = dstElementSize - srcElementSize = elementSize - dstElementSize = elementSize - - p[0].extent.width = (cd[0].WidthInBytes / elementSize) * copyBlockExtent.width - p[0].extent.height = cd[0].Height * copyBlockExtent.height - p[0].extent.depth = cd[0].Depth - - p[0].srcPos.x = (cd[0].srcXInBytes / elementSize) * srcBlockExtent.width - p[0].srcPos.y = cd[0].srcY * srcBlockExtent.height - p[0].srcPos.z = cd[0].srcZ + return cudaErrorInvalidChannelDescriptor - p[0].dstPos.x = (cd[0].dstXInBytes / elementSize) * dstBlockExtent.width - p[0].dstPos.y = cd[0].dstY * dstBlockExtent.height - p[0].dstPos.z = cd[0].dstZ + if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12, + cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H, + cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,): + if numberOfChannels[0] != 3: + return cudaErrorInvalidChannelDescriptor + else: + if (numberOfChannels[0] != 1) and (numberOfChannels[0] != 2) and (numberOfChannels[0] != 4): + return cudaErrorInvalidChannelDescriptor return cudaSuccess -cdef cudaError_t memcpy2DFromArray(char *dst, size_t dpitch, cudaArray_const_t src, size_t hOffset, - size_t wOffset, size_t width, size_t height, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - if width == 0 or height == 0: - return cudaSuccess - if height > 1 and width > dpitch: - return cudaErrorInvalidPitchValue +cdef cudaError_t getChannelFormatDescFromDriverDesc(cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, const cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - if kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - err = copyToHost2D(src, hOffset, wOffset, dst, dpitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - err = copyToDevice2D(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, src, hOffset, wOffset, dst, 0, dpitch, width, height, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - err = copyToDevice2D(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, src, hOffset, wOffset, dst, 0, dpitch, width, height, sid, async) + cdef int channel_size = 0 + if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT8: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned + channel_size = 32 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT8: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT32: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned + channel_size = 32 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_HALF: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_FLOAT: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat + channel_size = 32 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_NV12: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindNV12 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X1: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X4: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4 + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_SNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_SNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_UF16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_SF16: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H + channel_size = 16 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7 + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB + channel_size = 8 + elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2: + pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102 else: - return cudaErrorInvalidMemcpyDirection - return err - - -cdef cudaError_t memcpy2DArrayToArray(cudaArray_t dst, size_t hOffsetDst, size_t wOffsetDst, - cudaArray_const_t src, size_t hOffsetSrc, size_t wOffsetSrc, - size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - if width == 0 or height == 0: - return cudaSuccess - if kind != cudaMemcpyKind.cudaMemcpyDeviceToDevice and kind != cudaMemcpyKind.cudaMemcpyDefault: - return cudaErrorInvalidMemcpyDirection - return copyToArray2D(src, hOffsetSrc, wOffsetSrc, dst, hOffsetDst, wOffsetDst, width, height) - - -cdef cudaError_t memset3DPtr(cudaPitchedPtr p, int val, cudaExtent e, cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if e.width == 0 or e.height == 0 or e.depth == 0: - return cudaSuccess - - if (e.height > 1 or e.depth > 1) and e.width > p.pitch: - return cudaErrorInvalidValue - - if e.depth > 0 and e.height > p.ysize: - return cudaErrorInvalidValue + return cudaErrorInvalidChannelDescriptor - cdef char *ptr = p.ptr - cdef size_t d - cdef cudaError_t err = cudaSuccess + # populate bits per channel + pRuntimeDesc[0].x = 0 + pRuntimeDesc[0].y = 0 + pRuntimeDesc[0].z = 0 + pRuntimeDesc[0].w = 0 - if e.width >= p.xsize and e.height == p.ysize and e.width == p.pitch: - return memsetPtr(ptr, val, e.width * e.height * e.depth, sid, async) - elif e.height == p.ysize: - return memset2DPtr(ptr, p.pitch, val, e.width, e.height * e.depth, sid, async) + if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2 and pDriverDesc[0].NumChannels == 4: + pRuntimeDesc[0].w = 2 + pRuntimeDesc[0].z = 10 + pRuntimeDesc[0].y = 10 + pRuntimeDesc[0].x = 10 else: - d = 0 - while (d != e.depth): - err = memset2DPtr(ptr, p.pitch, val, e.width, e.height, sid, async) - if err != cudaSuccess: - return err - ptr += p.pitch * p.ysize - d += 1 - return cudaSuccess - - -cdef cudaError_t memcpyToArray(cudaArray_t dst, size_t hOffset, size_t wOffset, const char *src, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess - - if kind == cudaMemcpyKind.cudaMemcpyHostToDevice: - return copyFromHost(dst, hOffset, wOffset, src, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - return copyFromDevice(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, dst, hOffset, wOffset, src, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - return copyFromDevice(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, dst, hOffset, wOffset, src, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyHostToHost or kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - return cudaErrorInvalidMemcpyDirection - return cudaSuccess - + if pDriverDesc[0].NumChannels >= 4: + pRuntimeDesc[0].w = channel_size + if pDriverDesc[0].NumChannels >= 3: + pRuntimeDesc[0].z = channel_size + if pDriverDesc[0].NumChannels >= 2: + pRuntimeDesc[0].y = channel_size + if pDriverDesc[0].NumChannels >= 1: + pRuntimeDesc[0].x = channel_size -cdef cudaError_t memcpyFromArray(char *dst, cudaArray_const_t src, size_t hOffset, size_t wOffset, - size_t count, cudaMemcpyKind kind, - cudaStream_t sid, bool async) except ?cudaErrorCallRequiresNewerDriver nogil: - if count == 0: - return cudaSuccess + if pDriverDesc[0].NumChannels not in (4, 3, 2, 1): + return cudaErrorInvalidChannelDescriptor - if kind == cudaMemcpyKind.cudaMemcpyDeviceToHost: - return copyToHost(src, hOffset, wOffset, dst, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDeviceToDevice: - return copyToDevice(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_DEVICE, src, hOffset, wOffset, dst, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyDefault: - return copyToDevice(cydriver.CUmemorytype_enum.CU_MEMORYTYPE_UNIFIED, src, hOffset, wOffset, dst, 0, count, sid, async) - elif kind == cudaMemcpyKind.cudaMemcpyHostToDevice or kind == cudaMemcpyKind.cudaMemcpyHostToHost: - return cudaErrorInvalidMemcpyDirection + # populate dimensions + if pDepth != NULL: + pDepth[0] = pDriverDesc[0].Depth + if pHeight != NULL: + pHeight[0] = pDriverDesc[0].Height + if pWidth != NULL: + pWidth[0] = pDriverDesc[0].Width return cudaSuccess -cdef cudaError_t toDriverCudaResourceDesc(cydriver.CUDA_RESOURCE_DESC *_driver_pResDesc, const cudaResourceDesc *pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef int numChannels - cdef cydriver.CUarray_format format - - if pResDesc[0].resType == cudaResourceType.cudaResourceTypeArray: - _driver_pResDesc[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_ARRAY - _driver_pResDesc[0].res.array.hArray = pResDesc[0].res.array.array - elif pResDesc[0].resType == cudaResourceType.cudaResourceTypeMipmappedArray: - _driver_pResDesc[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_MIPMAPPED_ARRAY - _driver_pResDesc[0].res.mipmap.hMipmappedArray = pResDesc[0].res.mipmap.mipmap - elif pResDesc[0].resType == cudaResourceType.cudaResourceTypeLinear: - _driver_pResDesc[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_LINEAR - _driver_pResDesc[0].res.linear.devPtr = pResDesc[0].res.linear.devPtr - _driver_pResDesc[0].res.linear.sizeInBytes = pResDesc[0].res.linear.sizeInBytes - err = getDescInfo(&pResDesc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - _setLastError(err) - return err - _driver_pResDesc[0].res.linear.format = format - _driver_pResDesc[0].res.linear.numChannels = numChannels - elif pResDesc[0].resType == cudaResourceType.cudaResourceTypePitch2D: - _driver_pResDesc[0].resType = cydriver.CUresourcetype_enum.CU_RESOURCE_TYPE_PITCH2D - _driver_pResDesc[0].res.pitch2D.devPtr = pResDesc[0].res.pitch2D.devPtr - _driver_pResDesc[0].res.pitch2D.pitchInBytes = pResDesc[0].res.pitch2D.pitchInBytes - _driver_pResDesc[0].res.pitch2D.width = pResDesc[0].res.pitch2D.width - _driver_pResDesc[0].res.pitch2D.height = pResDesc[0].res.pitch2D.height - err = getDescInfo(&pResDesc[0].res.linear.desc, &numChannels, &format) - if err != cudaSuccess: - _setLastError(err) - return err - _driver_pResDesc[0].res.pitch2D.format = format - _driver_pResDesc[0].res.pitch2D.numChannels = numChannels - else: - _setLastError(cudaErrorInvalidValue) - return cudaErrorInvalidValue - _driver_pResDesc[0].flags = 0 - - return err - - cdef cudaError_t getDriverEglFrame(cydriver.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil: cdef cudaError_t err = cudaSuccess cdef unsigned int i = 0 @@ -3436,142 +992,3 @@ cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, cydriver.CUeglFrame else: return cudaErrorInvalidValue - -cdef cudaError_t toDriverGraphNodeParams(const cudaGraphNodeParams *rtParams, cydriver.CUgraphNodeParams *driverParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err - cdef cydriver.CUcontext context - memset(driverParams, 0, sizeof(driverParams[0])) - - if rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeKernel: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_KERNEL - err = toDriverKernelNodeParams(&rtParams[0].kernel, &driverParams[0].kernel) - if err != cudaSuccess: - return err - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemcpy: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMCPY - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - err = toDriverMemCopy3DParams(&rtParams[0].memcpy.copyParams, &driverParams[0].memcpy.copyParams) - if err != cudaSuccess: - return err - driverParams[0].memcpy.copyCtx = context - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemset: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEMSET - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - toDriverMemsetNodeParams(&rtParams[0].memset, &driverParams[0].memset) - driverParams[0].memset.ctx = context - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeHost: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_HOST - toDriverHostNodeParams(&rtParams[0].host, &driverParams[0].host) - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeGraph: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_GRAPH - driverParams[0].graph.graph = rtParams[0].graph.graph - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeEmpty: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EMPTY - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeWaitEvent: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_WAIT_EVENT - driverParams[0].eventWait.event = rtParams[0].eventWait.event - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeEventRecord: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EVENT_RECORD - driverParams[0].eventRecord.event = rtParams[0].eventRecord.event - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreSignal: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_SIGNAL - driverParams[0].extSemSignal = ((&rtParams[0].extSemSignal))[0] - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeExtSemaphoreWait: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_EXT_SEMAS_WAIT - driverParams[0].extSemWait = (&rtParams[0].extSemWait)[0] - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemAlloc: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_ALLOC - driverParams[0].alloc = (&rtParams[0].alloc)[0] - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeMemFree: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_FREE - driverParams[0].free.dptr = rtParams[0].free.dptr - elif rtParams[0].type == cudaGraphNodeType.cudaGraphNodeTypeConditional: - driverParams[0].type = cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_CONDITIONAL - # RT params mirror the driver params except the RT struct lacks the ctx at the end. - memcpy(&driverParams[0].conditional, &rtParams[0].conditional, sizeof(rtParams[0].conditional)) - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - driverParams[0].conditional.ctx = context - else: - return cudaErrorInvalidValue - return cudaSuccess - - -cdef void toCudartGraphNodeOutParams(const cydriver.CUgraphNodeParams *driverParams, cudaGraphNodeParams *rtParams) noexcept nogil: - if driverParams[0].type == cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_MEM_ALLOC: - rtParams[0].alloc.dptr = driverParams[0].alloc.dptr - elif driverParams[0].type == cydriver.CUgraphNodeType_enum.CU_GRAPH_NODE_TYPE_CONDITIONAL: - rtParams[0].conditional.phGraph_out = driverParams[0].conditional.phGraph_out - - -cdef cudaError_t toDriverKernelNodeParams(const cudaKernelNodeParams nodeParams[0], cydriver.CUDA_KERNEL_NODE_PARAMS *driverNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - cdef cydriver.CUcontext context - err = cydriver._cuCtxGetCurrent(&context) - if err != cudaSuccess: - _setLastError(err) - return err - driverNodeParams[0].func = nodeParams[0].func - driverNodeParams[0].kern = NULL - driverNodeParams[0].ctx = context - driverNodeParams[0].gridDimX = nodeParams[0].gridDim.x - driverNodeParams[0].gridDimY = nodeParams[0].gridDim.y - driverNodeParams[0].gridDimZ = nodeParams[0].gridDim.z - driverNodeParams[0].blockDimX = nodeParams[0].blockDim.x - driverNodeParams[0].blockDimY = nodeParams[0].blockDim.y - driverNodeParams[0].blockDimZ = nodeParams[0].blockDim.z - driverNodeParams[0].sharedMemBytes = nodeParams[0].sharedMemBytes - driverNodeParams[0].kernelParams = nodeParams[0].kernelParams - driverNodeParams[0].extra = nodeParams[0].extra - return err - - -cdef void toDriverHostNodeParams(const cudaHostNodeParams *pRuntimeNodeParams, cydriver.CUDA_HOST_NODE_PARAMS *pDriverNodeParams) noexcept nogil: - pDriverNodeParams[0].fn = pRuntimeNodeParams[0].fn - pDriverNodeParams[0].userData = pRuntimeNodeParams[0].userData - - -@cython.show_performance_hints(False) -cdef void cudaAsyncNotificationCallbackWrapper(cudaAsyncNotificationInfo_t *info, void *data, cudaAsyncCallbackHandle_t handle) nogil: - cdef cudaAsyncCallbackData *cbData = data - with gil: - cbData.callback(info, cbData.userData, handle) - - -cdef cudaError_t DeviceRegisterAsyncNotificationCommon(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaAsyncCallbackData *cbData = NULL - cdef cudaError_t err = cudaSuccess - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return cudaErrorMemoryAllocation - - cbData.callback = callbackFunc - cbData.userData = userData - err = cydriver._cuDeviceRegisterAsyncNotification(device, cudaAsyncNotificationCallbackWrapper, cbData, callback) - if err != cudaSuccess: - free(cbData) - - m_global._asyncCallbackDataMap[callback[0]] = cbData - - return err - -cdef cudaError_t DeviceUnregisterAsyncNotificationCommon(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: - cdef cudaError_t err = cudaSuccess - err = cydriver._cuDeviceUnregisterAsyncNotification(device, callback) - if err != cudaSuccess: - _setLastError(err) - return err - - free(m_global._asyncCallbackDataMap[callback]) - m_global._asyncCallbackDataMap.erase(callback) - - return err diff --git a/cuda_bindings/cuda/bindings/cydriver.pyx.in b/cuda_bindings/cuda/bindings/cydriver.pyx.in index 6b99e62dd..3df0b0cd2 100644 --- a/cuda_bindings/cuda/bindings/cydriver.pyx.in +++ b/cuda_bindings/cuda/bindings/cydriver.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -7,6 +7,9 @@ # is strictly prohibited. # # This code was automatically generated with version 12.8.0. Do not modify it directly. +import cython +from libcpp.map cimport map +from libc.stdlib cimport malloc, free cimport cuda.bindings._bindings.cydriver as cydriver {{if 'cuGetErrorString' in found_functions}} @@ -599,14 +602,47 @@ cdef CUresult cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} +ctypedef struct cuAsyncCallbackData_st: + CUasyncCallback callback + void *userData + +ctypedef cuAsyncCallbackData_st cuAsyncCallbackData + +@cython.show_performance_hints(False) +cdef void cuAsyncNotificationCallbackWrapper(CUasyncNotificationInfo *info, void *data, CUasyncCallbackHandle handle) nogil: + cdef cuAsyncCallbackData *cbData = data + with gil: + cbData.callback(info, cbData.userData, handle) + + cdef CUresult cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: - return cydriver._cuDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + cdef cuAsyncCallbackData *cbData = NULL + cdef CUresult err = CUDA_SUCCESS + cbData = malloc(sizeof(cbData[0])) + + if cbData == NULL: + return CUDA_ERROR_OUT_OF_MEMORY + + cbData.callback = callbackFunc + cbData.userData = userData + err = cydriver._cuDeviceRegisterAsyncNotification(device, cuAsyncNotificationCallbackWrapper, cbData, callback) + if err != CUDA_SUCCESS: + free(cbData) + return err + + m_global._asyncCallbackDataMap[callback[0]] = cbData + return err {{endif}} {{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} cdef CUresult cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: - return cydriver._cuDeviceUnregisterAsyncNotification(device, callback) + cdef CUresult err = CUDA_SUCCESS + err = cydriver._cuDeviceUnregisterAsyncNotification(device, callback) + if err == CUDA_SUCCESS: + free(m_global._asyncCallbackDataMap[callback]) + m_global._asyncCallbackDataMap.erase(callback) + return err {{endif}} {{if 'cuDeviceGetByPCIBusId' in found_functions}} @@ -1295,8 +1331,35 @@ cdef CUresult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int F {{if 'cuStreamAddCallback' in found_functions}} +ctypedef struct cuStreamCallbackData_st: + CUstreamCallback callback + void *userData + +ctypedef cuStreamCallbackData_st cuStreamCallbackData + +@cython.show_performance_hints(False) +cdef void cuStreamCallbackWrapper(CUstream stream, CUresult status, void *data) nogil: + cdef cuStreamCallbackData *cbData = data + with gil: + cbData.callback(stream, status, cbData.userData) + free(cbData) + + cdef CUresult cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - return cydriver._cuStreamAddCallback(hStream, callback, userData, flags) + cdef cuStreamCallbackData *cbData = NULL + cdef CUresult err = CUDA_SUCCESS + cbData = malloc(sizeof(cbData[0])) + + if cbData == NULL: + return CUDA_ERROR_OUT_OF_MEMORY + + cbData.callback = callback + cbData.userData = userData + err = cydriver._cuStreamAddCallback(hStream, cuStreamCallbackWrapper, cbData, flags) + if err != CUDA_SUCCESS: + free(cbData) + return err + return err {{endif}} {{if 'cuStreamBeginCapture_v2' in found_functions}} @@ -1595,8 +1658,35 @@ cdef CUresult cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchPar {{if 'cuLaunchHostFunc' in found_functions}} +ctypedef struct cuHostCallbackData_st: + CUhostFn callback + void *userData + +ctypedef cuHostCallbackData_st cuHostCallbackData + +@cython.show_performance_hints(False) +cdef void cuHostCallbackWrapper(void *data) nogil: + cdef cuHostCallbackData *cbData = data + with gil: + cbData.callback(cbData.userData) + free(cbData) + + cdef CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: - return cydriver._cuLaunchHostFunc(hStream, fn, userData) + cdef cuHostCallbackData *cbData = NULL + cdef CUresult err = CUDA_SUCCESS + cbData = malloc(sizeof(cbData[0])) + + if cbData == NULL: + return CUDA_ERROR_OUT_OF_MEMORY + + cbData.callback = fn + cbData.userData = userData + err = cydriver._cuLaunchHostFunc(hStream, cuHostCallbackWrapper, cbData) + if err != CUDA_SUCCESS: + free(cbData) + return err + return err {{endif}} {{if 'cuFuncSetBlockShape' in found_functions}} @@ -2816,3 +2906,19 @@ cdef CUresult cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResou cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: return cydriver._cuGraphicsVDPAURegisterOutputSurface(pCudaResource, vdpSurface, flags) {{endif}} + + +cdef class cudaBindingsDriverGlobal: + {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} + cdef map[CUasyncCallbackHandle, cuAsyncCallbackData*] _asyncCallbackDataMap + {{endif}} + + def __dealloc__(self): + pass + {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} + for item_asyncCallbackDataMap in self._asyncCallbackDataMap: + free(item_asyncCallbackDataMap.second) + self._asyncCallbackDataMap.clear() + {{endif}} + +cdef cudaBindingsDriverGlobal m_global = cudaBindingsDriverGlobal() diff --git a/cuda_bindings/cuda/bindings/cyruntime.pxd.in b/cuda_bindings/cuda/bindings/cyruntime.pxd.in index 6fb33eab2..8567d2335 100644 --- a/cuda_bindings/cuda/bindings/cyruntime.pxd.in +++ b/cuda_bindings/cuda/bindings/cyruntime.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -3264,12 +3264,12 @@ cdef cudaError_t cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, c cdef cudaError_t cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil {{endif}} -{{if True}} +{{if 'cudaProfilerStart' in found_functions}} cdef cudaError_t cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil {{endif}} -{{if True}} +{{if 'cudaProfilerStop' in found_functions}} cdef cudaError_t cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil {{endif}} diff --git a/cuda_bindings/cuda/bindings/cyruntime.pyx.in b/cuda_bindings/cuda/bindings/cyruntime.pyx.in index eed4f9145..8238f6067 100644 --- a/cuda_bindings/cuda/bindings/cyruntime.pyx.in +++ b/cuda_bindings/cuda/bindings/cyruntime.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -7,2601 +7,2012 @@ # is strictly prohibited. # # This code was automatically generated with version 12.8.0. Do not modify it directly. - -# cython: show_performance_hints=False - -cimport cuda.bindings._bindings.cydriver as cydriver -from cuda.bindings._lib.cyruntime.cyruntime cimport * -from cuda.bindings._lib.cyruntime.utils cimport * -from libc.stdlib cimport malloc, free, calloc -from libc cimport string -from libcpp cimport bool - -cdef cudaPythonGlobal m_global = globalGetInstance() +import cython +from libcpp.map cimport map +from libc.stdlib cimport malloc, free +cimport cuda.bindings._bindings.cyruntime as cyruntime +cimport cuda.bindings._lib.cyruntime.cyruntime as custom_cyruntime {{if 'cudaDeviceReset' in found_functions}} cdef cudaError_t cudaDeviceReset() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceReset() - + return cyruntime._cudaDeviceReset() {{endif}} {{if 'cudaDeviceSynchronize' in found_functions}} cdef cudaError_t cudaDeviceSynchronize() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSynchronize() - + return cyruntime._cudaDeviceSynchronize() {{endif}} {{if 'cudaDeviceSetLimit' in found_functions}} cdef cudaError_t cudaDeviceSetLimit(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetLimit(limit, value) - + return cyruntime._cudaDeviceSetLimit(limit, value) {{endif}} {{if 'cudaDeviceGetLimit' in found_functions}} cdef cudaError_t cudaDeviceGetLimit(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetLimit(pValue, limit) - + return cyruntime._cudaDeviceGetLimit(pValue, limit) {{endif}} {{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} cdef cudaError_t cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) - + return cyruntime._cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) {{endif}} {{if 'cudaDeviceGetCacheConfig' in found_functions}} cdef cudaError_t cudaDeviceGetCacheConfig(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetCacheConfig(pCacheConfig) - + return cyruntime._cudaDeviceGetCacheConfig(pCacheConfig) {{endif}} {{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} cdef cudaError_t cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) - + return cyruntime._cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) {{endif}} {{if 'cudaDeviceSetCacheConfig' in found_functions}} cdef cudaError_t cudaDeviceSetCacheConfig(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetCacheConfig(cacheConfig) - + return cyruntime._cudaDeviceSetCacheConfig(cacheConfig) {{endif}} {{if 'cudaDeviceGetByPCIBusId' in found_functions}} cdef cudaError_t cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetByPCIBusId(device, pciBusId) - + return cyruntime._cudaDeviceGetByPCIBusId(device, pciBusId) {{endif}} {{if 'cudaDeviceGetPCIBusId' in found_functions}} cdef cudaError_t cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetPCIBusId(pciBusId, length, device) - + return cyruntime._cudaDeviceGetPCIBusId(pciBusId, length, device) {{endif}} {{if 'cudaIpcGetEventHandle' in found_functions}} cdef cudaError_t cudaIpcGetEventHandle(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcGetEventHandle(handle, event) - + return cyruntime._cudaIpcGetEventHandle(handle, event) {{endif}} {{if 'cudaIpcOpenEventHandle' in found_functions}} cdef cudaError_t cudaIpcOpenEventHandle(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcOpenEventHandle(event, handle) - + return cyruntime._cudaIpcOpenEventHandle(event, handle) {{endif}} {{if 'cudaIpcGetMemHandle' in found_functions}} cdef cudaError_t cudaIpcGetMemHandle(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcGetMemHandle(handle, devPtr) - + return cyruntime._cudaIpcGetMemHandle(handle, devPtr) {{endif}} {{if 'cudaIpcOpenMemHandle' in found_functions}} cdef cudaError_t cudaIpcOpenMemHandle(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcOpenMemHandle(devPtr, handle, flags) - + return cyruntime._cudaIpcOpenMemHandle(devPtr, handle, flags) {{endif}} {{if 'cudaIpcCloseMemHandle' in found_functions}} cdef cudaError_t cudaIpcCloseMemHandle(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaIpcCloseMemHandle(devPtr) - + return cyruntime._cudaIpcCloseMemHandle(devPtr) {{endif}} {{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} cdef cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceFlushGPUDirectRDMAWrites(target, scope) - + return cyruntime._cudaDeviceFlushGPUDirectRDMAWrites(target, scope) {{endif}} {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} +ctypedef struct cudaAsyncCallbackData_st: + cudaAsyncCallback callback + void *userData + +ctypedef cudaAsyncCallbackData_st cudaAsyncCallbackData + +@cython.show_performance_hints(False) +cdef void cudaAsyncNotificationCallbackWrapper(cudaAsyncNotificationInfo_t *info, void *data, cudaAsyncCallbackHandle_t handle) nogil: + cdef cudaAsyncCallbackData *cbData = data + with gil: + cbData.callback(info, cbData.userData, handle) + + cdef cudaError_t cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + cdef cudaAsyncCallbackData *cbData = NULL + cdef cudaError_t err = cudaSuccess + cbData = malloc(sizeof(cbData[0])) + + if cbData == NULL: + return cudaErrorMemoryAllocation + cbData.callback = callbackFunc + cbData.userData = userData + err = cyruntime._cudaDeviceRegisterAsyncNotification(device, cudaAsyncNotificationCallbackWrapper, cbData, callback) + if err != cudaSuccess: + free(cbData) + return err + + m_global._asyncCallbackDataMap[callback[0]] = cbData + return err {{endif}} {{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} cdef cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceUnregisterAsyncNotification(device, callback) - + cdef cudaError_t err = cudaSuccess + err = cyruntime._cudaDeviceUnregisterAsyncNotification(device, callback) + if err == cudaSuccess: + free(m_global._asyncCallbackDataMap[callback]) + m_global._asyncCallbackDataMap.erase(callback) + return err {{endif}} {{if 'cudaDeviceGetSharedMemConfig' in found_functions}} cdef cudaError_t cudaDeviceGetSharedMemConfig(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetSharedMemConfig(pConfig) - + return cyruntime._cudaDeviceGetSharedMemConfig(pConfig) {{endif}} {{if 'cudaDeviceSetSharedMemConfig' in found_functions}} cdef cudaError_t cudaDeviceSetSharedMemConfig(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetSharedMemConfig(config) - + return cyruntime._cudaDeviceSetSharedMemConfig(config) {{endif}} {{if 'cudaGetLastError' in found_functions}} cdef cudaError_t cudaGetLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetLastError() - + return cyruntime._cudaGetLastError() {{endif}} {{if 'cudaPeekAtLastError' in found_functions}} cdef cudaError_t cudaPeekAtLastError() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaPeekAtLastError() - + return cyruntime._cudaPeekAtLastError() {{endif}} {{if 'cudaGetErrorName' in found_functions}} cdef const char* cudaGetErrorName(cudaError_t error) except ?NULL nogil: - cdef const char* pStr = "unrecognized error code" - {{if 'cudaSuccess' in found_values}} - if error == cudaSuccess: - return "cudaSuccess"{{endif}} - {{if 'cudaErrorInvalidValue' in found_values}} - if error == cudaErrorInvalidValue: - return "cudaErrorInvalidValue"{{endif}} - {{if 'cudaErrorMemoryAllocation' in found_values}} - if error == cudaErrorMemoryAllocation: - return "cudaErrorMemoryAllocation"{{endif}} - {{if 'cudaErrorInitializationError' in found_values}} - if error == cudaErrorInitializationError: - return "cudaErrorInitializationError"{{endif}} - {{if 'cudaErrorCudartUnloading' in found_values}} - if error == cudaErrorCudartUnloading: - return "cudaErrorCudartUnloading"{{endif}} - {{if 'cudaErrorProfilerDisabled' in found_values}} - if error == cudaErrorProfilerDisabled: - return "cudaErrorProfilerDisabled"{{endif}} - {{if 'cudaErrorProfilerNotInitialized' in found_values}} - if error == cudaErrorProfilerNotInitialized: - return "cudaErrorProfilerNotInitialized"{{endif}} - {{if 'cudaErrorProfilerAlreadyStarted' in found_values}} - if error == cudaErrorProfilerAlreadyStarted: - return "cudaErrorProfilerAlreadyStarted"{{endif}} - {{if 'cudaErrorProfilerAlreadyStopped' in found_values}} - if error == cudaErrorProfilerAlreadyStopped: - return "cudaErrorProfilerAlreadyStopped"{{endif}} - {{if 'cudaErrorInvalidConfiguration' in found_values}} - if error == cudaErrorInvalidConfiguration: - return "cudaErrorInvalidConfiguration"{{endif}} - {{if 'cudaErrorInvalidPitchValue' in found_values}} - if error == cudaErrorInvalidPitchValue: - return "cudaErrorInvalidPitchValue"{{endif}} - {{if 'cudaErrorInvalidSymbol' in found_values}} - if error == cudaErrorInvalidSymbol: - return "cudaErrorInvalidSymbol"{{endif}} - {{if 'cudaErrorInvalidHostPointer' in found_values}} - if error == cudaErrorInvalidHostPointer: - return "cudaErrorInvalidHostPointer"{{endif}} - {{if 'cudaErrorInvalidDevicePointer' in found_values}} - if error == cudaErrorInvalidDevicePointer: - return "cudaErrorInvalidDevicePointer"{{endif}} - {{if 'cudaErrorInvalidTexture' in found_values}} - if error == cudaErrorInvalidTexture: - return "cudaErrorInvalidTexture"{{endif}} - {{if 'cudaErrorInvalidTextureBinding' in found_values}} - if error == cudaErrorInvalidTextureBinding: - return "cudaErrorInvalidTextureBinding"{{endif}} - {{if 'cudaErrorInvalidChannelDescriptor' in found_values}} - if error == cudaErrorInvalidChannelDescriptor: - return "cudaErrorInvalidChannelDescriptor"{{endif}} - {{if 'cudaErrorInvalidMemcpyDirection' in found_values}} - if error == cudaErrorInvalidMemcpyDirection: - return "cudaErrorInvalidMemcpyDirection"{{endif}} - {{if 'cudaErrorAddressOfConstant' in found_values}} - if error == cudaErrorAddressOfConstant: - return "cudaErrorAddressOfConstant"{{endif}} - {{if 'cudaErrorTextureFetchFailed' in found_values}} - if error == cudaErrorTextureFetchFailed: - return "cudaErrorTextureFetchFailed"{{endif}} - {{if 'cudaErrorTextureNotBound' in found_values}} - if error == cudaErrorTextureNotBound: - return "cudaErrorTextureNotBound"{{endif}} - {{if 'cudaErrorSynchronizationError' in found_values}} - if error == cudaErrorSynchronizationError: - return "cudaErrorSynchronizationError"{{endif}} - {{if 'cudaErrorInvalidFilterSetting' in found_values}} - if error == cudaErrorInvalidFilterSetting: - return "cudaErrorInvalidFilterSetting"{{endif}} - {{if 'cudaErrorInvalidNormSetting' in found_values}} - if error == cudaErrorInvalidNormSetting: - return "cudaErrorInvalidNormSetting"{{endif}} - {{if 'cudaErrorMixedDeviceExecution' in found_values}} - if error == cudaErrorMixedDeviceExecution: - return "cudaErrorMixedDeviceExecution"{{endif}} - {{if 'cudaErrorNotYetImplemented' in found_values}} - if error == cudaErrorNotYetImplemented: - return "cudaErrorNotYetImplemented"{{endif}} - {{if 'cudaErrorMemoryValueTooLarge' in found_values}} - if error == cudaErrorMemoryValueTooLarge: - return "cudaErrorMemoryValueTooLarge"{{endif}} - {{if 'cudaErrorStubLibrary' in found_values}} - if error == cudaErrorStubLibrary: - return "cudaErrorStubLibrary"{{endif}} - {{if 'cudaErrorInsufficientDriver' in found_values}} - if error == cudaErrorInsufficientDriver: - return "cudaErrorInsufficientDriver"{{endif}} - {{if 'cudaErrorCallRequiresNewerDriver' in found_values}} - if error == cudaErrorCallRequiresNewerDriver: - return "cudaErrorCallRequiresNewerDriver"{{endif}} - {{if 'cudaErrorInvalidSurface' in found_values}} - if error == cudaErrorInvalidSurface: - return "cudaErrorInvalidSurface"{{endif}} - {{if 'cudaErrorDuplicateVariableName' in found_values}} - if error == cudaErrorDuplicateVariableName: - return "cudaErrorDuplicateVariableName"{{endif}} - {{if 'cudaErrorDuplicateTextureName' in found_values}} - if error == cudaErrorDuplicateTextureName: - return "cudaErrorDuplicateTextureName"{{endif}} - {{if 'cudaErrorDuplicateSurfaceName' in found_values}} - if error == cudaErrorDuplicateSurfaceName: - return "cudaErrorDuplicateSurfaceName"{{endif}} - {{if 'cudaErrorDevicesUnavailable' in found_values}} - if error == cudaErrorDevicesUnavailable: - return "cudaErrorDevicesUnavailable"{{endif}} - {{if 'cudaErrorIncompatibleDriverContext' in found_values}} - if error == cudaErrorIncompatibleDriverContext: - return "cudaErrorIncompatibleDriverContext"{{endif}} - {{if 'cudaErrorMissingConfiguration' in found_values}} - if error == cudaErrorMissingConfiguration: - return "cudaErrorMissingConfiguration"{{endif}} - {{if 'cudaErrorPriorLaunchFailure' in found_values}} - if error == cudaErrorPriorLaunchFailure: - return "cudaErrorPriorLaunchFailure"{{endif}} - {{if 'cudaErrorLaunchMaxDepthExceeded' in found_values}} - if error == cudaErrorLaunchMaxDepthExceeded: - return "cudaErrorLaunchMaxDepthExceeded"{{endif}} - {{if 'cudaErrorLaunchFileScopedTex' in found_values}} - if error == cudaErrorLaunchFileScopedTex: - return "cudaErrorLaunchFileScopedTex"{{endif}} - {{if 'cudaErrorLaunchFileScopedSurf' in found_values}} - if error == cudaErrorLaunchFileScopedSurf: - return "cudaErrorLaunchFileScopedSurf"{{endif}} - {{if 'cudaErrorSyncDepthExceeded' in found_values}} - if error == cudaErrorSyncDepthExceeded: - return "cudaErrorSyncDepthExceeded"{{endif}} - {{if 'cudaErrorLaunchPendingCountExceeded' in found_values}} - if error == cudaErrorLaunchPendingCountExceeded: - return "cudaErrorLaunchPendingCountExceeded"{{endif}} - {{if 'cudaErrorInvalidDeviceFunction' in found_values}} - if error == cudaErrorInvalidDeviceFunction: - return "cudaErrorInvalidDeviceFunction"{{endif}} - {{if 'cudaErrorNoDevice' in found_values}} - if error == cudaErrorNoDevice: - return "cudaErrorNoDevice"{{endif}} - {{if 'cudaErrorInvalidDevice' in found_values}} - if error == cudaErrorInvalidDevice: - return "cudaErrorInvalidDevice"{{endif}} - {{if 'cudaErrorDeviceNotLicensed' in found_values}} - if error == cudaErrorDeviceNotLicensed: - return "cudaErrorDeviceNotLicensed"{{endif}} - {{if 'cudaErrorSoftwareValidityNotEstablished' in found_values}} - if error == cudaErrorSoftwareValidityNotEstablished: - return "cudaErrorSoftwareValidityNotEstablished"{{endif}} - {{if 'cudaErrorStartupFailure' in found_values}} - if error == cudaErrorStartupFailure: - return "cudaErrorStartupFailure"{{endif}} - {{if 'cudaErrorInvalidKernelImage' in found_values}} - if error == cudaErrorInvalidKernelImage: - return "cudaErrorInvalidKernelImage"{{endif}} - {{if 'cudaErrorDeviceUninitialized' in found_values}} - if error == cudaErrorDeviceUninitialized: - return "cudaErrorDeviceUninitialized"{{endif}} - {{if 'cudaErrorMapBufferObjectFailed' in found_values}} - if error == cudaErrorMapBufferObjectFailed: - return "cudaErrorMapBufferObjectFailed"{{endif}} - {{if 'cudaErrorUnmapBufferObjectFailed' in found_values}} - if error == cudaErrorUnmapBufferObjectFailed: - return "cudaErrorUnmapBufferObjectFailed"{{endif}} - {{if 'cudaErrorArrayIsMapped' in found_values}} - if error == cudaErrorArrayIsMapped: - return "cudaErrorArrayIsMapped"{{endif}} - {{if 'cudaErrorAlreadyMapped' in found_values}} - if error == cudaErrorAlreadyMapped: - return "cudaErrorAlreadyMapped"{{endif}} - {{if 'cudaErrorNoKernelImageForDevice' in found_values}} - if error == cudaErrorNoKernelImageForDevice: - return "cudaErrorNoKernelImageForDevice"{{endif}} - {{if 'cudaErrorAlreadyAcquired' in found_values}} - if error == cudaErrorAlreadyAcquired: - return "cudaErrorAlreadyAcquired"{{endif}} - {{if 'cudaErrorNotMapped' in found_values}} - if error == cudaErrorNotMapped: - return "cudaErrorNotMapped"{{endif}} - {{if 'cudaErrorNotMappedAsArray' in found_values}} - if error == cudaErrorNotMappedAsArray: - return "cudaErrorNotMappedAsArray"{{endif}} - {{if 'cudaErrorNotMappedAsPointer' in found_values}} - if error == cudaErrorNotMappedAsPointer: - return "cudaErrorNotMappedAsPointer"{{endif}} - {{if 'cudaErrorECCUncorrectable' in found_values}} - if error == cudaErrorECCUncorrectable: - return "cudaErrorECCUncorrectable"{{endif}} - {{if 'cudaErrorUnsupportedLimit' in found_values}} - if error == cudaErrorUnsupportedLimit: - return "cudaErrorUnsupportedLimit"{{endif}} - {{if 'cudaErrorDeviceAlreadyInUse' in found_values}} - if error == cudaErrorDeviceAlreadyInUse: - return "cudaErrorDeviceAlreadyInUse"{{endif}} - {{if 'cudaErrorPeerAccessUnsupported' in found_values}} - if error == cudaErrorPeerAccessUnsupported: - return "cudaErrorPeerAccessUnsupported"{{endif}} - {{if 'cudaErrorInvalidPtx' in found_values}} - if error == cudaErrorInvalidPtx: - return "cudaErrorInvalidPtx"{{endif}} - {{if 'cudaErrorInvalidGraphicsContext' in found_values}} - if error == cudaErrorInvalidGraphicsContext: - return "cudaErrorInvalidGraphicsContext"{{endif}} - {{if 'cudaErrorNvlinkUncorrectable' in found_values}} - if error == cudaErrorNvlinkUncorrectable: - return "cudaErrorNvlinkUncorrectable"{{endif}} - {{if 'cudaErrorJitCompilerNotFound' in found_values}} - if error == cudaErrorJitCompilerNotFound: - return "cudaErrorJitCompilerNotFound"{{endif}} - {{if 'cudaErrorUnsupportedPtxVersion' in found_values}} - if error == cudaErrorUnsupportedPtxVersion: - return "cudaErrorUnsupportedPtxVersion"{{endif}} - {{if 'cudaErrorJitCompilationDisabled' in found_values}} - if error == cudaErrorJitCompilationDisabled: - return "cudaErrorJitCompilationDisabled"{{endif}} - {{if 'cudaErrorUnsupportedExecAffinity' in found_values}} - if error == cudaErrorUnsupportedExecAffinity: - return "cudaErrorUnsupportedExecAffinity"{{endif}} - {{if 'cudaErrorUnsupportedDevSideSync' in found_values}} - if error == cudaErrorUnsupportedDevSideSync: - return "cudaErrorUnsupportedDevSideSync"{{endif}} - {{if 'cudaErrorContained' in found_values}} - if error == cudaErrorContained: - return "cudaErrorContained"{{endif}} - {{if 'cudaErrorInvalidSource' in found_values}} - if error == cudaErrorInvalidSource: - return "cudaErrorInvalidSource"{{endif}} - {{if 'cudaErrorFileNotFound' in found_values}} - if error == cudaErrorFileNotFound: - return "cudaErrorFileNotFound"{{endif}} - {{if 'cudaErrorSharedObjectSymbolNotFound' in found_values}} - if error == cudaErrorSharedObjectSymbolNotFound: - return "cudaErrorSharedObjectSymbolNotFound"{{endif}} - {{if 'cudaErrorSharedObjectInitFailed' in found_values}} - if error == cudaErrorSharedObjectInitFailed: - return "cudaErrorSharedObjectInitFailed"{{endif}} - {{if 'cudaErrorOperatingSystem' in found_values}} - if error == cudaErrorOperatingSystem: - return "cudaErrorOperatingSystem"{{endif}} - {{if 'cudaErrorInvalidResourceHandle' in found_values}} - if error == cudaErrorInvalidResourceHandle: - return "cudaErrorInvalidResourceHandle"{{endif}} - {{if 'cudaErrorIllegalState' in found_values}} - if error == cudaErrorIllegalState: - return "cudaErrorIllegalState"{{endif}} - {{if 'cudaErrorLossyQuery' in found_values}} - if error == cudaErrorLossyQuery: - return "cudaErrorLossyQuery"{{endif}} - {{if 'cudaErrorSymbolNotFound' in found_values}} - if error == cudaErrorSymbolNotFound: - return "cudaErrorSymbolNotFound"{{endif}} - {{if 'cudaErrorNotReady' in found_values}} - if error == cudaErrorNotReady: - return "cudaErrorNotReady"{{endif}} - {{if 'cudaErrorIllegalAddress' in found_values}} - if error == cudaErrorIllegalAddress: - return "cudaErrorIllegalAddress"{{endif}} - {{if 'cudaErrorLaunchOutOfResources' in found_values}} - if error == cudaErrorLaunchOutOfResources: - return "cudaErrorLaunchOutOfResources"{{endif}} - {{if 'cudaErrorLaunchTimeout' in found_values}} - if error == cudaErrorLaunchTimeout: - return "cudaErrorLaunchTimeout"{{endif}} - {{if 'cudaErrorLaunchIncompatibleTexturing' in found_values}} - if error == cudaErrorLaunchIncompatibleTexturing: - return "cudaErrorLaunchIncompatibleTexturing"{{endif}} - {{if 'cudaErrorPeerAccessAlreadyEnabled' in found_values}} - if error == cudaErrorPeerAccessAlreadyEnabled: - return "cudaErrorPeerAccessAlreadyEnabled"{{endif}} - {{if 'cudaErrorPeerAccessNotEnabled' in found_values}} - if error == cudaErrorPeerAccessNotEnabled: - return "cudaErrorPeerAccessNotEnabled"{{endif}} - {{if 'cudaErrorSetOnActiveProcess' in found_values}} - if error == cudaErrorSetOnActiveProcess: - return "cudaErrorSetOnActiveProcess"{{endif}} - {{if 'cudaErrorContextIsDestroyed' in found_values}} - if error == cudaErrorContextIsDestroyed: - return "cudaErrorContextIsDestroyed"{{endif}} - {{if 'cudaErrorAssert' in found_values}} - if error == cudaErrorAssert: - return "cudaErrorAssert"{{endif}} - {{if 'cudaErrorTooManyPeers' in found_values}} - if error == cudaErrorTooManyPeers: - return "cudaErrorTooManyPeers"{{endif}} - {{if 'cudaErrorHostMemoryAlreadyRegistered' in found_values}} - if error == cudaErrorHostMemoryAlreadyRegistered: - return "cudaErrorHostMemoryAlreadyRegistered"{{endif}} - {{if 'cudaErrorHostMemoryNotRegistered' in found_values}} - if error == cudaErrorHostMemoryNotRegistered: - return "cudaErrorHostMemoryNotRegistered"{{endif}} - {{if 'cudaErrorHardwareStackError' in found_values}} - if error == cudaErrorHardwareStackError: - return "cudaErrorHardwareStackError"{{endif}} - {{if 'cudaErrorIllegalInstruction' in found_values}} - if error == cudaErrorIllegalInstruction: - return "cudaErrorIllegalInstruction"{{endif}} - {{if 'cudaErrorMisalignedAddress' in found_values}} - if error == cudaErrorMisalignedAddress: - return "cudaErrorMisalignedAddress"{{endif}} - {{if 'cudaErrorInvalidAddressSpace' in found_values}} - if error == cudaErrorInvalidAddressSpace: - return "cudaErrorInvalidAddressSpace"{{endif}} - {{if 'cudaErrorInvalidPc' in found_values}} - if error == cudaErrorInvalidPc: - return "cudaErrorInvalidPc"{{endif}} - {{if 'cudaErrorLaunchFailure' in found_values}} - if error == cudaErrorLaunchFailure: - return "cudaErrorLaunchFailure"{{endif}} - {{if 'cudaErrorCooperativeLaunchTooLarge' in found_values}} - if error == cudaErrorCooperativeLaunchTooLarge: - return "cudaErrorCooperativeLaunchTooLarge"{{endif}} - {{if 'cudaErrorTensorMemoryLeak' in found_values}} - if error == cudaErrorTensorMemoryLeak: - return "cudaErrorTensorMemoryLeak"{{endif}} - {{if 'cudaErrorNotPermitted' in found_values}} - if error == cudaErrorNotPermitted: - return "cudaErrorNotPermitted"{{endif}} - {{if 'cudaErrorNotSupported' in found_values}} - if error == cudaErrorNotSupported: - return "cudaErrorNotSupported"{{endif}} - {{if 'cudaErrorSystemNotReady' in found_values}} - if error == cudaErrorSystemNotReady: - return "cudaErrorSystemNotReady"{{endif}} - {{if 'cudaErrorSystemDriverMismatch' in found_values}} - if error == cudaErrorSystemDriverMismatch: - return "cudaErrorSystemDriverMismatch"{{endif}} - {{if 'cudaErrorCompatNotSupportedOnDevice' in found_values}} - if error == cudaErrorCompatNotSupportedOnDevice: - return "cudaErrorCompatNotSupportedOnDevice"{{endif}} - {{if 'cudaErrorMpsConnectionFailed' in found_values}} - if error == cudaErrorMpsConnectionFailed: - return "cudaErrorMpsConnectionFailed"{{endif}} - {{if 'cudaErrorMpsRpcFailure' in found_values}} - if error == cudaErrorMpsRpcFailure: - return "cudaErrorMpsRpcFailure"{{endif}} - {{if 'cudaErrorMpsServerNotReady' in found_values}} - if error == cudaErrorMpsServerNotReady: - return "cudaErrorMpsServerNotReady"{{endif}} - {{if 'cudaErrorMpsMaxClientsReached' in found_values}} - if error == cudaErrorMpsMaxClientsReached: - return "cudaErrorMpsMaxClientsReached"{{endif}} - {{if 'cudaErrorMpsMaxConnectionsReached' in found_values}} - if error == cudaErrorMpsMaxConnectionsReached: - return "cudaErrorMpsMaxConnectionsReached"{{endif}} - {{if 'cudaErrorMpsClientTerminated' in found_values}} - if error == cudaErrorMpsClientTerminated: - return "cudaErrorMpsClientTerminated"{{endif}} - {{if 'cudaErrorCdpNotSupported' in found_values}} - if error == cudaErrorCdpNotSupported: - return "cudaErrorCdpNotSupported"{{endif}} - {{if 'cudaErrorCdpVersionMismatch' in found_values}} - if error == cudaErrorCdpVersionMismatch: - return "cudaErrorCdpVersionMismatch"{{endif}} - {{if 'cudaErrorStreamCaptureUnsupported' in found_values}} - if error == cudaErrorStreamCaptureUnsupported: - return "cudaErrorStreamCaptureUnsupported"{{endif}} - {{if 'cudaErrorStreamCaptureInvalidated' in found_values}} - if error == cudaErrorStreamCaptureInvalidated: - return "cudaErrorStreamCaptureInvalidated"{{endif}} - {{if 'cudaErrorStreamCaptureMerge' in found_values}} - if error == cudaErrorStreamCaptureMerge: - return "cudaErrorStreamCaptureMerge"{{endif}} - {{if 'cudaErrorStreamCaptureUnmatched' in found_values}} - if error == cudaErrorStreamCaptureUnmatched: - return "cudaErrorStreamCaptureUnmatched"{{endif}} - {{if 'cudaErrorStreamCaptureUnjoined' in found_values}} - if error == cudaErrorStreamCaptureUnjoined: - return "cudaErrorStreamCaptureUnjoined"{{endif}} - {{if 'cudaErrorStreamCaptureIsolation' in found_values}} - if error == cudaErrorStreamCaptureIsolation: - return "cudaErrorStreamCaptureIsolation"{{endif}} - {{if 'cudaErrorStreamCaptureImplicit' in found_values}} - if error == cudaErrorStreamCaptureImplicit: - return "cudaErrorStreamCaptureImplicit"{{endif}} - {{if 'cudaErrorCapturedEvent' in found_values}} - if error == cudaErrorCapturedEvent: - return "cudaErrorCapturedEvent"{{endif}} - {{if 'cudaErrorStreamCaptureWrongThread' in found_values}} - if error == cudaErrorStreamCaptureWrongThread: - return "cudaErrorStreamCaptureWrongThread"{{endif}} - {{if 'cudaErrorTimeout' in found_values}} - if error == cudaErrorTimeout: - return "cudaErrorTimeout"{{endif}} - {{if 'cudaErrorGraphExecUpdateFailure' in found_values}} - if error == cudaErrorGraphExecUpdateFailure: - return "cudaErrorGraphExecUpdateFailure"{{endif}} - {{if 'cudaErrorExternalDevice' in found_values}} - if error == cudaErrorExternalDevice: - return "cudaErrorExternalDevice"{{endif}} - {{if 'cudaErrorInvalidClusterSize' in found_values}} - if error == cudaErrorInvalidClusterSize: - return "cudaErrorInvalidClusterSize"{{endif}} - {{if 'cudaErrorFunctionNotLoaded' in found_values}} - if error == cudaErrorFunctionNotLoaded: - return "cudaErrorFunctionNotLoaded"{{endif}} - {{if 'cudaErrorInvalidResourceType' in found_values}} - if error == cudaErrorInvalidResourceType: - return "cudaErrorInvalidResourceType"{{endif}} - {{if 'cudaErrorInvalidResourceConfiguration' in found_values}} - if error == cudaErrorInvalidResourceConfiguration: - return "cudaErrorInvalidResourceConfiguration"{{endif}} - {{if 'cudaErrorUnknown' in found_values}} - if error == cudaErrorUnknown: - return "cudaErrorUnknown"{{endif}} - {{if 'cudaErrorApiFailureBase' in found_values}} - if error == cudaErrorApiFailureBase: - return "cudaErrorApiFailureBase"{{endif}} - return pStr - + return cyruntime._cudaGetErrorName(error) {{endif}} {{if 'cudaGetErrorString' in found_functions}} cdef const char* cudaGetErrorString(cudaError_t error) except ?NULL nogil: - return _cudaGetErrorString(error) - + return cyruntime._cudaGetErrorString(error) {{endif}} {{if 'cudaGetDeviceCount' in found_functions}} cdef cudaError_t cudaGetDeviceCount(int* count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDeviceCount(count) - + return cyruntime._cudaGetDeviceCount(count) {{endif}} {{if 'cudaGetDeviceProperties_v2' in found_functions}} cdef cudaError_t cudaGetDeviceProperties(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDeviceProperties_v2(prop, device) - + return cyruntime._cudaGetDeviceProperties_v2(prop, device) {{endif}} {{if 'cudaDeviceGetAttribute' in found_functions}} cdef cudaError_t cudaDeviceGetAttribute(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetAttribute(value, attr, device) - + return cyruntime._cudaDeviceGetAttribute(value, attr, device) {{endif}} {{if 'cudaDeviceGetDefaultMemPool' in found_functions}} cdef cudaError_t cudaDeviceGetDefaultMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetDefaultMemPool(memPool, device) - + return cyruntime._cudaDeviceGetDefaultMemPool(memPool, device) {{endif}} {{if 'cudaDeviceSetMemPool' in found_functions}} cdef cudaError_t cudaDeviceSetMemPool(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetMemPool(device, memPool) - + return cyruntime._cudaDeviceSetMemPool(device, memPool) {{endif}} {{if 'cudaDeviceGetMemPool' in found_functions}} cdef cudaError_t cudaDeviceGetMemPool(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetMemPool(memPool, device) - + return cyruntime._cudaDeviceGetMemPool(memPool, device) {{endif}} {{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} cdef cudaError_t cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) - + return cyruntime._cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) {{endif}} {{if 'cudaDeviceGetP2PAttribute' in found_functions}} cdef cudaError_t cudaDeviceGetP2PAttribute(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) - + return cyruntime._cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) {{endif}} {{if 'cudaChooseDevice' in found_functions}} cdef cudaError_t cudaChooseDevice(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaChooseDevice(device, prop) - + return cyruntime._cudaChooseDevice(device, prop) {{endif}} {{if 'cudaInitDevice' in found_functions}} cdef cudaError_t cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaInitDevice(device, deviceFlags, flags) - + return cyruntime._cudaInitDevice(device, deviceFlags, flags) {{endif}} {{if 'cudaSetDevice' in found_functions}} cdef cudaError_t cudaSetDevice(int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaSetDevice(device) - + return cyruntime._cudaSetDevice(device) {{endif}} {{if 'cudaGetDevice' in found_functions}} cdef cudaError_t cudaGetDevice(int* device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDevice(device) - + return cyruntime._cudaGetDevice(device) {{endif}} {{if 'cudaSetDeviceFlags' in found_functions}} cdef cudaError_t cudaSetDeviceFlags(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaSetDeviceFlags(flags) - + return cyruntime._cudaSetDeviceFlags(flags) {{endif}} {{if 'cudaGetDeviceFlags' in found_functions}} cdef cudaError_t cudaGetDeviceFlags(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDeviceFlags(flags) - + return cyruntime._cudaGetDeviceFlags(flags) {{endif}} {{if 'cudaStreamCreate' in found_functions}} cdef cudaError_t cudaStreamCreate(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCreate(pStream) - + return cyruntime._cudaStreamCreate(pStream) {{endif}} {{if 'cudaStreamCreateWithFlags' in found_functions}} cdef cudaError_t cudaStreamCreateWithFlags(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCreateWithFlags(pStream, flags) - + return cyruntime._cudaStreamCreateWithFlags(pStream, flags) {{endif}} {{if 'cudaStreamCreateWithPriority' in found_functions}} cdef cudaError_t cudaStreamCreateWithPriority(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCreateWithPriority(pStream, flags, priority) - + return cyruntime._cudaStreamCreateWithPriority(pStream, flags, priority) {{endif}} {{if 'cudaStreamGetPriority' in found_functions}} cdef cudaError_t cudaStreamGetPriority(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetPriority(hStream, priority) - + return cyruntime._cudaStreamGetPriority(hStream, priority) {{endif}} {{if 'cudaStreamGetFlags' in found_functions}} cdef cudaError_t cudaStreamGetFlags(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetFlags(hStream, flags) - + return cyruntime._cudaStreamGetFlags(hStream, flags) {{endif}} {{if 'cudaStreamGetId' in found_functions}} cdef cudaError_t cudaStreamGetId(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetId(hStream, streamId) - + return cyruntime._cudaStreamGetId(hStream, streamId) {{endif}} {{if 'cudaStreamGetDevice' in found_functions}} cdef cudaError_t cudaStreamGetDevice(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetDevice(hStream, device) - + return cyruntime._cudaStreamGetDevice(hStream, device) {{endif}} {{if 'cudaCtxResetPersistingL2Cache' in found_functions}} cdef cudaError_t cudaCtxResetPersistingL2Cache() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaCtxResetPersistingL2Cache() - + return cyruntime._cudaCtxResetPersistingL2Cache() {{endif}} {{if 'cudaStreamCopyAttributes' in found_functions}} cdef cudaError_t cudaStreamCopyAttributes(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamCopyAttributes(dst, src) - + return cyruntime._cudaStreamCopyAttributes(dst, src) {{endif}} {{if 'cudaStreamGetAttribute' in found_functions}} cdef cudaError_t cudaStreamGetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetAttribute(hStream, attr, value_out) - + return cyruntime._cudaStreamGetAttribute(hStream, attr, value_out) {{endif}} {{if 'cudaStreamSetAttribute' in found_functions}} cdef cudaError_t cudaStreamSetAttribute(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamSetAttribute(hStream, attr, value) - + return cyruntime._cudaStreamSetAttribute(hStream, attr, value) {{endif}} {{if 'cudaStreamDestroy' in found_functions}} cdef cudaError_t cudaStreamDestroy(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamDestroy(stream) - + return cyruntime._cudaStreamDestroy(stream) {{endif}} {{if 'cudaStreamWaitEvent' in found_functions}} cdef cudaError_t cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamWaitEvent(stream, event, flags) - + return cyruntime._cudaStreamWaitEvent(stream, event, flags) {{endif}} {{if 'cudaStreamAddCallback' in found_functions}} +ctypedef struct cudaStreamCallbackData_st: + cudaStreamCallback_t callback + void *userData + +ctypedef cudaStreamCallbackData_st cudaStreamCallbackData + +@cython.show_performance_hints(False) +cdef void cudaStreamRtCallbackWrapper(cudaStream_t stream, cudaError_t status, void *data) nogil: + cdef cudaStreamCallbackData *cbData = data + with gil: + cbData.callback(stream, status, cbData.userData) + free(cbData) + + cdef cudaError_t cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamAddCallback(stream, callback, userData, flags) + cdef cudaStreamCallbackData *cbData = NULL + cdef cudaError_t err = cudaSuccess + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return cudaErrorMemoryAllocation + + cbData.callback = callback + cbData.userData = userData + err = cyruntime._cudaStreamAddCallback(stream, cudaStreamRtCallbackWrapper, cbData, flags) + if err != cudaSuccess: + free(cbData) + return err + return err {{endif}} {{if 'cudaStreamSynchronize' in found_functions}} cdef cudaError_t cudaStreamSynchronize(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamSynchronize(stream) - + return cyruntime._cudaStreamSynchronize(stream) {{endif}} {{if 'cudaStreamQuery' in found_functions}} cdef cudaError_t cudaStreamQuery(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamQuery(stream) - + return cyruntime._cudaStreamQuery(stream) {{endif}} {{if 'cudaStreamAttachMemAsync' in found_functions}} cdef cudaError_t cudaStreamAttachMemAsync(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamAttachMemAsync(stream, devPtr, length, flags) - + return cyruntime._cudaStreamAttachMemAsync(stream, devPtr, length, flags) {{endif}} {{if 'cudaStreamBeginCapture' in found_functions}} cdef cudaError_t cudaStreamBeginCapture(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamBeginCapture(stream, mode) - + return cyruntime._cudaStreamBeginCapture(stream, mode) {{endif}} {{if 'cudaStreamBeginCaptureToGraph' in found_functions}} cdef cudaError_t cudaStreamBeginCaptureToGraph(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) - + return cyruntime._cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) {{endif}} {{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} cdef cudaError_t cudaThreadExchangeStreamCaptureMode(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaThreadExchangeStreamCaptureMode(mode) - + return cyruntime._cudaThreadExchangeStreamCaptureMode(mode) {{endif}} {{if 'cudaStreamEndCapture' in found_functions}} cdef cudaError_t cudaStreamEndCapture(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamEndCapture(stream, pGraph) - + return cyruntime._cudaStreamEndCapture(stream, pGraph) {{endif}} {{if 'cudaStreamIsCapturing' in found_functions}} cdef cudaError_t cudaStreamIsCapturing(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamIsCapturing(stream, pCaptureStatus) - + return cyruntime._cudaStreamIsCapturing(stream, pCaptureStatus) {{endif}} {{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} cdef cudaError_t cudaStreamGetCaptureInfo(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetCaptureInfo_v2(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) - + return cyruntime._cudaStreamGetCaptureInfo_v2(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) {{endif}} {{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} cdef cudaError_t cudaStreamGetCaptureInfo_v3(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamGetCaptureInfo_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) - + return cyruntime._cudaStreamGetCaptureInfo_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) {{endif}} {{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} cdef cudaError_t cudaStreamUpdateCaptureDependencies(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) - + return cyruntime._cudaStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) {{endif}} {{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} cdef cudaError_t cudaStreamUpdateCaptureDependencies_v2(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) - + return cyruntime._cudaStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) {{endif}} {{if 'cudaEventCreate' in found_functions}} cdef cudaError_t cudaEventCreate(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventCreate(event) - + return cyruntime._cudaEventCreate(event) {{endif}} {{if 'cudaEventCreateWithFlags' in found_functions}} cdef cudaError_t cudaEventCreateWithFlags(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventCreateWithFlags(event, flags) - + return cyruntime._cudaEventCreateWithFlags(event, flags) {{endif}} {{if 'cudaEventRecord' in found_functions}} cdef cudaError_t cudaEventRecord(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventRecord(event, stream) - + return cyruntime._cudaEventRecord(event, stream) {{endif}} {{if 'cudaEventRecordWithFlags' in found_functions}} cdef cudaError_t cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventRecordWithFlags(event, stream, flags) - + return cyruntime._cudaEventRecordWithFlags(event, stream, flags) {{endif}} {{if 'cudaEventQuery' in found_functions}} cdef cudaError_t cudaEventQuery(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventQuery(event) - + return cyruntime._cudaEventQuery(event) {{endif}} {{if 'cudaEventSynchronize' in found_functions}} cdef cudaError_t cudaEventSynchronize(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventSynchronize(event) - + return cyruntime._cudaEventSynchronize(event) {{endif}} {{if 'cudaEventDestroy' in found_functions}} cdef cudaError_t cudaEventDestroy(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventDestroy(event) - + return cyruntime._cudaEventDestroy(event) {{endif}} {{if 'cudaEventElapsedTime' in found_functions}} cdef cudaError_t cudaEventElapsedTime(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventElapsedTime(ms, start, end) - + return cyruntime._cudaEventElapsedTime(ms, start, end) {{endif}} {{if 'cudaEventElapsedTime_v2' in found_functions}} cdef cudaError_t cudaEventElapsedTime_v2(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventElapsedTime_v2(ms, start, end) - + return cyruntime._cudaEventElapsedTime_v2(ms, start, end) {{endif}} {{if 'cudaImportExternalMemory' in found_functions}} cdef cudaError_t cudaImportExternalMemory(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaImportExternalMemory(extMem_out, memHandleDesc) - + return cyruntime._cudaImportExternalMemory(extMem_out, memHandleDesc) {{endif}} {{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} cdef cudaError_t cudaExternalMemoryGetMappedBuffer(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) - + return cyruntime._cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) {{endif}} {{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} cdef cudaError_t cudaExternalMemoryGetMappedMipmappedArray(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) - + return cyruntime._cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) {{endif}} {{if 'cudaDestroyExternalMemory' in found_functions}} cdef cudaError_t cudaDestroyExternalMemory(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroyExternalMemory(extMem) - + return cyruntime._cudaDestroyExternalMemory(extMem) {{endif}} {{if 'cudaImportExternalSemaphore' in found_functions}} cdef cudaError_t cudaImportExternalSemaphore(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaImportExternalSemaphore(extSem_out, semHandleDesc) - + return cyruntime._cudaImportExternalSemaphore(extSem_out, semHandleDesc) {{endif}} {{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} cdef cudaError_t cudaSignalExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaSignalExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) - + return cyruntime._cudaSignalExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) {{endif}} {{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} cdef cudaError_t cudaWaitExternalSemaphoresAsync(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaWaitExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) - + return cyruntime._cudaWaitExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) {{endif}} {{if 'cudaDestroyExternalSemaphore' in found_functions}} cdef cudaError_t cudaDestroyExternalSemaphore(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroyExternalSemaphore(extSem) - + return cyruntime._cudaDestroyExternalSemaphore(extSem) {{endif}} {{if 'cudaFuncSetCacheConfig' in found_functions}} cdef cudaError_t cudaFuncSetCacheConfig(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncSetCacheConfig(func, cacheConfig) - + return cyruntime._cudaFuncSetCacheConfig(func, cacheConfig) {{endif}} {{if 'cudaFuncGetAttributes' in found_functions}} cdef cudaError_t cudaFuncGetAttributes(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncGetAttributes(attr, func) - + return cyruntime._cudaFuncGetAttributes(attr, func) {{endif}} {{if 'cudaFuncSetAttribute' in found_functions}} cdef cudaError_t cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncSetAttribute(func, attr, value) - + return cyruntime._cudaFuncSetAttribute(func, attr, value) {{endif}} {{if 'cudaLaunchHostFunc' in found_functions}} +ctypedef struct cudaStreamHostCallbackData_st: + cudaHostFn_t callback + void *userData + +ctypedef cudaStreamHostCallbackData_st cudaStreamHostCallbackData + +@cython.show_performance_hints(False) +cdef void cudaStreamRtHostCallbackWrapper(void *data) nogil: + cdef cudaStreamHostCallbackData *cbData = data + with gil: + cbData.callback(cbData.userData) + free(cbData) + + cdef cudaError_t cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLaunchHostFunc(stream, fn, userData) + cdef cudaStreamHostCallbackData *cbData = NULL + cdef cudaError_t err = cudaSuccess + cbData = malloc(sizeof(cbData[0])) + if cbData == NULL: + return cudaErrorMemoryAllocation + + cbData.callback = fn + cbData.userData = userData + err = cyruntime._cudaLaunchHostFunc(stream, cudaStreamRtHostCallbackWrapper, cbData) + if err != cudaSuccess: + free(cbData) + return err + return err {{endif}} {{if 'cudaFuncSetSharedMemConfig' in found_functions}} cdef cudaError_t cudaFuncSetSharedMemConfig(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFuncSetSharedMemConfig(func, config) - + return cyruntime._cudaFuncSetSharedMemConfig(func, config) {{endif}} {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) - + return cyruntime._cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) {{endif}} {{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} cdef cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) - + return cyruntime._cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) {{endif}} {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} cdef cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) - + return cyruntime._cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) {{endif}} {{if 'cudaMallocManaged' in found_functions}} cdef cudaError_t cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocManaged(devPtr, size, flags) - + return cyruntime._cudaMallocManaged(devPtr, size, flags) {{endif}} {{if 'cudaMalloc' in found_functions}} cdef cudaError_t cudaMalloc(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMalloc(devPtr, size) - + return cyruntime._cudaMalloc(devPtr, size) {{endif}} {{if 'cudaMallocHost' in found_functions}} cdef cudaError_t cudaMallocHost(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocHost(ptr, size) - + return cyruntime._cudaMallocHost(ptr, size) {{endif}} {{if 'cudaMallocPitch' in found_functions}} cdef cudaError_t cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocPitch(devPtr, pitch, width, height) - + return cyruntime._cudaMallocPitch(devPtr, pitch, width, height) {{endif}} {{if 'cudaMallocArray' in found_functions}} cdef cudaError_t cudaMallocArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocArray(array, desc, width, height, flags) - + return cyruntime._cudaMallocArray(array, desc, width, height, flags) {{endif}} {{if 'cudaFree' in found_functions}} cdef cudaError_t cudaFree(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFree(devPtr) - + return cyruntime._cudaFree(devPtr) {{endif}} {{if 'cudaFreeHost' in found_functions}} cdef cudaError_t cudaFreeHost(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeHost(ptr) - + return cyruntime._cudaFreeHost(ptr) {{endif}} {{if 'cudaFreeArray' in found_functions}} cdef cudaError_t cudaFreeArray(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeArray(array) - + return cyruntime._cudaFreeArray(array) {{endif}} {{if 'cudaFreeMipmappedArray' in found_functions}} cdef cudaError_t cudaFreeMipmappedArray(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeMipmappedArray(mipmappedArray) - + return cyruntime._cudaFreeMipmappedArray(mipmappedArray) {{endif}} {{if 'cudaHostAlloc' in found_functions}} cdef cudaError_t cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostAlloc(pHost, size, flags) - + return cyruntime._cudaHostAlloc(pHost, size, flags) {{endif}} {{if 'cudaHostRegister' in found_functions}} cdef cudaError_t cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostRegister(ptr, size, flags) - + return cyruntime._cudaHostRegister(ptr, size, flags) {{endif}} {{if 'cudaHostUnregister' in found_functions}} cdef cudaError_t cudaHostUnregister(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostUnregister(ptr) - + return cyruntime._cudaHostUnregister(ptr) {{endif}} {{if 'cudaHostGetDevicePointer' in found_functions}} cdef cudaError_t cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostGetDevicePointer(pDevice, pHost, flags) - + return cyruntime._cudaHostGetDevicePointer(pDevice, pHost, flags) {{endif}} {{if 'cudaHostGetFlags' in found_functions}} cdef cudaError_t cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaHostGetFlags(pFlags, pHost) - + return cyruntime._cudaHostGetFlags(pFlags, pHost) {{endif}} {{if 'cudaMalloc3D' in found_functions}} cdef cudaError_t cudaMalloc3D(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMalloc3D(pitchedDevPtr, extent) - + return cyruntime._cudaMalloc3D(pitchedDevPtr, extent) {{endif}} {{if 'cudaMalloc3DArray' in found_functions}} cdef cudaError_t cudaMalloc3DArray(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMalloc3DArray(array, desc, extent, flags) - + return cyruntime._cudaMalloc3DArray(array, desc, extent, flags) {{endif}} {{if 'cudaMallocMipmappedArray' in found_functions}} cdef cudaError_t cudaMallocMipmappedArray(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) - + return cyruntime._cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) {{endif}} {{if 'cudaGetMipmappedArrayLevel' in found_functions}} cdef cudaError_t cudaGetMipmappedArrayLevel(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) - + return cyruntime._cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) {{endif}} {{if 'cudaMemcpy3D' in found_functions}} cdef cudaError_t cudaMemcpy3D(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3D(p) - + return cyruntime._cudaMemcpy3D(p) {{endif}} {{if 'cudaMemcpy3DPeer' in found_functions}} cdef cudaError_t cudaMemcpy3DPeer(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DPeer(p) - + return cyruntime._cudaMemcpy3DPeer(p) {{endif}} {{if 'cudaMemcpy3DAsync' in found_functions}} cdef cudaError_t cudaMemcpy3DAsync(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DAsync(p, stream) - + return cyruntime._cudaMemcpy3DAsync(p, stream) {{endif}} {{if 'cudaMemcpy3DPeerAsync' in found_functions}} cdef cudaError_t cudaMemcpy3DPeerAsync(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DPeerAsync(p, stream) - + return cyruntime._cudaMemcpy3DPeerAsync(p, stream) {{endif}} {{if 'cudaMemGetInfo' in found_functions}} cdef cudaError_t cudaMemGetInfo(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemGetInfo(free, total) - + return cyruntime._cudaMemGetInfo(free, total) {{endif}} {{if 'cudaArrayGetInfo' in found_functions}} cdef cudaError_t cudaArrayGetInfo(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetInfo(desc, extent, flags, array) - + return cyruntime._cudaArrayGetInfo(desc, extent, flags, array) {{endif}} {{if 'cudaArrayGetPlane' in found_functions}} cdef cudaError_t cudaArrayGetPlane(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) - + return cyruntime._cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) {{endif}} {{if 'cudaArrayGetMemoryRequirements' in found_functions}} cdef cudaError_t cudaArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetMemoryRequirements(memoryRequirements, array, device) - + return cyruntime._cudaArrayGetMemoryRequirements(memoryRequirements, array, device) {{endif}} {{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} cdef cudaError_t cudaMipmappedArrayGetMemoryRequirements(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) - + return cyruntime._cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) {{endif}} {{if 'cudaArrayGetSparseProperties' in found_functions}} cdef cudaError_t cudaArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaArrayGetSparseProperties(sparseProperties, array) - + return cyruntime._cudaArrayGetSparseProperties(sparseProperties, array) {{endif}} {{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} cdef cudaError_t cudaMipmappedArrayGetSparseProperties(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) - + return cyruntime._cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) {{endif}} {{if 'cudaMemcpy' in found_functions}} cdef cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy(dst, src, count, kind) - + return cyruntime._cudaMemcpy(dst, src, count, kind) {{endif}} {{if 'cudaMemcpyPeer' in found_functions}} cdef cudaError_t cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) - + return cyruntime._cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) {{endif}} {{if 'cudaMemcpy2D' in found_functions}} cdef cudaError_t cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) - + return cyruntime._cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) {{endif}} {{if 'cudaMemcpy2DToArray' in found_functions}} cdef cudaError_t cudaMemcpy2DToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) - + return cyruntime._cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) {{endif}} {{if 'cudaMemcpy2DFromArray' in found_functions}} cdef cudaError_t cudaMemcpy2DFromArray(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) - + return cyruntime._cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) {{endif}} {{if 'cudaMemcpy2DArrayToArray' in found_functions}} cdef cudaError_t cudaMemcpy2DArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) - + return cyruntime._cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) {{endif}} {{if 'cudaMemcpyAsync' in found_functions}} cdef cudaError_t cudaMemcpyAsync(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyAsync(dst, src, count, kind, stream) - + return cyruntime._cudaMemcpyAsync(dst, src, count, kind, stream) {{endif}} {{if 'cudaMemcpyPeerAsync' in found_functions}} cdef cudaError_t cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) - + return cyruntime._cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) {{endif}} {{if 'cudaMemcpyBatchAsync' in found_functions}} cdef cudaError_t cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, failIdx, stream) - + return cyruntime._cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, failIdx, stream) {{endif}} {{if 'cudaMemcpy3DBatchAsync' in found_functions}} cdef cudaError_t cudaMemcpy3DBatchAsync(size_t numOps, cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy3DBatchAsync(numOps, opList, failIdx, flags, stream) - + return cyruntime._cudaMemcpy3DBatchAsync(numOps, opList, failIdx, flags, stream) {{endif}} {{if 'cudaMemcpy2DAsync' in found_functions}} cdef cudaError_t cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) - + return cyruntime._cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) {{endif}} {{if 'cudaMemcpy2DToArrayAsync' in found_functions}} cdef cudaError_t cudaMemcpy2DToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) - + return cyruntime._cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) {{endif}} {{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} cdef cudaError_t cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) - + return cyruntime._cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) {{endif}} {{if 'cudaMemset' in found_functions}} cdef cudaError_t cudaMemset(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset(devPtr, value, count) - + return cyruntime._cudaMemset(devPtr, value, count) {{endif}} {{if 'cudaMemset2D' in found_functions}} cdef cudaError_t cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset2D(devPtr, pitch, value, width, height) - + return cyruntime._cudaMemset2D(devPtr, pitch, value, width, height) {{endif}} {{if 'cudaMemset3D' in found_functions}} cdef cudaError_t cudaMemset3D(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset3D(pitchedDevPtr, value, extent) - + return cyruntime._cudaMemset3D(pitchedDevPtr, value, extent) {{endif}} {{if 'cudaMemsetAsync' in found_functions}} cdef cudaError_t cudaMemsetAsync(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemsetAsync(devPtr, value, count, stream) - + return cyruntime._cudaMemsetAsync(devPtr, value, count, stream) {{endif}} {{if 'cudaMemset2DAsync' in found_functions}} cdef cudaError_t cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) - + return cyruntime._cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) {{endif}} {{if 'cudaMemset3DAsync' in found_functions}} cdef cudaError_t cudaMemset3DAsync(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) - + return cyruntime._cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) {{endif}} {{if 'cudaMemPrefetchAsync' in found_functions}} cdef cudaError_t cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPrefetchAsync(devPtr, count, dstDevice, stream) - + return cyruntime._cudaMemPrefetchAsync(devPtr, count, dstDevice, stream) {{endif}} {{if 'cudaMemPrefetchAsync_v2' in found_functions}} cdef cudaError_t cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPrefetchAsync_v2(devPtr, count, location, flags, stream) - + return cyruntime._cudaMemPrefetchAsync_v2(devPtr, count, location, flags, stream) {{endif}} {{if 'cudaMemAdvise' in found_functions}} cdef cudaError_t cudaMemAdvise(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemAdvise(devPtr, count, advice, device) - + return cyruntime._cudaMemAdvise(devPtr, count, advice, device) {{endif}} {{if 'cudaMemAdvise_v2' in found_functions}} cdef cudaError_t cudaMemAdvise_v2(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemAdvise_v2(devPtr, count, advice, location) - + return cyruntime._cudaMemAdvise_v2(devPtr, count, advice, location) {{endif}} {{if 'cudaMemRangeGetAttribute' in found_functions}} cdef cudaError_t cudaMemRangeGetAttribute(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) - + return cyruntime._cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) {{endif}} {{if 'cudaMemRangeGetAttributes' in found_functions}} cdef cudaError_t cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) - + return cyruntime._cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) {{endif}} {{if 'cudaMemcpyToArray' in found_functions}} cdef cudaError_t cudaMemcpyToArray(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) - + return cyruntime._cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) {{endif}} {{if 'cudaMemcpyFromArray' in found_functions}} cdef cudaError_t cudaMemcpyFromArray(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) - + return cyruntime._cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) {{endif}} {{if 'cudaMemcpyArrayToArray' in found_functions}} cdef cudaError_t cudaMemcpyArrayToArray(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) - + return cyruntime._cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) {{endif}} {{if 'cudaMemcpyToArrayAsync' in found_functions}} cdef cudaError_t cudaMemcpyToArrayAsync(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) - + return cyruntime._cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) {{endif}} {{if 'cudaMemcpyFromArrayAsync' in found_functions}} cdef cudaError_t cudaMemcpyFromArrayAsync(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) - + return cyruntime._cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) {{endif}} {{if 'cudaMallocAsync' in found_functions}} cdef cudaError_t cudaMallocAsync(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocAsync(devPtr, size, hStream) - + return cyruntime._cudaMallocAsync(devPtr, size, hStream) {{endif}} {{if 'cudaFreeAsync' in found_functions}} cdef cudaError_t cudaFreeAsync(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaFreeAsync(devPtr, hStream) - + return cyruntime._cudaFreeAsync(devPtr, hStream) {{endif}} {{if 'cudaMemPoolTrimTo' in found_functions}} cdef cudaError_t cudaMemPoolTrimTo(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolTrimTo(memPool, minBytesToKeep) - + return cyruntime._cudaMemPoolTrimTo(memPool, minBytesToKeep) {{endif}} {{if 'cudaMemPoolSetAttribute' in found_functions}} cdef cudaError_t cudaMemPoolSetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolSetAttribute(memPool, attr, value) - + return cyruntime._cudaMemPoolSetAttribute(memPool, attr, value) {{endif}} {{if 'cudaMemPoolGetAttribute' in found_functions}} cdef cudaError_t cudaMemPoolGetAttribute(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolGetAttribute(memPool, attr, value) - + return cyruntime._cudaMemPoolGetAttribute(memPool, attr, value) {{endif}} {{if 'cudaMemPoolSetAccess' in found_functions}} cdef cudaError_t cudaMemPoolSetAccess(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolSetAccess(memPool, descList, count) - + return cyruntime._cudaMemPoolSetAccess(memPool, descList, count) {{endif}} {{if 'cudaMemPoolGetAccess' in found_functions}} cdef cudaError_t cudaMemPoolGetAccess(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolGetAccess(flags, memPool, location) - + return cyruntime._cudaMemPoolGetAccess(flags, memPool, location) {{endif}} {{if 'cudaMemPoolCreate' in found_functions}} cdef cudaError_t cudaMemPoolCreate(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolCreate(memPool, poolProps) - + return cyruntime._cudaMemPoolCreate(memPool, poolProps) {{endif}} {{if 'cudaMemPoolDestroy' in found_functions}} cdef cudaError_t cudaMemPoolDestroy(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolDestroy(memPool) - + return cyruntime._cudaMemPoolDestroy(memPool) {{endif}} {{if 'cudaMallocFromPoolAsync' in found_functions}} cdef cudaError_t cudaMallocFromPoolAsync(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMallocFromPoolAsync(ptr, size, memPool, stream) - + return cyruntime._cudaMallocFromPoolAsync(ptr, size, memPool, stream) {{endif}} {{if 'cudaMemPoolExportToShareableHandle' in found_functions}} cdef cudaError_t cudaMemPoolExportToShareableHandle(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) - + return cyruntime._cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) {{endif}} {{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} cdef cudaError_t cudaMemPoolImportFromShareableHandle(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) - + return cyruntime._cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) {{endif}} {{if 'cudaMemPoolExportPointer' in found_functions}} cdef cudaError_t cudaMemPoolExportPointer(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolExportPointer(exportData, ptr) - + return cyruntime._cudaMemPoolExportPointer(exportData, ptr) {{endif}} {{if 'cudaMemPoolImportPointer' in found_functions}} cdef cudaError_t cudaMemPoolImportPointer(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaMemPoolImportPointer(ptr, memPool, exportData) - + return cyruntime._cudaMemPoolImportPointer(ptr, memPool, exportData) {{endif}} {{if 'cudaPointerGetAttributes' in found_functions}} cdef cudaError_t cudaPointerGetAttributes(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaPointerGetAttributes(attributes, ptr) - + return cyruntime._cudaPointerGetAttributes(attributes, ptr) {{endif}} {{if 'cudaDeviceCanAccessPeer' in found_functions}} cdef cudaError_t cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) - + return cyruntime._cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) {{endif}} {{if 'cudaDeviceEnablePeerAccess' in found_functions}} cdef cudaError_t cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceEnablePeerAccess(peerDevice, flags) - + return cyruntime._cudaDeviceEnablePeerAccess(peerDevice, flags) {{endif}} {{if 'cudaDeviceDisablePeerAccess' in found_functions}} cdef cudaError_t cudaDeviceDisablePeerAccess(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceDisablePeerAccess(peerDevice) - + return cyruntime._cudaDeviceDisablePeerAccess(peerDevice) {{endif}} {{if 'cudaGraphicsUnregisterResource' in found_functions}} cdef cudaError_t cudaGraphicsUnregisterResource(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsUnregisterResource(resource) - + return cyruntime._cudaGraphicsUnregisterResource(resource) {{endif}} {{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} cdef cudaError_t cudaGraphicsResourceSetMapFlags(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceSetMapFlags(resource, flags) - + return cyruntime._cudaGraphicsResourceSetMapFlags(resource, flags) {{endif}} {{if 'cudaGraphicsMapResources' in found_functions}} cdef cudaError_t cudaGraphicsMapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsMapResources(count, resources, stream) - + return cyruntime._cudaGraphicsMapResources(count, resources, stream) {{endif}} {{if 'cudaGraphicsUnmapResources' in found_functions}} cdef cudaError_t cudaGraphicsUnmapResources(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsUnmapResources(count, resources, stream) - + return cyruntime._cudaGraphicsUnmapResources(count, resources, stream) {{endif}} {{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} cdef cudaError_t cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) - + return cyruntime._cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) {{endif}} {{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} cdef cudaError_t cudaGraphicsSubResourceGetMappedArray(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) - + return cyruntime._cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) {{endif}} {{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} cdef cudaError_t cudaGraphicsResourceGetMappedMipmappedArray(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) - + return cyruntime._cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) {{endif}} {{if 'cudaGetChannelDesc' in found_functions}} cdef cudaError_t cudaGetChannelDesc(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetChannelDesc(desc, array) - + return cyruntime._cudaGetChannelDesc(desc, array) {{endif}} {{if 'cudaCreateChannelDesc' in found_functions}} cdef cudaChannelFormatDesc cudaCreateChannelDesc(int x, int y, int z, int w, cudaChannelFormatKind f) nogil: - return _cudaCreateChannelDesc(x, y, z, w, f) - + return cyruntime._cudaCreateChannelDesc(x, y, z, w, f) {{endif}} {{if 'cudaCreateTextureObject' in found_functions}} cdef cudaError_t cudaCreateTextureObject(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) - + return cyruntime._cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) {{endif}} {{if 'cudaDestroyTextureObject' in found_functions}} cdef cudaError_t cudaDestroyTextureObject(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroyTextureObject(texObject) - + return cyruntime._cudaDestroyTextureObject(texObject) {{endif}} {{if 'cudaGetTextureObjectResourceDesc' in found_functions}} cdef cudaError_t cudaGetTextureObjectResourceDesc(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetTextureObjectResourceDesc(pResDesc, texObject) - + return cyruntime._cudaGetTextureObjectResourceDesc(pResDesc, texObject) {{endif}} {{if 'cudaGetTextureObjectTextureDesc' in found_functions}} cdef cudaError_t cudaGetTextureObjectTextureDesc(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetTextureObjectTextureDesc(pTexDesc, texObject) - + return cyruntime._cudaGetTextureObjectTextureDesc(pTexDesc, texObject) {{endif}} {{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} cdef cudaError_t cudaGetTextureObjectResourceViewDesc(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) - + return cyruntime._cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) {{endif}} {{if 'cudaCreateSurfaceObject' in found_functions}} cdef cudaError_t cudaCreateSurfaceObject(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaCreateSurfaceObject(pSurfObject, pResDesc) - + return cyruntime._cudaCreateSurfaceObject(pSurfObject, pResDesc) {{endif}} {{if 'cudaDestroySurfaceObject' in found_functions}} cdef cudaError_t cudaDestroySurfaceObject(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDestroySurfaceObject(surfObject) - + return cyruntime._cudaDestroySurfaceObject(surfObject) {{endif}} {{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} cdef cudaError_t cudaGetSurfaceObjectResourceDesc(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) - + return cyruntime._cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) {{endif}} {{if 'cudaDriverGetVersion' in found_functions}} cdef cudaError_t cudaDriverGetVersion(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDriverGetVersion(driverVersion) - + return cyruntime._cudaDriverGetVersion(driverVersion) {{endif}} {{if 'cudaRuntimeGetVersion' in found_functions}} cdef cudaError_t cudaRuntimeGetVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaRuntimeGetVersion(runtimeVersion) - + return cyruntime._cudaRuntimeGetVersion(runtimeVersion) {{endif}} {{if 'cudaGraphCreate' in found_functions}} cdef cudaError_t cudaGraphCreate(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphCreate(pGraph, flags) - + return cyruntime._cudaGraphCreate(pGraph, flags) {{endif}} {{if 'cudaGraphAddKernelNode' in found_functions}} cdef cudaError_t cudaGraphAddKernelNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) - + return cyruntime._cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) {{endif}} {{if 'cudaGraphKernelNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphKernelNodeGetParams(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeGetParams(node, pNodeParams) - + return cyruntime._cudaGraphKernelNodeGetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphKernelNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphKernelNodeSetParams(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeSetParams(node, pNodeParams) - + return cyruntime._cudaGraphKernelNodeSetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} cdef cudaError_t cudaGraphKernelNodeCopyAttributes(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeCopyAttributes(hSrc, hDst) - + return cyruntime._cudaGraphKernelNodeCopyAttributes(hSrc, hDst) {{endif}} {{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} cdef cudaError_t cudaGraphKernelNodeGetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) - + return cyruntime._cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) {{endif}} {{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} cdef cudaError_t cudaGraphKernelNodeSetAttribute(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphKernelNodeSetAttribute(hNode, attr, value) - + return cyruntime._cudaGraphKernelNodeSetAttribute(hNode, attr, value) {{endif}} {{if 'cudaGraphAddMemcpyNode' in found_functions}} cdef cudaError_t cudaGraphAddMemcpyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) - + return cyruntime._cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) {{endif}} {{if 'cudaGraphAddMemcpyNode1D' in found_functions}} cdef cudaError_t cudaGraphAddMemcpyNode1D(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) - + return cyruntime._cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) {{endif}} {{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphMemcpyNodeGetParams(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemcpyNodeGetParams(node, pNodeParams) - + return cyruntime._cudaGraphMemcpyNodeGetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphMemcpyNodeSetParams(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemcpyNodeSetParams(node, pNodeParams) - + return cyruntime._cudaGraphMemcpyNodeSetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} cdef cudaError_t cudaGraphMemcpyNodeSetParams1D(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) - + return cyruntime._cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) {{endif}} {{if 'cudaGraphAddMemsetNode' in found_functions}} cdef cudaError_t cudaGraphAddMemsetNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) - + return cyruntime._cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) {{endif}} {{if 'cudaGraphMemsetNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphMemsetNodeGetParams(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemsetNodeGetParams(node, pNodeParams) - + return cyruntime._cudaGraphMemsetNodeGetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphMemsetNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphMemsetNodeSetParams(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemsetNodeSetParams(node, pNodeParams) - + return cyruntime._cudaGraphMemsetNodeSetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphAddHostNode' in found_functions}} cdef cudaError_t cudaGraphAddHostNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) - + return cyruntime._cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) {{endif}} {{if 'cudaGraphHostNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphHostNodeGetParams(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphHostNodeGetParams(node, pNodeParams) - + return cyruntime._cudaGraphHostNodeGetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphHostNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphHostNodeSetParams(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphHostNodeSetParams(node, pNodeParams) - + return cyruntime._cudaGraphHostNodeSetParams(node, pNodeParams) {{endif}} {{if 'cudaGraphAddChildGraphNode' in found_functions}} cdef cudaError_t cudaGraphAddChildGraphNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) - + return cyruntime._cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) {{endif}} {{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} cdef cudaError_t cudaGraphChildGraphNodeGetGraph(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphChildGraphNodeGetGraph(node, pGraph) - + return cyruntime._cudaGraphChildGraphNodeGetGraph(node, pGraph) {{endif}} {{if 'cudaGraphAddEmptyNode' in found_functions}} cdef cudaError_t cudaGraphAddEmptyNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) - + return cyruntime._cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) {{endif}} {{if 'cudaGraphAddEventRecordNode' in found_functions}} cdef cudaError_t cudaGraphAddEventRecordNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) - + return cyruntime._cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) {{endif}} {{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} cdef cudaError_t cudaGraphEventRecordNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventRecordNodeGetEvent(node, event_out) - + return cyruntime._cudaGraphEventRecordNodeGetEvent(node, event_out) {{endif}} {{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} cdef cudaError_t cudaGraphEventRecordNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventRecordNodeSetEvent(node, event) - + return cyruntime._cudaGraphEventRecordNodeSetEvent(node, event) {{endif}} {{if 'cudaGraphAddEventWaitNode' in found_functions}} cdef cudaError_t cudaGraphAddEventWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) - + return cyruntime._cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) {{endif}} {{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} cdef cudaError_t cudaGraphEventWaitNodeGetEvent(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventWaitNodeGetEvent(node, event_out) - + return cyruntime._cudaGraphEventWaitNodeGetEvent(node, event_out) {{endif}} {{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} cdef cudaError_t cudaGraphEventWaitNodeSetEvent(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphEventWaitNodeSetEvent(node, event) - + return cyruntime._cudaGraphEventWaitNodeSetEvent(node, event) {{endif}} {{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} cdef cudaError_t cudaGraphAddExternalSemaphoresSignalNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - + return cyruntime._cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) {{endif}} {{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) - + return cyruntime._cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) {{endif}} {{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExternalSemaphoresSignalNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) - + return cyruntime._cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) {{endif}} {{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} cdef cudaError_t cudaGraphAddExternalSemaphoresWaitNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - + return cyruntime._cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) {{endif}} {{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeGetParams(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) - + return cyruntime._cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) {{endif}} {{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExternalSemaphoresWaitNodeSetParams(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) - + return cyruntime._cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) {{endif}} {{if 'cudaGraphAddMemAllocNode' in found_functions}} cdef cudaError_t cudaGraphAddMemAllocNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - + return cyruntime._cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) {{endif}} {{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphMemAllocNodeGetParams(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemAllocNodeGetParams(node, params_out) - + return cyruntime._cudaGraphMemAllocNodeGetParams(node, params_out) {{endif}} {{if 'cudaGraphAddMemFreeNode' in found_functions}} cdef cudaError_t cudaGraphAddMemFreeNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) - + return cyruntime._cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) {{endif}} {{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} cdef cudaError_t cudaGraphMemFreeNodeGetParams(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphMemFreeNodeGetParams(node, dptr_out) - + return cyruntime._cudaGraphMemFreeNodeGetParams(node, dptr_out) {{endif}} {{if 'cudaDeviceGraphMemTrim' in found_functions}} cdef cudaError_t cudaDeviceGraphMemTrim(int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGraphMemTrim(device) - + return cyruntime._cudaDeviceGraphMemTrim(device) {{endif}} {{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} cdef cudaError_t cudaDeviceGetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceGetGraphMemAttribute(device, attr, value) - + return cyruntime._cudaDeviceGetGraphMemAttribute(device, attr, value) {{endif}} {{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} cdef cudaError_t cudaDeviceSetGraphMemAttribute(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaDeviceSetGraphMemAttribute(device, attr, value) - + return cyruntime._cudaDeviceSetGraphMemAttribute(device, attr, value) {{endif}} {{if 'cudaGraphClone' in found_functions}} cdef cudaError_t cudaGraphClone(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphClone(pGraphClone, originalGraph) - + return cyruntime._cudaGraphClone(pGraphClone, originalGraph) {{endif}} {{if 'cudaGraphNodeFindInClone' in found_functions}} cdef cudaError_t cudaGraphNodeFindInClone(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) - + return cyruntime._cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) {{endif}} {{if 'cudaGraphNodeGetType' in found_functions}} cdef cudaError_t cudaGraphNodeGetType(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetType(node, pType) - + return cyruntime._cudaGraphNodeGetType(node, pType) {{endif}} {{if 'cudaGraphGetNodes' in found_functions}} cdef cudaError_t cudaGraphGetNodes(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetNodes(graph, nodes, numNodes) - + return cyruntime._cudaGraphGetNodes(graph, nodes, numNodes) {{endif}} {{if 'cudaGraphGetRootNodes' in found_functions}} cdef cudaError_t cudaGraphGetRootNodes(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) - + return cyruntime._cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) {{endif}} {{if 'cudaGraphGetEdges' in found_functions}} cdef cudaError_t cudaGraphGetEdges(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetEdges(graph, from_, to, numEdges) - + return cyruntime._cudaGraphGetEdges(graph, from_, to, numEdges) {{endif}} {{if 'cudaGraphGetEdges_v2' in found_functions}} cdef cudaError_t cudaGraphGetEdges_v2(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) - + return cyruntime._cudaGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) {{endif}} {{if 'cudaGraphNodeGetDependencies' in found_functions}} cdef cudaError_t cudaGraphNodeGetDependencies(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependencies(node, pDependencies, pNumDependencies) - + return cyruntime._cudaGraphNodeGetDependencies(node, pDependencies, pNumDependencies) {{endif}} {{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} cdef cudaError_t cudaGraphNodeGetDependencies_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) - + return cyruntime._cudaGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) {{endif}} {{if 'cudaGraphNodeGetDependentNodes' in found_functions}} cdef cudaError_t cudaGraphNodeGetDependentNodes(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) - + return cyruntime._cudaGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) {{endif}} {{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} cdef cudaError_t cudaGraphNodeGetDependentNodes_v2(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) - + return cyruntime._cudaGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) {{endif}} {{if 'cudaGraphAddDependencies' in found_functions}} cdef cudaError_t cudaGraphAddDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddDependencies(graph, from_, to, numDependencies) - + return cyruntime._cudaGraphAddDependencies(graph, from_, to, numDependencies) {{endif}} {{if 'cudaGraphAddDependencies_v2' in found_functions}} cdef cudaError_t cudaGraphAddDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) - + return cyruntime._cudaGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) {{endif}} {{if 'cudaGraphRemoveDependencies' in found_functions}} cdef cudaError_t cudaGraphRemoveDependencies(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphRemoveDependencies(graph, from_, to, numDependencies) - + return cyruntime._cudaGraphRemoveDependencies(graph, from_, to, numDependencies) {{endif}} {{if 'cudaGraphRemoveDependencies_v2' in found_functions}} cdef cudaError_t cudaGraphRemoveDependencies_v2(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) - + return cyruntime._cudaGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) {{endif}} {{if 'cudaGraphDestroyNode' in found_functions}} cdef cudaError_t cudaGraphDestroyNode(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphDestroyNode(node) - + return cyruntime._cudaGraphDestroyNode(node) {{endif}} {{if 'cudaGraphInstantiate' in found_functions}} cdef cudaError_t cudaGraphInstantiate(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiate(pGraphExec, graph, flags) - + return cyruntime._cudaGraphInstantiate(pGraphExec, graph, flags) {{endif}} {{if 'cudaGraphInstantiateWithFlags' in found_functions}} cdef cudaError_t cudaGraphInstantiateWithFlags(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) - + return cyruntime._cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) {{endif}} {{if 'cudaGraphInstantiateWithParams' in found_functions}} cdef cudaError_t cudaGraphInstantiateWithParams(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) - + return cyruntime._cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) {{endif}} {{if 'cudaGraphExecGetFlags' in found_functions}} cdef cudaError_t cudaGraphExecGetFlags(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecGetFlags(graphExec, flags) - + return cyruntime._cudaGraphExecGetFlags(graphExec, flags) {{endif}} {{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecKernelNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) - + return cyruntime._cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) {{endif}} {{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecMemcpyNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) - + return cyruntime._cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) {{endif}} {{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} cdef cudaError_t cudaGraphExecMemcpyNodeSetParams1D(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) - + return cyruntime._cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) {{endif}} {{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecMemsetNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) - + return cyruntime._cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) {{endif}} {{if 'cudaGraphExecHostNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecHostNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) - + return cyruntime._cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) {{endif}} {{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecChildGraphNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) - + return cyruntime._cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) {{endif}} {{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} cdef cudaError_t cudaGraphExecEventRecordNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) - + return cyruntime._cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) {{endif}} {{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} cdef cudaError_t cudaGraphExecEventWaitNodeSetEvent(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) - + return cyruntime._cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) {{endif}} {{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecExternalSemaphoresSignalNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) - + return cyruntime._cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) {{endif}} {{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecExternalSemaphoresWaitNodeSetParams(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) - + return cyruntime._cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) {{endif}} {{if 'cudaGraphNodeSetEnabled' in found_functions}} cdef cudaError_t cudaGraphNodeSetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) - + return cyruntime._cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) {{endif}} {{if 'cudaGraphNodeGetEnabled' in found_functions}} cdef cudaError_t cudaGraphNodeGetEnabled(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) - + return cyruntime._cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) {{endif}} {{if 'cudaGraphExecUpdate' in found_functions}} cdef cudaError_t cudaGraphExecUpdate(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) - + return cyruntime._cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) {{endif}} {{if 'cudaGraphUpload' in found_functions}} cdef cudaError_t cudaGraphUpload(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphUpload(graphExec, stream) - + return cyruntime._cudaGraphUpload(graphExec, stream) {{endif}} {{if 'cudaGraphLaunch' in found_functions}} cdef cudaError_t cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphLaunch(graphExec, stream) - + return cyruntime._cudaGraphLaunch(graphExec, stream) {{endif}} {{if 'cudaGraphExecDestroy' in found_functions}} cdef cudaError_t cudaGraphExecDestroy(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecDestroy(graphExec) - + return cyruntime._cudaGraphExecDestroy(graphExec) {{endif}} {{if 'cudaGraphDestroy' in found_functions}} cdef cudaError_t cudaGraphDestroy(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphDestroy(graph) - + return cyruntime._cudaGraphDestroy(graph) {{endif}} {{if 'cudaGraphDebugDotPrint' in found_functions}} cdef cudaError_t cudaGraphDebugDotPrint(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphDebugDotPrint(graph, path, flags) - + return cyruntime._cudaGraphDebugDotPrint(graph, path, flags) {{endif}} {{if 'cudaUserObjectCreate' in found_functions}} cdef cudaError_t cudaUserObjectCreate(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) - + return cyruntime._cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) {{endif}} {{if 'cudaUserObjectRetain' in found_functions}} cdef cudaError_t cudaUserObjectRetain(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaUserObjectRetain(object, count) - + return cyruntime._cudaUserObjectRetain(object, count) {{endif}} {{if 'cudaUserObjectRelease' in found_functions}} cdef cudaError_t cudaUserObjectRelease(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaUserObjectRelease(object, count) - + return cyruntime._cudaUserObjectRelease(object, count) {{endif}} {{if 'cudaGraphRetainUserObject' in found_functions}} cdef cudaError_t cudaGraphRetainUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphRetainUserObject(graph, object, count, flags) - + return cyruntime._cudaGraphRetainUserObject(graph, object, count, flags) {{endif}} {{if 'cudaGraphReleaseUserObject' in found_functions}} cdef cudaError_t cudaGraphReleaseUserObject(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphReleaseUserObject(graph, object, count) - + return cyruntime._cudaGraphReleaseUserObject(graph, object, count) {{endif}} {{if 'cudaGraphAddNode' in found_functions}} cdef cudaError_t cudaGraphAddNode(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) - + return cyruntime._cudaGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) {{endif}} {{if 'cudaGraphAddNode_v2' in found_functions}} cdef cudaError_t cudaGraphAddNode_v2(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) - + return cyruntime._cudaGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) {{endif}} {{if 'cudaGraphNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphNodeSetParams(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphNodeSetParams(node, nodeParams) - + return cyruntime._cudaGraphNodeSetParams(node, nodeParams) {{endif}} {{if 'cudaGraphExecNodeSetParams' in found_functions}} cdef cudaError_t cudaGraphExecNodeSetParams(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphExecNodeSetParams(graphExec, node, nodeParams) - + return cyruntime._cudaGraphExecNodeSetParams(graphExec, node, nodeParams) {{endif}} {{if 'cudaGraphConditionalHandleCreate' in found_functions}} cdef cudaError_t cudaGraphConditionalHandleCreate(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) - + return cyruntime._cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) {{endif}} {{if 'cudaGetDriverEntryPoint' in found_functions}} cdef cudaError_t cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) - + return cyruntime._cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) {{endif}} {{if 'cudaGetDriverEntryPointByVersion' in found_functions}} cdef cudaError_t cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) - + return cyruntime._cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) {{endif}} {{if 'cudaLibraryLoadData' in found_functions}} cdef cudaError_t cudaLibraryLoadData(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) - + return cyruntime._cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) {{endif}} {{if 'cudaLibraryLoadFromFile' in found_functions}} cdef cudaError_t cudaLibraryLoadFromFile(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) - + return cyruntime._cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) {{endif}} {{if 'cudaLibraryUnload' in found_functions}} cdef cudaError_t cudaLibraryUnload(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryUnload(library) - + return cyruntime._cudaLibraryUnload(library) {{endif}} {{if 'cudaLibraryGetKernel' in found_functions}} cdef cudaError_t cudaLibraryGetKernel(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryGetKernel(pKernel, library, name) - + return cyruntime._cudaLibraryGetKernel(pKernel, library, name) {{endif}} {{if 'cudaLibraryGetGlobal' in found_functions}} cdef cudaError_t cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryGetGlobal(dptr, numbytes, library, name) - + return cyruntime._cudaLibraryGetGlobal(dptr, numbytes, library, name) {{endif}} {{if 'cudaLibraryGetManaged' in found_functions}} cdef cudaError_t cudaLibraryGetManaged(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryGetManaged(dptr, numbytes, library, name) - + return cyruntime._cudaLibraryGetManaged(dptr, numbytes, library, name) {{endif}} {{if 'cudaLibraryGetUnifiedFunction' in found_functions}} cdef cudaError_t cudaLibraryGetUnifiedFunction(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryGetUnifiedFunction(fptr, library, symbol) - + return cyruntime._cudaLibraryGetUnifiedFunction(fptr, library, symbol) {{endif}} {{if 'cudaLibraryGetKernelCount' in found_functions}} cdef cudaError_t cudaLibraryGetKernelCount(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryGetKernelCount(count, lib) - + return cyruntime._cudaLibraryGetKernelCount(count, lib) {{endif}} {{if 'cudaLibraryEnumerateKernels' in found_functions}} cdef cudaError_t cudaLibraryEnumerateKernels(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaLibraryEnumerateKernels(kernels, numKernels, lib) - + return cyruntime._cudaLibraryEnumerateKernels(kernels, numKernels, lib) {{endif}} {{if 'cudaKernelSetAttributeForDevice' in found_functions}} cdef cudaError_t cudaKernelSetAttributeForDevice(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaKernelSetAttributeForDevice(kernel, attr, value, device) - + return cyruntime._cudaKernelSetAttributeForDevice(kernel, attr, value, device) {{endif}} {{if 'cudaGetExportTable' in found_functions}} cdef cudaError_t cudaGetExportTable(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetExportTable(ppExportTable, pExportTableId) - + return cyruntime._cudaGetExportTable(ppExportTable, pExportTableId) {{endif}} {{if 'cudaGetKernel' in found_functions}} cdef cudaError_t cudaGetKernel(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGetKernel(kernelPtr, entryFuncAddr) - + return cyruntime._cudaGetKernel(kernelPtr, entryFuncAddr) {{endif}} {{if 'make_cudaPitchedPtr' in found_functions}} cdef cudaPitchedPtr make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil: - return _make_cudaPitchedPtr(d, p, xsz, ysz) - + return cyruntime._make_cudaPitchedPtr(d, p, xsz, ysz) {{endif}} {{if 'make_cudaPos' in found_functions}} cdef cudaPos make_cudaPos(size_t x, size_t y, size_t z) nogil: - return _make_cudaPos(x, y, z) - + return cyruntime._make_cudaPos(x, y, z) {{endif}} {{if 'make_cudaExtent' in found_functions}} cdef cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) nogil: - return _make_cudaExtent(w, h, d) - + return cyruntime._make_cudaExtent(w, h, d) {{endif}} {{if True}} cdef cudaError_t cudaGraphicsEGLRegisterImage(cudaGraphicsResource** pCudaResource, EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsEGLRegisterImage(pCudaResource, image, flags) - + return custom_cyruntime._cudaGraphicsEGLRegisterImage(pCudaResource, image, flags) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamConsumerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerConnect(conn, eglStream) - + return custom_cyruntime._cudaEGLStreamConsumerConnect(conn, eglStream) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) - + return custom_cyruntime._cudaEGLStreamConsumerConnectWithFlags(conn, eglStream, flags) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerDisconnect(conn) - + return custom_cyruntime._cudaEGLStreamConsumerDisconnect(conn) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) - + return custom_cyruntime._cudaEGLStreamConsumerAcquireFrame(conn, pCudaResource, pStream, timeout) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) - + return custom_cyruntime._cudaEGLStreamConsumerReleaseFrame(conn, pCudaResource, pStream) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamProducerConnect(cudaEglStreamConnection* conn, EGLStreamKHR eglStream, EGLint width, EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerConnect(conn, eglStream, width, height) - + return custom_cyruntime._cudaEGLStreamProducerConnect(conn, eglStream, width, height) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamProducerDisconnect(cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerDisconnect(conn) - + return custom_cyruntime._cudaEGLStreamProducerDisconnect(conn) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerPresentFrame(conn, eglframe, pStream) - + return custom_cyruntime._cudaEGLStreamProducerPresentFrame(conn, eglframe, pStream) {{endif}} {{if True}} cdef cudaError_t cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEGLStreamProducerReturnFrame(conn, eglframe, pStream) - + return custom_cyruntime._cudaEGLStreamProducerReturnFrame(conn, eglframe, pStream) {{endif}} {{if True}} cdef cudaError_t cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsResourceGetMappedEglFrame(eglFrame, resource, index, mipLevel) - + return custom_cyruntime._cudaGraphicsResourceGetMappedEglFrame(eglFrame, resource, index, mipLevel) {{endif}} {{if True}} cdef cudaError_t cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaEventCreateFromEGLSync(phEvent, eglSync, flags) - + return custom_cyruntime._cudaEventCreateFromEGLSync(phEvent, eglSync, flags) {{endif}} -{{if True}} +{{if 'cudaProfilerStart' in found_functions}} cdef cudaError_t cudaProfilerStart() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaProfilerStart() - + return cyruntime._cudaProfilerStart() {{endif}} -{{if True}} +{{if 'cudaProfilerStop' in found_functions}} cdef cudaError_t cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaProfilerStop() - + return cyruntime._cudaProfilerStop() {{endif}} {{if True}} cdef cudaError_t cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGLGetDevices(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) - + return custom_cyruntime._cudaGLGetDevices(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList) {{endif}} {{if True}} cdef cudaError_t cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, GLuint image, GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsGLRegisterImage(resource, image, target, flags) - + return custom_cyruntime._cudaGraphicsGLRegisterImage(resource, image, target, flags) {{endif}} {{if True}} cdef cudaError_t cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsGLRegisterBuffer(resource, buffer, flags) - + return custom_cyruntime._cudaGraphicsGLRegisterBuffer(resource, buffer, flags) {{endif}} {{if True}} cdef cudaError_t cudaVDPAUGetDevice(int* device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) - + return custom_cyruntime._cudaVDPAUGetDevice(device, vdpDevice, vdpGetProcAddress) {{endif}} {{if True}} cdef cudaError_t cudaVDPAUSetVDPAUDevice(int device, VdpDevice vdpDevice, VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaVDPAUSetVDPAUDevice(device, vdpDevice, vdpGetProcAddress) - + return custom_cyruntime._cudaVDPAUSetVDPAUDevice(device, vdpDevice, vdpGetProcAddress) {{endif}} {{if True}} cdef cudaError_t cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) - + return custom_cyruntime._cudaGraphicsVDPAURegisterVideoSurface(resource, vdpSurface, flags) {{endif}} {{if True}} cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil: - return _cudaGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) - + return custom_cyruntime._cudaGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags) {{endif}} + +cdef class cudaBindingsRuntimeGlobal: + {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + cdef map[cudaAsyncCallbackHandle_t, cudaAsyncCallbackData*] _asyncCallbackDataMap + {{endif}} + + def __dealloc__(self): + pass + {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + for item in self._asyncCallbackDataMap: + free(item.second) + self._asyncCallbackDataMap.clear() + {{endif}} + +cdef cudaBindingsRuntimeGlobal m_global = cudaBindingsRuntimeGlobal() + {{if True}} -cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: - return _getLocalRuntimeVersion(runtimeVersion) +{{if 'Windows' != platform.system()}} +cimport cuda.bindings._lib.dlfcn as dlfcn +{{endif}} +cdef cudaError_t getLocalRuntimeVersion(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil: + {{if 'Windows' == platform.system()}} + with gil: + raise NotImplementedError('"getLocalRuntimeVersion" is unsupported on Windows') + {{else}} + # Load + handle = dlfcn.dlopen('libcudart.so.12', dlfcn.RTLD_NOW) + if handle == NULL: + with gil: + raise RuntimeError(f'Failed to dlopen libcudart.so.12') + + __cudaRuntimeGetVersion = dlfcn.dlsym(handle, 'cudaRuntimeGetVersion') + + if __cudaRuntimeGetVersion == NULL: + with gil: + raise RuntimeError(f'Function "cudaRuntimeGetVersion" not found in libcudart.so.12') + + # Call + cdef cudaError_t err = cudaSuccess + err = ( __cudaRuntimeGetVersion)(runtimeVersion) + + # Unload + dlfcn.dlclose(handle) + + # Return + return err + {{endif}} {{endif}} diff --git a/cuda_bindings/cuda/bindings/runtime.pyx.in b/cuda_bindings/cuda/bindings/runtime.pyx.in index 4282e12d7..347e1d185 100644 --- a/cuda_bindings/cuda/bindings/runtime.pyx.in +++ b/cuda_bindings/cuda/bindings/runtime.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -36498,7 +36498,7 @@ def cudaEventCreateFromEGLSync(eglSync, unsigned int flags): return (cudaError_t(err), phEvent) {{endif}} -{{if True}} +{{if 'cudaProfilerStart' in found_functions}} @cython.embedsignature(True) def cudaProfilerStart(): @@ -36525,7 +36525,7 @@ def cudaProfilerStart(): return (cudaError_t(err),) {{endif}} -{{if True}} +{{if 'cudaProfilerStop' in found_functions}} @cython.embedsignature(True) def cudaProfilerStop(): diff --git a/cuda_bindings/docs/source/release/12.X.Y-notes.rst b/cuda_bindings/docs/source/release/12.X.Y-notes.rst index 6536d3aea..cbec0d194 100644 --- a/cuda_bindings/docs/source/release/12.X.Y-notes.rst +++ b/cuda_bindings/docs/source/release/12.X.Y-notes.rst @@ -10,3 +10,5 @@ Highlights * The ``cuda.bindings.nvvm`` Python module was added, wrapping the `libNVVM C API `_. * Source build error checking added for missing required headers +* Statically link CUDA Runtime instead of reimplementing it +* Call all callback functions with the GIL From 4480ccb0d05973fb95f0ab54191640e80713d8f8 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 13 Mar 2025 15:38:08 -0700 Subject: [PATCH 02/15] Specify LIB for Windows --- .github/workflows/build-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9ad2d8c1e..b00ea20dc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -142,6 +142,7 @@ jobs: CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }} CIBW_ENVIRONMENT_WINDOWS: > CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})" + LIB="%CUDA_HOME%\\lib\\x64;%LIB%" CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }} with: package-dir: ./cuda_bindings/ From a5e948bc2e8e20970bee2269a47bcdbd2f6d81f1 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 13 Mar 2025 15:42:31 -0700 Subject: [PATCH 03/15] Corrected parentheses --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b00ea20dc..92c6a6ae2 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -142,7 +142,7 @@ jobs: CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }} CIBW_ENVIRONMENT_WINDOWS: > CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})" - LIB="%CUDA_HOME%\\lib\\x64;%LIB%" + LIB="${CUDA_HOME}\\lib\\x64;${LIB}" CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }} with: package-dir: ./cuda_bindings/ From 9e08cef4dbbba37d04bbc5272f401006785f829f Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Fri, 14 Mar 2025 08:43:28 -0700 Subject: [PATCH 04/15] Link to cudart_static --- cuda_bindings/setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 3409766bf..a026c14b5 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -265,7 +265,7 @@ def generate_output(infile, local): # Cythonize -def prep_extensions(sources): +def prep_extensions(sources, libraries=[]): pattern = sources[0] files = glob.glob(pattern) exts = [] @@ -278,7 +278,7 @@ def prep_extensions(sources): include_dirs=include_dirs, library_dirs=library_dirs, runtime_library_dirs=[], - libraries=[], + libraries=libraries, language="c++", extra_compile_args=extra_compile_args, ) @@ -346,7 +346,7 @@ def do_cythonize(extensions): ] for sources in sources_list: - extensions += prep_extensions(sources) + extensions += prep_extensions(sources, ["cudart_static"]) # --------------------------------------------------------------------- # Custom cmdclass extensions From 3024f187d24ca9127d161e30ea96b21971db6590 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 20 Mar 2025 14:07:24 -0700 Subject: [PATCH 05/15] Support PTDS for Runtime --- .../cuda/bindings/_bindings/cyruntime.pxd.in | 1764 ++++++----- .../cuda/bindings/_bindings/cyruntime.pxi.in | 1496 ++++++++++ .../cuda/bindings/_bindings/cyruntime.pyx.in | 2653 +++++++++++++++++ .../bindings/_bindings/cyruntime_ptds.pxd.in | 1475 +++++++++ .../bindings/_bindings/cyruntime_ptds.pyx.in | 1767 +++++++++++ cuda_bindings/cuda/bindings/cydriver.pxd.in | 2 +- cuda_bindings/setup.py | 5 +- 7 files changed, 8273 insertions(+), 889 deletions(-) create mode 100644 cuda_bindings/cuda/bindings/_bindings/cyruntime.pxi.in create mode 100644 cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in create mode 100644 cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pxd.in create mode 100644 cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pyx.in diff --git a/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in index 334d58a13..2a00a39b2 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in +++ b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in @@ -7,1474 +7,1464 @@ # is strictly prohibited. # # This code was automatically generated with version 12.8.0. Do not modify it directly. -from cuda.bindings.cyruntime cimport * +cimport cuda.bindings.cyruntime as cyruntime -cdef extern from "cuda_runtime_api.h": +{{if 'cudaDeviceReset' in found_functions}} - {{if 'cudaDeviceReset' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceReset() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceReset "cudaDeviceReset"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceSynchronize' in found_functions}} - {{if 'cudaDeviceSynchronize' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceSynchronize() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceSynchronize "cudaDeviceSynchronize"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceSetLimit' in found_functions}} - {{if 'cudaDeviceSetLimit' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceSetLimit(cyruntime.cudaLimit limit, size_t value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceSetLimit "cudaDeviceSetLimit"(cudaLimit limit, size_t value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetLimit' in found_functions}} - {{if 'cudaDeviceGetLimit' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetLimit(size_t* pValue, cyruntime.cudaLimit limit) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetLimit "cudaDeviceGetLimit"(size_t* pValue, cudaLimit limit) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} - {{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cyruntime.cudaChannelFormatDesc* fmtDesc, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth "cudaDeviceGetTexture1DLinearMaxWidth"(size_t* maxWidthInElements, const cudaChannelFormatDesc* fmtDesc, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetCacheConfig' in found_functions}} - {{if 'cudaDeviceGetCacheConfig' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetCacheConfig(cyruntime.cudaFuncCache* pCacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetCacheConfig "cudaDeviceGetCacheConfig"(cudaFuncCache* pCacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} - {{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetStreamPriorityRange "cudaDeviceGetStreamPriorityRange"(int* leastPriority, int* greatestPriority) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceSetCacheConfig' in found_functions}} - {{if 'cudaDeviceSetCacheConfig' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceSetCacheConfig(cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceSetCacheConfig "cudaDeviceSetCacheConfig"(cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetByPCIBusId' in found_functions}} - {{if 'cudaDeviceGetByPCIBusId' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetByPCIBusId "cudaDeviceGetByPCIBusId"(int* device, const char* pciBusId) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetPCIBusId' in found_functions}} - {{if 'cudaDeviceGetPCIBusId' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetPCIBusId "cudaDeviceGetPCIBusId"(char* pciBusId, int length, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaIpcGetEventHandle' in found_functions}} - {{if 'cudaIpcGetEventHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaIpcGetEventHandle(cyruntime.cudaIpcEventHandle_t* handle, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaIpcGetEventHandle "cudaIpcGetEventHandle"(cudaIpcEventHandle_t* handle, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaIpcOpenEventHandle' in found_functions}} - {{if 'cudaIpcOpenEventHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaIpcOpenEventHandle(cyruntime.cudaEvent_t* event, cyruntime.cudaIpcEventHandle_t handle) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaIpcOpenEventHandle "cudaIpcOpenEventHandle"(cudaEvent_t* event, cudaIpcEventHandle_t handle) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaIpcGetMemHandle' in found_functions}} - {{if 'cudaIpcGetMemHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaIpcGetMemHandle(cyruntime.cudaIpcMemHandle_t* handle, void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaIpcGetMemHandle "cudaIpcGetMemHandle"(cudaIpcMemHandle_t* handle, void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaIpcOpenMemHandle' in found_functions}} - {{if 'cudaIpcOpenMemHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cyruntime.cudaIpcMemHandle_t handle, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaIpcOpenMemHandle "cudaIpcOpenMemHandle"(void** devPtr, cudaIpcMemHandle_t handle, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaIpcCloseMemHandle' in found_functions}} - {{if 'cudaIpcCloseMemHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaIpcCloseMemHandle "cudaIpcCloseMemHandle"(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} - {{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cyruntime.cudaFlushGPUDirectRDMAWritesTarget target, cyruntime.cudaFlushGPUDirectRDMAWritesScope scope) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites "cudaDeviceFlushGPUDirectRDMAWrites"(cudaFlushGPUDirectRDMAWritesTarget target, cudaFlushGPUDirectRDMAWritesScope scope) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} - {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cyruntime.cudaAsyncCallback callbackFunc, void* userData, cyruntime.cudaAsyncCallbackHandle_t* callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceRegisterAsyncNotification "cudaDeviceRegisterAsyncNotification"(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} - {{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cyruntime.cudaAsyncCallbackHandle_t callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceUnregisterAsyncNotification "cudaDeviceUnregisterAsyncNotification"(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} - {{if 'cudaDeviceGetSharedMemConfig' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetSharedMemConfig(cyruntime.cudaSharedMemConfig* pConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetSharedMemConfig "cudaDeviceGetSharedMemConfig"(cudaSharedMemConfig* pConfig) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} - {{if 'cudaDeviceSetSharedMemConfig' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceSetSharedMemConfig(cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceSetSharedMemConfig "cudaDeviceSetSharedMemConfig"(cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetLastError' in found_functions}} - {{if 'cudaGetLastError' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetLastError "cudaGetLastError"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaPeekAtLastError' in found_functions}} - {{if 'cudaPeekAtLastError' in found_functions}} +cdef cyruntime.cudaError_t _cudaPeekAtLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaPeekAtLastError "cudaPeekAtLastError"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetErrorName' in found_functions}} - {{if 'cudaGetErrorName' in found_functions}} +cdef const char* _cudaGetErrorName(cyruntime.cudaError_t error) except ?NULL nogil +{{endif}} - const char* _cudaGetErrorName "cudaGetErrorName"(cudaError_t error) except ?NULL nogil - {{endif}} +{{if 'cudaGetErrorString' in found_functions}} - {{if 'cudaGetErrorString' in found_functions}} +cdef const char* _cudaGetErrorString(cyruntime.cudaError_t error) except ?NULL nogil +{{endif}} - const char* _cudaGetErrorString "cudaGetErrorString"(cudaError_t error) except ?NULL nogil - {{endif}} +{{if 'cudaGetDeviceCount' in found_functions}} - {{if 'cudaGetDeviceCount' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetDeviceCount(int* count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetDeviceCount "cudaGetDeviceCount"(int* count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetDeviceProperties_v2' in found_functions}} - {{if 'cudaGetDeviceProperties_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetDeviceProperties_v2(cyruntime.cudaDeviceProp* prop, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetDeviceProperties_v2 "cudaGetDeviceProperties_v2"(cudaDeviceProp* prop, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetAttribute' in found_functions}} - {{if 'cudaDeviceGetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetAttribute(int* value, cyruntime.cudaDeviceAttr attr, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetAttribute "cudaDeviceGetAttribute"(int* value, cudaDeviceAttr attr, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} - {{if 'cudaDeviceGetDefaultMemPool' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetDefaultMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetDefaultMemPool "cudaDeviceGetDefaultMemPool"(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceSetMemPool' in found_functions}} - {{if 'cudaDeviceSetMemPool' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceSetMemPool(int device, cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceSetMemPool "cudaDeviceSetMemPool"(int device, cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetMemPool' in found_functions}} - {{if 'cudaDeviceGetMemPool' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetMemPool "cudaDeviceGetMemPool"(cudaMemPool_t* memPool, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} - {{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetNvSciSyncAttributes "cudaDeviceGetNvSciSyncAttributes"(void* nvSciSyncAttrList, int device, int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetP2PAttribute' in found_functions}} - {{if 'cudaDeviceGetP2PAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetP2PAttribute(int* value, cyruntime.cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetP2PAttribute "cudaDeviceGetP2PAttribute"(int* value, cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaChooseDevice' in found_functions}} - {{if 'cudaChooseDevice' in found_functions}} +cdef cyruntime.cudaError_t _cudaChooseDevice(int* device, const cyruntime.cudaDeviceProp* prop) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaChooseDevice "cudaChooseDevice"(int* device, const cudaDeviceProp* prop) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaInitDevice' in found_functions}} - {{if 'cudaInitDevice' in found_functions}} +cdef cyruntime.cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaInitDevice "cudaInitDevice"(int device, unsigned int deviceFlags, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaSetDevice' in found_functions}} - {{if 'cudaSetDevice' in found_functions}} +cdef cyruntime.cudaError_t _cudaSetDevice(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaSetDevice "cudaSetDevice"(int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetDevice' in found_functions}} - {{if 'cudaGetDevice' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetDevice(int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetDevice "cudaGetDevice"(int* device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaSetDeviceFlags' in found_functions}} - {{if 'cudaSetDeviceFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaSetDeviceFlags "cudaSetDeviceFlags"(unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetDeviceFlags' in found_functions}} - {{if 'cudaGetDeviceFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetDeviceFlags "cudaGetDeviceFlags"(unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamCreate' in found_functions}} - {{if 'cudaStreamCreate' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamCreate(cyruntime.cudaStream_t* pStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamCreate "cudaStreamCreate"(cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamCreateWithFlags' in found_functions}} - {{if 'cudaStreamCreateWithFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamCreateWithFlags(cyruntime.cudaStream_t* pStream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamCreateWithFlags "cudaStreamCreateWithFlags"(cudaStream_t* pStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamCreateWithPriority' in found_functions}} - {{if 'cudaStreamCreateWithPriority' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamCreateWithPriority(cyruntime.cudaStream_t* pStream, unsigned int flags, int priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamCreateWithPriority "cudaStreamCreateWithPriority"(cudaStream_t* pStream, unsigned int flags, int priority) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetPriority' in found_functions}} - {{if 'cudaStreamGetPriority' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetPriority(cyruntime.cudaStream_t hStream, int* priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetPriority "cudaStreamGetPriority"(cudaStream_t hStream, int* priority) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetFlags' in found_functions}} - {{if 'cudaStreamGetFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetFlags(cyruntime.cudaStream_t hStream, unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetFlags "cudaStreamGetFlags"(cudaStream_t hStream, unsigned int* flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetId' in found_functions}} - {{if 'cudaStreamGetId' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetId(cyruntime.cudaStream_t hStream, unsigned long long* streamId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetId "cudaStreamGetId"(cudaStream_t hStream, unsigned long long* streamId) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetDevice' in found_functions}} - {{if 'cudaStreamGetDevice' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetDevice(cyruntime.cudaStream_t hStream, int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetDevice "cudaStreamGetDevice"(cudaStream_t hStream, int* device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} - {{if 'cudaCtxResetPersistingL2Cache' in found_functions}} +cdef cyruntime.cudaError_t _cudaCtxResetPersistingL2Cache() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaCtxResetPersistingL2Cache "cudaCtxResetPersistingL2Cache"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamCopyAttributes' in found_functions}} - {{if 'cudaStreamCopyAttributes' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamCopyAttributes(cyruntime.cudaStream_t dst, cyruntime.cudaStream_t src) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamCopyAttributes "cudaStreamCopyAttributes"(cudaStream_t dst, cudaStream_t src) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetAttribute' in found_functions}} - {{if 'cudaStreamGetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, cyruntime.cudaStreamAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetAttribute "cudaStreamGetAttribute"(cudaStream_t hStream, cudaStreamAttrID attr, cudaStreamAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamSetAttribute' in found_functions}} - {{if 'cudaStreamSetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamSetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, const cyruntime.cudaStreamAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamSetAttribute "cudaStreamSetAttribute"(cudaStream_t hStream, cudaStreamAttrID attr, const cudaStreamAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamDestroy' in found_functions}} - {{if 'cudaStreamDestroy' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamDestroy(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamDestroy "cudaStreamDestroy"(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamWaitEvent' in found_functions}} - {{if 'cudaStreamWaitEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamWaitEvent(cyruntime.cudaStream_t stream, cyruntime.cudaEvent_t event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamWaitEvent "cudaStreamWaitEvent"(cudaStream_t stream, cudaEvent_t event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamAddCallback' in found_functions}} - {{if 'cudaStreamAddCallback' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamAddCallback(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamAddCallback "cudaStreamAddCallback"(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamSynchronize' in found_functions}} - {{if 'cudaStreamSynchronize' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamSynchronize(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamSynchronize "cudaStreamSynchronize"(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamQuery' in found_functions}} - {{if 'cudaStreamQuery' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamQuery(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamQuery "cudaStreamQuery"(cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamAttachMemAsync' in found_functions}} - {{if 'cudaStreamAttachMemAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamAttachMemAsync(cyruntime.cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamAttachMemAsync "cudaStreamAttachMemAsync"(cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamBeginCapture' in found_functions}} - {{if 'cudaStreamBeginCapture' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamBeginCapture(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamBeginCapture "cudaStreamBeginCapture"(cudaStream_t stream, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} - {{if 'cudaStreamBeginCaptureToGraph' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamBeginCaptureToGraph(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamBeginCaptureToGraph "cudaStreamBeginCaptureToGraph"(cudaStream_t stream, cudaGraph_t graph, const cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaStreamCaptureMode mode) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} - {{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} +cdef cyruntime.cudaError_t _cudaThreadExchangeStreamCaptureMode(cyruntime.cudaStreamCaptureMode* mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaThreadExchangeStreamCaptureMode "cudaThreadExchangeStreamCaptureMode"(cudaStreamCaptureMode* mode) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamEndCapture' in found_functions}} - {{if 'cudaStreamEndCapture' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamEndCapture(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamEndCapture "cudaStreamEndCapture"(cudaStream_t stream, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamIsCapturing' in found_functions}} - {{if 'cudaStreamIsCapturing' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamIsCapturing(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* pCaptureStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamIsCapturing "cudaStreamIsCapturing"(cudaStream_t stream, cudaStreamCaptureStatus* pCaptureStatus) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} - {{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v2(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetCaptureInfo_v2 "cudaStreamGetCaptureInfo_v2"(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} - {{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v3(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, const cyruntime.cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamGetCaptureInfo_v3 "cudaStreamGetCaptureInfo_v3"(cudaStream_t stream, cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cudaGraph_t* graph_out, const cudaGraphNode_t** dependencies_out, const cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} - {{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamUpdateCaptureDependencies "cudaStreamUpdateCaptureDependencies"(cudaStream_t stream, cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} - {{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaStreamUpdateCaptureDependencies_v2 "cudaStreamUpdateCaptureDependencies_v2"(cudaStream_t stream, cudaGraphNode_t* dependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventCreate' in found_functions}} - {{if 'cudaEventCreate' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventCreate(cyruntime.cudaEvent_t* event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventCreate "cudaEventCreate"(cudaEvent_t* event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventCreateWithFlags' in found_functions}} - {{if 'cudaEventCreateWithFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventCreateWithFlags(cyruntime.cudaEvent_t* event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventCreateWithFlags "cudaEventCreateWithFlags"(cudaEvent_t* event, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventRecord' in found_functions}} - {{if 'cudaEventRecord' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventRecord(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventRecord "cudaEventRecord"(cudaEvent_t event, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventRecordWithFlags' in found_functions}} - {{if 'cudaEventRecordWithFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventRecordWithFlags(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventRecordWithFlags "cudaEventRecordWithFlags"(cudaEvent_t event, cudaStream_t stream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventQuery' in found_functions}} - {{if 'cudaEventQuery' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventQuery(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventQuery "cudaEventQuery"(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventSynchronize' in found_functions}} - {{if 'cudaEventSynchronize' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventSynchronize(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventSynchronize "cudaEventSynchronize"(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventDestroy' in found_functions}} - {{if 'cudaEventDestroy' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventDestroy(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventDestroy "cudaEventDestroy"(cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventElapsedTime' in found_functions}} - {{if 'cudaEventElapsedTime' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventElapsedTime(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventElapsedTime "cudaEventElapsedTime"(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaEventElapsedTime_v2' in found_functions}} - {{if 'cudaEventElapsedTime_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaEventElapsedTime_v2(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaEventElapsedTime_v2 "cudaEventElapsedTime_v2"(float* ms, cudaEvent_t start, cudaEvent_t end) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaImportExternalMemory' in found_functions}} - {{if 'cudaImportExternalMemory' in found_functions}} +cdef cyruntime.cudaError_t _cudaImportExternalMemory(cyruntime.cudaExternalMemory_t* extMem_out, const cyruntime.cudaExternalMemoryHandleDesc* memHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaImportExternalMemory "cudaImportExternalMemory"(cudaExternalMemory_t* extMem_out, const cudaExternalMemoryHandleDesc* memHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} - {{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryBufferDesc* bufferDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaExternalMemoryGetMappedBuffer "cudaExternalMemoryGetMappedBuffer"(void** devPtr, cudaExternalMemory_t extMem, const cudaExternalMemoryBufferDesc* bufferDesc) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} - {{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmap, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaExternalMemoryGetMappedMipmappedArray "cudaExternalMemoryGetMappedMipmappedArray"(cudaMipmappedArray_t* mipmap, cudaExternalMemory_t extMem, const cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDestroyExternalMemory' in found_functions}} - {{if 'cudaDestroyExternalMemory' in found_functions}} +cdef cyruntime.cudaError_t _cudaDestroyExternalMemory(cyruntime.cudaExternalMemory_t extMem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDestroyExternalMemory "cudaDestroyExternalMemory"(cudaExternalMemory_t extMem) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaImportExternalSemaphore' in found_functions}} - {{if 'cudaImportExternalSemaphore' in found_functions}} +cdef cyruntime.cudaError_t _cudaImportExternalSemaphore(cyruntime.cudaExternalSemaphore_t* extSem_out, const cyruntime.cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaImportExternalSemaphore "cudaImportExternalSemaphore"(cudaExternalSemaphore_t* extSem_out, const cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} - {{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaSignalExternalSemaphoresAsync_v2 "cudaSignalExternalSemaphoresAsync_v2"(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} - {{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaWaitExternalSemaphoresAsync_v2 "cudaWaitExternalSemaphoresAsync_v2"(const cudaExternalSemaphore_t* extSemArray, const cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDestroyExternalSemaphore' in found_functions}} - {{if 'cudaDestroyExternalSemaphore' in found_functions}} +cdef cyruntime.cudaError_t _cudaDestroyExternalSemaphore(cyruntime.cudaExternalSemaphore_t extSem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDestroyExternalSemaphore "cudaDestroyExternalSemaphore"(cudaExternalSemaphore_t extSem) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFuncSetCacheConfig' in found_functions}} - {{if 'cudaFuncSetCacheConfig' in found_functions}} +cdef cyruntime.cudaError_t _cudaFuncSetCacheConfig(const void* func, cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFuncSetCacheConfig "cudaFuncSetCacheConfig"(const void* func, cudaFuncCache cacheConfig) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFuncGetAttributes' in found_functions}} - {{if 'cudaFuncGetAttributes' in found_functions}} +cdef cyruntime.cudaError_t _cudaFuncGetAttributes(cyruntime.cudaFuncAttributes* attr, const void* func) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFuncGetAttributes "cudaFuncGetAttributes"(cudaFuncAttributes* attr, const void* func) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFuncSetAttribute' in found_functions}} - {{if 'cudaFuncSetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaFuncSetAttribute(const void* func, cyruntime.cudaFuncAttribute attr, int value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFuncSetAttribute "cudaFuncSetAttribute"(const void* func, cudaFuncAttribute attr, int value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLaunchHostFunc' in found_functions}} - {{if 'cudaLaunchHostFunc' in found_functions}} +cdef cyruntime.cudaError_t _cudaLaunchHostFunc(cyruntime.cudaStream_t stream, cyruntime.cudaHostFn_t fn, void* userData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLaunchHostFunc "cudaLaunchHostFunc"(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFuncSetSharedMemConfig' in found_functions}} - {{if 'cudaFuncSetSharedMemConfig' in found_functions}} +cdef cyruntime.cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFuncSetSharedMemConfig "cudaFuncSetSharedMemConfig"(const void* func, cudaSharedMemConfig config) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} - {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor "cudaOccupancyMaxActiveBlocksPerMultiprocessor"(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} - {{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} +cdef cyruntime.cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock "cudaOccupancyAvailableDynamicSMemPerBlock"(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} - {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags "cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags"(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocManaged' in found_functions}} - {{if 'cudaMallocManaged' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocManaged "cudaMallocManaged"(void** devPtr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMalloc' in found_functions}} - {{if 'cudaMalloc' in found_functions}} +cdef cyruntime.cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMalloc "cudaMalloc"(void** devPtr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocHost' in found_functions}} - {{if 'cudaMallocHost' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocHost "cudaMallocHost"(void** ptr, size_t size) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocPitch' in found_functions}} - {{if 'cudaMallocPitch' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocPitch "cudaMallocPitch"(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocArray' in found_functions}} - {{if 'cudaMallocArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocArray "cudaMallocArray"(cudaArray_t* array, const cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFree' in found_functions}} - {{if 'cudaFree' in found_functions}} +cdef cyruntime.cudaError_t _cudaFree(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFree "cudaFree"(void* devPtr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFreeHost' in found_functions}} - {{if 'cudaFreeHost' in found_functions}} +cdef cyruntime.cudaError_t _cudaFreeHost(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFreeHost "cudaFreeHost"(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFreeArray' in found_functions}} - {{if 'cudaFreeArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaFreeArray(cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFreeArray "cudaFreeArray"(cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFreeMipmappedArray' in found_functions}} - {{if 'cudaFreeMipmappedArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaFreeMipmappedArray(cyruntime.cudaMipmappedArray_t mipmappedArray) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFreeMipmappedArray "cudaFreeMipmappedArray"(cudaMipmappedArray_t mipmappedArray) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaHostAlloc' in found_functions}} - {{if 'cudaHostAlloc' in found_functions}} +cdef cyruntime.cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaHostAlloc "cudaHostAlloc"(void** pHost, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaHostRegister' in found_functions}} - {{if 'cudaHostRegister' in found_functions}} +cdef cyruntime.cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaHostRegister "cudaHostRegister"(void* ptr, size_t size, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaHostUnregister' in found_functions}} - {{if 'cudaHostUnregister' in found_functions}} +cdef cyruntime.cudaError_t _cudaHostUnregister(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaHostUnregister "cudaHostUnregister"(void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaHostGetDevicePointer' in found_functions}} - {{if 'cudaHostGetDevicePointer' in found_functions}} +cdef cyruntime.cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaHostGetDevicePointer "cudaHostGetDevicePointer"(void** pDevice, void* pHost, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaHostGetFlags' in found_functions}} - {{if 'cudaHostGetFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaHostGetFlags "cudaHostGetFlags"(unsigned int* pFlags, void* pHost) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMalloc3D' in found_functions}} - {{if 'cudaMalloc3D' in found_functions}} +cdef cyruntime.cudaError_t _cudaMalloc3D(cyruntime.cudaPitchedPtr* pitchedDevPtr, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMalloc3D "cudaMalloc3D"(cudaPitchedPtr* pitchedDevPtr, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMalloc3DArray' in found_functions}} - {{if 'cudaMalloc3DArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMalloc3DArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMalloc3DArray "cudaMalloc3DArray"(cudaArray_t* array, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocMipmappedArray' in found_functions}} - {{if 'cudaMallocMipmappedArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocMipmappedArray "cudaMallocMipmappedArray"(cudaMipmappedArray_t* mipmappedArray, const cudaChannelFormatDesc* desc, cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetMipmappedArrayLevel' in found_functions}} - {{if 'cudaGetMipmappedArrayLevel' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetMipmappedArrayLevel(cyruntime.cudaArray_t* levelArray, cyruntime.cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetMipmappedArrayLevel "cudaGetMipmappedArrayLevel"(cudaArray_t* levelArray, cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy3D' in found_functions}} - {{if 'cudaMemcpy3D' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy3D(const cyruntime.cudaMemcpy3DParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy3D "cudaMemcpy3D"(const cudaMemcpy3DParms* p) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy3DPeer' in found_functions}} - {{if 'cudaMemcpy3DPeer' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy3DPeer(const cyruntime.cudaMemcpy3DPeerParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy3DPeer "cudaMemcpy3DPeer"(const cudaMemcpy3DPeerParms* p) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy3DAsync' in found_functions}} - {{if 'cudaMemcpy3DAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy3DAsync(const cyruntime.cudaMemcpy3DParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy3DAsync "cudaMemcpy3DAsync"(const cudaMemcpy3DParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy3DPeerAsync' in found_functions}} - {{if 'cudaMemcpy3DPeerAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy3DPeerAsync(const cyruntime.cudaMemcpy3DPeerParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy3DPeerAsync "cudaMemcpy3DPeerAsync"(const cudaMemcpy3DPeerParms* p, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemGetInfo' in found_functions}} - {{if 'cudaMemGetInfo' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemGetInfo "cudaMemGetInfo"(size_t* free, size_t* total) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaArrayGetInfo' in found_functions}} - {{if 'cudaArrayGetInfo' in found_functions}} +cdef cyruntime.cudaError_t _cudaArrayGetInfo(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent* extent, unsigned int* flags, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaArrayGetInfo "cudaArrayGetInfo"(cudaChannelFormatDesc* desc, cudaExtent* extent, unsigned int* flags, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaArrayGetPlane' in found_functions}} - {{if 'cudaArrayGetPlane' in found_functions}} +cdef cyruntime.cudaError_t _cudaArrayGetPlane(cyruntime.cudaArray_t* pPlaneArray, cyruntime.cudaArray_t hArray, unsigned int planeIdx) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaArrayGetPlane "cudaArrayGetPlane"(cudaArray_t* pPlaneArray, cudaArray_t hArray, unsigned int planeIdx) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaArrayGetMemoryRequirements' in found_functions}} - {{if 'cudaArrayGetMemoryRequirements' in found_functions}} +cdef cyruntime.cudaError_t _cudaArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaArray_t array, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaArrayGetMemoryRequirements "cudaArrayGetMemoryRequirements"(cudaArrayMemoryRequirements* memoryRequirements, cudaArray_t array, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} - {{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaMipmappedArray_t mipmap, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMipmappedArrayGetMemoryRequirements "cudaMipmappedArrayGetMemoryRequirements"(cudaArrayMemoryRequirements* memoryRequirements, cudaMipmappedArray_t mipmap, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaArrayGetSparseProperties' in found_functions}} - {{if 'cudaArrayGetSparseProperties' in found_functions}} +cdef cyruntime.cudaError_t _cudaArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaArrayGetSparseProperties "cudaArrayGetSparseProperties"(cudaArraySparseProperties* sparseProperties, cudaArray_t array) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} - {{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaMipmappedArray_t mipmap) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMipmappedArrayGetSparseProperties "cudaMipmappedArrayGetSparseProperties"(cudaArraySparseProperties* sparseProperties, cudaMipmappedArray_t mipmap) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy' in found_functions}} - {{if 'cudaMemcpy' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy "cudaMemcpy"(void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyPeer' in found_functions}} - {{if 'cudaMemcpyPeer' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyPeer "cudaMemcpyPeer"(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2D' in found_functions}} - {{if 'cudaMemcpy2D' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2D "cudaMemcpy2D"(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2DToArray' in found_functions}} - {{if 'cudaMemcpy2DToArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2DToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2DToArray "cudaMemcpy2DToArray"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2DFromArray' in found_functions}} - {{if 'cudaMemcpy2DFromArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2DFromArray "cudaMemcpy2DFromArray"(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2DArrayToArray' in found_functions}} - {{if 'cudaMemcpy2DArrayToArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2DArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2DArrayToArray "cudaMemcpy2DArrayToArray"(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyAsync' in found_functions}} - {{if 'cudaMemcpyAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyAsync "cudaMemcpyAsync"(void* dst, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyPeerAsync' in found_functions}} - {{if 'cudaMemcpyPeerAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyPeerAsync "cudaMemcpyPeerAsync"(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyBatchAsync' in found_functions}} - {{if 'cudaMemcpyBatchAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cyruntime.cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyBatchAsync "cudaMemcpyBatchAsync"(void** dsts, void** srcs, size_t* sizes, size_t count, cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy3DBatchAsync' in found_functions}} - {{if 'cudaMemcpy3DBatchAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cyruntime.cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy3DBatchAsync "cudaMemcpy3DBatchAsync"(size_t numOps, cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2DAsync' in found_functions}} - {{if 'cudaMemcpy2DAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2DAsync "cudaMemcpy2DAsync"(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} - {{if 'cudaMemcpy2DToArrayAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2DToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2DToArrayAsync "cudaMemcpy2DToArrayAsync"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} - {{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpy2DFromArrayAsync "cudaMemcpy2DFromArrayAsync"(void* dst, size_t dpitch, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemset' in found_functions}} - {{if 'cudaMemset' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemset "cudaMemset"(void* devPtr, int value, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemset2D' in found_functions}} - {{if 'cudaMemset2D' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemset2D "cudaMemset2D"(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemset3D' in found_functions}} - {{if 'cudaMemset3D' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemset3D(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemset3D "cudaMemset3D"(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemsetAsync' in found_functions}} - {{if 'cudaMemsetAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemsetAsync "cudaMemsetAsync"(void* devPtr, int value, size_t count, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemset2DAsync' in found_functions}} - {{if 'cudaMemset2DAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemset2DAsync "cudaMemset2DAsync"(void* devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemset3DAsync' in found_functions}} - {{if 'cudaMemset3DAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemset3DAsync(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemset3DAsync "cudaMemset3DAsync"(cudaPitchedPtr pitchedDevPtr, int value, cudaExtent extent, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPrefetchAsync' in found_functions}} - {{if 'cudaMemPrefetchAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPrefetchAsync "cudaMemPrefetchAsync"(const void* devPtr, size_t count, int dstDevice, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPrefetchAsync_v2' in found_functions}} - {{if 'cudaMemPrefetchAsync_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cyruntime.cudaMemLocation location, unsigned int flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPrefetchAsync_v2 "cudaMemPrefetchAsync_v2"(const void* devPtr, size_t count, cudaMemLocation location, unsigned int flags, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemAdvise' in found_functions}} - {{if 'cudaMemAdvise' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemAdvise "cudaMemAdvise"(const void* devPtr, size_t count, cudaMemoryAdvise advice, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemAdvise_v2' in found_functions}} - {{if 'cudaMemAdvise_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, cyruntime.cudaMemLocation location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemAdvise_v2 "cudaMemAdvise_v2"(const void* devPtr, size_t count, cudaMemoryAdvise advice, cudaMemLocation location) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemRangeGetAttribute' in found_functions}} - {{if 'cudaMemRangeGetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cyruntime.cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemRangeGetAttribute "cudaMemRangeGetAttribute"(void* data, size_t dataSize, cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemRangeGetAttributes' in found_functions}} - {{if 'cudaMemRangeGetAttributes' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cyruntime.cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemRangeGetAttributes "cudaMemRangeGetAttributes"(void** data, size_t* dataSizes, cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyToArray' in found_functions}} - {{if 'cudaMemcpyToArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyToArray "cudaMemcpyToArray"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyFromArray' in found_functions}} - {{if 'cudaMemcpyFromArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyFromArray(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyFromArray "cudaMemcpyFromArray"(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyArrayToArray' in found_functions}} - {{if 'cudaMemcpyArrayToArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyArrayToArray "cudaMemcpyArrayToArray"(cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyToArrayAsync' in found_functions}} - {{if 'cudaMemcpyToArrayAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyToArrayAsync "cudaMemcpyToArrayAsync"(cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemcpyFromArrayAsync' in found_functions}} - {{if 'cudaMemcpyFromArrayAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemcpyFromArrayAsync "cudaMemcpyFromArrayAsync"(void* dst, cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cudaMemcpyKind kind, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocAsync' in found_functions}} - {{if 'cudaMallocAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocAsync "cudaMallocAsync"(void** devPtr, size_t size, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaFreeAsync' in found_functions}} - {{if 'cudaFreeAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaFreeAsync(void* devPtr, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaFreeAsync "cudaFreeAsync"(void* devPtr, cudaStream_t hStream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolTrimTo' in found_functions}} - {{if 'cudaMemPoolTrimTo' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolTrimTo(cyruntime.cudaMemPool_t memPool, size_t minBytesToKeep) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolTrimTo "cudaMemPoolTrimTo"(cudaMemPool_t memPool, size_t minBytesToKeep) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolSetAttribute' in found_functions}} - {{if 'cudaMemPoolSetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolSetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolSetAttribute "cudaMemPoolSetAttribute"(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolGetAttribute' in found_functions}} - {{if 'cudaMemPoolGetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolGetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolGetAttribute "cudaMemPoolGetAttribute"(cudaMemPool_t memPool, cudaMemPoolAttr attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolSetAccess' in found_functions}} - {{if 'cudaMemPoolSetAccess' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolSetAccess(cyruntime.cudaMemPool_t memPool, const cyruntime.cudaMemAccessDesc* descList, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolSetAccess "cudaMemPoolSetAccess"(cudaMemPool_t memPool, const cudaMemAccessDesc* descList, size_t count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolGetAccess' in found_functions}} - {{if 'cudaMemPoolGetAccess' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolGetAccess(cyruntime.cudaMemAccessFlags* flags, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemLocation* location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolGetAccess "cudaMemPoolGetAccess"(cudaMemAccessFlags* flags, cudaMemPool_t memPool, cudaMemLocation* location) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolCreate' in found_functions}} - {{if 'cudaMemPoolCreate' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolCreate(cyruntime.cudaMemPool_t* memPool, const cyruntime.cudaMemPoolProps* poolProps) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolCreate "cudaMemPoolCreate"(cudaMemPool_t* memPool, const cudaMemPoolProps* poolProps) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolDestroy' in found_functions}} - {{if 'cudaMemPoolDestroy' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolDestroy(cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolDestroy "cudaMemPoolDestroy"(cudaMemPool_t memPool) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMallocFromPoolAsync' in found_functions}} - {{if 'cudaMallocFromPoolAsync' in found_functions}} +cdef cyruntime.cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cyruntime.cudaMemPool_t memPool, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMallocFromPoolAsync "cudaMallocFromPoolAsync"(void** ptr, size_t size, cudaMemPool_t memPool, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} - {{if 'cudaMemPoolExportToShareableHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolExportToShareableHandle "cudaMemPoolExportToShareableHandle"(void* shareableHandle, cudaMemPool_t memPool, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} - {{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolImportFromShareableHandle(cyruntime.cudaMemPool_t* memPool, void* shareableHandle, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolImportFromShareableHandle "cudaMemPoolImportFromShareableHandle"(cudaMemPool_t* memPool, void* shareableHandle, cudaMemAllocationHandleType handleType, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolExportPointer' in found_functions}} - {{if 'cudaMemPoolExportPointer' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolExportPointer(cyruntime.cudaMemPoolPtrExportData* exportData, void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolExportPointer "cudaMemPoolExportPointer"(cudaMemPoolPtrExportData* exportData, void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaMemPoolImportPointer' in found_functions}} - {{if 'cudaMemPoolImportPointer' in found_functions}} +cdef cyruntime.cudaError_t _cudaMemPoolImportPointer(void** ptr, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolPtrExportData* exportData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaMemPoolImportPointer "cudaMemPoolImportPointer"(void** ptr, cudaMemPool_t memPool, cudaMemPoolPtrExportData* exportData) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaPointerGetAttributes' in found_functions}} - {{if 'cudaPointerGetAttributes' in found_functions}} +cdef cyruntime.cudaError_t _cudaPointerGetAttributes(cyruntime.cudaPointerAttributes* attributes, const void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaPointerGetAttributes "cudaPointerGetAttributes"(cudaPointerAttributes* attributes, const void* ptr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceCanAccessPeer' in found_functions}} - {{if 'cudaDeviceCanAccessPeer' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceCanAccessPeer "cudaDeviceCanAccessPeer"(int* canAccessPeer, int device, int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceEnablePeerAccess' in found_functions}} - {{if 'cudaDeviceEnablePeerAccess' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceEnablePeerAccess "cudaDeviceEnablePeerAccess"(int peerDevice, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceDisablePeerAccess' in found_functions}} - {{if 'cudaDeviceDisablePeerAccess' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceDisablePeerAccess "cudaDeviceDisablePeerAccess"(int peerDevice) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsUnregisterResource' in found_functions}} - {{if 'cudaGraphicsUnregisterResource' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsUnregisterResource(cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsUnregisterResource "cudaGraphicsUnregisterResource"(cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} - {{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsResourceSetMapFlags(cyruntime.cudaGraphicsResource_t resource, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsResourceSetMapFlags "cudaGraphicsResourceSetMapFlags"(cudaGraphicsResource_t resource, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsMapResources' in found_functions}} - {{if 'cudaGraphicsMapResources' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsMapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsMapResources "cudaGraphicsMapResources"(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsUnmapResources' in found_functions}} - {{if 'cudaGraphicsUnmapResources' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsUnmapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsUnmapResources "cudaGraphicsUnmapResources"(int count, cudaGraphicsResource_t* resources, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} - {{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsResourceGetMappedPointer "cudaGraphicsResourceGetMappedPointer"(void** devPtr, size_t* size, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} - {{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsSubResourceGetMappedArray(cyruntime.cudaArray_t* array, cyruntime.cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsSubResourceGetMappedArray "cudaGraphicsSubResourceGetMappedArray"(cudaArray_t* array, cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} - {{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray "cudaGraphicsResourceGetMappedMipmappedArray"(cudaMipmappedArray_t* mipmappedArray, cudaGraphicsResource_t resource) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetChannelDesc' in found_functions}} - {{if 'cudaGetChannelDesc' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetChannelDesc(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaArray_const_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetChannelDesc "cudaGetChannelDesc"(cudaChannelFormatDesc* desc, cudaArray_const_t array) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaCreateChannelDesc' in found_functions}} - {{if 'cudaCreateChannelDesc' in found_functions}} +cdef cyruntime.cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cyruntime.cudaChannelFormatKind f) nogil +{{endif}} - cudaChannelFormatDesc _cudaCreateChannelDesc "cudaCreateChannelDesc"(int x, int y, int z, int w, cudaChannelFormatKind f) nogil - {{endif}} +{{if 'cudaCreateTextureObject' in found_functions}} - {{if 'cudaCreateTextureObject' in found_functions}} +cdef cyruntime.cudaError_t _cudaCreateTextureObject(cyruntime.cudaTextureObject_t* pTexObject, const cyruntime.cudaResourceDesc* pResDesc, const cyruntime.cudaTextureDesc* pTexDesc, const cyruntime.cudaResourceViewDesc* pResViewDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaCreateTextureObject "cudaCreateTextureObject"(cudaTextureObject_t* pTexObject, const cudaResourceDesc* pResDesc, const cudaTextureDesc* pTexDesc, const cudaResourceViewDesc* pResViewDesc) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDestroyTextureObject' in found_functions}} - {{if 'cudaDestroyTextureObject' in found_functions}} +cdef cyruntime.cudaError_t _cudaDestroyTextureObject(cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDestroyTextureObject "cudaDestroyTextureObject"(cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} - {{if 'cudaGetTextureObjectResourceDesc' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetTextureObjectResourceDesc "cudaGetTextureObjectResourceDesc"(cudaResourceDesc* pResDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} - {{if 'cudaGetTextureObjectTextureDesc' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetTextureObjectTextureDesc(cyruntime.cudaTextureDesc* pTexDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetTextureObjectTextureDesc "cudaGetTextureObjectTextureDesc"(cudaTextureDesc* pTexDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} - {{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceViewDesc(cyruntime.cudaResourceViewDesc* pResViewDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetTextureObjectResourceViewDesc "cudaGetTextureObjectResourceViewDesc"(cudaResourceViewDesc* pResViewDesc, cudaTextureObject_t texObject) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaCreateSurfaceObject' in found_functions}} - {{if 'cudaCreateSurfaceObject' in found_functions}} +cdef cyruntime.cudaError_t _cudaCreateSurfaceObject(cyruntime.cudaSurfaceObject_t* pSurfObject, const cyruntime.cudaResourceDesc* pResDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaCreateSurfaceObject "cudaCreateSurfaceObject"(cudaSurfaceObject_t* pSurfObject, const cudaResourceDesc* pResDesc) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDestroySurfaceObject' in found_functions}} - {{if 'cudaDestroySurfaceObject' in found_functions}} +cdef cyruntime.cudaError_t _cudaDestroySurfaceObject(cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDestroySurfaceObject "cudaDestroySurfaceObject"(cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} - {{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetSurfaceObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetSurfaceObjectResourceDesc "cudaGetSurfaceObjectResourceDesc"(cudaResourceDesc* pResDesc, cudaSurfaceObject_t surfObject) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDriverGetVersion' in found_functions}} - {{if 'cudaDriverGetVersion' in found_functions}} +cdef cyruntime.cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDriverGetVersion "cudaDriverGetVersion"(int* driverVersion) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaRuntimeGetVersion' in found_functions}} - {{if 'cudaRuntimeGetVersion' in found_functions}} +cdef cyruntime.cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaRuntimeGetVersion "cudaRuntimeGetVersion"(int* runtimeVersion) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphCreate' in found_functions}} - {{if 'cudaGraphCreate' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphCreate(cyruntime.cudaGraph_t* pGraph, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphCreate "cudaGraphCreate"(cudaGraph_t* pGraph, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddKernelNode' in found_functions}} - {{if 'cudaGraphAddKernelNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddKernelNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddKernelNode "cudaGraphAddKernelNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphKernelNodeGetParams' in found_functions}} - {{if 'cudaGraphKernelNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphKernelNodeGetParams "cudaGraphKernelNodeGetParams"(cudaGraphNode_t node, cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphKernelNodeSetParams' in found_functions}} - {{if 'cudaGraphKernelNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphKernelNodeSetParams "cudaGraphKernelNodeSetParams"(cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} - {{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphKernelNodeCopyAttributes(cyruntime.cudaGraphNode_t hSrc, cyruntime.cudaGraphNode_t hDst) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphKernelNodeCopyAttributes "cudaGraphKernelNodeCopyAttributes"(cudaGraphNode_t hSrc, cudaGraphNode_t hDst) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} - {{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, cyruntime.cudaKernelNodeAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphKernelNodeGetAttribute "cudaGraphKernelNodeGetAttribute"(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, cudaKernelNodeAttrValue* value_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} - {{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, const cyruntime.cudaKernelNodeAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphKernelNodeSetAttribute "cudaGraphKernelNodeSetAttribute"(cudaGraphNode_t hNode, cudaKernelNodeAttrID attr, const cudaKernelNodeAttrValue* value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddMemcpyNode' in found_functions}} - {{if 'cudaGraphAddMemcpyNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemcpy3DParms* pCopyParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddMemcpyNode "cudaGraphAddMemcpyNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemcpy3DParms* pCopyParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} - {{if 'cudaGraphAddMemcpyNode1D' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode1D(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddMemcpyNode1D "cudaGraphAddMemcpyNode1D"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} - {{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemcpyNodeGetParams "cudaGraphMemcpyNodeGetParams"(cudaGraphNode_t node, cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} - {{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemcpyNodeSetParams "cudaGraphMemcpyNodeSetParams"(cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} - {{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams1D(cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemcpyNodeSetParams1D "cudaGraphMemcpyNodeSetParams1D"(cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddMemsetNode' in found_functions}} - {{if 'cudaGraphAddMemsetNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddMemsetNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemsetParams* pMemsetParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddMemsetNode "cudaGraphAddMemsetNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaMemsetParams* pMemsetParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} - {{if 'cudaGraphMemsetNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemsetNodeGetParams "cudaGraphMemsetNodeGetParams"(cudaGraphNode_t node, cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} - {{if 'cudaGraphMemsetNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemsetNodeSetParams "cudaGraphMemsetNodeSetParams"(cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddHostNode' in found_functions}} - {{if 'cudaGraphAddHostNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddHostNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddHostNode "cudaGraphAddHostNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphHostNodeGetParams' in found_functions}} - {{if 'cudaGraphHostNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphHostNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphHostNodeGetParams "cudaGraphHostNodeGetParams"(cudaGraphNode_t node, cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphHostNodeSetParams' in found_functions}} - {{if 'cudaGraphHostNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphHostNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphHostNodeSetParams "cudaGraphHostNodeSetParams"(cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddChildGraphNode' in found_functions}} - {{if 'cudaGraphAddChildGraphNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddChildGraphNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddChildGraphNode "cudaGraphAddChildGraphNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} - {{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphChildGraphNodeGetGraph(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphChildGraphNodeGetGraph "cudaGraphChildGraphNodeGetGraph"(cudaGraphNode_t node, cudaGraph_t* pGraph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddEmptyNode' in found_functions}} - {{if 'cudaGraphAddEmptyNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddEmptyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddEmptyNode "cudaGraphAddEmptyNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddEventRecordNode' in found_functions}} - {{if 'cudaGraphAddEventRecordNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddEventRecordNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddEventRecordNode "cudaGraphAddEventRecordNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} - {{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphEventRecordNodeGetEvent "cudaGraphEventRecordNodeGetEvent"(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} - {{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphEventRecordNodeSetEvent "cudaGraphEventRecordNodeSetEvent"(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddEventWaitNode' in found_functions}} - {{if 'cudaGraphAddEventWaitNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddEventWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddEventWaitNode "cudaGraphAddEventWaitNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} - {{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphEventWaitNodeGetEvent "cudaGraphEventWaitNodeGetEvent"(cudaGraphNode_t node, cudaEvent_t* event_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} - {{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphEventWaitNodeSetEvent "cudaGraphEventWaitNodeSetEvent"(cudaGraphNode_t node, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} - {{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddExternalSemaphoresSignalNode "cudaGraphAddExternalSemaphoresSignalNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} - {{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreSignalNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams "cudaGraphExternalSemaphoresSignalNodeGetParams"(cudaGraphNode_t hNode, cudaExternalSemaphoreSignalNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} - {{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams "cudaGraphExternalSemaphoresSignalNodeSetParams"(cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} - {{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddExternalSemaphoresWaitNode "cudaGraphAddExternalSemaphoresWaitNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} - {{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreWaitNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams "cudaGraphExternalSemaphoresWaitNodeGetParams"(cudaGraphNode_t hNode, cudaExternalSemaphoreWaitNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} - {{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams "cudaGraphExternalSemaphoresWaitNodeSetParams"(cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddMemAllocNode' in found_functions}} - {{if 'cudaGraphAddMemAllocNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddMemAllocNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaMemAllocNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddMemAllocNode "cudaGraphAddMemAllocNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaMemAllocNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} - {{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemAllocNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemAllocNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemAllocNodeGetParams "cudaGraphMemAllocNodeGetParams"(cudaGraphNode_t node, cudaMemAllocNodeParams* params_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddMemFreeNode' in found_functions}} - {{if 'cudaGraphAddMemFreeNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddMemFreeNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddMemFreeNode "cudaGraphAddMemFreeNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} - {{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphMemFreeNodeGetParams(cyruntime.cudaGraphNode_t node, void* dptr_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphMemFreeNodeGetParams "cudaGraphMemFreeNodeGetParams"(cudaGraphNode_t node, void* dptr_out) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGraphMemTrim' in found_functions}} - {{if 'cudaDeviceGraphMemTrim' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGraphMemTrim "cudaDeviceGraphMemTrim"(int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} - {{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceGetGraphMemAttribute "cudaDeviceGetGraphMemAttribute"(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} - {{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} +cdef cyruntime.cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaDeviceSetGraphMemAttribute "cudaDeviceSetGraphMemAttribute"(int device, cudaGraphMemAttributeType attr, void* value) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphClone' in found_functions}} - {{if 'cudaGraphClone' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphClone(cyruntime.cudaGraph_t* pGraphClone, cyruntime.cudaGraph_t originalGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphClone "cudaGraphClone"(cudaGraph_t* pGraphClone, cudaGraph_t originalGraph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeFindInClone' in found_functions}} - {{if 'cudaGraphNodeFindInClone' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeFindInClone(cyruntime.cudaGraphNode_t* pNode, cyruntime.cudaGraphNode_t originalNode, cyruntime.cudaGraph_t clonedGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeFindInClone "cudaGraphNodeFindInClone"(cudaGraphNode_t* pNode, cudaGraphNode_t originalNode, cudaGraph_t clonedGraph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeGetType' in found_functions}} - {{if 'cudaGraphNodeGetType' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeGetType(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeType* pType) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeGetType "cudaGraphNodeGetType"(cudaGraphNode_t node, cudaGraphNodeType* pType) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphGetNodes' in found_functions}} - {{if 'cudaGraphGetNodes' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphGetNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* nodes, size_t* numNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphGetNodes "cudaGraphGetNodes"(cudaGraph_t graph, cudaGraphNode_t* nodes, size_t* numNodes) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphGetRootNodes' in found_functions}} - {{if 'cudaGraphGetRootNodes' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphGetRootNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphGetRootNodes "cudaGraphGetRootNodes"(cudaGraph_t graph, cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphGetEdges' in found_functions}} - {{if 'cudaGraphGetEdges' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphGetEdges(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphGetEdges "cudaGraphGetEdges"(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphGetEdges_v2' in found_functions}} - {{if 'cudaGraphGetEdges_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphGetEdges_v2(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, cyruntime.cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphGetEdges_v2 "cudaGraphGetEdges_v2"(cudaGraph_t graph, cudaGraphNode_t* from_, cudaGraphNode_t* to, cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeGetDependencies' in found_functions}} - {{if 'cudaGraphNodeGetDependencies' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeGetDependencies "cudaGraphNodeGetDependencies"(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} - {{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeGetDependencies_v2 "cudaGraphNodeGetDependencies_v2"(cudaGraphNode_t node, cudaGraphNode_t* pDependencies, cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} - {{if 'cudaGraphNodeGetDependentNodes' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeGetDependentNodes "cudaGraphNodeGetDependentNodes"(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} - {{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeGetDependentNodes_v2 "cudaGraphNodeGetDependentNodes_v2"(cudaGraphNode_t node, cudaGraphNode_t* pDependentNodes, cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddDependencies' in found_functions}} - {{if 'cudaGraphAddDependencies' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddDependencies "cudaGraphAddDependencies"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddDependencies_v2' in found_functions}} - {{if 'cudaGraphAddDependencies_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddDependencies_v2 "cudaGraphAddDependencies_v2"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphRemoveDependencies' in found_functions}} - {{if 'cudaGraphRemoveDependencies' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphRemoveDependencies "cudaGraphRemoveDependencies"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} - {{if 'cudaGraphRemoveDependencies_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphRemoveDependencies_v2 "cudaGraphRemoveDependencies_v2"(cudaGraph_t graph, const cudaGraphNode_t* from_, const cudaGraphNode_t* to, const cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphDestroyNode' in found_functions}} - {{if 'cudaGraphDestroyNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphDestroyNode(cyruntime.cudaGraphNode_t node) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphDestroyNode "cudaGraphDestroyNode"(cudaGraphNode_t node) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphInstantiate' in found_functions}} - {{if 'cudaGraphInstantiate' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphInstantiate(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphInstantiate "cudaGraphInstantiate"(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphInstantiateWithFlags' in found_functions}} - {{if 'cudaGraphInstantiateWithFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithFlags(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphInstantiateWithFlags "cudaGraphInstantiateWithFlags"(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, unsigned long long flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphInstantiateWithParams' in found_functions}} - {{if 'cudaGraphInstantiateWithParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithParams(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, cyruntime.cudaGraphInstantiateParams* instantiateParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphInstantiateWithParams "cudaGraphInstantiateWithParams"(cudaGraphExec_t* pGraphExec, cudaGraph_t graph, cudaGraphInstantiateParams* instantiateParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecGetFlags' in found_functions}} - {{if 'cudaGraphExecGetFlags' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecGetFlags(cyruntime.cudaGraphExec_t graphExec, unsigned long long* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecGetFlags "cudaGraphExecGetFlags"(cudaGraphExec_t graphExec, unsigned long long* flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} - {{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecKernelNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecKernelNodeSetParams "cudaGraphExecKernelNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaKernelNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} - {{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecMemcpyNodeSetParams "cudaGraphExecMemcpyNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemcpy3DParms* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} - {{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecMemcpyNodeSetParams1D "cudaGraphExecMemcpyNodeSetParams1D"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, void* dst, const void* src, size_t count, cudaMemcpyKind kind) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} - {{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecMemsetNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecMemsetNodeSetParams "cudaGraphExecMemsetNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaMemsetParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} - {{if 'cudaGraphExecHostNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecHostNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecHostNodeSetParams "cudaGraphExecHostNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, const cudaHostNodeParams* pNodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} - {{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecChildGraphNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecChildGraphNodeSetParams "cudaGraphExecChildGraphNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t node, cudaGraph_t childGraph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} - {{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecEventRecordNodeSetEvent "cudaGraphExecEventRecordNodeSetEvent"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} - {{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecEventWaitNodeSetEvent "cudaGraphExecEventWaitNodeSetEvent"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, cudaEvent_t event) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} - {{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams "cudaGraphExecExternalSemaphoresSignalNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} - {{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams "cudaGraphExecExternalSemaphoresWaitNodeSetParams"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, const cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeSetEnabled' in found_functions}} - {{if 'cudaGraphNodeSetEnabled' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeSetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeSetEnabled "cudaGraphNodeSetEnabled"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeGetEnabled' in found_functions}} - {{if 'cudaGraphNodeGetEnabled' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeGetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeGetEnabled "cudaGraphNodeGetEnabled"(cudaGraphExec_t hGraphExec, cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecUpdate' in found_functions}} - {{if 'cudaGraphExecUpdate' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecUpdate(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraph_t hGraph, cyruntime.cudaGraphExecUpdateResultInfo* resultInfo) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecUpdate "cudaGraphExecUpdate"(cudaGraphExec_t hGraphExec, cudaGraph_t hGraph, cudaGraphExecUpdateResultInfo* resultInfo) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphUpload' in found_functions}} - {{if 'cudaGraphUpload' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphUpload(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphUpload "cudaGraphUpload"(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphLaunch' in found_functions}} - {{if 'cudaGraphLaunch' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphLaunch(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphLaunch "cudaGraphLaunch"(cudaGraphExec_t graphExec, cudaStream_t stream) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecDestroy' in found_functions}} - {{if 'cudaGraphExecDestroy' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecDestroy(cyruntime.cudaGraphExec_t graphExec) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecDestroy "cudaGraphExecDestroy"(cudaGraphExec_t graphExec) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphDestroy' in found_functions}} - {{if 'cudaGraphDestroy' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphDestroy(cyruntime.cudaGraph_t graph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphDestroy "cudaGraphDestroy"(cudaGraph_t graph) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphDebugDotPrint' in found_functions}} - {{if 'cudaGraphDebugDotPrint' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphDebugDotPrint(cyruntime.cudaGraph_t graph, const char* path, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphDebugDotPrint "cudaGraphDebugDotPrint"(cudaGraph_t graph, const char* path, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaUserObjectCreate' in found_functions}} - {{if 'cudaUserObjectCreate' in found_functions}} +cdef cyruntime.cudaError_t _cudaUserObjectCreate(cyruntime.cudaUserObject_t* object_out, void* ptr, cyruntime.cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaUserObjectCreate "cudaUserObjectCreate"(cudaUserObject_t* object_out, void* ptr, cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaUserObjectRetain' in found_functions}} - {{if 'cudaUserObjectRetain' in found_functions}} +cdef cyruntime.cudaError_t _cudaUserObjectRetain(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaUserObjectRetain "cudaUserObjectRetain"(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaUserObjectRelease' in found_functions}} - {{if 'cudaUserObjectRelease' in found_functions}} +cdef cyruntime.cudaError_t _cudaUserObjectRelease(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaUserObjectRelease "cudaUserObjectRelease"(cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphRetainUserObject' in found_functions}} - {{if 'cudaGraphRetainUserObject' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphRetainUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphRetainUserObject "cudaGraphRetainUserObject"(cudaGraph_t graph, cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphReleaseUserObject' in found_functions}} - {{if 'cudaGraphReleaseUserObject' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphReleaseUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphReleaseUserObject "cudaGraphReleaseUserObject"(cudaGraph_t graph, cudaUserObject_t object, unsigned int count) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddNode' in found_functions}} - {{if 'cudaGraphAddNode' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddNode "cudaGraphAddNode"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphAddNode_v2' in found_functions}} - {{if 'cudaGraphAddNode_v2' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphAddNode_v2(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphAddNode_v2 "cudaGraphAddNode_v2"(cudaGraphNode_t* pGraphNode, cudaGraph_t graph, const cudaGraphNode_t* pDependencies, const cudaGraphEdgeData* dependencyData, size_t numDependencies, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphNodeSetParams' in found_functions}} - {{if 'cudaGraphNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphNodeSetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphNodeSetParams "cudaGraphNodeSetParams"(cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphExecNodeSetParams' in found_functions}} - {{if 'cudaGraphExecNodeSetParams' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphExecNodeSetParams(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphExecNodeSetParams "cudaGraphExecNodeSetParams"(cudaGraphExec_t graphExec, cudaGraphNode_t node, cudaGraphNodeParams* nodeParams) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGraphConditionalHandleCreate' in found_functions}} - {{if 'cudaGraphConditionalHandleCreate' in found_functions}} +cdef cyruntime.cudaError_t _cudaGraphConditionalHandleCreate(cyruntime.cudaGraphConditionalHandle* pHandle_out, cyruntime.cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGraphConditionalHandleCreate "cudaGraphConditionalHandleCreate"(cudaGraphConditionalHandle* pHandle_out, cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetDriverEntryPoint' in found_functions}} - {{if 'cudaGetDriverEntryPoint' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetDriverEntryPoint "cudaGetDriverEntryPoint"(const char* symbol, void** funcPtr, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} - {{if 'cudaGetDriverEntryPointByVersion' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetDriverEntryPointByVersion "cudaGetDriverEntryPointByVersion"(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cudaDriverEntryPointQueryResult* driverStatus) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryLoadData' in found_functions}} - {{if 'cudaLibraryLoadData' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryLoadData(cyruntime.cudaLibrary_t* library, const void* code, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryLoadData "cudaLibraryLoadData"(cudaLibrary_t* library, const void* code, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryLoadFromFile' in found_functions}} - {{if 'cudaLibraryLoadFromFile' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryLoadFromFile(cyruntime.cudaLibrary_t* library, const char* fileName, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryLoadFromFile "cudaLibraryLoadFromFile"(cudaLibrary_t* library, const char* fileName, cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryUnload' in found_functions}} - {{if 'cudaLibraryUnload' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryUnload(cyruntime.cudaLibrary_t library) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryUnload "cudaLibraryUnload"(cudaLibrary_t library) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryGetKernel' in found_functions}} - {{if 'cudaLibraryGetKernel' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryGetKernel(cyruntime.cudaKernel_t* pKernel, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryGetKernel "cudaLibraryGetKernel"(cudaKernel_t* pKernel, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryGetGlobal' in found_functions}} - {{if 'cudaLibraryGetGlobal' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryGetGlobal "cudaLibraryGetGlobal"(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryGetManaged' in found_functions}} - {{if 'cudaLibraryGetManaged' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryGetManaged "cudaLibraryGetManaged"(void** dptr, size_t* numbytes, cudaLibrary_t library, const char* name) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryGetUnifiedFunction' in found_functions}} - {{if 'cudaLibraryGetUnifiedFunction' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cyruntime.cudaLibrary_t library, const char* symbol) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryGetUnifiedFunction "cudaLibraryGetUnifiedFunction"(void** fptr, cudaLibrary_t library, const char* symbol) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryGetKernelCount' in found_functions}} - {{if 'cudaLibraryGetKernelCount' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryGetKernelCount "cudaLibraryGetKernelCount"(unsigned int* count, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaLibraryEnumerateKernels' in found_functions}} - {{if 'cudaLibraryEnumerateKernels' in found_functions}} +cdef cyruntime.cudaError_t _cudaLibraryEnumerateKernels(cyruntime.cudaKernel_t* kernels, unsigned int numKernels, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaLibraryEnumerateKernels "cudaLibraryEnumerateKernels"(cudaKernel_t* kernels, unsigned int numKernels, cudaLibrary_t lib) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaKernelSetAttributeForDevice' in found_functions}} - {{if 'cudaKernelSetAttributeForDevice' in found_functions}} +cdef cyruntime.cudaError_t _cudaKernelSetAttributeForDevice(cyruntime.cudaKernel_t kernel, cyruntime.cudaFuncAttribute attr, int value, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaKernelSetAttributeForDevice "cudaKernelSetAttributeForDevice"(cudaKernel_t kernel, cudaFuncAttribute attr, int value, int device) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetExportTable' in found_functions}} - {{if 'cudaGetExportTable' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetExportTable(const void** ppExportTable, const cyruntime.cudaUUID_t* pExportTableId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetExportTable "cudaGetExportTable"(const void** ppExportTable, const cudaUUID_t* pExportTableId) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'cudaGetKernel' in found_functions}} - {{if 'cudaGetKernel' in found_functions}} +cdef cyruntime.cudaError_t _cudaGetKernel(cyruntime.cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} - cudaError_t _cudaGetKernel "cudaGetKernel"(cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +{{if 'make_cudaPitchedPtr' in found_functions}} +cdef cyruntime.cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil +{{endif}} -cdef extern from "cuda_runtime.h": +{{if 'make_cudaPos' in found_functions}} - {{if 'make_cudaPitchedPtr' in found_functions}} +cdef cyruntime.cudaPos _make_cudaPos(size_t x, size_t y, size_t z) nogil +{{endif}} - cudaPitchedPtr _make_cudaPitchedPtr "make_cudaPitchedPtr"(void* d, size_t p, size_t xsz, size_t ysz) nogil - {{endif}} +{{if 'make_cudaExtent' in found_functions}} - {{if 'make_cudaPos' in found_functions}} +cdef cyruntime.cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) nogil +{{endif}} - cudaPos _make_cudaPos "make_cudaPos"(size_t x, size_t y, size_t z) nogil - {{endif}} +{{if 'cudaProfilerStart' in found_functions}} - {{if 'make_cudaExtent' in found_functions}} - - cudaExtent _make_cudaExtent "make_cudaExtent"(size_t w, size_t h, size_t d) nogil - {{endif}} - - -cdef extern from "cuda_profiler_api.h": - - {{if 'cudaProfilerStart' in found_functions}} - - cudaError_t _cudaProfilerStart "cudaProfilerStart"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} - - {{if 'cudaProfilerStop' in found_functions}} - - cudaError_t _cudaProfilerStop "cudaProfilerStop"() except ?cudaErrorCallRequiresNewerDriver nogil - {{endif}} +cdef cyruntime.cudaError_t _cudaProfilerStart() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} +{{if 'cudaProfilerStop' in found_functions}} +cdef cyruntime.cudaError_t _cudaProfilerStop() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} diff --git a/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxi.in b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxi.in new file mode 100644 index 000000000..cf46efe91 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pxi.in @@ -0,0 +1,1496 @@ +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. +# +# Please refer to the NVIDIA end user license agreement (EULA) associated +# with this source code for terms and conditions that govern your use of +# this software. Any use, reproduction, disclosure, or distribution of +# this software and related documentation outside the terms of the EULA +# is strictly prohibited. +# +# This code was automatically generated with version 12.8.0. Do not modify it directly. +cimport cuda.bindings.cyruntime as cyruntime + +cdef extern from "cuda_runtime_api.h": + + {{if 'cudaDeviceReset' in found_functions}} + + cyruntime.cudaError_t cudaDeviceReset() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceSynchronize' in found_functions}} + + cyruntime.cudaError_t cudaDeviceSynchronize() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceSetLimit' in found_functions}} + + cyruntime.cudaError_t cudaDeviceSetLimit(cyruntime.cudaLimit limit, size_t value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetLimit' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetLimit(size_t* pValue, cyruntime.cudaLimit limit) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cyruntime.cudaChannelFormatDesc* fmtDesc, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetCacheConfig' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetCacheConfig(cyruntime.cudaFuncCache* pCacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceSetCacheConfig' in found_functions}} + + cyruntime.cudaError_t cudaDeviceSetCacheConfig(cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetByPCIBusId' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetPCIBusId' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaIpcGetEventHandle' in found_functions}} + + cyruntime.cudaError_t cudaIpcGetEventHandle(cyruntime.cudaIpcEventHandle_t* handle, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaIpcOpenEventHandle' in found_functions}} + + cyruntime.cudaError_t cudaIpcOpenEventHandle(cyruntime.cudaEvent_t* event, cyruntime.cudaIpcEventHandle_t handle) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaIpcGetMemHandle' in found_functions}} + + cyruntime.cudaError_t cudaIpcGetMemHandle(cyruntime.cudaIpcMemHandle_t* handle, void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaIpcOpenMemHandle' in found_functions}} + + cyruntime.cudaError_t cudaIpcOpenMemHandle(void** devPtr, cyruntime.cudaIpcMemHandle_t handle, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaIpcCloseMemHandle' in found_functions}} + + cyruntime.cudaError_t cudaIpcCloseMemHandle(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} + + cyruntime.cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cyruntime.cudaFlushGPUDirectRDMAWritesTarget target, cyruntime.cudaFlushGPUDirectRDMAWritesScope scope) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + + cyruntime.cudaError_t cudaDeviceRegisterAsyncNotification(int device, cyruntime.cudaAsyncCallback callbackFunc, void* userData, cyruntime.cudaAsyncCallbackHandle_t* callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} + + cyruntime.cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cyruntime.cudaAsyncCallbackHandle_t callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetSharedMemConfig' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetSharedMemConfig(cyruntime.cudaSharedMemConfig* pConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceSetSharedMemConfig' in found_functions}} + + cyruntime.cudaError_t cudaDeviceSetSharedMemConfig(cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetLastError' in found_functions}} + + cyruntime.cudaError_t cudaGetLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaPeekAtLastError' in found_functions}} + + cyruntime.cudaError_t cudaPeekAtLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetErrorName' in found_functions}} + + const char* cudaGetErrorName(cyruntime.cudaError_t error) except ?NULL nogil + + {{endif}} + {{if 'cudaGetErrorString' in found_functions}} + + const char* cudaGetErrorString(cyruntime.cudaError_t error) except ?NULL nogil + + {{endif}} + {{if 'cudaGetDeviceCount' in found_functions}} + + cyruntime.cudaError_t cudaGetDeviceCount(int* count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetDeviceProperties_v2' in found_functions}} + + cyruntime.cudaError_t cudaGetDeviceProperties_v2(cyruntime.cudaDeviceProp* prop, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetAttribute(int* value, cyruntime.cudaDeviceAttr attr, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetDefaultMemPool' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetDefaultMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceSetMemPool' in found_functions}} + + cyruntime.cudaError_t cudaDeviceSetMemPool(int device, cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetMemPool' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetP2PAttribute' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetP2PAttribute(int* value, cyruntime.cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaChooseDevice' in found_functions}} + + cyruntime.cudaError_t cudaChooseDevice(int* device, const cyruntime.cudaDeviceProp* prop) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaInitDevice' in found_functions}} + + cyruntime.cudaError_t cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaSetDevice' in found_functions}} + + cyruntime.cudaError_t cudaSetDevice(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetDevice' in found_functions}} + + cyruntime.cudaError_t cudaGetDevice(int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaSetDeviceFlags' in found_functions}} + + cyruntime.cudaError_t cudaSetDeviceFlags(unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetDeviceFlags' in found_functions}} + + cyruntime.cudaError_t cudaGetDeviceFlags(unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamCreate' in found_functions}} + + cyruntime.cudaError_t cudaStreamCreate(cyruntime.cudaStream_t* pStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamCreateWithFlags' in found_functions}} + + cyruntime.cudaError_t cudaStreamCreateWithFlags(cyruntime.cudaStream_t* pStream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamCreateWithPriority' in found_functions}} + + cyruntime.cudaError_t cudaStreamCreateWithPriority(cyruntime.cudaStream_t* pStream, unsigned int flags, int priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetPriority' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetPriority(cyruntime.cudaStream_t hStream, int* priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetFlags' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetFlags(cyruntime.cudaStream_t hStream, unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetId' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetId(cyruntime.cudaStream_t hStream, unsigned long long* streamId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetDevice' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetDevice(cyruntime.cudaStream_t hStream, int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaCtxResetPersistingL2Cache' in found_functions}} + + cyruntime.cudaError_t cudaCtxResetPersistingL2Cache() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamCopyAttributes' in found_functions}} + + cyruntime.cudaError_t cudaStreamCopyAttributes(cyruntime.cudaStream_t dst, cyruntime.cudaStream_t src) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, cyruntime.cudaStreamAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamSetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaStreamSetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, const cyruntime.cudaStreamAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamDestroy' in found_functions}} + + cyruntime.cudaError_t cudaStreamDestroy(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamWaitEvent' in found_functions}} + + cyruntime.cudaError_t cudaStreamWaitEvent(cyruntime.cudaStream_t stream, cyruntime.cudaEvent_t event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamAddCallback' in found_functions}} + + cyruntime.cudaError_t cudaStreamAddCallback(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamSynchronize' in found_functions}} + + cyruntime.cudaError_t cudaStreamSynchronize(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamQuery' in found_functions}} + + cyruntime.cudaError_t cudaStreamQuery(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamAttachMemAsync' in found_functions}} + + cyruntime.cudaError_t cudaStreamAttachMemAsync(cyruntime.cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamBeginCapture' in found_functions}} + + cyruntime.cudaError_t cudaStreamBeginCapture(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamBeginCaptureToGraph' in found_functions}} + + cyruntime.cudaError_t cudaStreamBeginCaptureToGraph(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} + + cyruntime.cudaError_t cudaThreadExchangeStreamCaptureMode(cyruntime.cudaStreamCaptureMode* mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamEndCapture' in found_functions}} + + cyruntime.cudaError_t cudaStreamEndCapture(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamIsCapturing' in found_functions}} + + cyruntime.cudaError_t cudaStreamIsCapturing(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* pCaptureStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetCaptureInfo_v2_ptsz(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetCaptureInfo_v2(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} + + cyruntime.cudaError_t cudaStreamGetCaptureInfo_v3(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, const cyruntime.cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} + + cyruntime.cudaError_t cudaStreamUpdateCaptureDependencies(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} + + cyruntime.cudaError_t cudaStreamUpdateCaptureDependencies_v2(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventCreate' in found_functions}} + + cyruntime.cudaError_t cudaEventCreate(cyruntime.cudaEvent_t* event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventCreateWithFlags' in found_functions}} + + cyruntime.cudaError_t cudaEventCreateWithFlags(cyruntime.cudaEvent_t* event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventRecord' in found_functions}} + + cyruntime.cudaError_t cudaEventRecord(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventRecordWithFlags' in found_functions}} + + cyruntime.cudaError_t cudaEventRecordWithFlags(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventQuery' in found_functions}} + + cyruntime.cudaError_t cudaEventQuery(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventSynchronize' in found_functions}} + + cyruntime.cudaError_t cudaEventSynchronize(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventDestroy' in found_functions}} + + cyruntime.cudaError_t cudaEventDestroy(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventElapsedTime' in found_functions}} + + cyruntime.cudaError_t cudaEventElapsedTime(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaEventElapsedTime_v2' in found_functions}} + + cyruntime.cudaError_t cudaEventElapsedTime_v2(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaImportExternalMemory' in found_functions}} + + cyruntime.cudaError_t cudaImportExternalMemory(cyruntime.cudaExternalMemory_t* extMem_out, const cyruntime.cudaExternalMemoryHandleDesc* memHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} + + cyruntime.cudaError_t cudaExternalMemoryGetMappedBuffer(void** devPtr, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryBufferDesc* bufferDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} + + cyruntime.cudaError_t cudaExternalMemoryGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmap, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDestroyExternalMemory' in found_functions}} + + cyruntime.cudaError_t cudaDestroyExternalMemory(cyruntime.cudaExternalMemory_t extMem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaImportExternalSemaphore' in found_functions}} + + cyruntime.cudaError_t cudaImportExternalSemaphore(cyruntime.cudaExternalSemaphore_t* extSem_out, const cyruntime.cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + + cyruntime.cudaError_t cudaSignalExternalSemaphoresAsync_v2_ptsz(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + + cyruntime.cudaError_t cudaSignalExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + + cyruntime.cudaError_t cudaWaitExternalSemaphoresAsync_v2_ptsz(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + + cyruntime.cudaError_t cudaWaitExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDestroyExternalSemaphore' in found_functions}} + + cyruntime.cudaError_t cudaDestroyExternalSemaphore(cyruntime.cudaExternalSemaphore_t extSem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFuncSetCacheConfig' in found_functions}} + + cyruntime.cudaError_t cudaFuncSetCacheConfig(const void* func, cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFuncGetAttributes' in found_functions}} + + cyruntime.cudaError_t cudaFuncGetAttributes(cyruntime.cudaFuncAttributes* attr, const void* func) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFuncSetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaFuncSetAttribute(const void* func, cyruntime.cudaFuncAttribute attr, int value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLaunchHostFunc' in found_functions}} + + cyruntime.cudaError_t cudaLaunchHostFunc(cyruntime.cudaStream_t stream, cyruntime.cudaHostFn_t fn, void* userData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFuncSetSharedMemConfig' in found_functions}} + + cyruntime.cudaError_t cudaFuncSetSharedMemConfig(const void* func, cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + + cyruntime.cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + + cyruntime.cudaError_t cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + + cyruntime.cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocManaged' in found_functions}} + + cyruntime.cudaError_t cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMalloc' in found_functions}} + + cyruntime.cudaError_t cudaMalloc(void** devPtr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocHost' in found_functions}} + + cyruntime.cudaError_t cudaMallocHost(void** ptr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocPitch' in found_functions}} + + cyruntime.cudaError_t cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocArray' in found_functions}} + + cyruntime.cudaError_t cudaMallocArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFree' in found_functions}} + + cyruntime.cudaError_t cudaFree(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFreeHost' in found_functions}} + + cyruntime.cudaError_t cudaFreeHost(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFreeArray' in found_functions}} + + cyruntime.cudaError_t cudaFreeArray(cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFreeMipmappedArray' in found_functions}} + + cyruntime.cudaError_t cudaFreeMipmappedArray(cyruntime.cudaMipmappedArray_t mipmappedArray) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaHostAlloc' in found_functions}} + + cyruntime.cudaError_t cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaHostRegister' in found_functions}} + + cyruntime.cudaError_t cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaHostUnregister' in found_functions}} + + cyruntime.cudaError_t cudaHostUnregister(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaHostGetDevicePointer' in found_functions}} + + cyruntime.cudaError_t cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaHostGetFlags' in found_functions}} + + cyruntime.cudaError_t cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMalloc3D' in found_functions}} + + cyruntime.cudaError_t cudaMalloc3D(cyruntime.cudaPitchedPtr* pitchedDevPtr, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMalloc3DArray' in found_functions}} + + cyruntime.cudaError_t cudaMalloc3DArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocMipmappedArray' in found_functions}} + + cyruntime.cudaError_t cudaMallocMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetMipmappedArrayLevel' in found_functions}} + + cyruntime.cudaError_t cudaGetMipmappedArrayLevel(cyruntime.cudaArray_t* levelArray, cyruntime.cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy3D' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy3D(const cyruntime.cudaMemcpy3DParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy3DPeer' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy3DPeer(const cyruntime.cudaMemcpy3DPeerParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy3DAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy3DAsync(const cyruntime.cudaMemcpy3DParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy3DPeerAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy3DPeerAsync(const cyruntime.cudaMemcpy3DPeerParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemGetInfo' in found_functions}} + + cyruntime.cudaError_t cudaMemGetInfo(size_t* free, size_t* total) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaArrayGetInfo' in found_functions}} + + cyruntime.cudaError_t cudaArrayGetInfo(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent* extent, unsigned int* flags, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaArrayGetPlane' in found_functions}} + + cyruntime.cudaError_t cudaArrayGetPlane(cyruntime.cudaArray_t* pPlaneArray, cyruntime.cudaArray_t hArray, unsigned int planeIdx) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaArrayGetMemoryRequirements' in found_functions}} + + cyruntime.cudaError_t cudaArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaArray_t array, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} + + cyruntime.cudaError_t cudaMipmappedArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaMipmappedArray_t mipmap, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaArrayGetSparseProperties' in found_functions}} + + cyruntime.cudaError_t cudaArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} + + cyruntime.cudaError_t cudaMipmappedArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaMipmappedArray_t mipmap) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyPeer' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2D' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2DToArray' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2DToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2DFromArray' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2DFromArray(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2DArrayToArray' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2DArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyAsync(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyPeerAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyBatchAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cyruntime.cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy3DBatchAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy3DBatchAsync(size_t numOps, cyruntime.cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2DAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2DToArrayAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2DToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemset' in found_functions}} + + cyruntime.cudaError_t cudaMemset(void* devPtr, int value, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemset2D' in found_functions}} + + cyruntime.cudaError_t cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemset3D' in found_functions}} + + cyruntime.cudaError_t cudaMemset3D(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemsetAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemsetAsync(void* devPtr, int value, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemset2DAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemset3DAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemset3DAsync(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPrefetchAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPrefetchAsync_v2' in found_functions}} + + cyruntime.cudaError_t cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cyruntime.cudaMemLocation location, unsigned int flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemAdvise' in found_functions}} + + cyruntime.cudaError_t cudaMemAdvise(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemAdvise_v2' in found_functions}} + + cyruntime.cudaError_t cudaMemAdvise_v2(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, cyruntime.cudaMemLocation location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemRangeGetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaMemRangeGetAttribute(void* data, size_t dataSize, cyruntime.cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemRangeGetAttributes' in found_functions}} + + cyruntime.cudaError_t cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cyruntime.cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyToArray' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyFromArray' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyFromArray(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyArrayToArray' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyToArrayAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemcpyFromArrayAsync' in found_functions}} + + cyruntime.cudaError_t cudaMemcpyFromArrayAsync(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocAsync' in found_functions}} + + cyruntime.cudaError_t cudaMallocAsync(void** devPtr, size_t size, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaFreeAsync' in found_functions}} + + cyruntime.cudaError_t cudaFreeAsync(void* devPtr, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolTrimTo' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolTrimTo(cyruntime.cudaMemPool_t memPool, size_t minBytesToKeep) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolSetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolSetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolGetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolGetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolSetAccess' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolSetAccess(cyruntime.cudaMemPool_t memPool, const cyruntime.cudaMemAccessDesc* descList, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolGetAccess' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolGetAccess(cyruntime.cudaMemAccessFlags* flags, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemLocation* location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolCreate' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolCreate(cyruntime.cudaMemPool_t* memPool, const cyruntime.cudaMemPoolProps* poolProps) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolDestroy' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolDestroy(cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMallocFromPoolAsync' in found_functions}} + + cyruntime.cudaError_t cudaMallocFromPoolAsync(void** ptr, size_t size, cyruntime.cudaMemPool_t memPool, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolExportToShareableHandle' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolExportToShareableHandle(void* shareableHandle, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolImportFromShareableHandle(cyruntime.cudaMemPool_t* memPool, void* shareableHandle, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolExportPointer' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolExportPointer(cyruntime.cudaMemPoolPtrExportData* exportData, void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaMemPoolImportPointer' in found_functions}} + + cyruntime.cudaError_t cudaMemPoolImportPointer(void** ptr, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolPtrExportData* exportData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaPointerGetAttributes' in found_functions}} + + cyruntime.cudaError_t cudaPointerGetAttributes(cyruntime.cudaPointerAttributes* attributes, const void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceCanAccessPeer' in found_functions}} + + cyruntime.cudaError_t cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceEnablePeerAccess' in found_functions}} + + cyruntime.cudaError_t cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceDisablePeerAccess' in found_functions}} + + cyruntime.cudaError_t cudaDeviceDisablePeerAccess(int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsUnregisterResource' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsUnregisterResource(cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsResourceSetMapFlags(cyruntime.cudaGraphicsResource_t resource, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsMapResources' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsMapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsUnmapResources' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsUnmapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsSubResourceGetMappedArray(cyruntime.cudaArray_t* array, cyruntime.cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} + + cyruntime.cudaError_t cudaGraphicsResourceGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetChannelDesc' in found_functions}} + + cyruntime.cudaError_t cudaGetChannelDesc(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaArray_const_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaCreateChannelDesc' in found_functions}} + + cyruntime.cudaChannelFormatDesc cudaCreateChannelDesc(int x, int y, int z, int w, cyruntime.cudaChannelFormatKind f) nogil + + {{endif}} + {{if 'cudaCreateTextureObject' in found_functions}} + + cyruntime.cudaError_t cudaCreateTextureObject(cyruntime.cudaTextureObject_t* pTexObject, const cyruntime.cudaResourceDesc* pResDesc, const cyruntime.cudaTextureDesc* pTexDesc, const cyruntime.cudaResourceViewDesc* pResViewDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDestroyTextureObject' in found_functions}} + + cyruntime.cudaError_t cudaDestroyTextureObject(cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetTextureObjectResourceDesc' in found_functions}} + + cyruntime.cudaError_t cudaGetTextureObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetTextureObjectTextureDesc' in found_functions}} + + cyruntime.cudaError_t cudaGetTextureObjectTextureDesc(cyruntime.cudaTextureDesc* pTexDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} + + cyruntime.cudaError_t cudaGetTextureObjectResourceViewDesc(cyruntime.cudaResourceViewDesc* pResViewDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaCreateSurfaceObject' in found_functions}} + + cyruntime.cudaError_t cudaCreateSurfaceObject(cyruntime.cudaSurfaceObject_t* pSurfObject, const cyruntime.cudaResourceDesc* pResDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDestroySurfaceObject' in found_functions}} + + cyruntime.cudaError_t cudaDestroySurfaceObject(cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} + + cyruntime.cudaError_t cudaGetSurfaceObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDriverGetVersion' in found_functions}} + + cyruntime.cudaError_t cudaDriverGetVersion(int* driverVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaRuntimeGetVersion' in found_functions}} + + cyruntime.cudaError_t cudaRuntimeGetVersion(int* runtimeVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphCreate' in found_functions}} + + cyruntime.cudaError_t cudaGraphCreate(cyruntime.cudaGraph_t* pGraph, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddKernelNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddKernelNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphKernelNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphKernelNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphKernelNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphKernelNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} + + cyruntime.cudaError_t cudaGraphKernelNodeCopyAttributes(cyruntime.cudaGraphNode_t hSrc, cyruntime.cudaGraphNode_t hDst) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaGraphKernelNodeGetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, cyruntime.cudaKernelNodeAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} + + cyruntime.cudaError_t cudaGraphKernelNodeSetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, const cyruntime.cudaKernelNodeAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddMemcpyNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddMemcpyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemcpy3DParms* pCopyParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddMemcpyNode1D' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddMemcpyNode1D(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemcpyNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemcpyNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemcpyNodeSetParams1D(cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddMemsetNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddMemsetNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemsetParams* pMemsetParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemsetNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemsetNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemsetNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemsetNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddHostNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddHostNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphHostNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphHostNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphHostNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphHostNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddChildGraphNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddChildGraphNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} + + cyruntime.cudaError_t cudaGraphChildGraphNodeGetGraph(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddEmptyNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddEmptyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddEventRecordNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddEventRecordNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} + + cyruntime.cudaError_t cudaGraphEventRecordNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} + + cyruntime.cudaError_t cudaGraphEventRecordNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddEventWaitNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddEventWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} + + cyruntime.cudaError_t cudaGraphEventWaitNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} + + cyruntime.cudaError_t cudaGraphEventWaitNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddExternalSemaphoresSignalNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExternalSemaphoresSignalNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreSignalNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddExternalSemaphoresWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExternalSemaphoresWaitNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreWaitNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddMemAllocNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddMemAllocNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaMemAllocNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemAllocNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemAllocNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddMemFreeNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddMemFreeNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphMemFreeNodeGetParams(cyruntime.cudaGraphNode_t node, void* dptr_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGraphMemTrim' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGraphMemTrim(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} + + cyruntime.cudaError_t cudaDeviceGetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} + + cyruntime.cudaError_t cudaDeviceSetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphClone' in found_functions}} + + cyruntime.cudaError_t cudaGraphClone(cyruntime.cudaGraph_t* pGraphClone, cyruntime.cudaGraph_t originalGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeFindInClone' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeFindInClone(cyruntime.cudaGraphNode_t* pNode, cyruntime.cudaGraphNode_t originalNode, cyruntime.cudaGraph_t clonedGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeGetType' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeGetType(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeType* pType) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphGetNodes' in found_functions}} + + cyruntime.cudaError_t cudaGraphGetNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* nodes, size_t* numNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphGetRootNodes' in found_functions}} + + cyruntime.cudaError_t cudaGraphGetRootNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphGetEdges' in found_functions}} + + cyruntime.cudaError_t cudaGraphGetEdges(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphGetEdges_v2' in found_functions}} + + cyruntime.cudaError_t cudaGraphGetEdges_v2(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, cyruntime.cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeGetDependencies' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeGetDependencies(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeGetDependencies_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeGetDependentNodes' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeGetDependentNodes(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeGetDependentNodes_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddDependencies' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddDependencies_v2' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphRemoveDependencies' in found_functions}} + + cyruntime.cudaError_t cudaGraphRemoveDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphRemoveDependencies_v2' in found_functions}} + + cyruntime.cudaError_t cudaGraphRemoveDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphDestroyNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphDestroyNode(cyruntime.cudaGraphNode_t node) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphInstantiate' in found_functions}} + + cyruntime.cudaError_t cudaGraphInstantiate(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphInstantiateWithFlags' in found_functions}} + + cyruntime.cudaError_t cudaGraphInstantiateWithFlags(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphInstantiateWithParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphInstantiateWithParams(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, cyruntime.cudaGraphInstantiateParams* instantiateParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecGetFlags' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecGetFlags(cyruntime.cudaGraphExec_t graphExec, unsigned long long* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecKernelNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecMemcpyNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecMemcpyNodeSetParams1D(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecMemsetNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecHostNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecHostNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecChildGraphNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecEventRecordNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecEventWaitNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeSetEnabled' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeSetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeGetEnabled' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeGetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecUpdate' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecUpdate(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraph_t hGraph, cyruntime.cudaGraphExecUpdateResultInfo* resultInfo) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphUpload' in found_functions}} + + cyruntime.cudaError_t cudaGraphUpload(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphLaunch' in found_functions}} + + cyruntime.cudaError_t cudaGraphLaunch(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecDestroy' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecDestroy(cyruntime.cudaGraphExec_t graphExec) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphDestroy' in found_functions}} + + cyruntime.cudaError_t cudaGraphDestroy(cyruntime.cudaGraph_t graph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphDebugDotPrint' in found_functions}} + + cyruntime.cudaError_t cudaGraphDebugDotPrint(cyruntime.cudaGraph_t graph, const char* path, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaUserObjectCreate' in found_functions}} + + cyruntime.cudaError_t cudaUserObjectCreate(cyruntime.cudaUserObject_t* object_out, void* ptr, cyruntime.cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaUserObjectRetain' in found_functions}} + + cyruntime.cudaError_t cudaUserObjectRetain(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaUserObjectRelease' in found_functions}} + + cyruntime.cudaError_t cudaUserObjectRelease(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphRetainUserObject' in found_functions}} + + cyruntime.cudaError_t cudaGraphRetainUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphReleaseUserObject' in found_functions}} + + cyruntime.cudaError_t cudaGraphReleaseUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddNode' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphAddNode_v2' in found_functions}} + + cyruntime.cudaError_t cudaGraphAddNode_v2(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphNodeSetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphExecNodeSetParams' in found_functions}} + + cyruntime.cudaError_t cudaGraphExecNodeSetParams(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGraphConditionalHandleCreate' in found_functions}} + + cyruntime.cudaError_t cudaGraphConditionalHandleCreate(cyruntime.cudaGraphConditionalHandle* pHandle_out, cyruntime.cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetDriverEntryPoint' in found_functions}} + + cyruntime.cudaError_t cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetDriverEntryPointByVersion' in found_functions}} + + cyruntime.cudaError_t cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryLoadData' in found_functions}} + + cyruntime.cudaError_t cudaLibraryLoadData(cyruntime.cudaLibrary_t* library, const void* code, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryLoadFromFile' in found_functions}} + + cyruntime.cudaError_t cudaLibraryLoadFromFile(cyruntime.cudaLibrary_t* library, const char* fileName, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryUnload' in found_functions}} + + cyruntime.cudaError_t cudaLibraryUnload(cyruntime.cudaLibrary_t library) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryGetKernel' in found_functions}} + + cyruntime.cudaError_t cudaLibraryGetKernel(cyruntime.cudaKernel_t* pKernel, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryGetGlobal' in found_functions}} + + cyruntime.cudaError_t cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryGetManaged' in found_functions}} + + cyruntime.cudaError_t cudaLibraryGetManaged(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryGetUnifiedFunction' in found_functions}} + + cyruntime.cudaError_t cudaLibraryGetUnifiedFunction(void** fptr, cyruntime.cudaLibrary_t library, const char* symbol) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryGetKernelCount' in found_functions}} + + cyruntime.cudaError_t cudaLibraryGetKernelCount(unsigned int* count, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaLibraryEnumerateKernels' in found_functions}} + + cyruntime.cudaError_t cudaLibraryEnumerateKernels(cyruntime.cudaKernel_t* kernels, unsigned int numKernels, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaKernelSetAttributeForDevice' in found_functions}} + + cyruntime.cudaError_t cudaKernelSetAttributeForDevice(cyruntime.cudaKernel_t kernel, cyruntime.cudaFuncAttribute attr, int value, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetExportTable' in found_functions}} + + cyruntime.cudaError_t cudaGetExportTable(const void** ppExportTable, const cyruntime.cudaUUID_t* pExportTableId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaGetKernel' in found_functions}} + + cyruntime.cudaError_t cudaGetKernel(cyruntime.cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + +cdef extern from "cuda_runtime.h": + + {{if 'make_cudaPitchedPtr' in found_functions}} + + cyruntime.cudaPitchedPtr make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil + + {{endif}} + {{if 'make_cudaPos' in found_functions}} + + cyruntime.cudaPos make_cudaPos(size_t x, size_t y, size_t z) nogil + + {{endif}} + {{if 'make_cudaExtent' in found_functions}} + + cyruntime.cudaExtent make_cudaExtent(size_t w, size_t h, size_t d) nogil + + {{endif}} + +cdef extern from "cuda_profiler_api.h": + + {{if 'cudaProfilerStart' in found_functions}} + + cyruntime.cudaError_t cudaProfilerStart() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + {{if 'cudaProfilerStop' in found_functions}} + + cyruntime.cudaError_t cudaProfilerStop() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil + + {{endif}} + + diff --git a/cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in new file mode 100644 index 000000000..1d799a104 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in @@ -0,0 +1,2653 @@ +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. +# +# Please refer to the NVIDIA end user license agreement (EULA) associated +# with this source code for terms and conditions that govern your use of +# this software. Any use, reproduction, disclosure, or distribution of +# this software and related documentation outside the terms of the EULA +# is strictly prohibited. +# +# This code was automatically generated with version 12.8.0. Do not modify it directly. +include "cyruntime.pxi" + +import os +cimport cuda.bindings._bindings.cyruntime_ptds as ptds + +cdef bint __cudaPythonInit = False +cdef bint __usePTDS = False +cdef int cudaPythonInit() except -1 nogil: + global __cudaPythonInit + global __usePTDS + if __cudaPythonInit: + return __usePTDS + with gil: + __usePTDS = os.getenv('CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM', default=False) + __cudaPythonInit = True + return __usePTDS + +{{if 'cudaDeviceReset' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceReset() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceReset() + return cudaDeviceReset() +{{endif}} + +{{if 'cudaDeviceSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSynchronize() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSynchronize() + return cudaDeviceSynchronize() +{{endif}} + +{{if 'cudaDeviceSetLimit' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetLimit(cyruntime.cudaLimit limit, size_t value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetLimit(limit, value) + return cudaDeviceSetLimit(limit, value) +{{endif}} + +{{if 'cudaDeviceGetLimit' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetLimit(size_t* pValue, cyruntime.cudaLimit limit) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetLimit(pValue, limit) + return cudaDeviceGetLimit(pValue, limit) +{{endif}} + +{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cyruntime.cudaChannelFormatDesc* fmtDesc, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) + return cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) +{{endif}} + +{{if 'cudaDeviceGetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetCacheConfig(cyruntime.cudaFuncCache* pCacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetCacheConfig(pCacheConfig) + return cudaDeviceGetCacheConfig(pCacheConfig) +{{endif}} + +{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) + return cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) +{{endif}} + +{{if 'cudaDeviceSetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetCacheConfig(cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetCacheConfig(cacheConfig) + return cudaDeviceSetCacheConfig(cacheConfig) +{{endif}} + +{{if 'cudaDeviceGetByPCIBusId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetByPCIBusId(device, pciBusId) + return cudaDeviceGetByPCIBusId(device, pciBusId) +{{endif}} + +{{if 'cudaDeviceGetPCIBusId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetPCIBusId(pciBusId, length, device) + return cudaDeviceGetPCIBusId(pciBusId, length, device) +{{endif}} + +{{if 'cudaIpcGetEventHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcGetEventHandle(cyruntime.cudaIpcEventHandle_t* handle, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcGetEventHandle(handle, event) + return cudaIpcGetEventHandle(handle, event) +{{endif}} + +{{if 'cudaIpcOpenEventHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcOpenEventHandle(cyruntime.cudaEvent_t* event, cyruntime.cudaIpcEventHandle_t handle) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcOpenEventHandle(event, handle) + return cudaIpcOpenEventHandle(event, handle) +{{endif}} + +{{if 'cudaIpcGetMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcGetMemHandle(cyruntime.cudaIpcMemHandle_t* handle, void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcGetMemHandle(handle, devPtr) + return cudaIpcGetMemHandle(handle, devPtr) +{{endif}} + +{{if 'cudaIpcOpenMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cyruntime.cudaIpcMemHandle_t handle, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcOpenMemHandle(devPtr, handle, flags) + return cudaIpcOpenMemHandle(devPtr, handle, flags) +{{endif}} + +{{if 'cudaIpcCloseMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaIpcCloseMemHandle(devPtr) + return cudaIpcCloseMemHandle(devPtr) +{{endif}} + +{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cyruntime.cudaFlushGPUDirectRDMAWritesTarget target, cyruntime.cudaFlushGPUDirectRDMAWritesScope scope) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceFlushGPUDirectRDMAWrites(target, scope) + return cudaDeviceFlushGPUDirectRDMAWrites(target, scope) +{{endif}} + +{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cyruntime.cudaAsyncCallback callbackFunc, void* userData, cyruntime.cudaAsyncCallbackHandle_t* callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) + return cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) +{{endif}} + +{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cyruntime.cudaAsyncCallbackHandle_t callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceUnregisterAsyncNotification(device, callback) + return cudaDeviceUnregisterAsyncNotification(device, callback) +{{endif}} + +{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetSharedMemConfig(cyruntime.cudaSharedMemConfig* pConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetSharedMemConfig(pConfig) + return cudaDeviceGetSharedMemConfig(pConfig) +{{endif}} + +{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetSharedMemConfig(cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetSharedMemConfig(config) + return cudaDeviceSetSharedMemConfig(config) +{{endif}} + +{{if 'cudaGetLastError' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetLastError() + return cudaGetLastError() +{{endif}} + +{{if 'cudaPeekAtLastError' in found_functions}} + +cdef cyruntime.cudaError_t _cudaPeekAtLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaPeekAtLastError() + return cudaPeekAtLastError() +{{endif}} + +{{if 'cudaGetErrorName' in found_functions}} + +cdef const char* _cudaGetErrorName(cyruntime.cudaError_t error) except ?NULL nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetErrorName(error) + return cudaGetErrorName(error) +{{endif}} + +{{if 'cudaGetErrorString' in found_functions}} + +cdef const char* _cudaGetErrorString(cyruntime.cudaError_t error) except ?NULL nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetErrorString(error) + return cudaGetErrorString(error) +{{endif}} + +{{if 'cudaGetDeviceCount' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceCount(int* count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceCount(count) + return cudaGetDeviceCount(count) +{{endif}} + +{{if 'cudaGetDeviceProperties_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceProperties_v2(cyruntime.cudaDeviceProp* prop, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceProperties_v2(prop, device) + return cudaGetDeviceProperties_v2(prop, device) +{{endif}} + +{{if 'cudaDeviceGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetAttribute(int* value, cyruntime.cudaDeviceAttr attr, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetAttribute(value, attr, device) + return cudaDeviceGetAttribute(value, attr, device) +{{endif}} + +{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetDefaultMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetDefaultMemPool(memPool, device) + return cudaDeviceGetDefaultMemPool(memPool, device) +{{endif}} + +{{if 'cudaDeviceSetMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetMemPool(int device, cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetMemPool(device, memPool) + return cudaDeviceSetMemPool(device, memPool) +{{endif}} + +{{if 'cudaDeviceGetMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetMemPool(memPool, device) + return cudaDeviceGetMemPool(memPool, device) +{{endif}} + +{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) + return cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) +{{endif}} + +{{if 'cudaDeviceGetP2PAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetP2PAttribute(int* value, cyruntime.cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) + return cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) +{{endif}} + +{{if 'cudaChooseDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaChooseDevice(int* device, const cyruntime.cudaDeviceProp* prop) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaChooseDevice(device, prop) + return cudaChooseDevice(device, prop) +{{endif}} + +{{if 'cudaInitDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaInitDevice(device, deviceFlags, flags) + return cudaInitDevice(device, deviceFlags, flags) +{{endif}} + +{{if 'cudaSetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSetDevice(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSetDevice(device) + return cudaSetDevice(device) +{{endif}} + +{{if 'cudaGetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDevice(int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDevice(device) + return cudaGetDevice(device) +{{endif}} + +{{if 'cudaSetDeviceFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSetDeviceFlags(flags) + return cudaSetDeviceFlags(flags) +{{endif}} + +{{if 'cudaGetDeviceFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDeviceFlags(flags) + return cudaGetDeviceFlags(flags) +{{endif}} + +{{if 'cudaStreamCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreate(cyruntime.cudaStream_t* pStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreate(pStream) + return cudaStreamCreate(pStream) +{{endif}} + +{{if 'cudaStreamCreateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreateWithFlags(cyruntime.cudaStream_t* pStream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreateWithFlags(pStream, flags) + return cudaStreamCreateWithFlags(pStream, flags) +{{endif}} + +{{if 'cudaStreamCreateWithPriority' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreateWithPriority(cyruntime.cudaStream_t* pStream, unsigned int flags, int priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCreateWithPriority(pStream, flags, priority) + return cudaStreamCreateWithPriority(pStream, flags, priority) +{{endif}} + +{{if 'cudaStreamGetPriority' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetPriority(cyruntime.cudaStream_t hStream, int* priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetPriority(hStream, priority) + return cudaStreamGetPriority(hStream, priority) +{{endif}} + +{{if 'cudaStreamGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetFlags(cyruntime.cudaStream_t hStream, unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetFlags(hStream, flags) + return cudaStreamGetFlags(hStream, flags) +{{endif}} + +{{if 'cudaStreamGetId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetId(cyruntime.cudaStream_t hStream, unsigned long long* streamId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetId(hStream, streamId) + return cudaStreamGetId(hStream, streamId) +{{endif}} + +{{if 'cudaStreamGetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetDevice(cyruntime.cudaStream_t hStream, int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetDevice(hStream, device) + return cudaStreamGetDevice(hStream, device) +{{endif}} + +{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCtxResetPersistingL2Cache() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCtxResetPersistingL2Cache() + return cudaCtxResetPersistingL2Cache() +{{endif}} + +{{if 'cudaStreamCopyAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCopyAttributes(cyruntime.cudaStream_t dst, cyruntime.cudaStream_t src) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamCopyAttributes(dst, src) + return cudaStreamCopyAttributes(dst, src) +{{endif}} + +{{if 'cudaStreamGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, cyruntime.cudaStreamAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetAttribute(hStream, attr, value_out) + return cudaStreamGetAttribute(hStream, attr, value_out) +{{endif}} + +{{if 'cudaStreamSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamSetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, const cyruntime.cudaStreamAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamSetAttribute(hStream, attr, value) + return cudaStreamSetAttribute(hStream, attr, value) +{{endif}} + +{{if 'cudaStreamDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamDestroy(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamDestroy(stream) + return cudaStreamDestroy(stream) +{{endif}} + +{{if 'cudaStreamWaitEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamWaitEvent(cyruntime.cudaStream_t stream, cyruntime.cudaEvent_t event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamWaitEvent(stream, event, flags) + return cudaStreamWaitEvent(stream, event, flags) +{{endif}} + +{{if 'cudaStreamAddCallback' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamAddCallback(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamAddCallback(stream, callback, userData, flags) + return cudaStreamAddCallback(stream, callback, userData, flags) +{{endif}} + +{{if 'cudaStreamSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamSynchronize(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamSynchronize(stream) + return cudaStreamSynchronize(stream) +{{endif}} + +{{if 'cudaStreamQuery' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamQuery(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamQuery(stream) + return cudaStreamQuery(stream) +{{endif}} + +{{if 'cudaStreamAttachMemAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamAttachMemAsync(cyruntime.cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamAttachMemAsync(stream, devPtr, length, flags) + return cudaStreamAttachMemAsync(stream, devPtr, length, flags) +{{endif}} + +{{if 'cudaStreamBeginCapture' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamBeginCapture(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginCapture(stream, mode) + return cudaStreamBeginCapture(stream, mode) +{{endif}} + +{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamBeginCaptureToGraph(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) + return cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) +{{endif}} + +{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaThreadExchangeStreamCaptureMode(cyruntime.cudaStreamCaptureMode* mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaThreadExchangeStreamCaptureMode(mode) + return cudaThreadExchangeStreamCaptureMode(mode) +{{endif}} + +{{if 'cudaStreamEndCapture' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamEndCapture(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamEndCapture(stream, pGraph) + return cudaStreamEndCapture(stream, pGraph) +{{endif}} + +{{if 'cudaStreamIsCapturing' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamIsCapturing(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* pCaptureStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamIsCapturing(stream, pCaptureStatus) + return cudaStreamIsCapturing(stream, pCaptureStatus) +{{endif}} + +{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v2(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetCaptureInfo_v2(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) + return cudaStreamGetCaptureInfo_v2(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) +{{endif}} + +{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v3(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, const cyruntime.cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamGetCaptureInfo_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) + return cudaStreamGetCaptureInfo_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) +{{endif}} + +{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) + return cudaStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) +{{endif}} + +{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) + return cudaStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) +{{endif}} + +{{if 'cudaEventCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventCreate(cyruntime.cudaEvent_t* event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventCreate(event) + return cudaEventCreate(event) +{{endif}} + +{{if 'cudaEventCreateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventCreateWithFlags(cyruntime.cudaEvent_t* event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventCreateWithFlags(event, flags) + return cudaEventCreateWithFlags(event, flags) +{{endif}} + +{{if 'cudaEventRecord' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventRecord(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventRecord(event, stream) + return cudaEventRecord(event, stream) +{{endif}} + +{{if 'cudaEventRecordWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventRecordWithFlags(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventRecordWithFlags(event, stream, flags) + return cudaEventRecordWithFlags(event, stream, flags) +{{endif}} + +{{if 'cudaEventQuery' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventQuery(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventQuery(event) + return cudaEventQuery(event) +{{endif}} + +{{if 'cudaEventSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventSynchronize(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventSynchronize(event) + return cudaEventSynchronize(event) +{{endif}} + +{{if 'cudaEventDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventDestroy(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventDestroy(event) + return cudaEventDestroy(event) +{{endif}} + +{{if 'cudaEventElapsedTime' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventElapsedTime(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventElapsedTime(ms, start, end) + return cudaEventElapsedTime(ms, start, end) +{{endif}} + +{{if 'cudaEventElapsedTime_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventElapsedTime_v2(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaEventElapsedTime_v2(ms, start, end) + return cudaEventElapsedTime_v2(ms, start, end) +{{endif}} + +{{if 'cudaImportExternalMemory' in found_functions}} + +cdef cyruntime.cudaError_t _cudaImportExternalMemory(cyruntime.cudaExternalMemory_t* extMem_out, const cyruntime.cudaExternalMemoryHandleDesc* memHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaImportExternalMemory(extMem_out, memHandleDesc) + return cudaImportExternalMemory(extMem_out, memHandleDesc) +{{endif}} + +{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryBufferDesc* bufferDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) + return cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) +{{endif}} + +{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmap, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) + return cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) +{{endif}} + +{{if 'cudaDestroyExternalMemory' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyExternalMemory(cyruntime.cudaExternalMemory_t extMem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyExternalMemory(extMem) + return cudaDestroyExternalMemory(extMem) +{{endif}} + +{{if 'cudaImportExternalSemaphore' in found_functions}} + +cdef cyruntime.cudaError_t _cudaImportExternalSemaphore(cyruntime.cudaExternalSemaphore_t* extSem_out, const cyruntime.cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaImportExternalSemaphore(extSem_out, semHandleDesc) + return cudaImportExternalSemaphore(extSem_out, semHandleDesc) +{{endif}} + +{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaSignalExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) + return cudaSignalExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) +{{endif}} + +{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaWaitExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) + return cudaWaitExternalSemaphoresAsync_v2(extSemArray, paramsArray, numExtSems, stream) +{{endif}} + +{{if 'cudaDestroyExternalSemaphore' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyExternalSemaphore(cyruntime.cudaExternalSemaphore_t extSem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyExternalSemaphore(extSem) + return cudaDestroyExternalSemaphore(extSem) +{{endif}} + +{{if 'cudaFuncSetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetCacheConfig(const void* func, cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetCacheConfig(func, cacheConfig) + return cudaFuncSetCacheConfig(func, cacheConfig) +{{endif}} + +{{if 'cudaFuncGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncGetAttributes(cyruntime.cudaFuncAttributes* attr, const void* func) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncGetAttributes(attr, func) + return cudaFuncGetAttributes(attr, func) +{{endif}} + +{{if 'cudaFuncSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetAttribute(const void* func, cyruntime.cudaFuncAttribute attr, int value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetAttribute(func, attr, value) + return cudaFuncSetAttribute(func, attr, value) +{{endif}} + +{{if 'cudaLaunchHostFunc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLaunchHostFunc(cyruntime.cudaStream_t stream, cyruntime.cudaHostFn_t fn, void* userData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLaunchHostFunc(stream, fn, userData) + return cudaLaunchHostFunc(stream, fn, userData) +{{endif}} + +{{if 'cudaFuncSetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFuncSetSharedMemConfig(func, config) + return cudaFuncSetSharedMemConfig(func, config) +{{endif}} + +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) + return cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) +{{endif}} + +{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) + return cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) +{{endif}} + +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) + return cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) +{{endif}} + +{{if 'cudaMallocManaged' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocManaged(devPtr, size, flags) + return cudaMallocManaged(devPtr, size, flags) +{{endif}} + +{{if 'cudaMalloc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc(devPtr, size) + return cudaMalloc(devPtr, size) +{{endif}} + +{{if 'cudaMallocHost' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocHost(ptr, size) + return cudaMallocHost(ptr, size) +{{endif}} + +{{if 'cudaMallocPitch' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocPitch(devPtr, pitch, width, height) + return cudaMallocPitch(devPtr, pitch, width, height) +{{endif}} + +{{if 'cudaMallocArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocArray(array, desc, width, height, flags) + return cudaMallocArray(array, desc, width, height, flags) +{{endif}} + +{{if 'cudaFree' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFree(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFree(devPtr) + return cudaFree(devPtr) +{{endif}} + +{{if 'cudaFreeHost' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeHost(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeHost(ptr) + return cudaFreeHost(ptr) +{{endif}} + +{{if 'cudaFreeArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeArray(cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeArray(array) + return cudaFreeArray(array) +{{endif}} + +{{if 'cudaFreeMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeMipmappedArray(cyruntime.cudaMipmappedArray_t mipmappedArray) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeMipmappedArray(mipmappedArray) + return cudaFreeMipmappedArray(mipmappedArray) +{{endif}} + +{{if 'cudaHostAlloc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostAlloc(pHost, size, flags) + return cudaHostAlloc(pHost, size, flags) +{{endif}} + +{{if 'cudaHostRegister' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostRegister(ptr, size, flags) + return cudaHostRegister(ptr, size, flags) +{{endif}} + +{{if 'cudaHostUnregister' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostUnregister(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostUnregister(ptr) + return cudaHostUnregister(ptr) +{{endif}} + +{{if 'cudaHostGetDevicePointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostGetDevicePointer(pDevice, pHost, flags) + return cudaHostGetDevicePointer(pDevice, pHost, flags) +{{endif}} + +{{if 'cudaHostGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaHostGetFlags(pFlags, pHost) + return cudaHostGetFlags(pFlags, pHost) +{{endif}} + +{{if 'cudaMalloc3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc3D(cyruntime.cudaPitchedPtr* pitchedDevPtr, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc3D(pitchedDevPtr, extent) + return cudaMalloc3D(pitchedDevPtr, extent) +{{endif}} + +{{if 'cudaMalloc3DArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc3DArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMalloc3DArray(array, desc, extent, flags) + return cudaMalloc3DArray(array, desc, extent, flags) +{{endif}} + +{{if 'cudaMallocMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) + return cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) +{{endif}} + +{{if 'cudaGetMipmappedArrayLevel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetMipmappedArrayLevel(cyruntime.cudaArray_t* levelArray, cyruntime.cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) + return cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) +{{endif}} + +{{if 'cudaMemcpy3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3D(const cyruntime.cudaMemcpy3DParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3D(p) + return cudaMemcpy3D(p) +{{endif}} + +{{if 'cudaMemcpy3DPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DPeer(const cyruntime.cudaMemcpy3DPeerParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DPeer(p) + return cudaMemcpy3DPeer(p) +{{endif}} + +{{if 'cudaMemcpy3DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DAsync(const cyruntime.cudaMemcpy3DParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DAsync(p, stream) + return cudaMemcpy3DAsync(p, stream) +{{endif}} + +{{if 'cudaMemcpy3DPeerAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DPeerAsync(const cyruntime.cudaMemcpy3DPeerParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DPeerAsync(p, stream) + return cudaMemcpy3DPeerAsync(p, stream) +{{endif}} + +{{if 'cudaMemGetInfo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemGetInfo(free, total) + return cudaMemGetInfo(free, total) +{{endif}} + +{{if 'cudaArrayGetInfo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetInfo(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent* extent, unsigned int* flags, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetInfo(desc, extent, flags, array) + return cudaArrayGetInfo(desc, extent, flags, array) +{{endif}} + +{{if 'cudaArrayGetPlane' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetPlane(cyruntime.cudaArray_t* pPlaneArray, cyruntime.cudaArray_t hArray, unsigned int planeIdx) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) + return cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) +{{endif}} + +{{if 'cudaArrayGetMemoryRequirements' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaArray_t array, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetMemoryRequirements(memoryRequirements, array, device) + return cudaArrayGetMemoryRequirements(memoryRequirements, array, device) +{{endif}} + +{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaMipmappedArray_t mipmap, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) + return cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) +{{endif}} + +{{if 'cudaArrayGetSparseProperties' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaArrayGetSparseProperties(sparseProperties, array) + return cudaArrayGetSparseProperties(sparseProperties, array) +{{endif}} + +{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaMipmappedArray_t mipmap) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) + return cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) +{{endif}} + +{{if 'cudaMemcpy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy(dst, src, count, kind) + return cudaMemcpy(dst, src, count, kind) +{{endif}} + +{{if 'cudaMemcpyPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) + return cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) +{{endif}} + +{{if 'cudaMemcpy2D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) + return cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) +{{endif}} + +{{if 'cudaMemcpy2DToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) + return cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) +{{endif}} + +{{if 'cudaMemcpy2DFromArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) + return cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) +{{endif}} + +{{if 'cudaMemcpy2DArrayToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) + return cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) +{{endif}} + +{{if 'cudaMemcpyAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyAsync(dst, src, count, kind, stream) + return cudaMemcpyAsync(dst, src, count, kind, stream) +{{endif}} + +{{if 'cudaMemcpyPeerAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) + return cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) +{{endif}} + +{{if 'cudaMemcpyBatchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cyruntime.cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, failIdx, stream) + return cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, failIdx, stream) +{{endif}} + +{{if 'cudaMemcpy3DBatchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cyruntime.cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy3DBatchAsync(numOps, opList, failIdx, flags, stream) + return cudaMemcpy3DBatchAsync(numOps, opList, failIdx, flags, stream) +{{endif}} + +{{if 'cudaMemcpy2DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) + return cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) +{{endif}} + +{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) + return cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) +{{endif}} + +{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) + return cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) +{{endif}} + +{{if 'cudaMemset' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset(devPtr, value, count) + return cudaMemset(devPtr, value, count) +{{endif}} + +{{if 'cudaMemset2D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset2D(devPtr, pitch, value, width, height) + return cudaMemset2D(devPtr, pitch, value, width, height) +{{endif}} + +{{if 'cudaMemset3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset3D(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset3D(pitchedDevPtr, value, extent) + return cudaMemset3D(pitchedDevPtr, value, extent) +{{endif}} + +{{if 'cudaMemsetAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemsetAsync(devPtr, value, count, stream) + return cudaMemsetAsync(devPtr, value, count, stream) +{{endif}} + +{{if 'cudaMemset2DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) + return cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) +{{endif}} + +{{if 'cudaMemset3DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset3DAsync(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) + return cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) +{{endif}} + +{{if 'cudaMemPrefetchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPrefetchAsync(devPtr, count, dstDevice, stream) + return cudaMemPrefetchAsync(devPtr, count, dstDevice, stream) +{{endif}} + +{{if 'cudaMemPrefetchAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cyruntime.cudaMemLocation location, unsigned int flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPrefetchAsync_v2(devPtr, count, location, flags, stream) + return cudaMemPrefetchAsync_v2(devPtr, count, location, flags, stream) +{{endif}} + +{{if 'cudaMemAdvise' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemAdvise(devPtr, count, advice, device) + return cudaMemAdvise(devPtr, count, advice, device) +{{endif}} + +{{if 'cudaMemAdvise_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, cyruntime.cudaMemLocation location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemAdvise_v2(devPtr, count, advice, location) + return cudaMemAdvise_v2(devPtr, count, advice, location) +{{endif}} + +{{if 'cudaMemRangeGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cyruntime.cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) + return cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) +{{endif}} + +{{if 'cudaMemRangeGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cyruntime.cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) + return cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) +{{endif}} + +{{if 'cudaMemcpyToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) + return cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) +{{endif}} + +{{if 'cudaMemcpyFromArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyFromArray(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) + return cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) +{{endif}} + +{{if 'cudaMemcpyArrayToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) + return cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) +{{endif}} + +{{if 'cudaMemcpyToArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) + return cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) +{{endif}} + +{{if 'cudaMemcpyFromArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) + return cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) +{{endif}} + +{{if 'cudaMallocAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocAsync(devPtr, size, hStream) + return cudaMallocAsync(devPtr, size, hStream) +{{endif}} + +{{if 'cudaFreeAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeAsync(void* devPtr, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaFreeAsync(devPtr, hStream) + return cudaFreeAsync(devPtr, hStream) +{{endif}} + +{{if 'cudaMemPoolTrimTo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolTrimTo(cyruntime.cudaMemPool_t memPool, size_t minBytesToKeep) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolTrimTo(memPool, minBytesToKeep) + return cudaMemPoolTrimTo(memPool, minBytesToKeep) +{{endif}} + +{{if 'cudaMemPoolSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolSetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolSetAttribute(memPool, attr, value) + return cudaMemPoolSetAttribute(memPool, attr, value) +{{endif}} + +{{if 'cudaMemPoolGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolGetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolGetAttribute(memPool, attr, value) + return cudaMemPoolGetAttribute(memPool, attr, value) +{{endif}} + +{{if 'cudaMemPoolSetAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolSetAccess(cyruntime.cudaMemPool_t memPool, const cyruntime.cudaMemAccessDesc* descList, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolSetAccess(memPool, descList, count) + return cudaMemPoolSetAccess(memPool, descList, count) +{{endif}} + +{{if 'cudaMemPoolGetAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolGetAccess(cyruntime.cudaMemAccessFlags* flags, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemLocation* location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolGetAccess(flags, memPool, location) + return cudaMemPoolGetAccess(flags, memPool, location) +{{endif}} + +{{if 'cudaMemPoolCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolCreate(cyruntime.cudaMemPool_t* memPool, const cyruntime.cudaMemPoolProps* poolProps) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolCreate(memPool, poolProps) + return cudaMemPoolCreate(memPool, poolProps) +{{endif}} + +{{if 'cudaMemPoolDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolDestroy(cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolDestroy(memPool) + return cudaMemPoolDestroy(memPool) +{{endif}} + +{{if 'cudaMallocFromPoolAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cyruntime.cudaMemPool_t memPool, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMallocFromPoolAsync(ptr, size, memPool, stream) + return cudaMallocFromPoolAsync(ptr, size, memPool, stream) +{{endif}} + +{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) + return cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) +{{endif}} + +{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolImportFromShareableHandle(cyruntime.cudaMemPool_t* memPool, void* shareableHandle, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) + return cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) +{{endif}} + +{{if 'cudaMemPoolExportPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolExportPointer(cyruntime.cudaMemPoolPtrExportData* exportData, void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolExportPointer(exportData, ptr) + return cudaMemPoolExportPointer(exportData, ptr) +{{endif}} + +{{if 'cudaMemPoolImportPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolImportPointer(void** ptr, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolPtrExportData* exportData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaMemPoolImportPointer(ptr, memPool, exportData) + return cudaMemPoolImportPointer(ptr, memPool, exportData) +{{endif}} + +{{if 'cudaPointerGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaPointerGetAttributes(cyruntime.cudaPointerAttributes* attributes, const void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaPointerGetAttributes(attributes, ptr) + return cudaPointerGetAttributes(attributes, ptr) +{{endif}} + +{{if 'cudaDeviceCanAccessPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) + return cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) +{{endif}} + +{{if 'cudaDeviceEnablePeerAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceEnablePeerAccess(peerDevice, flags) + return cudaDeviceEnablePeerAccess(peerDevice, flags) +{{endif}} + +{{if 'cudaDeviceDisablePeerAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceDisablePeerAccess(peerDevice) + return cudaDeviceDisablePeerAccess(peerDevice) +{{endif}} + +{{if 'cudaGraphicsUnregisterResource' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsUnregisterResource(cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsUnregisterResource(resource) + return cudaGraphicsUnregisterResource(resource) +{{endif}} + +{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceSetMapFlags(cyruntime.cudaGraphicsResource_t resource, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceSetMapFlags(resource, flags) + return cudaGraphicsResourceSetMapFlags(resource, flags) +{{endif}} + +{{if 'cudaGraphicsMapResources' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsMapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsMapResources(count, resources, stream) + return cudaGraphicsMapResources(count, resources, stream) +{{endif}} + +{{if 'cudaGraphicsUnmapResources' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsUnmapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsUnmapResources(count, resources, stream) + return cudaGraphicsUnmapResources(count, resources, stream) +{{endif}} + +{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) + return cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) +{{endif}} + +{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsSubResourceGetMappedArray(cyruntime.cudaArray_t* array, cyruntime.cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) + return cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) +{{endif}} + +{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) + return cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) +{{endif}} + +{{if 'cudaGetChannelDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetChannelDesc(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaArray_const_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetChannelDesc(desc, array) + return cudaGetChannelDesc(desc, array) +{{endif}} + +{{if 'cudaCreateChannelDesc' in found_functions}} + +cdef cyruntime.cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cyruntime.cudaChannelFormatKind f) nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateChannelDesc(x, y, z, w, f) + return cudaCreateChannelDesc(x, y, z, w, f) +{{endif}} + +{{if 'cudaCreateTextureObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCreateTextureObject(cyruntime.cudaTextureObject_t* pTexObject, const cyruntime.cudaResourceDesc* pResDesc, const cyruntime.cudaTextureDesc* pTexDesc, const cyruntime.cudaResourceViewDesc* pResViewDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) + return cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) +{{endif}} + +{{if 'cudaDestroyTextureObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyTextureObject(cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroyTextureObject(texObject) + return cudaDestroyTextureObject(texObject) +{{endif}} + +{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectResourceDesc(pResDesc, texObject) + return cudaGetTextureObjectResourceDesc(pResDesc, texObject) +{{endif}} + +{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectTextureDesc(cyruntime.cudaTextureDesc* pTexDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectTextureDesc(pTexDesc, texObject) + return cudaGetTextureObjectTextureDesc(pTexDesc, texObject) +{{endif}} + +{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceViewDesc(cyruntime.cudaResourceViewDesc* pResViewDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) + return cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) +{{endif}} + +{{if 'cudaCreateSurfaceObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCreateSurfaceObject(cyruntime.cudaSurfaceObject_t* pSurfObject, const cyruntime.cudaResourceDesc* pResDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaCreateSurfaceObject(pSurfObject, pResDesc) + return cudaCreateSurfaceObject(pSurfObject, pResDesc) +{{endif}} + +{{if 'cudaDestroySurfaceObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroySurfaceObject(cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDestroySurfaceObject(surfObject) + return cudaDestroySurfaceObject(surfObject) +{{endif}} + +{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetSurfaceObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) + return cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) +{{endif}} + +{{if 'cudaDriverGetVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDriverGetVersion(driverVersion) + return cudaDriverGetVersion(driverVersion) +{{endif}} + +{{if 'cudaRuntimeGetVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaRuntimeGetVersion(runtimeVersion) + return cudaRuntimeGetVersion(runtimeVersion) +{{endif}} + +{{if 'cudaGraphCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphCreate(cyruntime.cudaGraph_t* pGraph, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphCreate(pGraph, flags) + return cudaGraphCreate(pGraph, flags) +{{endif}} + +{{if 'cudaGraphAddKernelNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddKernelNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + return cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) +{{endif}} + +{{if 'cudaGraphKernelNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeGetParams(node, pNodeParams) + return cudaGraphKernelNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphKernelNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeSetParams(node, pNodeParams) + return cudaGraphKernelNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeCopyAttributes(cyruntime.cudaGraphNode_t hSrc, cyruntime.cudaGraphNode_t hDst) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeCopyAttributes(hSrc, hDst) + return cudaGraphKernelNodeCopyAttributes(hSrc, hDst) +{{endif}} + +{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, cyruntime.cudaKernelNodeAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) + return cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) +{{endif}} + +{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, const cyruntime.cudaKernelNodeAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphKernelNodeSetAttribute(hNode, attr, value) + return cudaGraphKernelNodeSetAttribute(hNode, attr, value) +{{endif}} + +{{if 'cudaGraphAddMemcpyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemcpy3DParms* pCopyParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) + return cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) +{{endif}} + +{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode1D(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) + return cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) +{{endif}} + +{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeGetParams(node, pNodeParams) + return cudaGraphMemcpyNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeSetParams(node, pNodeParams) + return cudaGraphMemcpyNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams1D(cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) + return cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) +{{endif}} + +{{if 'cudaGraphAddMemsetNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemsetNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemsetParams* pMemsetParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) + return cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) +{{endif}} + +{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemsetNodeGetParams(node, pNodeParams) + return cudaGraphMemsetNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemsetNodeSetParams(node, pNodeParams) + return cudaGraphMemsetNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphAddHostNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddHostNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) + return cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) +{{endif}} + +{{if 'cudaGraphHostNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphHostNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphHostNodeGetParams(node, pNodeParams) + return cudaGraphHostNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphHostNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphHostNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphHostNodeSetParams(node, pNodeParams) + return cudaGraphHostNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphAddChildGraphNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddChildGraphNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) + return cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) +{{endif}} + +{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphChildGraphNodeGetGraph(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphChildGraphNodeGetGraph(node, pGraph) + return cudaGraphChildGraphNodeGetGraph(node, pGraph) +{{endif}} + +{{if 'cudaGraphAddEmptyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEmptyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) + return cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) +{{endif}} + +{{if 'cudaGraphAddEventRecordNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEventRecordNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) + return cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) +{{endif}} + +{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventRecordNodeGetEvent(node, event_out) + return cudaGraphEventRecordNodeGetEvent(node, event_out) +{{endif}} + +{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventRecordNodeSetEvent(node, event) + return cudaGraphEventRecordNodeSetEvent(node, event) +{{endif}} + +{{if 'cudaGraphAddEventWaitNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEventWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) + return cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) +{{endif}} + +{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventWaitNodeGetEvent(node, event_out) + return cudaGraphEventWaitNodeGetEvent(node, event_out) +{{endif}} + +{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphEventWaitNodeSetEvent(node, event) + return cudaGraphEventWaitNodeSetEvent(node, event) +{{endif}} + +{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreSignalNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) + return cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) + return cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreWaitNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) + return cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) + return cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphAddMemAllocNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemAllocNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaMemAllocNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemAllocNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemAllocNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemAllocNodeGetParams(node, params_out) + return cudaGraphMemAllocNodeGetParams(node, params_out) +{{endif}} + +{{if 'cudaGraphAddMemFreeNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemFreeNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) + return cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) +{{endif}} + +{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemFreeNodeGetParams(cyruntime.cudaGraphNode_t node, void* dptr_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphMemFreeNodeGetParams(node, dptr_out) + return cudaGraphMemFreeNodeGetParams(node, dptr_out) +{{endif}} + +{{if 'cudaDeviceGraphMemTrim' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGraphMemTrim(device) + return cudaDeviceGraphMemTrim(device) +{{endif}} + +{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceGetGraphMemAttribute(device, attr, value) + return cudaDeviceGetGraphMemAttribute(device, attr, value) +{{endif}} + +{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaDeviceSetGraphMemAttribute(device, attr, value) + return cudaDeviceSetGraphMemAttribute(device, attr, value) +{{endif}} + +{{if 'cudaGraphClone' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphClone(cyruntime.cudaGraph_t* pGraphClone, cyruntime.cudaGraph_t originalGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphClone(pGraphClone, originalGraph) + return cudaGraphClone(pGraphClone, originalGraph) +{{endif}} + +{{if 'cudaGraphNodeFindInClone' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeFindInClone(cyruntime.cudaGraphNode_t* pNode, cyruntime.cudaGraphNode_t originalNode, cyruntime.cudaGraph_t clonedGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) + return cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) +{{endif}} + +{{if 'cudaGraphNodeGetType' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetType(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeType* pType) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetType(node, pType) + return cudaGraphNodeGetType(node, pType) +{{endif}} + +{{if 'cudaGraphGetNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* nodes, size_t* numNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetNodes(graph, nodes, numNodes) + return cudaGraphGetNodes(graph, nodes, numNodes) +{{endif}} + +{{if 'cudaGraphGetRootNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetRootNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) + return cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) +{{endif}} + +{{if 'cudaGraphGetEdges' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetEdges(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetEdges(graph, from_, to, numEdges) + return cudaGraphGetEdges(graph, from_, to, numEdges) +{{endif}} + +{{if 'cudaGraphGetEdges_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetEdges_v2(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, cyruntime.cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) + return cudaGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) +{{endif}} + +{{if 'cudaGraphNodeGetDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependencies(node, pDependencies, pNumDependencies) + return cudaGraphNodeGetDependencies(node, pDependencies, pNumDependencies) +{{endif}} + +{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) + return cudaGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) +{{endif}} + +{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) + return cudaGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) +{{endif}} + +{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) + return cudaGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) +{{endif}} + +{{if 'cudaGraphAddDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddDependencies(graph, from_, to, numDependencies) + return cudaGraphAddDependencies(graph, from_, to, numDependencies) +{{endif}} + +{{if 'cudaGraphAddDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) + return cudaGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) +{{endif}} + +{{if 'cudaGraphRemoveDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRemoveDependencies(graph, from_, to, numDependencies) + return cudaGraphRemoveDependencies(graph, from_, to, numDependencies) +{{endif}} + +{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) + return cudaGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) +{{endif}} + +{{if 'cudaGraphDestroyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDestroyNode(cyruntime.cudaGraphNode_t node) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDestroyNode(node) + return cudaGraphDestroyNode(node) +{{endif}} + +{{if 'cudaGraphInstantiate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiate(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiate(pGraphExec, graph, flags) + return cudaGraphInstantiate(pGraphExec, graph, flags) +{{endif}} + +{{if 'cudaGraphInstantiateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithFlags(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) + return cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) +{{endif}} + +{{if 'cudaGraphInstantiateWithParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithParams(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, cyruntime.cudaGraphInstantiateParams* instantiateParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) + return cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) +{{endif}} + +{{if 'cudaGraphExecGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecGetFlags(cyruntime.cudaGraphExec_t graphExec, unsigned long long* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecGetFlags(graphExec, flags) + return cudaGraphExecGetFlags(graphExec, flags) +{{endif}} + +{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecKernelNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) + return cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) + return cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) + return cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) +{{endif}} + +{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemsetNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) + return cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecHostNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) + return cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecChildGraphNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) + return cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) +{{endif}} + +{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) + return cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) +{{endif}} + +{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) + return cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) +{{endif}} + +{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) + return cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) + return cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphNodeSetEnabled' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeSetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) + return cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) +{{endif}} + +{{if 'cudaGraphNodeGetEnabled' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) + return cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) +{{endif}} + +{{if 'cudaGraphExecUpdate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecUpdate(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraph_t hGraph, cyruntime.cudaGraphExecUpdateResultInfo* resultInfo) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) + return cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) +{{endif}} + +{{if 'cudaGraphUpload' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphUpload(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphUpload(graphExec, stream) + return cudaGraphUpload(graphExec, stream) +{{endif}} + +{{if 'cudaGraphLaunch' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphLaunch(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphLaunch(graphExec, stream) + return cudaGraphLaunch(graphExec, stream) +{{endif}} + +{{if 'cudaGraphExecDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecDestroy(cyruntime.cudaGraphExec_t graphExec) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecDestroy(graphExec) + return cudaGraphExecDestroy(graphExec) +{{endif}} + +{{if 'cudaGraphDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDestroy(cyruntime.cudaGraph_t graph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDestroy(graph) + return cudaGraphDestroy(graph) +{{endif}} + +{{if 'cudaGraphDebugDotPrint' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDebugDotPrint(cyruntime.cudaGraph_t graph, const char* path, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphDebugDotPrint(graph, path, flags) + return cudaGraphDebugDotPrint(graph, path, flags) +{{endif}} + +{{if 'cudaUserObjectCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectCreate(cyruntime.cudaUserObject_t* object_out, void* ptr, cyruntime.cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) + return cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) +{{endif}} + +{{if 'cudaUserObjectRetain' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectRetain(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectRetain(object, count) + return cudaUserObjectRetain(object, count) +{{endif}} + +{{if 'cudaUserObjectRelease' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectRelease(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaUserObjectRelease(object, count) + return cudaUserObjectRelease(object, count) +{{endif}} + +{{if 'cudaGraphRetainUserObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRetainUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphRetainUserObject(graph, object, count, flags) + return cudaGraphRetainUserObject(graph, object, count, flags) +{{endif}} + +{{if 'cudaGraphReleaseUserObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphReleaseUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphReleaseUserObject(graph, object, count) + return cudaGraphReleaseUserObject(graph, object, count) +{{endif}} + +{{if 'cudaGraphAddNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) + return cudaGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphAddNode_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddNode_v2(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) + return cudaGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeSetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphNodeSetParams(node, nodeParams) + return cudaGraphNodeSetParams(node, nodeParams) +{{endif}} + +{{if 'cudaGraphExecNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecNodeSetParams(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphExecNodeSetParams(graphExec, node, nodeParams) + return cudaGraphExecNodeSetParams(graphExec, node, nodeParams) +{{endif}} + +{{if 'cudaGraphConditionalHandleCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphConditionalHandleCreate(cyruntime.cudaGraphConditionalHandle* pHandle_out, cyruntime.cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) + return cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) +{{endif}} + +{{if 'cudaGetDriverEntryPoint' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) + return cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) +{{endif}} + +{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) + return cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) +{{endif}} + +{{if 'cudaLibraryLoadData' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryLoadData(cyruntime.cudaLibrary_t* library, const void* code, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + return cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) +{{endif}} + +{{if 'cudaLibraryLoadFromFile' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryLoadFromFile(cyruntime.cudaLibrary_t* library, const char* fileName, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) + return cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) +{{endif}} + +{{if 'cudaLibraryUnload' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryUnload(cyruntime.cudaLibrary_t library) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryUnload(library) + return cudaLibraryUnload(library) +{{endif}} + +{{if 'cudaLibraryGetKernel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetKernel(cyruntime.cudaKernel_t* pKernel, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetKernel(pKernel, library, name) + return cudaLibraryGetKernel(pKernel, library, name) +{{endif}} + +{{if 'cudaLibraryGetGlobal' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetGlobal(dptr, numbytes, library, name) + return cudaLibraryGetGlobal(dptr, numbytes, library, name) +{{endif}} + +{{if 'cudaLibraryGetManaged' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetManaged(dptr, numbytes, library, name) + return cudaLibraryGetManaged(dptr, numbytes, library, name) +{{endif}} + +{{if 'cudaLibraryGetUnifiedFunction' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cyruntime.cudaLibrary_t library, const char* symbol) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetUnifiedFunction(fptr, library, symbol) + return cudaLibraryGetUnifiedFunction(fptr, library, symbol) +{{endif}} + +{{if 'cudaLibraryGetKernelCount' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryGetKernelCount(count, lib) + return cudaLibraryGetKernelCount(count, lib) +{{endif}} + +{{if 'cudaLibraryEnumerateKernels' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryEnumerateKernels(cyruntime.cudaKernel_t* kernels, unsigned int numKernels, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaLibraryEnumerateKernels(kernels, numKernels, lib) + return cudaLibraryEnumerateKernels(kernels, numKernels, lib) +{{endif}} + +{{if 'cudaKernelSetAttributeForDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaKernelSetAttributeForDevice(cyruntime.cudaKernel_t kernel, cyruntime.cudaFuncAttribute attr, int value, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaKernelSetAttributeForDevice(kernel, attr, value, device) + return cudaKernelSetAttributeForDevice(kernel, attr, value, device) +{{endif}} + +{{if 'cudaGetExportTable' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetExportTable(const void** ppExportTable, const cyruntime.cudaUUID_t* pExportTableId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetExportTable(ppExportTable, pExportTableId) + return cudaGetExportTable(ppExportTable, pExportTableId) +{{endif}} + +{{if 'cudaGetKernel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetKernel(cyruntime.cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaGetKernel(kernelPtr, entryFuncAddr) + return cudaGetKernel(kernelPtr, entryFuncAddr) +{{endif}} + +{{if 'make_cudaPitchedPtr' in found_functions}} + +cdef cyruntime.cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._make_cudaPitchedPtr(d, p, xsz, ysz) + return make_cudaPitchedPtr(d, p, xsz, ysz) +{{endif}} + +{{if 'make_cudaPos' in found_functions}} + +cdef cyruntime.cudaPos _make_cudaPos(size_t x, size_t y, size_t z) nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._make_cudaPos(x, y, z) + return make_cudaPos(x, y, z) +{{endif}} + +{{if 'make_cudaExtent' in found_functions}} + +cdef cyruntime.cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._make_cudaExtent(w, h, d) + return make_cudaExtent(w, h, d) +{{endif}} + +{{if 'cudaProfilerStart' in found_functions}} + +cdef cyruntime.cudaError_t _cudaProfilerStart() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaProfilerStart() + return cudaProfilerStart() +{{endif}} + +{{if 'cudaProfilerStop' in found_functions}} + +cdef cyruntime.cudaError_t _cudaProfilerStop() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + cdef bint usePTDS = cudaPythonInit() + if usePTDS: + return ptds._cudaProfilerStop() + return cudaProfilerStop() +{{endif}} diff --git a/cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pxd.in b/cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pxd.in new file mode 100644 index 000000000..1b0aa5e45 --- /dev/null +++ b/cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pxd.in @@ -0,0 +1,1475 @@ +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. +# +# Please refer to the NVIDIA end user license agreement (EULA) associated +# with this source code for terms and conditions that govern your use of +# this software. Any use, reproduction, disclosure, or distribution of +# this software and related documentation outside the terms of the EULA +# is strictly prohibited. +# +# This code was automatically generated with version 12.8.0. Do not modify it directly. +cdef extern from "": + """ + #define CUDA_API_PER_THREAD_DEFAULT_STREAM + """ + +cimport cuda.bindings.cyruntime as cyruntime + +{{if 'cudaDeviceReset' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceReset() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSynchronize() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceSetLimit' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetLimit(cyruntime.cudaLimit limit, size_t value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetLimit' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetLimit(size_t* pValue, cyruntime.cudaLimit limit) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cyruntime.cudaChannelFormatDesc* fmtDesc, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetCacheConfig(cyruntime.cudaFuncCache* pCacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceSetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetCacheConfig(cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetByPCIBusId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetPCIBusId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaIpcGetEventHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcGetEventHandle(cyruntime.cudaIpcEventHandle_t* handle, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaIpcOpenEventHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcOpenEventHandle(cyruntime.cudaEvent_t* event, cyruntime.cudaIpcEventHandle_t handle) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaIpcGetMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcGetMemHandle(cyruntime.cudaIpcMemHandle_t* handle, void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaIpcOpenMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cyruntime.cudaIpcMemHandle_t handle, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaIpcCloseMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cyruntime.cudaFlushGPUDirectRDMAWritesTarget target, cyruntime.cudaFlushGPUDirectRDMAWritesScope scope) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cyruntime.cudaAsyncCallback callbackFunc, void* userData, cyruntime.cudaAsyncCallbackHandle_t* callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cyruntime.cudaAsyncCallbackHandle_t callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetSharedMemConfig(cyruntime.cudaSharedMemConfig* pConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetSharedMemConfig(cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetLastError' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaPeekAtLastError' in found_functions}} + +cdef cyruntime.cudaError_t _cudaPeekAtLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetErrorName' in found_functions}} + +cdef const char* _cudaGetErrorName(cyruntime.cudaError_t error) except ?NULL nogil +{{endif}} + +{{if 'cudaGetErrorString' in found_functions}} + +cdef const char* _cudaGetErrorString(cyruntime.cudaError_t error) except ?NULL nogil +{{endif}} + +{{if 'cudaGetDeviceCount' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceCount(int* count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetDeviceProperties_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceProperties_v2(cyruntime.cudaDeviceProp* prop, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetAttribute(int* value, cyruntime.cudaDeviceAttr attr, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetDefaultMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceSetMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetMemPool(int device, cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetP2PAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetP2PAttribute(int* value, cyruntime.cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaChooseDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaChooseDevice(int* device, const cyruntime.cudaDeviceProp* prop) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaInitDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaSetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSetDevice(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDevice(int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaSetDeviceFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetDeviceFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreate(cyruntime.cudaStream_t* pStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamCreateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreateWithFlags(cyruntime.cudaStream_t* pStream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamCreateWithPriority' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreateWithPriority(cyruntime.cudaStream_t* pStream, unsigned int flags, int priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetPriority' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetPriority(cyruntime.cudaStream_t hStream, int* priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetFlags(cyruntime.cudaStream_t hStream, unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetId(cyruntime.cudaStream_t hStream, unsigned long long* streamId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetDevice(cyruntime.cudaStream_t hStream, int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCtxResetPersistingL2Cache() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamCopyAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCopyAttributes(cyruntime.cudaStream_t dst, cyruntime.cudaStream_t src) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, cyruntime.cudaStreamAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamSetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, const cyruntime.cudaStreamAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamDestroy(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamWaitEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamWaitEvent(cyruntime.cudaStream_t stream, cyruntime.cudaEvent_t event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamAddCallback' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamAddCallback(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamSynchronize(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamQuery' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamQuery(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamAttachMemAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamAttachMemAsync(cyruntime.cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamBeginCapture' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamBeginCapture(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamBeginCaptureToGraph(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaThreadExchangeStreamCaptureMode(cyruntime.cudaStreamCaptureMode* mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamEndCapture' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamEndCapture(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamIsCapturing' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamIsCapturing(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* pCaptureStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v2(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v3(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, const cyruntime.cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventCreate(cyruntime.cudaEvent_t* event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventCreateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventCreateWithFlags(cyruntime.cudaEvent_t* event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventRecord' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventRecord(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventRecordWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventRecordWithFlags(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventQuery' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventQuery(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventSynchronize(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventDestroy(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventElapsedTime' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventElapsedTime(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaEventElapsedTime_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventElapsedTime_v2(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaImportExternalMemory' in found_functions}} + +cdef cyruntime.cudaError_t _cudaImportExternalMemory(cyruntime.cudaExternalMemory_t* extMem_out, const cyruntime.cudaExternalMemoryHandleDesc* memHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryBufferDesc* bufferDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmap, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDestroyExternalMemory' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyExternalMemory(cyruntime.cudaExternalMemory_t extMem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaImportExternalSemaphore' in found_functions}} + +cdef cyruntime.cudaError_t _cudaImportExternalSemaphore(cyruntime.cudaExternalSemaphore_t* extSem_out, const cyruntime.cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDestroyExternalSemaphore' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyExternalSemaphore(cyruntime.cudaExternalSemaphore_t extSem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFuncSetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetCacheConfig(const void* func, cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFuncGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncGetAttributes(cyruntime.cudaFuncAttributes* attr, const void* func) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFuncSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetAttribute(const void* func, cyruntime.cudaFuncAttribute attr, int value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLaunchHostFunc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLaunchHostFunc(cyruntime.cudaStream_t stream, cyruntime.cudaHostFn_t fn, void* userData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFuncSetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocManaged' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMalloc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocHost' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocPitch' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFree' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFree(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFreeHost' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeHost(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFreeArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeArray(cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFreeMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeMipmappedArray(cyruntime.cudaMipmappedArray_t mipmappedArray) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaHostAlloc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaHostRegister' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaHostUnregister' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostUnregister(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaHostGetDevicePointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaHostGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMalloc3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc3D(cyruntime.cudaPitchedPtr* pitchedDevPtr, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMalloc3DArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc3DArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetMipmappedArrayLevel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetMipmappedArrayLevel(cyruntime.cudaArray_t* levelArray, cyruntime.cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3D(const cyruntime.cudaMemcpy3DParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy3DPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DPeer(const cyruntime.cudaMemcpy3DPeerParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy3DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DAsync(const cyruntime.cudaMemcpy3DParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy3DPeerAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DPeerAsync(const cyruntime.cudaMemcpy3DPeerParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemGetInfo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaArrayGetInfo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetInfo(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent* extent, unsigned int* flags, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaArrayGetPlane' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetPlane(cyruntime.cudaArray_t* pPlaneArray, cyruntime.cudaArray_t hArray, unsigned int planeIdx) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaArrayGetMemoryRequirements' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaArray_t array, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaMipmappedArray_t mipmap, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaArrayGetSparseProperties' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaMipmappedArray_t mipmap) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2DToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2DFromArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2DArrayToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyPeerAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyBatchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cyruntime.cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy3DBatchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cyruntime.cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemset' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemset2D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemset3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset3D(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemsetAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemset2DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemset3DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset3DAsync(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPrefetchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPrefetchAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cyruntime.cudaMemLocation location, unsigned int flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemAdvise' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemAdvise_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, cyruntime.cudaMemLocation location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemRangeGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cyruntime.cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemRangeGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cyruntime.cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyFromArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyFromArray(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyArrayToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyToArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemcpyFromArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaFreeAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeAsync(void* devPtr, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolTrimTo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolTrimTo(cyruntime.cudaMemPool_t memPool, size_t minBytesToKeep) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolSetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolGetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolSetAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolSetAccess(cyruntime.cudaMemPool_t memPool, const cyruntime.cudaMemAccessDesc* descList, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolGetAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolGetAccess(cyruntime.cudaMemAccessFlags* flags, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemLocation* location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolCreate(cyruntime.cudaMemPool_t* memPool, const cyruntime.cudaMemPoolProps* poolProps) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolDestroy(cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMallocFromPoolAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cyruntime.cudaMemPool_t memPool, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolImportFromShareableHandle(cyruntime.cudaMemPool_t* memPool, void* shareableHandle, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolExportPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolExportPointer(cyruntime.cudaMemPoolPtrExportData* exportData, void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaMemPoolImportPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolImportPointer(void** ptr, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolPtrExportData* exportData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaPointerGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaPointerGetAttributes(cyruntime.cudaPointerAttributes* attributes, const void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceCanAccessPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceEnablePeerAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceDisablePeerAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsUnregisterResource' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsUnregisterResource(cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceSetMapFlags(cyruntime.cudaGraphicsResource_t resource, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsMapResources' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsMapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsUnmapResources' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsUnmapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsSubResourceGetMappedArray(cyruntime.cudaArray_t* array, cyruntime.cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetChannelDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetChannelDesc(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaArray_const_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaCreateChannelDesc' in found_functions}} + +cdef cyruntime.cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cyruntime.cudaChannelFormatKind f) nogil +{{endif}} + +{{if 'cudaCreateTextureObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCreateTextureObject(cyruntime.cudaTextureObject_t* pTexObject, const cyruntime.cudaResourceDesc* pResDesc, const cyruntime.cudaTextureDesc* pTexDesc, const cyruntime.cudaResourceViewDesc* pResViewDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDestroyTextureObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyTextureObject(cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectTextureDesc(cyruntime.cudaTextureDesc* pTexDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceViewDesc(cyruntime.cudaResourceViewDesc* pResViewDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaCreateSurfaceObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCreateSurfaceObject(cyruntime.cudaSurfaceObject_t* pSurfObject, const cyruntime.cudaResourceDesc* pResDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDestroySurfaceObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroySurfaceObject(cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetSurfaceObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDriverGetVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaRuntimeGetVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphCreate(cyruntime.cudaGraph_t* pGraph, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddKernelNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddKernelNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphKernelNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphKernelNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeCopyAttributes(cyruntime.cudaGraphNode_t hSrc, cyruntime.cudaGraphNode_t hDst) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, cyruntime.cudaKernelNodeAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, const cyruntime.cudaKernelNodeAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddMemcpyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemcpy3DParms* pCopyParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode1D(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams1D(cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddMemsetNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemsetNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemsetParams* pMemsetParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddHostNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddHostNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphHostNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphHostNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphHostNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphHostNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddChildGraphNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddChildGraphNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphChildGraphNodeGetGraph(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddEmptyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEmptyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddEventRecordNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEventRecordNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddEventWaitNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEventWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreSignalNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreWaitNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddMemAllocNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemAllocNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaMemAllocNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemAllocNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemAllocNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddMemFreeNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemFreeNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemFreeNodeGetParams(cyruntime.cudaGraphNode_t node, void* dptr_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGraphMemTrim' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphClone' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphClone(cyruntime.cudaGraph_t* pGraphClone, cyruntime.cudaGraph_t originalGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeFindInClone' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeFindInClone(cyruntime.cudaGraphNode_t* pNode, cyruntime.cudaGraphNode_t originalNode, cyruntime.cudaGraph_t clonedGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeGetType' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetType(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeType* pType) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphGetNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* nodes, size_t* numNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphGetRootNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetRootNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphGetEdges' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetEdges(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphGetEdges_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetEdges_v2(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, cyruntime.cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeGetDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphRemoveDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphDestroyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDestroyNode(cyruntime.cudaGraphNode_t node) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphInstantiate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiate(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphInstantiateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithFlags(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphInstantiateWithParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithParams(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, cyruntime.cudaGraphInstantiateParams* instantiateParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecGetFlags(cyruntime.cudaGraphExec_t graphExec, unsigned long long* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecKernelNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemsetNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecHostNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecChildGraphNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeSetEnabled' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeSetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeGetEnabled' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecUpdate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecUpdate(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraph_t hGraph, cyruntime.cudaGraphExecUpdateResultInfo* resultInfo) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphUpload' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphUpload(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphLaunch' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphLaunch(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecDestroy(cyruntime.cudaGraphExec_t graphExec) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDestroy(cyruntime.cudaGraph_t graph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphDebugDotPrint' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDebugDotPrint(cyruntime.cudaGraph_t graph, const char* path, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaUserObjectCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectCreate(cyruntime.cudaUserObject_t* object_out, void* ptr, cyruntime.cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaUserObjectRetain' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectRetain(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaUserObjectRelease' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectRelease(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphRetainUserObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRetainUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphReleaseUserObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphReleaseUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphAddNode_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddNode_v2(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeSetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphExecNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecNodeSetParams(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGraphConditionalHandleCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphConditionalHandleCreate(cyruntime.cudaGraphConditionalHandle* pHandle_out, cyruntime.cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetDriverEntryPoint' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryLoadData' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryLoadData(cyruntime.cudaLibrary_t* library, const void* code, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryLoadFromFile' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryLoadFromFile(cyruntime.cudaLibrary_t* library, const char* fileName, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryUnload' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryUnload(cyruntime.cudaLibrary_t library) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryGetKernel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetKernel(cyruntime.cudaKernel_t* pKernel, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryGetGlobal' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryGetManaged' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryGetUnifiedFunction' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cyruntime.cudaLibrary_t library, const char* symbol) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryGetKernelCount' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaLibraryEnumerateKernels' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryEnumerateKernels(cyruntime.cudaKernel_t* kernels, unsigned int numKernels, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaKernelSetAttributeForDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaKernelSetAttributeForDevice(cyruntime.cudaKernel_t kernel, cyruntime.cudaFuncAttribute attr, int value, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetExportTable' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetExportTable(const void** ppExportTable, const cyruntime.cudaUUID_t* pExportTableId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaGetKernel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetKernel(cyruntime.cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'make_cudaPitchedPtr' in found_functions}} + +cdef cyruntime.cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil +{{endif}} + +{{if 'make_cudaPos' in found_functions}} + +cdef cyruntime.cudaPos _make_cudaPos(size_t x, size_t y, size_t z) nogil +{{endif}} + +{{if 'make_cudaExtent' in found_functions}} + +cdef cyruntime.cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) nogil +{{endif}} + +{{if 'cudaProfilerStart' in found_functions}} + +cdef cyruntime.cudaError_t _cudaProfilerStart() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} + +{{if 'cudaProfilerStop' in found_functions}} + +cdef cyruntime.cudaError_t _cudaProfilerStop() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil +{{endif}} diff --git a/cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pyx.in new file mode 100644 index 000000000..f71c67c0b --- /dev/null +++ b/cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pyx.in @@ -0,0 +1,1767 @@ +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. +# +# Please refer to the NVIDIA end user license agreement (EULA) associated +# with this source code for terms and conditions that govern your use of +# this software. Any use, reproduction, disclosure, or distribution of +# this software and related documentation outside the terms of the EULA +# is strictly prohibited. +# +# This code was automatically generated with version 12.8.0. Do not modify it directly. +cdef extern from "": + """ + #define CUDA_API_PER_THREAD_DEFAULT_STREAM + """ + +include "cyruntime.pxi" + +{{if 'cudaDeviceReset' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceReset() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceReset() +{{endif}} + +{{if 'cudaDeviceSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSynchronize() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceSynchronize() +{{endif}} + +{{if 'cudaDeviceSetLimit' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetLimit(cyruntime.cudaLimit limit, size_t value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceSetLimit(limit, value) +{{endif}} + +{{if 'cudaDeviceGetLimit' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetLimit(size_t* pValue, cyruntime.cudaLimit limit) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetLimit(pValue, limit) +{{endif}} + +{{if 'cudaDeviceGetTexture1DLinearMaxWidth' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements, const cyruntime.cudaChannelFormatDesc* fmtDesc, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetTexture1DLinearMaxWidth(maxWidthInElements, fmtDesc, device) +{{endif}} + +{{if 'cudaDeviceGetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetCacheConfig(cyruntime.cudaFuncCache* pCacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetCacheConfig(pCacheConfig) +{{endif}} + +{{if 'cudaDeviceGetStreamPriorityRange' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetStreamPriorityRange(leastPriority, greatestPriority) +{{endif}} + +{{if 'cudaDeviceSetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetCacheConfig(cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceSetCacheConfig(cacheConfig) +{{endif}} + +{{if 'cudaDeviceGetByPCIBusId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetByPCIBusId(int* device, const char* pciBusId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetByPCIBusId(device, pciBusId) +{{endif}} + +{{if 'cudaDeviceGetPCIBusId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetPCIBusId(char* pciBusId, int length, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetPCIBusId(pciBusId, length, device) +{{endif}} + +{{if 'cudaIpcGetEventHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcGetEventHandle(cyruntime.cudaIpcEventHandle_t* handle, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaIpcGetEventHandle(handle, event) +{{endif}} + +{{if 'cudaIpcOpenEventHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcOpenEventHandle(cyruntime.cudaEvent_t* event, cyruntime.cudaIpcEventHandle_t handle) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaIpcOpenEventHandle(event, handle) +{{endif}} + +{{if 'cudaIpcGetMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcGetMemHandle(cyruntime.cudaIpcMemHandle_t* handle, void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaIpcGetMemHandle(handle, devPtr) +{{endif}} + +{{if 'cudaIpcOpenMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcOpenMemHandle(void** devPtr, cyruntime.cudaIpcMemHandle_t handle, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaIpcOpenMemHandle(devPtr, handle, flags) +{{endif}} + +{{if 'cudaIpcCloseMemHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaIpcCloseMemHandle(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaIpcCloseMemHandle(devPtr) +{{endif}} + +{{if 'cudaDeviceFlushGPUDirectRDMAWrites' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceFlushGPUDirectRDMAWrites(cyruntime.cudaFlushGPUDirectRDMAWritesTarget target, cyruntime.cudaFlushGPUDirectRDMAWritesScope scope) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceFlushGPUDirectRDMAWrites(target, scope) +{{endif}} + +{{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceRegisterAsyncNotification(int device, cyruntime.cudaAsyncCallback callbackFunc, void* userData, cyruntime.cudaAsyncCallbackHandle_t* callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) +{{endif}} + +{{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceUnregisterAsyncNotification(int device, cyruntime.cudaAsyncCallbackHandle_t callback) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceUnregisterAsyncNotification(device, callback) +{{endif}} + +{{if 'cudaDeviceGetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetSharedMemConfig(cyruntime.cudaSharedMemConfig* pConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetSharedMemConfig(pConfig) +{{endif}} + +{{if 'cudaDeviceSetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetSharedMemConfig(cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceSetSharedMemConfig(config) +{{endif}} + +{{if 'cudaGetLastError' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetLastError() +{{endif}} + +{{if 'cudaPeekAtLastError' in found_functions}} + +cdef cyruntime.cudaError_t _cudaPeekAtLastError() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaPeekAtLastError() +{{endif}} + +{{if 'cudaGetErrorName' in found_functions}} + +cdef const char* _cudaGetErrorName(cyruntime.cudaError_t error) except ?NULL nogil: + return cudaGetErrorName(error) +{{endif}} + +{{if 'cudaGetErrorString' in found_functions}} + +cdef const char* _cudaGetErrorString(cyruntime.cudaError_t error) except ?NULL nogil: + return cudaGetErrorString(error) +{{endif}} + +{{if 'cudaGetDeviceCount' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceCount(int* count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetDeviceCount(count) +{{endif}} + +{{if 'cudaGetDeviceProperties_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceProperties_v2(cyruntime.cudaDeviceProp* prop, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetDeviceProperties_v2(prop, device) +{{endif}} + +{{if 'cudaDeviceGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetAttribute(int* value, cyruntime.cudaDeviceAttr attr, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetAttribute(value, attr, device) +{{endif}} + +{{if 'cudaDeviceGetDefaultMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetDefaultMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetDefaultMemPool(memPool, device) +{{endif}} + +{{if 'cudaDeviceSetMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetMemPool(int device, cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceSetMemPool(device, memPool) +{{endif}} + +{{if 'cudaDeviceGetMemPool' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetMemPool(cyruntime.cudaMemPool_t* memPool, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetMemPool(memPool, device) +{{endif}} + +{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetNvSciSyncAttributes(void* nvSciSyncAttrList, int device, int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, device, flags) +{{endif}} + +{{if 'cudaDeviceGetP2PAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetP2PAttribute(int* value, cyruntime.cudaDeviceP2PAttr attr, int srcDevice, int dstDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetP2PAttribute(value, attr, srcDevice, dstDevice) +{{endif}} + +{{if 'cudaChooseDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaChooseDevice(int* device, const cyruntime.cudaDeviceProp* prop) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaChooseDevice(device, prop) +{{endif}} + +{{if 'cudaInitDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaInitDevice(int device, unsigned int deviceFlags, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaInitDevice(device, deviceFlags, flags) +{{endif}} + +{{if 'cudaSetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSetDevice(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaSetDevice(device) +{{endif}} + +{{if 'cudaGetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDevice(int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetDevice(device) +{{endif}} + +{{if 'cudaSetDeviceFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSetDeviceFlags(unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaSetDeviceFlags(flags) +{{endif}} + +{{if 'cudaGetDeviceFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDeviceFlags(unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetDeviceFlags(flags) +{{endif}} + +{{if 'cudaStreamCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreate(cyruntime.cudaStream_t* pStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamCreate(pStream) +{{endif}} + +{{if 'cudaStreamCreateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreateWithFlags(cyruntime.cudaStream_t* pStream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamCreateWithFlags(pStream, flags) +{{endif}} + +{{if 'cudaStreamCreateWithPriority' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCreateWithPriority(cyruntime.cudaStream_t* pStream, unsigned int flags, int priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamCreateWithPriority(pStream, flags, priority) +{{endif}} + +{{if 'cudaStreamGetPriority' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetPriority(cyruntime.cudaStream_t hStream, int* priority) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetPriority(hStream, priority) +{{endif}} + +{{if 'cudaStreamGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetFlags(cyruntime.cudaStream_t hStream, unsigned int* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetFlags(hStream, flags) +{{endif}} + +{{if 'cudaStreamGetId' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetId(cyruntime.cudaStream_t hStream, unsigned long long* streamId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetId(hStream, streamId) +{{endif}} + +{{if 'cudaStreamGetDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetDevice(cyruntime.cudaStream_t hStream, int* device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetDevice(hStream, device) +{{endif}} + +{{if 'cudaCtxResetPersistingL2Cache' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCtxResetPersistingL2Cache() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaCtxResetPersistingL2Cache() +{{endif}} + +{{if 'cudaStreamCopyAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamCopyAttributes(cyruntime.cudaStream_t dst, cyruntime.cudaStream_t src) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamCopyAttributes(dst, src) +{{endif}} + +{{if 'cudaStreamGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, cyruntime.cudaStreamAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetAttribute(hStream, attr, value_out) +{{endif}} + +{{if 'cudaStreamSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamSetAttribute(cyruntime.cudaStream_t hStream, cyruntime.cudaStreamAttrID attr, const cyruntime.cudaStreamAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamSetAttribute(hStream, attr, value) +{{endif}} + +{{if 'cudaStreamDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamDestroy(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamDestroy(stream) +{{endif}} + +{{if 'cudaStreamWaitEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamWaitEvent(cyruntime.cudaStream_t stream, cyruntime.cudaEvent_t event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamWaitEvent(stream, event, flags) +{{endif}} + +{{if 'cudaStreamAddCallback' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamAddCallback(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamAddCallback(stream, callback, userData, flags) +{{endif}} + +{{if 'cudaStreamSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamSynchronize(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamSynchronize(stream) +{{endif}} + +{{if 'cudaStreamQuery' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamQuery(cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamQuery(stream) +{{endif}} + +{{if 'cudaStreamAttachMemAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamAttachMemAsync(cyruntime.cudaStream_t stream, void* devPtr, size_t length, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamAttachMemAsync(stream, devPtr, length, flags) +{{endif}} + +{{if 'cudaStreamBeginCapture' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamBeginCapture(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamBeginCapture(stream, mode) +{{endif}} + +{{if 'cudaStreamBeginCaptureToGraph' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamBeginCaptureToGraph(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaStreamCaptureMode mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamBeginCaptureToGraph(stream, graph, dependencies, dependencyData, numDependencies, mode) +{{endif}} + +{{if 'cudaThreadExchangeStreamCaptureMode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaThreadExchangeStreamCaptureMode(cyruntime.cudaStreamCaptureMode* mode) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaThreadExchangeStreamCaptureMode(mode) +{{endif}} + +{{if 'cudaStreamEndCapture' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamEndCapture(cyruntime.cudaStream_t stream, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamEndCapture(stream, pGraph) +{{endif}} + +{{if 'cudaStreamIsCapturing' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamIsCapturing(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* pCaptureStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamIsCapturing(stream, pCaptureStatus) +{{endif}} + +{{if 'cudaStreamGetCaptureInfo_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v2(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetCaptureInfo_v2_ptsz(stream, captureStatus_out, id_out, graph_out, dependencies_out, numDependencies_out) +{{endif}} + +{{if 'cudaStreamGetCaptureInfo_v3' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamGetCaptureInfo_v3(cyruntime.cudaStream_t stream, cyruntime.cudaStreamCaptureStatus* captureStatus_out, unsigned long long* id_out, cyruntime.cudaGraph_t* graph_out, const cyruntime.cudaGraphNode_t** dependencies_out, const cyruntime.cudaGraphEdgeData** edgeData_out, size_t* numDependencies_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamGetCaptureInfo_v3(stream, captureStatus_out, id_out, graph_out, dependencies_out, edgeData_out, numDependencies_out) +{{endif}} + +{{if 'cudaStreamUpdateCaptureDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamUpdateCaptureDependencies(stream, dependencies, numDependencies, flags) +{{endif}} + +{{if 'cudaStreamUpdateCaptureDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaStreamUpdateCaptureDependencies_v2(cyruntime.cudaStream_t stream, cyruntime.cudaGraphNode_t* dependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaStreamUpdateCaptureDependencies_v2(stream, dependencies, dependencyData, numDependencies, flags) +{{endif}} + +{{if 'cudaEventCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventCreate(cyruntime.cudaEvent_t* event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventCreate(event) +{{endif}} + +{{if 'cudaEventCreateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventCreateWithFlags(cyruntime.cudaEvent_t* event, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventCreateWithFlags(event, flags) +{{endif}} + +{{if 'cudaEventRecord' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventRecord(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventRecord(event, stream) +{{endif}} + +{{if 'cudaEventRecordWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventRecordWithFlags(cyruntime.cudaEvent_t event, cyruntime.cudaStream_t stream, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventRecordWithFlags(event, stream, flags) +{{endif}} + +{{if 'cudaEventQuery' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventQuery(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventQuery(event) +{{endif}} + +{{if 'cudaEventSynchronize' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventSynchronize(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventSynchronize(event) +{{endif}} + +{{if 'cudaEventDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventDestroy(cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventDestroy(event) +{{endif}} + +{{if 'cudaEventElapsedTime' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventElapsedTime(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventElapsedTime(ms, start, end) +{{endif}} + +{{if 'cudaEventElapsedTime_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaEventElapsedTime_v2(float* ms, cyruntime.cudaEvent_t start, cyruntime.cudaEvent_t end) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaEventElapsedTime_v2(ms, start, end) +{{endif}} + +{{if 'cudaImportExternalMemory' in found_functions}} + +cdef cyruntime.cudaError_t _cudaImportExternalMemory(cyruntime.cudaExternalMemory_t* extMem_out, const cyruntime.cudaExternalMemoryHandleDesc* memHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaImportExternalMemory(extMem_out, memHandleDesc) +{{endif}} + +{{if 'cudaExternalMemoryGetMappedBuffer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedBuffer(void** devPtr, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryBufferDesc* bufferDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaExternalMemoryGetMappedBuffer(devPtr, extMem, bufferDesc) +{{endif}} + +{{if 'cudaExternalMemoryGetMappedMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaExternalMemoryGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmap, cyruntime.cudaExternalMemory_t extMem, const cyruntime.cudaExternalMemoryMipmappedArrayDesc* mipmapDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaExternalMemoryGetMappedMipmappedArray(mipmap, extMem, mipmapDesc) +{{endif}} + +{{if 'cudaDestroyExternalMemory' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyExternalMemory(cyruntime.cudaExternalMemory_t extMem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDestroyExternalMemory(extMem) +{{endif}} + +{{if 'cudaImportExternalSemaphore' in found_functions}} + +cdef cyruntime.cudaError_t _cudaImportExternalSemaphore(cyruntime.cudaExternalSemaphore_t* extSem_out, const cyruntime.cudaExternalSemaphoreHandleDesc* semHandleDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaImportExternalSemaphore(extSem_out, semHandleDesc) +{{endif}} + +{{if 'cudaSignalExternalSemaphoresAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaSignalExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreSignalParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaSignalExternalSemaphoresAsync_v2_ptsz(extSemArray, paramsArray, numExtSems, stream) +{{endif}} + +{{if 'cudaWaitExternalSemaphoresAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaWaitExternalSemaphoresAsync_v2(const cyruntime.cudaExternalSemaphore_t* extSemArray, const cyruntime.cudaExternalSemaphoreWaitParams* paramsArray, unsigned int numExtSems, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaWaitExternalSemaphoresAsync_v2_ptsz(extSemArray, paramsArray, numExtSems, stream) +{{endif}} + +{{if 'cudaDestroyExternalSemaphore' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyExternalSemaphore(cyruntime.cudaExternalSemaphore_t extSem) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDestroyExternalSemaphore(extSem) +{{endif}} + +{{if 'cudaFuncSetCacheConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetCacheConfig(const void* func, cyruntime.cudaFuncCache cacheConfig) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFuncSetCacheConfig(func, cacheConfig) +{{endif}} + +{{if 'cudaFuncGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncGetAttributes(cyruntime.cudaFuncAttributes* attr, const void* func) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFuncGetAttributes(attr, func) +{{endif}} + +{{if 'cudaFuncSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetAttribute(const void* func, cyruntime.cudaFuncAttribute attr, int value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFuncSetAttribute(func, attr, value) +{{endif}} + +{{if 'cudaLaunchHostFunc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLaunchHostFunc(cyruntime.cudaStream_t stream, cyruntime.cudaHostFn_t fn, void* userData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLaunchHostFunc(stream, fn, userData) +{{endif}} + +{{if 'cudaFuncSetSharedMemConfig' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFuncSetSharedMemConfig(const void* func, cyruntime.cudaSharedMemConfig config) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFuncSetSharedMemConfig(func, config) +{{endif}} + +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessor' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize) +{{endif}} + +{{if 'cudaOccupancyAvailableDynamicSMemPerBlock' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyAvailableDynamicSMemPerBlock(size_t* dynamicSmemSize, const void* func, int numBlocks, int blockSize) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaOccupancyAvailableDynamicSMemPerBlock(dynamicSmemSize, func, numBlocks, blockSize) +{{endif}} + +{{if 'cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, const void* func, int blockSize, size_t dynamicSMemSize, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags) +{{endif}} + +{{if 'cudaMallocManaged' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocManaged(void** devPtr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocManaged(devPtr, size, flags) +{{endif}} + +{{if 'cudaMalloc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc(void** devPtr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMalloc(devPtr, size) +{{endif}} + +{{if 'cudaMallocHost' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocHost(void** ptr, size_t size) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocHost(ptr, size) +{{endif}} + +{{if 'cudaMallocPitch' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocPitch(void** devPtr, size_t* pitch, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocPitch(devPtr, pitch, width, height) +{{endif}} + +{{if 'cudaMallocArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, size_t width, size_t height, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocArray(array, desc, width, height, flags) +{{endif}} + +{{if 'cudaFree' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFree(void* devPtr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFree(devPtr) +{{endif}} + +{{if 'cudaFreeHost' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeHost(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFreeHost(ptr) +{{endif}} + +{{if 'cudaFreeArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeArray(cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFreeArray(array) +{{endif}} + +{{if 'cudaFreeMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeMipmappedArray(cyruntime.cudaMipmappedArray_t mipmappedArray) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFreeMipmappedArray(mipmappedArray) +{{endif}} + +{{if 'cudaHostAlloc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostAlloc(void** pHost, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaHostAlloc(pHost, size, flags) +{{endif}} + +{{if 'cudaHostRegister' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostRegister(void* ptr, size_t size, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaHostRegister(ptr, size, flags) +{{endif}} + +{{if 'cudaHostUnregister' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostUnregister(void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaHostUnregister(ptr) +{{endif}} + +{{if 'cudaHostGetDevicePointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostGetDevicePointer(void** pDevice, void* pHost, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaHostGetDevicePointer(pDevice, pHost, flags) +{{endif}} + +{{if 'cudaHostGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaHostGetFlags(unsigned int* pFlags, void* pHost) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaHostGetFlags(pFlags, pHost) +{{endif}} + +{{if 'cudaMalloc3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc3D(cyruntime.cudaPitchedPtr* pitchedDevPtr, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMalloc3D(pitchedDevPtr, extent) +{{endif}} + +{{if 'cudaMalloc3DArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMalloc3DArray(cyruntime.cudaArray_t* array, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMalloc3DArray(array, desc, extent, flags) +{{endif}} + +{{if 'cudaMallocMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, const cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent extent, unsigned int numLevels, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocMipmappedArray(mipmappedArray, desc, extent, numLevels, flags) +{{endif}} + +{{if 'cudaGetMipmappedArrayLevel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetMipmappedArrayLevel(cyruntime.cudaArray_t* levelArray, cyruntime.cudaMipmappedArray_const_t mipmappedArray, unsigned int level) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetMipmappedArrayLevel(levelArray, mipmappedArray, level) +{{endif}} + +{{if 'cudaMemcpy3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3D(const cyruntime.cudaMemcpy3DParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy3D(p) +{{endif}} + +{{if 'cudaMemcpy3DPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DPeer(const cyruntime.cudaMemcpy3DPeerParms* p) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy3DPeer(p) +{{endif}} + +{{if 'cudaMemcpy3DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DAsync(const cyruntime.cudaMemcpy3DParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy3DAsync(p, stream) +{{endif}} + +{{if 'cudaMemcpy3DPeerAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DPeerAsync(const cyruntime.cudaMemcpy3DPeerParms* p, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy3DPeerAsync(p, stream) +{{endif}} + +{{if 'cudaMemGetInfo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemGetInfo(size_t* free, size_t* total) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemGetInfo(free, total) +{{endif}} + +{{if 'cudaArrayGetInfo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetInfo(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaExtent* extent, unsigned int* flags, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaArrayGetInfo(desc, extent, flags, array) +{{endif}} + +{{if 'cudaArrayGetPlane' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetPlane(cyruntime.cudaArray_t* pPlaneArray, cyruntime.cudaArray_t hArray, unsigned int planeIdx) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaArrayGetPlane(pPlaneArray, hArray, planeIdx) +{{endif}} + +{{if 'cudaArrayGetMemoryRequirements' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaArray_t array, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaArrayGetMemoryRequirements(memoryRequirements, array, device) +{{endif}} + +{{if 'cudaMipmappedArrayGetMemoryRequirements' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetMemoryRequirements(cyruntime.cudaArrayMemoryRequirements* memoryRequirements, cyruntime.cudaMipmappedArray_t mipmap, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMipmappedArrayGetMemoryRequirements(memoryRequirements, mipmap, device) +{{endif}} + +{{if 'cudaArrayGetSparseProperties' in found_functions}} + +cdef cyruntime.cudaError_t _cudaArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaArray_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaArrayGetSparseProperties(sparseProperties, array) +{{endif}} + +{{if 'cudaMipmappedArrayGetSparseProperties' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMipmappedArrayGetSparseProperties(cyruntime.cudaArraySparseProperties* sparseProperties, cyruntime.cudaMipmappedArray_t mipmap) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMipmappedArrayGetSparseProperties(sparseProperties, mipmap) +{{endif}} + +{{if 'cudaMemcpy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy(dst, src, count, kind) +{{endif}} + +{{if 'cudaMemcpyPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyPeer(void* dst, int dstDevice, const void* src, int srcDevice, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyPeer(dst, dstDevice, src, srcDevice, count) +{{endif}} + +{{if 'cudaMemcpy2D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2D(dst, dpitch, src, spitch, width, height, kind) +{{endif}} + +{{if 'cudaMemcpy2DToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2DToArray(dst, wOffset, hOffset, src, spitch, width, height, kind) +{{endif}} + +{{if 'cudaMemcpy2DFromArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArray(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2DFromArray(dst, dpitch, src, wOffset, hOffset, width, height, kind) +{{endif}} + +{{if 'cudaMemcpy2DArrayToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t width, size_t height, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2DArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, width, height, kind) +{{endif}} + +{{if 'cudaMemcpyAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyAsync(void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyAsync(dst, src, count, kind, stream) +{{endif}} + +{{if 'cudaMemcpyPeerAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyPeerAsync(dst, dstDevice, src, srcDevice, count, stream) +{{endif}} + +{{if 'cudaMemcpyBatchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyBatchAsync(void** dsts, void** srcs, size_t* sizes, size_t count, cyruntime.cudaMemcpyAttributes* attrs, size_t* attrsIdxs, size_t numAttrs, size_t* failIdx, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyBatchAsync(dsts, srcs, sizes, count, attrs, attrsIdxs, numAttrs, failIdx, stream) +{{endif}} + +{{if 'cudaMemcpy3DBatchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy3DBatchAsync(size_t numOps, cyruntime.cudaMemcpy3DBatchOp* opList, size_t* failIdx, unsigned long long flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy3DBatchAsync(numOps, opList, failIdx, flags, stream) +{{endif}} + +{{if 'cudaMemcpy2DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream) +{{endif}} + +{{if 'cudaMemcpy2DToArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2DToArrayAsync(dst, wOffset, hOffset, src, spitch, width, height, kind, stream) +{{endif}} + +{{if 'cudaMemcpy2DFromArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpy2DFromArrayAsync(void* dst, size_t dpitch, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t width, size_t height, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpy2DFromArrayAsync(dst, dpitch, src, wOffset, hOffset, width, height, kind, stream) +{{endif}} + +{{if 'cudaMemset' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset(void* devPtr, int value, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemset(devPtr, value, count) +{{endif}} + +{{if 'cudaMemset2D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset2D(void* devPtr, size_t pitch, int value, size_t width, size_t height) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemset2D(devPtr, pitch, value, width, height) +{{endif}} + +{{if 'cudaMemset3D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset3D(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemset3D(pitchedDevPtr, value, extent) +{{endif}} + +{{if 'cudaMemsetAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemsetAsync(void* devPtr, int value, size_t count, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemsetAsync(devPtr, value, count, stream) +{{endif}} + +{{if 'cudaMemset2DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset2DAsync(void* devPtr, size_t pitch, int value, size_t width, size_t height, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemset2DAsync(devPtr, pitch, value, width, height, stream) +{{endif}} + +{{if 'cudaMemset3DAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemset3DAsync(cyruntime.cudaPitchedPtr pitchedDevPtr, int value, cyruntime.cudaExtent extent, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemset3DAsync(pitchedDevPtr, value, extent, stream) +{{endif}} + +{{if 'cudaMemPrefetchAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync(const void* devPtr, size_t count, int dstDevice, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPrefetchAsync(devPtr, count, dstDevice, stream) +{{endif}} + +{{if 'cudaMemPrefetchAsync_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPrefetchAsync_v2(const void* devPtr, size_t count, cyruntime.cudaMemLocation location, unsigned int flags, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPrefetchAsync_v2(devPtr, count, location, flags, stream) +{{endif}} + +{{if 'cudaMemAdvise' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemAdvise(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemAdvise(devPtr, count, advice, device) +{{endif}} + +{{if 'cudaMemAdvise_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemAdvise_v2(const void* devPtr, size_t count, cyruntime.cudaMemoryAdvise advice, cyruntime.cudaMemLocation location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemAdvise_v2(devPtr, count, advice, location) +{{endif}} + +{{if 'cudaMemRangeGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemRangeGetAttribute(void* data, size_t dataSize, cyruntime.cudaMemRangeAttribute attribute, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemRangeGetAttribute(data, dataSize, attribute, devPtr, count) +{{endif}} + +{{if 'cudaMemRangeGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemRangeGetAttributes(void** data, size_t* dataSizes, cyruntime.cudaMemRangeAttribute* attributes, size_t numAttributes, const void* devPtr, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemRangeGetAttributes(data, dataSizes, attributes, numAttributes, devPtr, count) +{{endif}} + +{{if 'cudaMemcpyToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyToArray(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyToArray(dst, wOffset, hOffset, src, count, kind) +{{endif}} + +{{if 'cudaMemcpyFromArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyFromArray(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyFromArray(dst, src, wOffset, hOffset, count, kind) +{{endif}} + +{{if 'cudaMemcpyArrayToArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyArrayToArray(cyruntime.cudaArray_t dst, size_t wOffsetDst, size_t hOffsetDst, cyruntime.cudaArray_const_t src, size_t wOffsetSrc, size_t hOffsetSrc, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyArrayToArray(dst, wOffsetDst, hOffsetDst, src, wOffsetSrc, hOffsetSrc, count, kind) +{{endif}} + +{{if 'cudaMemcpyToArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyToArrayAsync(cyruntime.cudaArray_t dst, size_t wOffset, size_t hOffset, const void* src, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyToArrayAsync(dst, wOffset, hOffset, src, count, kind, stream) +{{endif}} + +{{if 'cudaMemcpyFromArrayAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemcpyFromArrayAsync(void* dst, cyruntime.cudaArray_const_t src, size_t wOffset, size_t hOffset, size_t count, cyruntime.cudaMemcpyKind kind, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemcpyFromArrayAsync(dst, src, wOffset, hOffset, count, kind, stream) +{{endif}} + +{{if 'cudaMallocAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocAsync(void** devPtr, size_t size, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocAsync(devPtr, size, hStream) +{{endif}} + +{{if 'cudaFreeAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaFreeAsync(void* devPtr, cyruntime.cudaStream_t hStream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaFreeAsync(devPtr, hStream) +{{endif}} + +{{if 'cudaMemPoolTrimTo' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolTrimTo(cyruntime.cudaMemPool_t memPool, size_t minBytesToKeep) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolTrimTo(memPool, minBytesToKeep) +{{endif}} + +{{if 'cudaMemPoolSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolSetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolSetAttribute(memPool, attr, value) +{{endif}} + +{{if 'cudaMemPoolGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolGetAttribute(cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolAttr attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolGetAttribute(memPool, attr, value) +{{endif}} + +{{if 'cudaMemPoolSetAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolSetAccess(cyruntime.cudaMemPool_t memPool, const cyruntime.cudaMemAccessDesc* descList, size_t count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolSetAccess(memPool, descList, count) +{{endif}} + +{{if 'cudaMemPoolGetAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolGetAccess(cyruntime.cudaMemAccessFlags* flags, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemLocation* location) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolGetAccess(flags, memPool, location) +{{endif}} + +{{if 'cudaMemPoolCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolCreate(cyruntime.cudaMemPool_t* memPool, const cyruntime.cudaMemPoolProps* poolProps) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolCreate(memPool, poolProps) +{{endif}} + +{{if 'cudaMemPoolDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolDestroy(cyruntime.cudaMemPool_t memPool) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolDestroy(memPool) +{{endif}} + +{{if 'cudaMallocFromPoolAsync' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMallocFromPoolAsync(void** ptr, size_t size, cyruntime.cudaMemPool_t memPool, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMallocFromPoolAsync(ptr, size, memPool, stream) +{{endif}} + +{{if 'cudaMemPoolExportToShareableHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolExportToShareableHandle(void* shareableHandle, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolExportToShareableHandle(shareableHandle, memPool, handleType, flags) +{{endif}} + +{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolImportFromShareableHandle(cyruntime.cudaMemPool_t* memPool, void* shareableHandle, cyruntime.cudaMemAllocationHandleType handleType, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolImportFromShareableHandle(memPool, shareableHandle, handleType, flags) +{{endif}} + +{{if 'cudaMemPoolExportPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolExportPointer(cyruntime.cudaMemPoolPtrExportData* exportData, void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolExportPointer(exportData, ptr) +{{endif}} + +{{if 'cudaMemPoolImportPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaMemPoolImportPointer(void** ptr, cyruntime.cudaMemPool_t memPool, cyruntime.cudaMemPoolPtrExportData* exportData) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaMemPoolImportPointer(ptr, memPool, exportData) +{{endif}} + +{{if 'cudaPointerGetAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaPointerGetAttributes(cyruntime.cudaPointerAttributes* attributes, const void* ptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaPointerGetAttributes(attributes, ptr) +{{endif}} + +{{if 'cudaDeviceCanAccessPeer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceCanAccessPeer(int* canAccessPeer, int device, int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceCanAccessPeer(canAccessPeer, device, peerDevice) +{{endif}} + +{{if 'cudaDeviceEnablePeerAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceEnablePeerAccess(int peerDevice, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceEnablePeerAccess(peerDevice, flags) +{{endif}} + +{{if 'cudaDeviceDisablePeerAccess' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceDisablePeerAccess(int peerDevice) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceDisablePeerAccess(peerDevice) +{{endif}} + +{{if 'cudaGraphicsUnregisterResource' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsUnregisterResource(cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsUnregisterResource(resource) +{{endif}} + +{{if 'cudaGraphicsResourceSetMapFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceSetMapFlags(cyruntime.cudaGraphicsResource_t resource, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsResourceSetMapFlags(resource, flags) +{{endif}} + +{{if 'cudaGraphicsMapResources' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsMapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsMapResources(count, resources, stream) +{{endif}} + +{{if 'cudaGraphicsUnmapResources' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsUnmapResources(int count, cyruntime.cudaGraphicsResource_t* resources, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsUnmapResources(count, resources, stream) +{{endif}} + +{{if 'cudaGraphicsResourceGetMappedPointer' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedPointer(void** devPtr, size_t* size, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsResourceGetMappedPointer(devPtr, size, resource) +{{endif}} + +{{if 'cudaGraphicsSubResourceGetMappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsSubResourceGetMappedArray(cyruntime.cudaArray_t* array, cyruntime.cudaGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsSubResourceGetMappedArray(array, resource, arrayIndex, mipLevel) +{{endif}} + +{{if 'cudaGraphicsResourceGetMappedMipmappedArray' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphicsResourceGetMappedMipmappedArray(cyruntime.cudaMipmappedArray_t* mipmappedArray, cyruntime.cudaGraphicsResource_t resource) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphicsResourceGetMappedMipmappedArray(mipmappedArray, resource) +{{endif}} + +{{if 'cudaGetChannelDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetChannelDesc(cyruntime.cudaChannelFormatDesc* desc, cyruntime.cudaArray_const_t array) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetChannelDesc(desc, array) +{{endif}} + +{{if 'cudaCreateChannelDesc' in found_functions}} + +cdef cyruntime.cudaChannelFormatDesc _cudaCreateChannelDesc(int x, int y, int z, int w, cyruntime.cudaChannelFormatKind f) nogil: + return cudaCreateChannelDesc(x, y, z, w, f) +{{endif}} + +{{if 'cudaCreateTextureObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCreateTextureObject(cyruntime.cudaTextureObject_t* pTexObject, const cyruntime.cudaResourceDesc* pResDesc, const cyruntime.cudaTextureDesc* pTexDesc, const cyruntime.cudaResourceViewDesc* pResViewDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaCreateTextureObject(pTexObject, pResDesc, pTexDesc, pResViewDesc) +{{endif}} + +{{if 'cudaDestroyTextureObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroyTextureObject(cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDestroyTextureObject(texObject) +{{endif}} + +{{if 'cudaGetTextureObjectResourceDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetTextureObjectResourceDesc(pResDesc, texObject) +{{endif}} + +{{if 'cudaGetTextureObjectTextureDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectTextureDesc(cyruntime.cudaTextureDesc* pTexDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetTextureObjectTextureDesc(pTexDesc, texObject) +{{endif}} + +{{if 'cudaGetTextureObjectResourceViewDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetTextureObjectResourceViewDesc(cyruntime.cudaResourceViewDesc* pResViewDesc, cyruntime.cudaTextureObject_t texObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetTextureObjectResourceViewDesc(pResViewDesc, texObject) +{{endif}} + +{{if 'cudaCreateSurfaceObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaCreateSurfaceObject(cyruntime.cudaSurfaceObject_t* pSurfObject, const cyruntime.cudaResourceDesc* pResDesc) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaCreateSurfaceObject(pSurfObject, pResDesc) +{{endif}} + +{{if 'cudaDestroySurfaceObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDestroySurfaceObject(cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDestroySurfaceObject(surfObject) +{{endif}} + +{{if 'cudaGetSurfaceObjectResourceDesc' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetSurfaceObjectResourceDesc(cyruntime.cudaResourceDesc* pResDesc, cyruntime.cudaSurfaceObject_t surfObject) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetSurfaceObjectResourceDesc(pResDesc, surfObject) +{{endif}} + +{{if 'cudaDriverGetVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDriverGetVersion(int* driverVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDriverGetVersion(driverVersion) +{{endif}} + +{{if 'cudaRuntimeGetVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaRuntimeGetVersion(int* runtimeVersion) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaRuntimeGetVersion(runtimeVersion) +{{endif}} + +{{if 'cudaGraphCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphCreate(cyruntime.cudaGraph_t* pGraph, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphCreate(pGraph, flags) +{{endif}} + +{{if 'cudaGraphAddKernelNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddKernelNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddKernelNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) +{{endif}} + +{{if 'cudaGraphKernelNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphKernelNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphKernelNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphKernelNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphKernelNodeCopyAttributes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeCopyAttributes(cyruntime.cudaGraphNode_t hSrc, cyruntime.cudaGraphNode_t hDst) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphKernelNodeCopyAttributes(hSrc, hDst) +{{endif}} + +{{if 'cudaGraphKernelNodeGetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeGetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, cyruntime.cudaKernelNodeAttrValue* value_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphKernelNodeGetAttribute(hNode, attr, value_out) +{{endif}} + +{{if 'cudaGraphKernelNodeSetAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphKernelNodeSetAttribute(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaKernelNodeAttrID attr, const cyruntime.cudaKernelNodeAttrValue* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphKernelNodeSetAttribute(hNode, attr, value) +{{endif}} + +{{if 'cudaGraphAddMemcpyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemcpy3DParms* pCopyParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddMemcpyNode(pGraphNode, graph, pDependencies, numDependencies, pCopyParams) +{{endif}} + +{{if 'cudaGraphAddMemcpyNode1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemcpyNode1D(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddMemcpyNode1D(pGraphNode, graph, pDependencies, numDependencies, dst, src, count, kind) +{{endif}} + +{{if 'cudaGraphMemcpyNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemcpyNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphMemcpyNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemcpyNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphMemcpyNodeSetParams1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemcpyNodeSetParams1D(cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemcpyNodeSetParams1D(node, dst, src, count, kind) +{{endif}} + +{{if 'cudaGraphAddMemsetNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemsetNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaMemsetParams* pMemsetParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddMemsetNode(pGraphNode, graph, pDependencies, numDependencies, pMemsetParams) +{{endif}} + +{{if 'cudaGraphMemsetNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemsetNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphMemsetNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemsetNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemsetNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphAddHostNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddHostNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddHostNode(pGraphNode, graph, pDependencies, numDependencies, pNodeParams) +{{endif}} + +{{if 'cudaGraphHostNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphHostNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphHostNodeGetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphHostNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphHostNodeSetParams(cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphHostNodeSetParams(node, pNodeParams) +{{endif}} + +{{if 'cudaGraphAddChildGraphNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddChildGraphNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddChildGraphNode(pGraphNode, graph, pDependencies, numDependencies, childGraph) +{{endif}} + +{{if 'cudaGraphChildGraphNodeGetGraph' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphChildGraphNodeGetGraph(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t* pGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphChildGraphNodeGetGraph(node, pGraph) +{{endif}} + +{{if 'cudaGraphAddEmptyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEmptyNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddEmptyNode(pGraphNode, graph, pDependencies, numDependencies) +{{endif}} + +{{if 'cudaGraphAddEventRecordNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEventRecordNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddEventRecordNode(pGraphNode, graph, pDependencies, numDependencies, event) +{{endif}} + +{{if 'cudaGraphEventRecordNodeGetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphEventRecordNodeGetEvent(node, event_out) +{{endif}} + +{{if 'cudaGraphEventRecordNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventRecordNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphEventRecordNodeSetEvent(node, event) +{{endif}} + +{{if 'cudaGraphAddEventWaitNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddEventWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddEventWaitNode(pGraphNode, graph, pDependencies, numDependencies, event) +{{endif}} + +{{if 'cudaGraphEventWaitNodeGetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeGetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t* event_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphEventWaitNodeGetEvent(node, event_out) +{{endif}} + +{{if 'cudaGraphEventWaitNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphEventWaitNodeSetEvent(cyruntime.cudaGraphNode_t node, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphEventWaitNodeSetEvent(node, event) +{{endif}} + +{{if 'cudaGraphAddExternalSemaphoresSignalNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresSignalNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddExternalSemaphoresSignalNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresSignalNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreSignalNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExternalSemaphoresSignalNodeGetParams(hNode, params_out) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresSignalNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExternalSemaphoresSignalNodeSetParams(hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphAddExternalSemaphoresWaitNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddExternalSemaphoresWaitNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddExternalSemaphoresWaitNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresWaitNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeGetParams(cyruntime.cudaGraphNode_t hNode, cyruntime.cudaExternalSemaphoreWaitNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExternalSemaphoresWaitNodeGetParams(hNode, params_out) +{{endif}} + +{{if 'cudaGraphExternalSemaphoresWaitNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExternalSemaphoresWaitNodeSetParams(hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphAddMemAllocNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemAllocNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaMemAllocNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddMemAllocNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphMemAllocNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemAllocNodeGetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaMemAllocNodeParams* params_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemAllocNodeGetParams(node, params_out) +{{endif}} + +{{if 'cudaGraphAddMemFreeNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddMemFreeNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, void* dptr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddMemFreeNode(pGraphNode, graph, pDependencies, numDependencies, dptr) +{{endif}} + +{{if 'cudaGraphMemFreeNodeGetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphMemFreeNodeGetParams(cyruntime.cudaGraphNode_t node, void* dptr_out) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphMemFreeNodeGetParams(node, dptr_out) +{{endif}} + +{{if 'cudaDeviceGraphMemTrim' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGraphMemTrim(int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGraphMemTrim(device) +{{endif}} + +{{if 'cudaDeviceGetGraphMemAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceGetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceGetGraphMemAttribute(device, attr, value) +{{endif}} + +{{if 'cudaDeviceSetGraphMemAttribute' in found_functions}} + +cdef cyruntime.cudaError_t _cudaDeviceSetGraphMemAttribute(int device, cyruntime.cudaGraphMemAttributeType attr, void* value) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaDeviceSetGraphMemAttribute(device, attr, value) +{{endif}} + +{{if 'cudaGraphClone' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphClone(cyruntime.cudaGraph_t* pGraphClone, cyruntime.cudaGraph_t originalGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphClone(pGraphClone, originalGraph) +{{endif}} + +{{if 'cudaGraphNodeFindInClone' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeFindInClone(cyruntime.cudaGraphNode_t* pNode, cyruntime.cudaGraphNode_t originalNode, cyruntime.cudaGraph_t clonedGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeFindInClone(pNode, originalNode, clonedGraph) +{{endif}} + +{{if 'cudaGraphNodeGetType' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetType(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeType* pType) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeGetType(node, pType) +{{endif}} + +{{if 'cudaGraphGetNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* nodes, size_t* numNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphGetNodes(graph, nodes, numNodes) +{{endif}} + +{{if 'cudaGraphGetRootNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetRootNodes(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* pRootNodes, size_t* pNumRootNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphGetRootNodes(graph, pRootNodes, pNumRootNodes) +{{endif}} + +{{if 'cudaGraphGetEdges' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetEdges(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphGetEdges(graph, from_, to, numEdges) +{{endif}} + +{{if 'cudaGraphGetEdges_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphGetEdges_v2(cyruntime.cudaGraph_t graph, cyruntime.cudaGraphNode_t* from_, cyruntime.cudaGraphNode_t* to, cyruntime.cudaGraphEdgeData* edgeData, size_t* numEdges) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphGetEdges_v2(graph, from_, to, edgeData, numEdges) +{{endif}} + +{{if 'cudaGraphNodeGetDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeGetDependencies(node, pDependencies, pNumDependencies) +{{endif}} + +{{if 'cudaGraphNodeGetDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependencies_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependencies, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeGetDependencies_v2(node, pDependencies, edgeData, pNumDependencies) +{{endif}} + +{{if 'cudaGraphNodeGetDependentNodes' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeGetDependentNodes(node, pDependentNodes, pNumDependentNodes) +{{endif}} + +{{if 'cudaGraphNodeGetDependentNodes_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetDependentNodes_v2(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNode_t* pDependentNodes, cyruntime.cudaGraphEdgeData* edgeData, size_t* pNumDependentNodes) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeGetDependentNodes_v2(node, pDependentNodes, edgeData, pNumDependentNodes) +{{endif}} + +{{if 'cudaGraphAddDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddDependencies(graph, from_, to, numDependencies) +{{endif}} + +{{if 'cudaGraphAddDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddDependencies_v2(graph, from_, to, edgeData, numDependencies) +{{endif}} + +{{if 'cudaGraphRemoveDependencies' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphRemoveDependencies(graph, from_, to, numDependencies) +{{endif}} + +{{if 'cudaGraphRemoveDependencies_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRemoveDependencies_v2(cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* from_, const cyruntime.cudaGraphNode_t* to, const cyruntime.cudaGraphEdgeData* edgeData, size_t numDependencies) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphRemoveDependencies_v2(graph, from_, to, edgeData, numDependencies) +{{endif}} + +{{if 'cudaGraphDestroyNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDestroyNode(cyruntime.cudaGraphNode_t node) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphDestroyNode(node) +{{endif}} + +{{if 'cudaGraphInstantiate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiate(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphInstantiate(pGraphExec, graph, flags) +{{endif}} + +{{if 'cudaGraphInstantiateWithFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithFlags(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, unsigned long long flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphInstantiateWithFlags(pGraphExec, graph, flags) +{{endif}} + +{{if 'cudaGraphInstantiateWithParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphInstantiateWithParams(cyruntime.cudaGraphExec_t* pGraphExec, cyruntime.cudaGraph_t graph, cyruntime.cudaGraphInstantiateParams* instantiateParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphInstantiateWithParams(pGraphExec, graph, instantiateParams) +{{endif}} + +{{if 'cudaGraphExecGetFlags' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecGetFlags(cyruntime.cudaGraphExec_t graphExec, unsigned long long* flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecGetFlags(graphExec, flags) +{{endif}} + +{{if 'cudaGraphExecKernelNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecKernelNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaKernelNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecKernelNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecMemcpyNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemcpy3DParms* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecMemcpyNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecMemcpyNodeSetParams1D' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemcpyNodeSetParams1D(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, void* dst, const void* src, size_t count, cyruntime.cudaMemcpyKind kind) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecMemcpyNodeSetParams1D(hGraphExec, node, dst, src, count, kind) +{{endif}} + +{{if 'cudaGraphExecMemsetNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecMemsetNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaMemsetParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecMemsetNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecHostNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecHostNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, const cyruntime.cudaHostNodeParams* pNodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecHostNodeSetParams(hGraphExec, node, pNodeParams) +{{endif}} + +{{if 'cudaGraphExecChildGraphNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecChildGraphNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraph_t childGraph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecChildGraphNodeSetParams(hGraphExec, node, childGraph) +{{endif}} + +{{if 'cudaGraphExecEventRecordNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecEventRecordNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecEventRecordNodeSetEvent(hGraphExec, hNode, event) +{{endif}} + +{{if 'cudaGraphExecEventWaitNodeSetEvent' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecEventWaitNodeSetEvent(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, cyruntime.cudaEvent_t event) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecEventWaitNodeSetEvent(hGraphExec, hNode, event) +{{endif}} + +{{if 'cudaGraphExecExternalSemaphoresSignalNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresSignalNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreSignalNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecExternalSemaphoresSignalNodeSetParams(hGraphExec, hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphExecExternalSemaphoresWaitNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecExternalSemaphoresWaitNodeSetParams(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, const cyruntime.cudaExternalSemaphoreWaitNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecExternalSemaphoresWaitNodeSetParams(hGraphExec, hNode, nodeParams) +{{endif}} + +{{if 'cudaGraphNodeSetEnabled' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeSetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeSetEnabled(hGraphExec, hNode, isEnabled) +{{endif}} + +{{if 'cudaGraphNodeGetEnabled' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeGetEnabled(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraphNode_t hNode, unsigned int* isEnabled) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeGetEnabled(hGraphExec, hNode, isEnabled) +{{endif}} + +{{if 'cudaGraphExecUpdate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecUpdate(cyruntime.cudaGraphExec_t hGraphExec, cyruntime.cudaGraph_t hGraph, cyruntime.cudaGraphExecUpdateResultInfo* resultInfo) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecUpdate(hGraphExec, hGraph, resultInfo) +{{endif}} + +{{if 'cudaGraphUpload' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphUpload(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphUpload(graphExec, stream) +{{endif}} + +{{if 'cudaGraphLaunch' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphLaunch(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaStream_t stream) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphLaunch(graphExec, stream) +{{endif}} + +{{if 'cudaGraphExecDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecDestroy(cyruntime.cudaGraphExec_t graphExec) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecDestroy(graphExec) +{{endif}} + +{{if 'cudaGraphDestroy' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDestroy(cyruntime.cudaGraph_t graph) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphDestroy(graph) +{{endif}} + +{{if 'cudaGraphDebugDotPrint' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphDebugDotPrint(cyruntime.cudaGraph_t graph, const char* path, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphDebugDotPrint(graph, path, flags) +{{endif}} + +{{if 'cudaUserObjectCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectCreate(cyruntime.cudaUserObject_t* object_out, void* ptr, cyruntime.cudaHostFn_t destroy, unsigned int initialRefcount, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaUserObjectCreate(object_out, ptr, destroy, initialRefcount, flags) +{{endif}} + +{{if 'cudaUserObjectRetain' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectRetain(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaUserObjectRetain(object, count) +{{endif}} + +{{if 'cudaUserObjectRelease' in found_functions}} + +cdef cyruntime.cudaError_t _cudaUserObjectRelease(cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaUserObjectRelease(object, count) +{{endif}} + +{{if 'cudaGraphRetainUserObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphRetainUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphRetainUserObject(graph, object, count, flags) +{{endif}} + +{{if 'cudaGraphReleaseUserObject' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphReleaseUserObject(cyruntime.cudaGraph_t graph, cyruntime.cudaUserObject_t object, unsigned int count) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphReleaseUserObject(graph, object, count) +{{endif}} + +{{if 'cudaGraphAddNode' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddNode(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddNode(pGraphNode, graph, pDependencies, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphAddNode_v2' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphAddNode_v2(cyruntime.cudaGraphNode_t* pGraphNode, cyruntime.cudaGraph_t graph, const cyruntime.cudaGraphNode_t* pDependencies, const cyruntime.cudaGraphEdgeData* dependencyData, size_t numDependencies, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphAddNode_v2(pGraphNode, graph, pDependencies, dependencyData, numDependencies, nodeParams) +{{endif}} + +{{if 'cudaGraphNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphNodeSetParams(cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphNodeSetParams(node, nodeParams) +{{endif}} + +{{if 'cudaGraphExecNodeSetParams' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphExecNodeSetParams(cyruntime.cudaGraphExec_t graphExec, cyruntime.cudaGraphNode_t node, cyruntime.cudaGraphNodeParams* nodeParams) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphExecNodeSetParams(graphExec, node, nodeParams) +{{endif}} + +{{if 'cudaGraphConditionalHandleCreate' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGraphConditionalHandleCreate(cyruntime.cudaGraphConditionalHandle* pHandle_out, cyruntime.cudaGraph_t graph, unsigned int defaultLaunchValue, unsigned int flags) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGraphConditionalHandleCreate(pHandle_out, graph, defaultLaunchValue, flags) +{{endif}} + +{{if 'cudaGetDriverEntryPoint' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDriverEntryPoint(const char* symbol, void** funcPtr, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetDriverEntryPoint(symbol, funcPtr, flags, driverStatus) +{{endif}} + +{{if 'cudaGetDriverEntryPointByVersion' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetDriverEntryPointByVersion(const char* symbol, void** funcPtr, unsigned int cudaVersion, unsigned long long flags, cyruntime.cudaDriverEntryPointQueryResult* driverStatus) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetDriverEntryPointByVersion(symbol, funcPtr, cudaVersion, flags, driverStatus) +{{endif}} + +{{if 'cudaLibraryLoadData' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryLoadData(cyruntime.cudaLibrary_t* library, const void* code, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryLoadData(library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) +{{endif}} + +{{if 'cudaLibraryLoadFromFile' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryLoadFromFile(cyruntime.cudaLibrary_t* library, const char* fileName, cyruntime.cudaJitOption* jitOptions, void** jitOptionsValues, unsigned int numJitOptions, cyruntime.cudaLibraryOption* libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryLoadFromFile(library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions) +{{endif}} + +{{if 'cudaLibraryUnload' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryUnload(cyruntime.cudaLibrary_t library) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryUnload(library) +{{endif}} + +{{if 'cudaLibraryGetKernel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetKernel(cyruntime.cudaKernel_t* pKernel, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryGetKernel(pKernel, library, name) +{{endif}} + +{{if 'cudaLibraryGetGlobal' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetGlobal(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryGetGlobal(dptr, numbytes, library, name) +{{endif}} + +{{if 'cudaLibraryGetManaged' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetManaged(void** dptr, size_t* numbytes, cyruntime.cudaLibrary_t library, const char* name) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryGetManaged(dptr, numbytes, library, name) +{{endif}} + +{{if 'cudaLibraryGetUnifiedFunction' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetUnifiedFunction(void** fptr, cyruntime.cudaLibrary_t library, const char* symbol) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryGetUnifiedFunction(fptr, library, symbol) +{{endif}} + +{{if 'cudaLibraryGetKernelCount' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryGetKernelCount(unsigned int* count, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryGetKernelCount(count, lib) +{{endif}} + +{{if 'cudaLibraryEnumerateKernels' in found_functions}} + +cdef cyruntime.cudaError_t _cudaLibraryEnumerateKernels(cyruntime.cudaKernel_t* kernels, unsigned int numKernels, cyruntime.cudaLibrary_t lib) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaLibraryEnumerateKernels(kernels, numKernels, lib) +{{endif}} + +{{if 'cudaKernelSetAttributeForDevice' in found_functions}} + +cdef cyruntime.cudaError_t _cudaKernelSetAttributeForDevice(cyruntime.cudaKernel_t kernel, cyruntime.cudaFuncAttribute attr, int value, int device) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaKernelSetAttributeForDevice(kernel, attr, value, device) +{{endif}} + +{{if 'cudaGetExportTable' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetExportTable(const void** ppExportTable, const cyruntime.cudaUUID_t* pExportTableId) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetExportTable(ppExportTable, pExportTableId) +{{endif}} + +{{if 'cudaGetKernel' in found_functions}} + +cdef cyruntime.cudaError_t _cudaGetKernel(cyruntime.cudaKernel_t* kernelPtr, const void* entryFuncAddr) except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaGetKernel(kernelPtr, entryFuncAddr) +{{endif}} + +{{if 'make_cudaPitchedPtr' in found_functions}} + +cdef cyruntime.cudaPitchedPtr _make_cudaPitchedPtr(void* d, size_t p, size_t xsz, size_t ysz) nogil: + return make_cudaPitchedPtr(d, p, xsz, ysz) +{{endif}} + +{{if 'make_cudaPos' in found_functions}} + +cdef cyruntime.cudaPos _make_cudaPos(size_t x, size_t y, size_t z) nogil: + return make_cudaPos(x, y, z) +{{endif}} + +{{if 'make_cudaExtent' in found_functions}} + +cdef cyruntime.cudaExtent _make_cudaExtent(size_t w, size_t h, size_t d) nogil: + return make_cudaExtent(w, h, d) +{{endif}} + +{{if 'cudaProfilerStart' in found_functions}} + +cdef cyruntime.cudaError_t _cudaProfilerStart() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaProfilerStart() +{{endif}} + +{{if 'cudaProfilerStop' in found_functions}} + +cdef cyruntime.cudaError_t _cudaProfilerStop() except ?cyruntime.cudaErrorCallRequiresNewerDriver nogil: + return cudaProfilerStop() +{{endif}} diff --git a/cuda_bindings/cuda/bindings/cydriver.pxd.in b/cuda_bindings/cuda/bindings/cydriver.pxd.in index d1a3f24b6..c674c7703 100644 --- a/cuda_bindings/cuda/bindings/cydriver.pxd.in +++ b/cuda_bindings/cuda/bindings/cydriver.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index a026c14b5..636fde936 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -345,8 +345,11 @@ def do_cythonize(extensions): ["cuda/bindings/_internal/utils.pyx"], ] +libraries = ["cudart_static"] +if sys.platform == "linux": + libraries += ["rt"] for sources in sources_list: - extensions += prep_extensions(sources, ["cudart_static"]) + extensions += prep_extensions(sources, libraries) # --------------------------------------------------------------------- # Custom cmdclass extensions From f427481829cd918257c0983ef1058a7c29c7e067 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 20 Mar 2025 15:12:37 -0700 Subject: [PATCH 06/15] Run pre-commit --- cuda_bindings/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 636fde936..5da6fa735 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -265,7 +265,7 @@ def generate_output(infile, local): # Cythonize -def prep_extensions(sources, libraries=[]): +def prep_extensions(sources, libraries): pattern = sources[0] files = glob.glob(pattern) exts = [] From dc00d08def2ad151372170e40275c1791371f2cd Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 20 Mar 2025 15:21:16 -0700 Subject: [PATCH 07/15] Add LIBRARY_PATH --- .github/workflows/build-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 92c6a6ae2..33e3cf48e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -139,6 +139,7 @@ jobs: # CIBW mounts the host filesystem under /host CIBW_ENVIRONMENT_LINUX: > CUDA_PATH=/host/${{ env.CUDA_PATH }} + LIBRARY_PATH=/host/${{ env.CUDA_PATH }}/lib64 CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }} CIBW_ENVIRONMENT_WINDOWS: > CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})" From a79852374e0b161018489040bcfd8806a84a0ff1 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 20 Mar 2025 15:49:59 -0700 Subject: [PATCH 08/15] Look inside lib --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 33e3cf48e..288a5624b 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -139,7 +139,7 @@ jobs: # CIBW mounts the host filesystem under /host CIBW_ENVIRONMENT_LINUX: > CUDA_PATH=/host/${{ env.CUDA_PATH }} - LIBRARY_PATH=/host/${{ env.CUDA_PATH }}/lib64 + LIBRARY_PATH=/host/${{ env.CUDA_PATH }}/lib CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }} CIBW_ENVIRONMENT_WINDOWS: > CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})" From 27ea14706befe9994160cae824a6352422c4a524 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 20 Mar 2025 16:14:24 -0700 Subject: [PATCH 09/15] Add missing files to source list --- cuda_bindings/setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 5da6fa735..39d4b7b32 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -331,6 +331,8 @@ def do_cythonize(extensions): # private ["cuda/bindings/_bindings/cydriver.pyx", "cuda/bindings/_bindings/loader.cpp"], ["cuda/bindings/_bindings/cynvrtc.pyx"], + ["cuda/bindings/_bindings/cyruntime.pyx"], + ["cuda/bindings/_bindings/cyruntime_ptds.pyx"], # utils ["cuda/bindings/_lib/utils.pyx", "cuda/bindings/_lib/param_packer.cpp"], ["cuda/bindings/_lib/cyruntime/cyruntime.pyx"], From 776e7622fcb57e34fadd1ee420bc0bdfa54f4457 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Thu, 20 Mar 2025 16:24:36 -0700 Subject: [PATCH 10/15] Build WAR for excluding folder copy --- cuda_bindings/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/cuda_bindings/MANIFEST.in b/cuda_bindings/MANIFEST.in index 88bab329a..b0a806442 100644 --- a/cuda_bindings/MANIFEST.in +++ b/cuda_bindings/MANIFEST.in @@ -2,3 +2,4 @@ recursive-include cuda/ *.pyx *.pxd # at least with setuptools 75.0.0 this folder was added erroneously # to the payload, causing file copying to the build environment failed exclude cuda/bindings cuda?bindings +exclude cuda/bindings/_bindings cuda?bindings?_bindings From be6f948b20cf5d8b9dfa8a4a0478ebb60f9391e3 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Mon, 24 Mar 2025 15:36:30 -0700 Subject: [PATCH 11/15] Remove callback wrappers for Driver --- .../cuda/bindings/_bindings/cydriver.pxd.in | 2 +- .../cuda/bindings/_bindings/cydriver.pyx.in | 2 +- .../cuda/bindings/_bindings/cynvrtc.pxd.in | 2 +- .../cuda/bindings/_bindings/cynvrtc.pyx.in | 2 +- .../bindings/_lib/cyruntime/cyruntime.pxd.in | 5 + .../cuda/bindings/_lib/cyruntime/utils.pxd.in | 2 + cuda_bindings/cuda/bindings/cydriver.pyx.in | 109 +----------------- cuda_bindings/cuda/bindings/cynvrtc.pxd.in | 2 +- cuda_bindings/cuda/bindings/cynvrtc.pyx.in | 7 +- cuda_bindings/cuda/bindings/driver.pxd.in | 2 +- cuda_bindings/cuda/bindings/driver.pyx.in | 2 +- cuda_bindings/cuda/bindings/nvrtc.pxd.in | 2 +- cuda_bindings/cuda/bindings/nvrtc.pyx.in | 2 +- cuda_bindings/cuda/bindings/runtime.pxd.in | 2 +- cuda_bindings/setup.py | 30 +++-- 15 files changed, 41 insertions(+), 132 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in b/cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in index 8f0e92269..ea78183cf 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in +++ b/cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in index 9cd92fa71..4b9528e19 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in +++ b/cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd.in b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd.in index d4be8d479..1e69d8f32 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd.in +++ b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in index 884ec65da..a0f8a27a0 100644 --- a/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in +++ b/cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in index 53e7cd3b3..6a8101e3a 100644 --- a/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd.in @@ -7,6 +7,11 @@ # is strictly prohibited. from cuda.bindings.cyruntime cimport * +# These graphics API are the reimplemented version of what's supported by CUDA Runtime. +# Issue https://github.com/NVIDIA/cuda-python/issues/488 will remove them by letting us +# use call into the static library directly. +# +# This is an ABI breaking change which can only happen in a major version bump. {{if True}}cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection* conn, cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection* conn, cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} {{if True}}cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil{{endif}} diff --git a/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in b/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in index 68ec2ea22..eb3612522 100644 --- a/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in +++ b/cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd.in @@ -8,5 +8,7 @@ from cuda.bindings.cyruntime cimport * cimport cuda.bindings._bindings.cydriver as cydriver +# These are hard-coded helper function from the initial reimplementation of CUDA Runtime +# and will be removed as part of https://github.com/NVIDIA/cuda-python/issues/488 cdef cudaError_t getDriverEglFrame(cydriver.CUeglFrame *cuEglFrame, cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil cdef cudaError_t getRuntimeEglFrame(cudaEglFrame *eglFrame, cydriver.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil diff --git a/cuda_bindings/cuda/bindings/cydriver.pyx.in b/cuda_bindings/cuda/bindings/cydriver.pyx.in index 3df0b0cd2..858a06fdd 100644 --- a/cuda_bindings/cuda/bindings/cydriver.pyx.in +++ b/cuda_bindings/cuda/bindings/cydriver.pyx.in @@ -602,47 +602,14 @@ cdef CUresult cuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} -ctypedef struct cuAsyncCallbackData_st: - CUasyncCallback callback - void *userData - -ctypedef cuAsyncCallbackData_st cuAsyncCallbackData - -@cython.show_performance_hints(False) -cdef void cuAsyncNotificationCallbackWrapper(CUasyncNotificationInfo *info, void *data, CUasyncCallbackHandle handle) nogil: - cdef cuAsyncCallbackData *cbData = data - with gil: - cbData.callback(info, cbData.userData, handle) - - cdef CUresult cuDeviceRegisterAsyncNotification(CUdevice device, CUasyncCallback callbackFunc, void* userData, CUasyncCallbackHandle* callback) except ?CUDA_ERROR_NOT_FOUND nogil: - cdef cuAsyncCallbackData *cbData = NULL - cdef CUresult err = CUDA_SUCCESS - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return CUDA_ERROR_OUT_OF_MEMORY - - cbData.callback = callbackFunc - cbData.userData = userData - err = cydriver._cuDeviceRegisterAsyncNotification(device, cuAsyncNotificationCallbackWrapper, cbData, callback) - if err != CUDA_SUCCESS: - free(cbData) - return err - - m_global._asyncCallbackDataMap[callback[0]] = cbData - return err + return cydriver._cuDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) {{endif}} {{if 'cuDeviceUnregisterAsyncNotification' in found_functions}} cdef CUresult cuDeviceUnregisterAsyncNotification(CUdevice device, CUasyncCallbackHandle callback) except ?CUDA_ERROR_NOT_FOUND nogil: - cdef CUresult err = CUDA_SUCCESS - err = cydriver._cuDeviceUnregisterAsyncNotification(device, callback) - if err == CUDA_SUCCESS: - free(m_global._asyncCallbackDataMap[callback]) - m_global._asyncCallbackDataMap.erase(callback) - return err + return cydriver._cuDeviceUnregisterAsyncNotification(device, callback) {{endif}} {{if 'cuDeviceGetByPCIBusId' in found_functions}} @@ -1331,35 +1298,8 @@ cdef CUresult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int F {{if 'cuStreamAddCallback' in found_functions}} -ctypedef struct cuStreamCallbackData_st: - CUstreamCallback callback - void *userData - -ctypedef cuStreamCallbackData_st cuStreamCallbackData - -@cython.show_performance_hints(False) -cdef void cuStreamCallbackWrapper(CUstream stream, CUresult status, void *data) nogil: - cdef cuStreamCallbackData *cbData = data - with gil: - cbData.callback(stream, status, cbData.userData) - free(cbData) - - cdef CUresult cuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: - cdef cuStreamCallbackData *cbData = NULL - cdef CUresult err = CUDA_SUCCESS - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return CUDA_ERROR_OUT_OF_MEMORY - - cbData.callback = callback - cbData.userData = userData - err = cydriver._cuStreamAddCallback(hStream, cuStreamCallbackWrapper, cbData, flags) - if err != CUDA_SUCCESS: - free(cbData) - return err - return err + return cydriver._cuStreamAddCallback(hStream, callback, userData, flags) {{endif}} {{if 'cuStreamBeginCapture_v2' in found_functions}} @@ -1658,35 +1598,8 @@ cdef CUresult cuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchPar {{if 'cuLaunchHostFunc' in found_functions}} -ctypedef struct cuHostCallbackData_st: - CUhostFn callback - void *userData - -ctypedef cuHostCallbackData_st cuHostCallbackData - -@cython.show_performance_hints(False) -cdef void cuHostCallbackWrapper(void *data) nogil: - cdef cuHostCallbackData *cbData = data - with gil: - cbData.callback(cbData.userData) - free(cbData) - - cdef CUresult cuLaunchHostFunc(CUstream hStream, CUhostFn fn, void* userData) except ?CUDA_ERROR_NOT_FOUND nogil: - cdef cuHostCallbackData *cbData = NULL - cdef CUresult err = CUDA_SUCCESS - cbData = malloc(sizeof(cbData[0])) - - if cbData == NULL: - return CUDA_ERROR_OUT_OF_MEMORY - - cbData.callback = fn - cbData.userData = userData - err = cydriver._cuLaunchHostFunc(hStream, cuHostCallbackWrapper, cbData) - if err != CUDA_SUCCESS: - free(cbData) - return err - return err + return cydriver._cuLaunchHostFunc(hStream, fn, userData) {{endif}} {{if 'cuFuncSetBlockShape' in found_functions}} @@ -2908,17 +2821,3 @@ cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaReso {{endif}} -cdef class cudaBindingsDriverGlobal: - {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - cdef map[CUasyncCallbackHandle, cuAsyncCallbackData*] _asyncCallbackDataMap - {{endif}} - - def __dealloc__(self): - pass - {{if 'cuDeviceRegisterAsyncNotification' in found_functions}} - for item_asyncCallbackDataMap in self._asyncCallbackDataMap: - free(item_asyncCallbackDataMap.second) - self._asyncCallbackDataMap.clear() - {{endif}} - -cdef cudaBindingsDriverGlobal m_global = cudaBindingsDriverGlobal() diff --git a/cuda_bindings/cuda/bindings/cynvrtc.pxd.in b/cuda_bindings/cuda/bindings/cynvrtc.pxd.in index ce1fed330..1fc318b38 100644 --- a/cuda_bindings/cuda/bindings/cynvrtc.pxd.in +++ b/cuda_bindings/cuda/bindings/cynvrtc.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/cynvrtc.pyx.in index 17b187bef..9c65d3f38 100644 --- a/cuda_bindings/cuda/bindings/cynvrtc.pyx.in +++ b/cuda_bindings/cuda/bindings/cynvrtc.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of @@ -7,6 +7,9 @@ # is strictly prohibited. # # This code was automatically generated with version 12.8.0. Do not modify it directly. +import cython +from libcpp.map cimport map +from libc.stdlib cimport malloc, free cimport cuda.bindings._bindings.cynvrtc as cynvrtc {{if 'nvrtcGetErrorString' in found_functions}} @@ -164,3 +167,5 @@ cdef nvrtcResult nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) ex cdef nvrtcResult nvrtcSetFlowCallback(nvrtcProgram prog, void* callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil: return cynvrtc._nvrtcSetFlowCallback(prog, callback, payload) {{endif}} + + diff --git a/cuda_bindings/cuda/bindings/driver.pxd.in b/cuda_bindings/cuda/bindings/driver.pxd.in index 87af8aa31..1959f67fe 100644 --- a/cuda_bindings/cuda/bindings/driver.pxd.in +++ b/cuda_bindings/cuda/bindings/driver.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/driver.pyx.in b/cuda_bindings/cuda/bindings/driver.pyx.in index 7eec936ba..c2ff5b776 100644 --- a/cuda_bindings/cuda/bindings/driver.pyx.in +++ b/cuda_bindings/cuda/bindings/driver.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/nvrtc.pxd.in b/cuda_bindings/cuda/bindings/nvrtc.pxd.in index e6785a370..ee01b204b 100644 --- a/cuda_bindings/cuda/bindings/nvrtc.pxd.in +++ b/cuda_bindings/cuda/bindings/nvrtc.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/nvrtc.pyx.in b/cuda_bindings/cuda/bindings/nvrtc.pyx.in index 6c2704c59..72aa15a9a 100644 --- a/cuda_bindings/cuda/bindings/nvrtc.pyx.in +++ b/cuda_bindings/cuda/bindings/nvrtc.pyx.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/cuda/bindings/runtime.pxd.in b/cuda_bindings/cuda/bindings/runtime.pxd.in index ef4367077..2cc689b50 100644 --- a/cuda_bindings/cuda/bindings/runtime.pxd.in +++ b/cuda_bindings/cuda/bindings/runtime.pxd.in @@ -1,4 +1,4 @@ -# Copyright 2021-2024 NVIDIA Corporation. All rights reserved. +# Copyright 2021-2025 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 39d4b7b32..2ade89557 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -268,6 +268,7 @@ def generate_output(infile, local): def prep_extensions(sources, libraries): pattern = sources[0] files = glob.glob(pattern) + libraries = libraries if libraries else [] exts = [] for pyx in files: mod_name = pyx.replace(".pyx", "").replace(os.sep, ".").replace("/", ".") @@ -327,30 +328,27 @@ def do_cythonize(extensions): ) +static_runtime_libraries = ["cudart_static", "rt"] if sys.platform == "linux" else ["cudart_static"] sources_list = [ # private - ["cuda/bindings/_bindings/cydriver.pyx", "cuda/bindings/_bindings/loader.cpp"], - ["cuda/bindings/_bindings/cynvrtc.pyx"], - ["cuda/bindings/_bindings/cyruntime.pyx"], - ["cuda/bindings/_bindings/cyruntime_ptds.pyx"], + (["cuda/bindings/_bindings/cydriver.pyx", "cuda/bindings/_bindings/loader.cpp"], None), + (["cuda/bindings/_bindings/cynvrtc.pyx"], None), + (["cuda/bindings/_bindings/cyruntime.pyx"], static_runtime_libraries), + (["cuda/bindings/_bindings/cyruntime_ptds.pyx"], static_runtime_libraries), # utils - ["cuda/bindings/_lib/utils.pyx", "cuda/bindings/_lib/param_packer.cpp"], - ["cuda/bindings/_lib/cyruntime/cyruntime.pyx"], - ["cuda/bindings/_lib/cyruntime/utils.pyx"], + (["cuda/bindings/_lib/utils.pyx", "cuda/bindings/_lib/param_packer.cpp"], None), + (["cuda/bindings/_lib/cyruntime/cyruntime.pyx"], None), + (["cuda/bindings/_lib/cyruntime/utils.pyx"], None), # public - ["cuda/bindings/*.pyx"], + (["cuda/bindings/*.pyx"], None), # public (deprecated, to be removed) - ["cuda/*.pyx"], + (["cuda/*.pyx"], None), # internal files used by generated bindings - ["cuda/bindings/_internal/nvjitlink.pyx"], - ["cuda/bindings/_internal/nvvm.pyx"], - ["cuda/bindings/_internal/utils.pyx"], + (["cuda/bindings/_internal/nvjitlink.pyx"], None), + (["cuda/bindings/_internal/utils.pyx"], None), ] -libraries = ["cudart_static"] -if sys.platform == "linux": - libraries += ["rt"] -for sources in sources_list: +for sources, libraries in sources_list: extensions += prep_extensions(sources, libraries) # --------------------------------------------------------------------- From 2b7288f8b534e6994d0ae15ecb53ca12d2941bc0 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Mon, 24 Mar 2025 15:49:23 -0700 Subject: [PATCH 12/15] Cleanup imports --- cuda_bindings/cuda/bindings/cydriver.pyx.in | 5 ----- cuda_bindings/cuda/bindings/cynvrtc.pyx.in | 5 ----- 2 files changed, 10 deletions(-) diff --git a/cuda_bindings/cuda/bindings/cydriver.pyx.in b/cuda_bindings/cuda/bindings/cydriver.pyx.in index 858a06fdd..5482af1bb 100644 --- a/cuda_bindings/cuda/bindings/cydriver.pyx.in +++ b/cuda_bindings/cuda/bindings/cydriver.pyx.in @@ -7,9 +7,6 @@ # is strictly prohibited. # # This code was automatically generated with version 12.8.0. Do not modify it directly. -import cython -from libcpp.map cimport map -from libc.stdlib cimport malloc, free cimport cuda.bindings._bindings.cydriver as cydriver {{if 'cuGetErrorString' in found_functions}} @@ -2819,5 +2816,3 @@ cdef CUresult cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource* pCudaResou cdef CUresult cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource* pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags) except ?CUDA_ERROR_NOT_FOUND nogil: return cydriver._cuGraphicsVDPAURegisterOutputSurface(pCudaResource, vdpSurface, flags) {{endif}} - - diff --git a/cuda_bindings/cuda/bindings/cynvrtc.pyx.in b/cuda_bindings/cuda/bindings/cynvrtc.pyx.in index 9c65d3f38..71e091a00 100644 --- a/cuda_bindings/cuda/bindings/cynvrtc.pyx.in +++ b/cuda_bindings/cuda/bindings/cynvrtc.pyx.in @@ -7,9 +7,6 @@ # is strictly prohibited. # # This code was automatically generated with version 12.8.0. Do not modify it directly. -import cython -from libcpp.map cimport map -from libc.stdlib cimport malloc, free cimport cuda.bindings._bindings.cynvrtc as cynvrtc {{if 'nvrtcGetErrorString' in found_functions}} @@ -167,5 +164,3 @@ cdef nvrtcResult nvrtcGetPCHHeapSizeRequired(nvrtcProgram prog, size_t* size) ex cdef nvrtcResult nvrtcSetFlowCallback(nvrtcProgram prog, void* callback, void* payload) except ?NVRTC_ERROR_INVALID_INPUT nogil: return cynvrtc._nvrtcSetFlowCallback(prog, callback, payload) {{endif}} - - From 9e138fa6187a18f7161e1b3107faaf7f4c62c6e8 Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Mon, 24 Mar 2025 15:50:55 -0700 Subject: [PATCH 13/15] Update docs --- cuda_bindings/docs/source/release/12.X.Y-notes.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/cuda_bindings/docs/source/release/12.X.Y-notes.rst b/cuda_bindings/docs/source/release/12.X.Y-notes.rst index cbec0d194..f8cb86ab6 100644 --- a/cuda_bindings/docs/source/release/12.X.Y-notes.rst +++ b/cuda_bindings/docs/source/release/12.X.Y-notes.rst @@ -11,4 +11,3 @@ Highlights `libNVVM C API `_. * Source build error checking added for missing required headers * Statically link CUDA Runtime instead of reimplementing it -* Call all callback functions with the GIL From 60d16819ef4cfea801458e3b47d27ed5bd63b5ce Mon Sep 17 00:00:00 2001 From: Vladislav Zhurba Date: Mon, 24 Mar 2025 16:05:10 -0700 Subject: [PATCH 14/15] Add accidentally remove source files --- cuda_bindings/setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 2ade89557..38b43ee94 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -345,6 +345,8 @@ def do_cythonize(extensions): (["cuda/*.pyx"], None), # internal files used by generated bindings (["cuda/bindings/_internal/nvjitlink.pyx"], None), + (["cuda/bindings/_internal/nvvm.pyx"], None), + (["cuda/bindings/_internal/nvjitlink.pyx"], None), (["cuda/bindings/_internal/utils.pyx"], None), ] From 56532c9bfa7fd77700d2ea6e3925b98708a5128e Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 24 Mar 2025 19:27:56 -0400 Subject: [PATCH 15/15] remove repeated entry --- cuda_bindings/setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cuda_bindings/setup.py b/cuda_bindings/setup.py index 38b43ee94..e14d060cf 100644 --- a/cuda_bindings/setup.py +++ b/cuda_bindings/setup.py @@ -346,7 +346,6 @@ def do_cythonize(extensions): # internal files used by generated bindings (["cuda/bindings/_internal/nvjitlink.pyx"], None), (["cuda/bindings/_internal/nvvm.pyx"], None), - (["cuda/bindings/_internal/nvjitlink.pyx"], None), (["cuda/bindings/_internal/utils.pyx"], None), ]