Use __pyx_capi__ for CUDA driver function pointers#1466
Use __pyx_capi__ for CUDA driver function pointers#1466Andy-Jost merged 2 commits intoNVIDIA:mainfrom
Conversation
Replace the _CUDA_DRIVER_API_V1 capsule with direct extraction of function pointers from cuda.bindings.cydriver.__pyx_capi__ at module import time. This simplifies the architecture by eliminating the custom capsule struct and its associated loading machinery (load_driver_api, ensure_driver_loaded, cuGetProcAddress resolution). The driver function pointers are now populated directly from Cython's built-in cross-module API mechanism. Closes NVIDIA#1450
|
/ok to test 3921ca6 |
rwgk
left a comment
There was a problem hiding this comment.
Awesome! I didn't find anything visually, or with Cursor.
If we had more CI resources we'd be flying! :-)
|
Instead of reaching for the This generates header file(s) that we can use nicely as expected instead of reaching into internal structs generated by Cython. |
|
/ok to test 0b08aa4 |
|
|
@kkraus14 No, I didn't consider We discussed If we were to use
The tradeoff is that If you'd like me to look into using |
leofang
left a comment
There was a problem hiding this comment.
Wonderful! Thanks for looking into it @Andy-Jost.
|
Sorry, for some reason I missed the |
Summary
Replace the
_CUDA_DRIVER_API_V1capsule with direct extraction of function pointers fromcuda.bindings.cydriver.__pyx_capi__at module import time.Changes
CudaDriverApiV1struct and_get_cuda_driver_api_v1_capsule()from_resource_handles.pyxload_driver_api(),ensure_driver_loaded(), and related machinery fromresource_handles.cppresource_handles.hppPyCapsule_GetPointer()withPyCapsule_GetName()for signature lookup__pyx_capi__approachThis simplifies the architecture by eliminating the custom capsule struct and its loading machinery. The driver function pointers are now populated directly from Cython's built-in cross-module API mechanism.
Stats: 4 files changed, 228 insertions(+), 392 deletions(-) (net -164 lines)
Test Plan
test_stream.py,test_event.py,test_memory.py,test_device.pypassCloses #1450