Skip to content

Commit

Permalink
and OpenCL
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Nov 26, 2023
1 parent 971a74e commit 19af20e
Show file tree
Hide file tree
Showing 4 changed files with 797 additions and 73 deletions.
1 change: 1 addition & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
clang2py /opt/rocm/include/hip/hiprtc.h /opt/rocm/include/hip/hip_runtime_api.h /opt/rocm/include/hip/driver_types.h --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include" -o gpuctypes/hip.py -l /opt/rocm/lib/libhiprtc.so -l /opt/rocm/lib/libamdhip64.so
clang2py /usr/include/cuda.h /usr/include/nvrtc.h -o gpuctypes/cuda.py -l /usr/lib/x86_64-linux-gnu/libcuda.so -l /usr/lib/x86_64-linux-gnu/libnvrtc.so
clang2py /usr/include/CL/cl.h -o gpuctypes/opencl.py -l /usr/lib/x86_64-linux-gnu/libOpenCL.so
grep FIXME_STUB gpuctypes/*
84 changes: 42 additions & 42 deletions gpuctypes/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,30 @@ class struct_CUipcMemHandle_st(Structure):
class union_CUstreamBatchMemOpParams_union(Union):
pass

class struct_CUstreamMemOpWaitValueParams_st(Structure):
pass

class union_CUstreamMemOpWaitValueParams_st_0(Union):
pass

union_CUstreamMemOpWaitValueParams_st_0._pack_ = 1 # source:False
union_CUstreamMemOpWaitValueParams_st_0._fields_ = [
('value', ctypes.c_uint32),
('value64', ctypes.c_uint64),
]

struct_CUstreamMemOpWaitValueParams_st._pack_ = 1 # source:False
struct_CUstreamMemOpWaitValueParams_st._anonymous_ = ('_0',)
struct_CUstreamMemOpWaitValueParams_st._fields_ = [
('operation', CUstreamBatchMemOpType),
('PADDING_0', ctypes.c_ubyte * 4),
('address', ctypes.c_uint64),
('_0', union_CUstreamMemOpWaitValueParams_st_0),
('flags', ctypes.c_uint32),
('PADDING_1', ctypes.c_ubyte * 4),
('alias', ctypes.c_uint64),
]

class struct_CUstreamMemOpFlushRemoteWritesParams_st(Structure):
pass

Expand Down Expand Up @@ -431,30 +455,6 @@ class union_CUstreamMemOpWriteValueParams_st_0(Union):
('alias', ctypes.c_uint64),
]

class struct_CUstreamMemOpWaitValueParams_st(Structure):
pass

class union_CUstreamMemOpWaitValueParams_st_0(Union):
pass

union_CUstreamMemOpWaitValueParams_st_0._pack_ = 1 # source:False
union_CUstreamMemOpWaitValueParams_st_0._fields_ = [
('value', ctypes.c_uint32),
('value64', ctypes.c_uint64),
]

struct_CUstreamMemOpWaitValueParams_st._pack_ = 1 # source:False
struct_CUstreamMemOpWaitValueParams_st._anonymous_ = ('_0',)
struct_CUstreamMemOpWaitValueParams_st._fields_ = [
('operation', CUstreamBatchMemOpType),
('PADDING_0', ctypes.c_ubyte * 4),
('address', ctypes.c_uint64),
('_0', union_CUstreamMemOpWaitValueParams_st_0),
('flags', ctypes.c_uint32),
('PADDING_1', ctypes.c_ubyte * 4),
('alias', ctypes.c_uint64),
]

union_CUstreamBatchMemOpParams_union._pack_ = 1 # source:False
union_CUstreamBatchMemOpParams_union._fields_ = [
('operation', CUstreamBatchMemOpType),
Expand Down Expand Up @@ -2264,6 +2264,14 @@ class struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st(Structure):
class struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_params(Structure):
pass

class struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_keyedMutex(Structure):
pass

struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_keyedMutex._pack_ = 1 # source:False
struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_keyedMutex._fields_ = [
('key', ctypes.c_uint64),
]

class union_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_nvSciSync(Union):
pass

Expand All @@ -2281,14 +2289,6 @@ class struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_fence(Structure):
('value', ctypes.c_uint64),
]

class struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_keyedMutex(Structure):
pass

struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_keyedMutex._pack_ = 1 # source:False
struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_keyedMutex._fields_ = [
('key', ctypes.c_uint64),
]

struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_params._pack_ = 1 # source:False
struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_params._fields_ = [
('fence', struct_CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st_0_fence),
Expand All @@ -2313,16 +2313,6 @@ class struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st(Structure):
class struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_params(Structure):
pass

class struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_keyedMutex(Structure):
pass

struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_keyedMutex._pack_ = 1 # source:False
struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_keyedMutex._fields_ = [
('key', ctypes.c_uint64),
('timeoutMs', ctypes.c_uint32),
('PADDING_0', ctypes.c_ubyte * 4),
]

class union_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_nvSciSync(Union):
pass

Expand All @@ -2340,6 +2330,16 @@ class struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_fence(Structure):
('value', ctypes.c_uint64),
]

class struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_keyedMutex(Structure):
pass

struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_keyedMutex._pack_ = 1 # source:False
struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_keyedMutex._fields_ = [
('key', ctypes.c_uint64),
('timeoutMs', ctypes.c_uint32),
('PADDING_0', ctypes.c_ubyte * 4),
]

struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_params._pack_ = 1 # source:False
struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_params._fields_ = [
('fence', struct_CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st_0_fence),
Expand Down
62 changes: 31 additions & 31 deletions gpuctypes/hip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,17 +1334,6 @@ class struct_HIP_RESOURCE_DESC_st(Structure):
class union_HIP_RESOURCE_DESC_st_res(Union):
pass

class struct_HIP_RESOURCE_DESC_st_0_linear(Structure):
pass

struct_HIP_RESOURCE_DESC_st_0_linear._pack_ = 1 # source:False
struct_HIP_RESOURCE_DESC_st_0_linear._fields_ = [
('devPtr', ctypes.POINTER(None)),
('format', hipArray_Format),
('numChannels', ctypes.c_uint32),
('sizeInBytes', ctypes.c_uint64),
]

class struct_HIP_RESOURCE_DESC_st_0_pitch2D(Structure):
pass

Expand Down Expand Up @@ -1382,6 +1371,17 @@ class struct_HIP_RESOURCE_DESC_st_0_array(Structure):
('hArray', ctypes.POINTER(struct_hipArray)),
]

class struct_HIP_RESOURCE_DESC_st_0_linear(Structure):
pass

struct_HIP_RESOURCE_DESC_st_0_linear._pack_ = 1 # source:False
struct_HIP_RESOURCE_DESC_st_0_linear._fields_ = [
('devPtr', ctypes.POINTER(None)),
('format', hipArray_Format),
('numChannels', ctypes.c_uint32),
('sizeInBytes', ctypes.c_uint64),
]

union_HIP_RESOURCE_DESC_st_res._pack_ = 1 # source:False
union_HIP_RESOURCE_DESC_st_res._fields_ = [
('array', struct_HIP_RESOURCE_DESC_st_0_array),
Expand Down Expand Up @@ -2575,6 +2575,17 @@ class union_hipArrayMapInfo_resource(Union):
class union_hipArrayMapInfo_subresource(Union):
pass

class struct_hipArrayMapInfo_1_miptail(Structure):
pass

struct_hipArrayMapInfo_1_miptail._pack_ = 1 # source:False
struct_hipArrayMapInfo_1_miptail._fields_ = [
('layer', ctypes.c_uint32),
('PADDING_0', ctypes.c_ubyte * 4),
('offset', ctypes.c_uint64),
('size', ctypes.c_uint64),
]

class struct_hipArrayMapInfo_1_sparseLevel(Structure):
pass

Expand All @@ -2590,17 +2601,6 @@ class struct_hipArrayMapInfo_1_sparseLevel(Structure):
('extentDepth', ctypes.c_uint32),
]

class struct_hipArrayMapInfo_1_miptail(Structure):
pass

struct_hipArrayMapInfo_1_miptail._pack_ = 1 # source:False
struct_hipArrayMapInfo_1_miptail._fields_ = [
('layer', ctypes.c_uint32),
('PADDING_0', ctypes.c_ubyte * 4),
('offset', ctypes.c_uint64),
('size', ctypes.c_uint64),
]

union_hipArrayMapInfo_subresource._pack_ = 1 # source:False
union_hipArrayMapInfo_subresource._fields_ = [
('sparseLevel', struct_hipArrayMapInfo_1_sparseLevel),
Expand Down Expand Up @@ -3248,15 +3248,6 @@ class struct___hip_texture(Structure):
pass


# values for enumeration 'hipTextureFilterMode'
hipTextureFilterMode__enumvalues = {
0: 'hipFilterModePoint',
1: 'hipFilterModeLinear',
}
hipFilterModePoint = 0
hipFilterModeLinear = 1
hipTextureFilterMode = ctypes.c_uint32 # enum

# values for enumeration 'hipTextureAddressMode'
hipTextureAddressMode__enumvalues = {
0: 'hipAddressModeWrap',
Expand All @@ -3278,6 +3269,15 @@ class struct___hip_texture(Structure):
hipReadModeElementType = 0
hipReadModeNormalizedFloat = 1
hipTextureReadMode = ctypes.c_uint32 # enum

# values for enumeration 'hipTextureFilterMode'
hipTextureFilterMode__enumvalues = {
0: 'hipFilterModePoint',
1: 'hipFilterModeLinear',
}
hipFilterModePoint = 0
hipFilterModeLinear = 1
hipTextureFilterMode = ctypes.c_uint32 # enum
struct_textureReference._pack_ = 1 # source:False
struct_textureReference._fields_ = [
('normalized', ctypes.c_int32),
Expand Down
Loading

0 comments on commit 19af20e

Please sign in to comment.