|
7 | 7 | # is strictly prohibited.
|
8 | 8 | #
|
9 | 9 | # This code was automatically generated with version 12.8.0. Do not modify it directly.
|
10 |
| -import cython |
11 | 10 | cimport cython
|
12 |
| -from libcpp.map cimport map |
13 |
| -from libc.stdlib cimport malloc, free |
14 | 11 | cimport cuda.bindings._bindings.cyruntime as cyruntime
|
15 | 12 | cimport cuda.bindings._lib.cyruntime.cyruntime as custom_cyruntime
|
16 | 13 |
|
@@ -112,47 +109,14 @@ cdef cudaError_t cudaDeviceFlushGPUDirectRDMAWrites(cudaFlushGPUDirectRDMAWrites
|
112 | 109 |
|
113 | 110 | {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}}
|
114 | 111 |
|
115 |
| -ctypedef struct cudaAsyncCallbackData_st: |
116 |
| - cudaAsyncCallback callback |
117 |
| - void *userData |
118 |
| - |
119 |
| -ctypedef cudaAsyncCallbackData_st cudaAsyncCallbackData |
120 |
| - |
121 |
| -@cython.show_performance_hints(False) |
122 |
| -cdef void cudaAsyncNotificationCallbackWrapper(cudaAsyncNotificationInfo_t *info, void *data, cudaAsyncCallbackHandle_t handle) nogil: |
123 |
| - cdef cudaAsyncCallbackData *cbData = <cudaAsyncCallbackData *>data |
124 |
| - with gil: |
125 |
| - cbData.callback(info, cbData.userData, handle) |
126 |
| - |
127 |
| - |
128 | 112 | cdef cudaError_t cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback) except ?cudaErrorCallRequiresNewerDriver nogil:
|
129 |
| - cdef cudaAsyncCallbackData *cbData = NULL |
130 |
| - cdef cudaError_t err = cudaSuccess |
131 |
| - cbData = <cudaAsyncCallbackData *>malloc(sizeof(cbData[0])) |
132 |
| - |
133 |
| - if cbData == NULL: |
134 |
| - return cudaErrorMemoryAllocation |
135 |
| - |
136 |
| - cbData.callback = callbackFunc |
137 |
| - cbData.userData = userData |
138 |
| - err = cyruntime._cudaDeviceRegisterAsyncNotification(device, <cudaAsyncCallback>cudaAsyncNotificationCallbackWrapper, <void *>cbData, callback) |
139 |
| - if err != cudaSuccess: |
140 |
| - free(cbData) |
141 |
| - return err |
142 |
| - |
143 |
| - m_global._asyncCallbackDataMap[callback[0]] = cbData |
144 |
| - return err |
| 113 | + return cyruntime._cudaDeviceRegisterAsyncNotification(device, callbackFunc, userData, callback) |
145 | 114 | {{endif}}
|
146 | 115 |
|
147 | 116 | {{if 'cudaDeviceUnregisterAsyncNotification' in found_functions}}
|
148 | 117 |
|
149 | 118 | cdef cudaError_t cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback) except ?cudaErrorCallRequiresNewerDriver nogil:
|
150 |
| - cdef cudaError_t err = cudaSuccess |
151 |
| - err = cyruntime._cudaDeviceUnregisterAsyncNotification(device, callback) |
152 |
| - if err == cudaSuccess: |
153 |
| - free(m_global._asyncCallbackDataMap[callback]) |
154 |
| - m_global._asyncCallbackDataMap.erase(callback) |
155 |
| - return err |
| 119 | + return cyruntime._cudaDeviceUnregisterAsyncNotification(device, callback) |
156 | 120 | {{endif}}
|
157 | 121 |
|
158 | 122 | {{if 'cudaDeviceGetSharedMemConfig' in found_functions}}
|
@@ -355,35 +319,8 @@ cdef cudaError_t cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, uns
|
355 | 319 |
|
356 | 320 | {{if 'cudaStreamAddCallback' in found_functions}}
|
357 | 321 |
|
358 |
| -ctypedef struct cudaStreamCallbackData_st: |
359 |
| - cudaStreamCallback_t callback |
360 |
| - void *userData |
361 |
| - |
362 |
| -ctypedef cudaStreamCallbackData_st cudaStreamCallbackData |
363 |
| - |
364 |
| -@cython.show_performance_hints(False) |
365 |
| -cdef void cudaStreamRtCallbackWrapper(cudaStream_t stream, cudaError_t status, void *data) nogil: |
366 |
| - cdef cudaStreamCallbackData *cbData = <cudaStreamCallbackData *>data |
367 |
| - with gil: |
368 |
| - cbData.callback(stream, status, cbData.userData) |
369 |
| - free(cbData) |
370 |
| - |
371 |
| - |
372 | 322 | cdef cudaError_t cudaStreamAddCallback(cudaStream_t stream, cudaStreamCallback_t callback, void* userData, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
|
373 |
| - cdef cudaStreamCallbackData *cbData = NULL |
374 |
| - cdef cudaError_t err = cudaSuccess |
375 |
| - cbData = <cudaStreamCallbackData *>malloc(sizeof(cbData[0])) |
376 |
| - |
377 |
| - if cbData == NULL: |
378 |
| - return cudaErrorMemoryAllocation |
379 |
| - |
380 |
| - cbData.callback = callback |
381 |
| - cbData.userData = userData |
382 |
| - err = cyruntime._cudaStreamAddCallback(stream, <cudaStreamCallback_t>cudaStreamRtCallbackWrapper, <void *>cbData, flags) |
383 |
| - if err != cudaSuccess: |
384 |
| - free(cbData) |
385 |
| - return err |
386 |
| - return err |
| 323 | + return cyruntime._cudaStreamAddCallback(stream, callback, userData, flags) |
387 | 324 | {{endif}}
|
388 | 325 |
|
389 | 326 | {{if 'cudaStreamSynchronize' in found_functions}}
|
@@ -580,35 +517,8 @@ cdef cudaError_t cudaFuncSetAttribute(const void* func, cudaFuncAttribute attr,
|
580 | 517 |
|
581 | 518 | {{if 'cudaLaunchHostFunc' in found_functions}}
|
582 | 519 |
|
583 |
| -ctypedef struct cudaStreamHostCallbackData_st: |
584 |
| - cudaHostFn_t callback |
585 |
| - void *userData |
586 |
| - |
587 |
| -ctypedef cudaStreamHostCallbackData_st cudaStreamHostCallbackData |
588 |
| - |
589 |
| -@cython.show_performance_hints(False) |
590 |
| -cdef void cudaStreamRtHostCallbackWrapper(void *data) nogil: |
591 |
| - cdef cudaStreamHostCallbackData *cbData = <cudaStreamHostCallbackData *>data |
592 |
| - with gil: |
593 |
| - cbData.callback(cbData.userData) |
594 |
| - free(cbData) |
595 |
| - |
596 |
| - |
597 | 520 | cdef cudaError_t cudaLaunchHostFunc(cudaStream_t stream, cudaHostFn_t fn, void* userData) except ?cudaErrorCallRequiresNewerDriver nogil:
|
598 |
| - cdef cudaStreamHostCallbackData *cbData = NULL |
599 |
| - cdef cudaError_t err = cudaSuccess |
600 |
| - cbData = <cudaStreamHostCallbackData *>malloc(sizeof(cbData[0])) |
601 |
| - |
602 |
| - if cbData == NULL: |
603 |
| - return cudaErrorMemoryAllocation |
604 |
| - |
605 |
| - cbData.callback = fn |
606 |
| - cbData.userData = userData |
607 |
| - err = cyruntime._cudaLaunchHostFunc(stream, <cudaHostFn_t>cudaStreamRtHostCallbackWrapper, <void *>cbData) |
608 |
| - if err != cudaSuccess: |
609 |
| - free(cbData) |
610 |
| - return err |
611 |
| - return err |
| 521 | + return cyruntime._cudaLaunchHostFunc(stream, fn, userData) |
612 | 522 | {{endif}}
|
613 | 523 |
|
614 | 524 | {{if 'cudaFuncSetSharedMemConfig' in found_functions}}
|
@@ -1967,22 +1877,6 @@ cdef cudaError_t cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** r
|
1967 | 1877 | return custom_cyruntime._cudaGraphicsVDPAURegisterOutputSurface(resource, vdpSurface, flags)
|
1968 | 1878 | {{endif}}
|
1969 | 1879 |
|
1970 |
| - |
1971 |
| -cdef class cudaBindingsRuntimeGlobal: |
1972 |
| - {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} |
1973 |
| - cdef map[cudaAsyncCallbackHandle_t, cudaAsyncCallbackData*] _asyncCallbackDataMap |
1974 |
| - {{endif}} |
1975 |
| - |
1976 |
| - def __dealloc__(self): |
1977 |
| - pass |
1978 |
| - {{if 'cudaDeviceRegisterAsyncNotification' in found_functions}} |
1979 |
| - for item in self._asyncCallbackDataMap: |
1980 |
| - free(item.second) |
1981 |
| - self._asyncCallbackDataMap.clear() |
1982 |
| - {{endif}} |
1983 |
| - |
1984 |
| -cdef cudaBindingsRuntimeGlobal m_global = cudaBindingsRuntimeGlobal() |
1985 |
| - |
1986 | 1880 | {{if True}}
|
1987 | 1881 |
|
1988 | 1882 | {{if 'Windows' != platform.system()}}
|
|
0 commit comments