Skip to content

Commit dd0ceef

Browse files
authored
Fix #789: Remove cycle between c.b.cyruntime and c.b._lib.cyruntime.cyruntime (#914)
* Fix #789: Remove cycle between c.b.cyruntime and c.b._lib.cyruntime.cyruntime * Rename cyruntime.pyx to cyruntime.pxi * Renome cuda.bindings._lib from path_list * Add cufile to the mix, too * Fix typo * Restore _lib directory * Skip cufile import test on Windows * Add comments about the source of these files
1 parent 1137e15 commit dd0ceef

14 files changed

Lines changed: 502 additions & 566 deletions

File tree

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd
2929
cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx
3030
cuda_bindings/cuda/bindings/_internal/nvjitlink.pyx
3131
cuda_bindings/cuda/bindings/_internal/nvvm.pyx
32-
cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd
33-
cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx
34-
cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd
35-
cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pyx
3632
cuda_bindings/cuda/bindings/_lib/utils.pxd
3733
cuda_bindings/cuda/bindings/_lib/utils.pyx
3834
cuda_bindings/cuda/bindings/cydriver.pxd

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# This code was automatically generated with version 13.0.0. Do not modify it directly.
55
include "../cyruntime_types.pxi"
6+
include "../_lib/cyruntime/cyruntime.pxd"
67

78
{{if 'cudaDeviceReset' in found_functions}}
89

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,3 +2671,5 @@ cdef cudaError_t _cudaProfilerStop() except ?cudaErrorCallRequiresNewerDriver no
26712671
return ptds._cudaProfilerStop()
26722672
return cudaProfilerStop()
26732673
{{endif}}
2674+
2675+
include "../_lib/cyruntime/cyruntime.pxi"

cuda_bindings/cuda/bindings/_lib/cyruntime/__init__.py

Whitespace-only changes.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
3+
4+
cimport cuda.bindings.cyruntime as cyruntime
5+
cimport cuda.bindings._bindings.cydriver as _cydriver
6+
7+
# These graphics API are the reimplemented version of what's supported by CUDA Runtime.
8+
# Issue https://github.com/NVIDIA/cuda-python/issues/488 will remove them by letting us
9+
# use call into the static library directly.
10+
#
11+
# This is an ABI breaking change which can only happen in a major version bump.
12+
13+
# This file is included from cuda/bindings/_bindings/cyruntime.pxd.in but kept in a
14+
# separate file to keep it separated from the auto-generated code there.
15+
16+
# Prior to https://github.com/NVIDIA/cuda-python/pull/914, this was two
17+
# independent modules (c.b._lib.cyruntime.cyruntime and
18+
# c.b._lib.cyruntime.utils), but was merged into one.
19+
20+
cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cyruntime.cudaEglStreamConnection* conn, cyruntime.cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil
21+
cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cyruntime.cudaEglStreamConnection* conn, cyruntime.cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil
22+
cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cyruntime.cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil
23+
cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, cyruntime.VdpDevice vdpDevice, cyruntime.VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil
24+
cdef cudaError_t _cudaVDPAUGetDevice(int* device, cyruntime.VdpDevice vdpDevice, cyruntime.VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil
25+
cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, cyruntime.VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
26+
cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, cyruntime.VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
27+
cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cyruntime.cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil
28+
cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, cyruntime.GLuint image, cyruntime.GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
29+
cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, cyruntime.GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
30+
cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, cyruntime.EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
31+
cdef cudaError_t _cudaEGLStreamConsumerConnect(cyruntime.cudaEglStreamConnection* conn, cyruntime.EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil
32+
cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cyruntime.cudaEglStreamConnection* conn, cyruntime.EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
33+
cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cyruntime.cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil
34+
cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cyruntime.cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil
35+
cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cyruntime.cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil
36+
cdef cudaError_t _cudaEGLStreamProducerConnect(cyruntime.cudaEglStreamConnection* conn, cyruntime.EGLStreamKHR eglStream, cyruntime.EGLint width, cyruntime.EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil
37+
cdef cudaError_t _cudaEGLStreamProducerDisconnect(cyruntime.cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil
38+
cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, cyruntime.EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil
39+
40+
# utility functions
41+
42+
cdef cudaError_t getDriverEglFrame(_cydriver.CUeglFrame *cuEglFrame, cyruntime.cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil
43+
cdef cudaError_t getRuntimeEglFrame(cyruntime.cudaEglFrame *eglFrame, _cydriver.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil

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

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)