-
Notifications
You must be signed in to change notification settings - Fork 238
Use __pyx_capi__ for CUDA driver function pointers #1466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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