-
Notifications
You must be signed in to change notification settings - Fork 42
[UIL] Update python ctypes bindings to match revised deviceHandle and Ipc/Stream APIs #301
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
Changes from all commits
7c47b25
8580b27
d1abe2e
25d793c
1c24fa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,24 +19,18 @@ | |||||||||
| flagcxMemcpyType_t = ctypes.c_int | ||||||||||
| flagcxMemType_t = ctypes.c_int | ||||||||||
| flagcxEventType_t = ctypes.c_int | ||||||||||
| flagcxIpcMemHandle_t = ctypes.c_void_p | ||||||||||
|
|
||||||||||
| flagcxHandlerGroup_t = ctypes.c_void_p | ||||||||||
| flagcxComm_t = ctypes.c_void_p | ||||||||||
| flagcxEvent_t = ctypes.c_void_p | ||||||||||
| cudaStream_t = ctypes.c_void_p | ||||||||||
| flagcxStream_t = ctypes.c_void_p | ||||||||||
| buffer_type = ctypes.c_void_p | ||||||||||
|
|
||||||||||
|
|
||||||||||
| class flagcxStream(ctypes.Structure): | ||||||||||
| _fields_ = [("base", cudaStream_t)] | ||||||||||
| flagcxStream_t = ctypes.POINTER(flagcxStream) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| class flagcxUniqueId(ctypes.Structure): | ||||||||||
| _fields_ = [("internal", ctypes.c_byte * 256)] | ||||||||||
| flagcxUniqueId_t = ctypes.POINTER(flagcxUniqueId) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| DEVICE_SYNCHRONIZE_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t) | ||||||||||
| DEVICE_MEMCPY_FUNCTYPE = ctypes.CFUNCTYPE( | ||||||||||
| flagcxResult_t, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t, | ||||||||||
|
|
@@ -57,6 +51,7 @@ class flagcxUniqueId(ctypes.Structure): | |||||||||
| GET_DEVICE_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, ctypes.POINTER(ctypes.c_int)) | ||||||||||
| GET_DEVICE_COUNT_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, ctypes.POINTER(ctypes.c_int)) | ||||||||||
| GET_VENDOR_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, ctypes.c_char_p) | ||||||||||
| HOST_GET_DEVICE_POINTER_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, ctypes.POINTER(ctypes.c_void_p), ctypes.c_void_p) | ||||||||||
|
|
||||||||||
| STREAM_CREATE_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, ctypes.POINTER(flagcxStream_t)) | ||||||||||
| STREAM_DESTROY_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxStream_t) | ||||||||||
|
|
@@ -71,6 +66,13 @@ class flagcxUniqueId(ctypes.Structure): | |||||||||
| EVENT_RECORD_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxEvent_t, flagcxStream_t) | ||||||||||
| EVENT_SYNCHRONIZE_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxEvent_t) | ||||||||||
| EVENT_QUERY_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxEvent_t) | ||||||||||
|
|
||||||||||
| IPC_MEM_HANDLE_CREATE_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, ctypes.POINTER(flagcxIpcMemHandle_t), ctypes.POINTER(ctypes.c_size_t)) | ||||||||||
| IPC_MEM_HANDLE_GET_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxIpcMemHandle_t, ctypes.c_void_p) | ||||||||||
| IPC_MEM_HANDLE_OPEN_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxIpcMemHandle_t, ctypes.POINTER(ctypes.c_void_p)) | ||||||||||
|
Comment on lines
+71
to
+72
|
||||||||||
| IPC_MEM_HANDLE_GET_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxIpcMemHandle_t, ctypes.c_void_p) | |
| IPC_MEM_HANDLE_OPEN_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxIpcMemHandle_t, ctypes.POINTER(ctypes.c_void_p)) | |
| IPC_MEM_HANDLE_GET_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxIpcMemHandle_t, ctypes.POINTER(ctypes.c_void_p)) | |
| IPC_MEM_HANDLE_OPEN_FUNCTYPE = ctypes.CFUNCTYPE(flagcxResult_t, flagcxIpcMemHandle_t, ctypes.c_void_p) |
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.
The IPC_MEM_HANDLE_CREATE_FUNCTYPE signature appears inconsistent with the C header. According to flagcx.h line 158-159, ipcMemHandleCreate takes
flagcxIpcMemHandle_t *handle(pointer to pointer) andsize_t *size, but flagcxIpcMemHandle_t is already defined asctypes.c_void_p(line 22), which is a single pointer. The first parameter should bectypes.POINTER(ctypes.c_void_p)to match the double-pointer indirection.