You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow win32_handle_metadata to be an arbitrary object? #1263
I'd like to have input from the team on this. I feel taking a pointer address here is not the most pleasant design, but the challenge is that there is no official Python binding for the Windows SECURITY_ATTRIBUTES struct, so we either have to take arbitrary object or a pointer.
FWIW, SA is only 24B whereas OA is 48B (on the Colossus system that I rented), so this is definitely a bug in the test suite that we must fix. This would, for example, answer why I saw weird things like this.
Since OA must be initialized by InitializeObjectAttributes, which unfortunately is a macro function, compiling a bit of C code to wrap it is needed. I confirm this example works:
Update: on the Thursday team-sync we decided to disable win32 support for now, thereby bypassing this discussion, because the underlying OBJECT_ATTRIBUTES is very hard to produce in Python, and it is unclear to us how to ensure general correctness. If handle_type="win32" is passed we'll raise an exception asking users to reach out.
Activity
leofang commentedon Nov 18, 2025
This needs to be addressed before the next cuda.core release is out (v0.5.0), otherwise it'd become a breaking change.
rwgk commentedon Nov 18, 2025
xref: #1264 — possibly related, but NOT certainly
kkraus14 commentedon Nov 20, 2025
According to the CUDA Driver API docs: https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemAllocationProp__v1.html#structCUmemAllocationProp__v1_1542262ad88e1d00f02b306c641270168
This is a pointer to a
OBJECT_ATTRIBUTESstruct (https://learn.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_object_attributes), not aSECURITY_ATTRIBUTESstruct. Is there a relationship between these two in some way that makes us care aboutSECURITY_ATTRIBUTES?leofang commentedon Nov 20, 2025
Right, good catch @kkraus14. Unfortunately I confused myself. Confirmed with Vishnu that we need to use OA (
OBJECT_ATTRIBUTES).I used SA (
SECURITY_ATTRIBUTES) because when we started exploring with mempools (#446) SA was what we needed to use:https://docs.nvidia.com/cuda/cuda-driver-api/structCUmemPoolProps__v1.html#structCUmemPoolProps__v1_1b153a37a3a73be7aaa98f271429b87a7
I forgot that we are now dealing with VMM instead of mempools, and so I did not bother to double check this impression.
FWIW, SA is only 24B whereas OA is 48B (on the Colossus system that I rented), so this is definitely a bug in the test suite that we must fix. This would, for example, answer why I saw weird things like this.
Since OA must be initialized by
InitializeObjectAttributes, which unfortunately is a macro function, compiling a bit of C code to wrap it is needed. I confirm this example works:I'll integrate this example into the test suite.
leofang commentedon Nov 24, 2025
Update: on the Thursday team-sync we decided to disable
win32support for now, thereby bypassing this discussion, because the underlyingOBJECT_ATTRIBUTESis very hard to produce in Python, and it is unclear to us how to ensure general correctness. Ifhandle_type="win32"is passed we'll raise an exception asking users to reach out.