├── .github └── workflows │ ├── python-publish.yml │ └── test.yml ├── .gitignore ├── .pre-commit-config.yaml ├── LICENSE ├── README.md ├── generate.sh ├── generate_cuda.sh ├── generate_hip.sh ├── generate_opencl.sh ├── gpuctypes ├── comgr.py ├── cuda.py ├── hip.py └── opencl.py ├── setup.py └── test ├── helpers.py ├── test_cuda.py ├── test_hip.py └── test_opencl.py /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflows will upload a Python Package using Twine when a release is created 2 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries 3 | 4 | name: Upload Python Package 5 | 6 | on: 7 | release: 8 | types: [published] 9 | workflow_dispatch: 10 | 11 | jobs: 12 | deploy: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Set up Python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: '3.x' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install setuptools wheel twine 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 27 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 28 | run: | 29 | python setup.py sdist bdist_wheel 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Unit Tests 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | mactest: 10 | name: Mac OpenCL Test 11 | runs-on: macos-13 12 | timeout-minutes: 20 13 | steps: 14 | - name: Checkout Code 15 | uses: actions/checkout@v3 16 | - name: Set up Python 3.11 17 | uses: actions/setup-python@v4 18 | with: 19 | python-version: 3.11 20 | - name: Install gpuctypes 21 | run: pip install . 22 | - name: Run OpenCL test 23 | run: python3 test/test_opencl.py -v 24 | 25 | buildhip: 26 | strategy: 27 | fail-fast: false 28 | matrix: 29 | task: [hip, cuda, opencl] 30 | name: Build ${{ matrix.task }} 31 | runs-on: ubuntu-latest 32 | timeout-minutes: 10 33 | 34 | steps: 35 | - name: Checkout Code 36 | uses: actions/checkout@v3 37 | - name: Make apt fast 38 | run: echo 'Acquire::http::Pipeline-Depth "5";' | sudo tee -a /etc/apt/apt.conf.d/99parallel 39 | - name: Install HIP 40 | if: ${{ matrix.task == 'hip' }} 41 | run: | 42 | wget https://repo.radeon.com/amdgpu-install/6.0/ubuntu/jammy/amdgpu-install_6.0.60000-1_all.deb 43 | sudo apt install ./amdgpu-install_6.0.60000-1_all.deb 44 | sudo apt update -y 45 | sudo apt install -y --no-install-recommends rocm-hip-sdk 46 | - name: Install CUDA 47 | if: ${{ matrix.task == 'cuda' }} 48 | run: | 49 | sudo apt update -y 50 | sudo apt install -y --no-install-recommends git g++ cmake ninja-build llvm-15-dev zlib1g-dev libglew-dev \ 51 | flex bison libfl-dev libboost-thread-dev libboost-filesystem-dev nvidia-cuda-toolkit-gcc 52 | nvcc -V 53 | - name: Install OpenCL 54 | if: ${{ matrix.task == 'opencl' }} 55 | run: | 56 | echo "deb [ allow-insecure=yes ] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list 57 | sudo apt update -y 58 | sudo apt install --allow-unauthenticated -y --no-install-recommends \ 59 | opencl-headers ocl-icd-opencl-dev \ 60 | intel-oneapi-runtime-openmp=2023.2.1-16 intel-oneapi-runtime-compilers-common=2023.2.1-16 intel-oneapi-runtime-compilers=2023.2.1-16 \ 61 | intel-oneapi-runtime-dpcpp-sycl-opencl-cpu=2023.2.1-16 intel-oneapi-runtime-tbb-common=2021.10.0-49541 \ 62 | intel-oneapi-runtime-tbb=2021.10.0-49541 intel-oneapi-runtime-opencl=2023.2.1-16 63 | - name: Set up Python 3.11 64 | uses: actions/setup-python@v4 65 | with: 66 | python-version: 3.11 67 | - name: Install ctypeslib 68 | run: | 69 | sudo apt-get install -y --no-install-recommends clang 70 | pip install clang==14.0.6 71 | git clone https://github.com/geohot/ctypeslib.git 72 | cd ctypeslib 73 | pip install . 74 | clang2py -V 75 | - name: Generate headers 76 | run: | 77 | mv gpuctypes/${{ matrix.task }}.py gpuctypes/${{ matrix.task }}.py.bak 78 | ./generate_${{ matrix.task }}.sh 79 | - name: Install gpuctypes 80 | run: pip install . 81 | - name: Test gpuctypes import 82 | run: python3 -c "import gpuctypes.${{ matrix.task }} as ${{ matrix.task }}" 83 | - name: Run device specific test 84 | run: python3 test/test_${{ matrix.task }}.py -v 85 | - uses: actions/upload-artifact@v3 86 | with: 87 | name: Generated ${{ matrix.task }} Header 88 | path: gpuctypes/${{ matrix.task }}.py 89 | - name: Confirm the generated headers match the committed 90 | run: diff gpuctypes/${{ matrix.task }}.py.bak gpuctypes/${{ matrix.task }}.py 91 | 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | gpuctypes.egg-info 4 | __pycache__ 5 | .*.swp 6 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: local 3 | hooks: 4 | - id: mypy 5 | name: mypy 6 | entry: mypy test/ 7 | language: system 8 | always_run: true 9 | pass_filenames: false -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 George Hotz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## gpuctypes (a low level GPU library for Python) 2 | 3 | Do you wish that there were simple wrappers for GPU libraries in Python? Like not pyopencl, pycuda, and (HIP library someday?) here, but just raw access to the APIs? 4 | 5 | That's what [gpuctypes](https://pypi.org/project/gpuctypes/) does! While high level libraries have their place, the world needs more low level libraries. Like gpuctypes. Welcome home. 6 | 7 | ### Installation (usage) 8 | 9 | ```sh 10 | pip install gpuctypes 11 | ``` 12 | 13 | ### Usage 14 | 15 | ```py 16 | import gpuctypes.hip as hip 17 | import gpuctypes.cuda as cuda 18 | import gpuctypes.opencl as opencl 19 | ``` 20 | 21 | ### How it works 22 | 23 | gpuctypes uses [ctypeslib](https://github.com/trolldbois/ctypeslib) to autogenerate Python files from the headers of the respective libraries. 24 | 25 | ### Installation (development) 26 | 27 | ```sh 28 | git clone https://github.com/tinygrad/gpuctypes.git 29 | cd gpuctypes 30 | pip install -e . 31 | ``` 32 | 33 | ### Current versions 34 | 35 | * ROCm 6.0.0 36 | * CUDA 11.5 37 | * OpenCL (whatever is in Ubuntu 22.04) 38 | -------------------------------------------------------------------------------- /generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ./generate_cuda.sh 3 | ./generate_hip.sh 4 | ./generate_opencl.sh 5 | -------------------------------------------------------------------------------- /generate_cuda.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 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 3 | sed -i "s\import ctypes\import ctypes, ctypes.util\g" gpuctypes/cuda.py 4 | sed -i "s\ctypes.CDLL('/usr/lib/x86_64-linux-gnu/libcuda.so')\ctypes.CDLL(ctypes.util.find_library('cuda'))\g" gpuctypes/cuda.py 5 | sed -i "s\ctypes.CDLL('/usr/lib/x86_64-linux-gnu/libnvrtc.so')\ctypes.CDLL(ctypes.util.find_library('nvrtc'))\g" gpuctypes/cuda.py 6 | grep FIXME_STUB gpuctypes/cuda.py || true 7 | -------------------------------------------------------------------------------- /generate_hip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | clang2py /opt/rocm/include/hip/hip_ext.h /opt/rocm/include/hip/hiprtc.h \ 3 | /opt/rocm/include/hip/hip_runtime_api.h /opt/rocm/include/hip/driver_types.h \ 4 | --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include -x c++" -o gpuctypes/hip.py -l /opt/rocm/lib/libamdhip64.so 5 | echo "hipDeviceProp_t = hipDeviceProp_tR0600" >> gpuctypes/hip.py 6 | echo "hipGetDeviceProperties = hipGetDevicePropertiesR0600" >> gpuctypes/hip.py 7 | grep FIXME_STUB gpuctypes/hip.py || true 8 | # we can trust HIP is always at /opt/rocm/lib 9 | #sed -i "s\import ctypes\import ctypes, ctypes.util\g" gpuctypes/hip.py 10 | #sed -i "s\ctypes.CDLL('/opt/rocm/lib/libhiprtc.so')\ctypes.CDLL(ctypes.util.find_library('hiprtc'))\g" gpuctypes/hip.py 11 | #sed -i "s\ctypes.CDLL('/opt/rocm/lib/libamdhip64.so')\ctypes.CDLL(ctypes.util.find_library('amdhip64'))\g" gpuctypes/hip.py 12 | python3 -c "import gpuctypes.hip" 13 | 14 | clang2py /opt/rocm/include/amd_comgr/amd_comgr.h \ 15 | --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include -x c++" -o gpuctypes/comgr.py -l /opt/rocm/lib/libamd_comgr.so 16 | grep FIXME_STUB gpuctypes/comgr.py || true 17 | python3 -c "import gpuctypes.comgr" 18 | -------------------------------------------------------------------------------- /generate_opencl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clang2py /usr/include/CL/cl.h -o gpuctypes/opencl.py -l /usr/lib/x86_64-linux-gnu/libOpenCL.so -k cdefstum 3 | grep FIXME_STUB gpuctypes/opencl.py || true 4 | # hot patches 5 | sed -i "s\import ctypes\import ctypes, ctypes.util\g" gpuctypes/opencl.py 6 | sed -i "s\ctypes.CDLL('/usr/lib/x86_64-linux-gnu/libOpenCL.so')\ctypes.CDLL(ctypes.util.find_library('OpenCL'))\g" gpuctypes/opencl.py 7 | python3 -c "import gpuctypes.opencl" 8 | -------------------------------------------------------------------------------- /gpuctypes/comgr.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # TARGET arch is: ['-D__HIP_PLATFORM_AMD__', '-I/opt/rocm/include', '-x', 'c++'] 4 | # WORD_SIZE is: 8 5 | # POINTER_SIZE is: 8 6 | # LONGDOUBLE_SIZE is: 16 7 | # 8 | import ctypes 9 | 10 | 11 | def string_cast(char_pointer, encoding='utf-8', errors='strict'): 12 | value = ctypes.cast(char_pointer, ctypes.c_char_p).value 13 | if value is not None and encoding is not None: 14 | value = value.decode(encoding, errors=errors) 15 | return value 16 | 17 | 18 | def char_pointer_cast(string, encoding='utf-8'): 19 | if encoding is not None: 20 | try: 21 | string = string.encode(encoding) 22 | except AttributeError: 23 | # In Python3, bytes has no encode attribute 24 | pass 25 | string = ctypes.c_char_p(string) 26 | return ctypes.cast(string, ctypes.POINTER(ctypes.c_char)) 27 | 28 | 29 | 30 | _libraries = {} 31 | _libraries['libamd_comgr.so'] = ctypes.CDLL('/opt/rocm/lib/libamd_comgr.so') 32 | c_int128 = ctypes.c_ubyte*16 33 | c_uint128 = c_int128 34 | void = None 35 | if ctypes.sizeof(ctypes.c_longdouble) == 16: 36 | c_long_double_t = ctypes.c_longdouble 37 | else: 38 | c_long_double_t = ctypes.c_ubyte*16 39 | 40 | class AsDictMixin: 41 | @classmethod 42 | def as_dict(cls, self): 43 | result = {} 44 | if not isinstance(self, AsDictMixin): 45 | # not a structure, assume it's already a python object 46 | return self 47 | if not hasattr(cls, "_fields_"): 48 | return result 49 | # sys.version_info >= (3, 5) 50 | # for (field, *_) in cls._fields_: # noqa 51 | for field_tuple in cls._fields_: # noqa 52 | field = field_tuple[0] 53 | if field.startswith('PADDING_'): 54 | continue 55 | value = getattr(self, field) 56 | type_ = type(value) 57 | if hasattr(value, "_length_") and hasattr(value, "_type_"): 58 | # array 59 | if not hasattr(type_, "as_dict"): 60 | value = [v for v in value] 61 | else: 62 | type_ = type_._type_ 63 | value = [type_.as_dict(v) for v in value] 64 | elif hasattr(value, "contents") and hasattr(value, "_type_"): 65 | # pointer 66 | try: 67 | if not hasattr(type_, "as_dict"): 68 | value = value.contents 69 | else: 70 | type_ = type_._type_ 71 | value = type_.as_dict(value.contents) 72 | except ValueError: 73 | # nullptr 74 | value = None 75 | elif isinstance(value, AsDictMixin): 76 | # other structure 77 | value = type_.as_dict(value) 78 | result[field] = value 79 | return result 80 | 81 | 82 | class Structure(ctypes.Structure, AsDictMixin): 83 | 84 | def __init__(self, *args, **kwds): 85 | # We don't want to use positional arguments fill PADDING_* fields 86 | 87 | args = dict(zip(self.__class__._field_names_(), args)) 88 | args.update(kwds) 89 | super(Structure, self).__init__(**args) 90 | 91 | @classmethod 92 | def _field_names_(cls): 93 | if hasattr(cls, '_fields_'): 94 | return (f[0] for f in cls._fields_ if not f[0].startswith('PADDING')) 95 | else: 96 | return () 97 | 98 | @classmethod 99 | def get_type(cls, field): 100 | for f in cls._fields_: 101 | if f[0] == field: 102 | return f[1] 103 | return None 104 | 105 | @classmethod 106 | def bind(cls, bound_fields): 107 | fields = {} 108 | for name, type_ in cls._fields_: 109 | if hasattr(type_, "restype"): 110 | if name in bound_fields: 111 | if bound_fields[name] is None: 112 | fields[name] = type_() 113 | else: 114 | # use a closure to capture the callback from the loop scope 115 | fields[name] = ( 116 | type_((lambda callback: lambda *args: callback(*args))( 117 | bound_fields[name])) 118 | ) 119 | del bound_fields[name] 120 | else: 121 | # default callback implementation (does nothing) 122 | try: 123 | default_ = type_(0).restype().value 124 | except TypeError: 125 | default_ = None 126 | fields[name] = type_(( 127 | lambda default_: lambda *args: default_)(default_)) 128 | else: 129 | # not a callback function, use default initialization 130 | if name in bound_fields: 131 | fields[name] = bound_fields[name] 132 | del bound_fields[name] 133 | else: 134 | fields[name] = type_() 135 | if len(bound_fields) != 0: 136 | raise ValueError( 137 | "Cannot bind the following unknown callback(s) {}.{}".format( 138 | cls.__name__, bound_fields.keys() 139 | )) 140 | return cls(**fields) 141 | 142 | 143 | class Union(ctypes.Union, AsDictMixin): 144 | pass 145 | 146 | 147 | 148 | 149 | 150 | 151 | # values for enumeration 'amd_comgr_status_s' 152 | amd_comgr_status_s__enumvalues = { 153 | 0: 'AMD_COMGR_STATUS_SUCCESS', 154 | 1: 'AMD_COMGR_STATUS_ERROR', 155 | 2: 'AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT', 156 | 3: 'AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES', 157 | } 158 | AMD_COMGR_STATUS_SUCCESS = 0 159 | AMD_COMGR_STATUS_ERROR = 1 160 | AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT = 2 161 | AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES = 3 162 | amd_comgr_status_s = ctypes.c_uint32 # enum 163 | amd_comgr_status_t = amd_comgr_status_s 164 | amd_comgr_status_t__enumvalues = amd_comgr_status_s__enumvalues 165 | 166 | # values for enumeration 'amd_comgr_language_s' 167 | amd_comgr_language_s__enumvalues = { 168 | 0: 'AMD_COMGR_LANGUAGE_NONE', 169 | 1: 'AMD_COMGR_LANGUAGE_OPENCL_1_2', 170 | 2: 'AMD_COMGR_LANGUAGE_OPENCL_2_0', 171 | 3: 'AMD_COMGR_LANGUAGE_HC', 172 | 4: 'AMD_COMGR_LANGUAGE_HIP', 173 | 4: 'AMD_COMGR_LANGUAGE_LAST', 174 | } 175 | AMD_COMGR_LANGUAGE_NONE = 0 176 | AMD_COMGR_LANGUAGE_OPENCL_1_2 = 1 177 | AMD_COMGR_LANGUAGE_OPENCL_2_0 = 2 178 | AMD_COMGR_LANGUAGE_HC = 3 179 | AMD_COMGR_LANGUAGE_HIP = 4 180 | AMD_COMGR_LANGUAGE_LAST = 4 181 | amd_comgr_language_s = ctypes.c_uint32 # enum 182 | amd_comgr_language_t = amd_comgr_language_s 183 | amd_comgr_language_t__enumvalues = amd_comgr_language_s__enumvalues 184 | try: 185 | amd_comgr_status_string = _libraries['libamd_comgr.so'].amd_comgr_status_string 186 | amd_comgr_status_string.restype = amd_comgr_status_t 187 | amd_comgr_status_string.argtypes = [amd_comgr_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))] 188 | except AttributeError: 189 | pass 190 | try: 191 | amd_comgr_get_version = _libraries['libamd_comgr.so'].amd_comgr_get_version 192 | amd_comgr_get_version.restype = None 193 | amd_comgr_get_version.argtypes = [ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] 194 | except AttributeError: 195 | pass 196 | 197 | # values for enumeration 'amd_comgr_data_kind_s' 198 | amd_comgr_data_kind_s__enumvalues = { 199 | 0: 'AMD_COMGR_DATA_KIND_UNDEF', 200 | 1: 'AMD_COMGR_DATA_KIND_SOURCE', 201 | 2: 'AMD_COMGR_DATA_KIND_INCLUDE', 202 | 3: 'AMD_COMGR_DATA_KIND_PRECOMPILED_HEADER', 203 | 4: 'AMD_COMGR_DATA_KIND_DIAGNOSTIC', 204 | 5: 'AMD_COMGR_DATA_KIND_LOG', 205 | 6: 'AMD_COMGR_DATA_KIND_BC', 206 | 7: 'AMD_COMGR_DATA_KIND_RELOCATABLE', 207 | 8: 'AMD_COMGR_DATA_KIND_EXECUTABLE', 208 | 9: 'AMD_COMGR_DATA_KIND_BYTES', 209 | 16: 'AMD_COMGR_DATA_KIND_FATBIN', 210 | 17: 'AMD_COMGR_DATA_KIND_AR', 211 | 18: 'AMD_COMGR_DATA_KIND_BC_BUNDLE', 212 | 19: 'AMD_COMGR_DATA_KIND_AR_BUNDLE', 213 | 19: 'AMD_COMGR_DATA_KIND_LAST', 214 | } 215 | AMD_COMGR_DATA_KIND_UNDEF = 0 216 | AMD_COMGR_DATA_KIND_SOURCE = 1 217 | AMD_COMGR_DATA_KIND_INCLUDE = 2 218 | AMD_COMGR_DATA_KIND_PRECOMPILED_HEADER = 3 219 | AMD_COMGR_DATA_KIND_DIAGNOSTIC = 4 220 | AMD_COMGR_DATA_KIND_LOG = 5 221 | AMD_COMGR_DATA_KIND_BC = 6 222 | AMD_COMGR_DATA_KIND_RELOCATABLE = 7 223 | AMD_COMGR_DATA_KIND_EXECUTABLE = 8 224 | AMD_COMGR_DATA_KIND_BYTES = 9 225 | AMD_COMGR_DATA_KIND_FATBIN = 16 226 | AMD_COMGR_DATA_KIND_AR = 17 227 | AMD_COMGR_DATA_KIND_BC_BUNDLE = 18 228 | AMD_COMGR_DATA_KIND_AR_BUNDLE = 19 229 | AMD_COMGR_DATA_KIND_LAST = 19 230 | amd_comgr_data_kind_s = ctypes.c_uint32 # enum 231 | amd_comgr_data_kind_t = amd_comgr_data_kind_s 232 | amd_comgr_data_kind_t__enumvalues = amd_comgr_data_kind_s__enumvalues 233 | class struct_amd_comgr_data_s(Structure): 234 | pass 235 | 236 | struct_amd_comgr_data_s._pack_ = 1 # source:False 237 | struct_amd_comgr_data_s._fields_ = [ 238 | ('handle', ctypes.c_uint64), 239 | ] 240 | 241 | amd_comgr_data_t = struct_amd_comgr_data_s 242 | class struct_amd_comgr_data_set_s(Structure): 243 | pass 244 | 245 | struct_amd_comgr_data_set_s._pack_ = 1 # source:False 246 | struct_amd_comgr_data_set_s._fields_ = [ 247 | ('handle', ctypes.c_uint64), 248 | ] 249 | 250 | amd_comgr_data_set_t = struct_amd_comgr_data_set_s 251 | class struct_amd_comgr_action_info_s(Structure): 252 | pass 253 | 254 | struct_amd_comgr_action_info_s._pack_ = 1 # source:False 255 | struct_amd_comgr_action_info_s._fields_ = [ 256 | ('handle', ctypes.c_uint64), 257 | ] 258 | 259 | amd_comgr_action_info_t = struct_amd_comgr_action_info_s 260 | class struct_amd_comgr_metadata_node_s(Structure): 261 | pass 262 | 263 | struct_amd_comgr_metadata_node_s._pack_ = 1 # source:False 264 | struct_amd_comgr_metadata_node_s._fields_ = [ 265 | ('handle', ctypes.c_uint64), 266 | ] 267 | 268 | amd_comgr_metadata_node_t = struct_amd_comgr_metadata_node_s 269 | class struct_amd_comgr_symbol_s(Structure): 270 | pass 271 | 272 | struct_amd_comgr_symbol_s._pack_ = 1 # source:False 273 | struct_amd_comgr_symbol_s._fields_ = [ 274 | ('handle', ctypes.c_uint64), 275 | ] 276 | 277 | amd_comgr_symbol_t = struct_amd_comgr_symbol_s 278 | class struct_amd_comgr_disassembly_info_s(Structure): 279 | pass 280 | 281 | struct_amd_comgr_disassembly_info_s._pack_ = 1 # source:False 282 | struct_amd_comgr_disassembly_info_s._fields_ = [ 283 | ('handle', ctypes.c_uint64), 284 | ] 285 | 286 | amd_comgr_disassembly_info_t = struct_amd_comgr_disassembly_info_s 287 | class struct_amd_comgr_symbolizer_info_s(Structure): 288 | pass 289 | 290 | struct_amd_comgr_symbolizer_info_s._pack_ = 1 # source:False 291 | struct_amd_comgr_symbolizer_info_s._fields_ = [ 292 | ('handle', ctypes.c_uint64), 293 | ] 294 | 295 | amd_comgr_symbolizer_info_t = struct_amd_comgr_symbolizer_info_s 296 | try: 297 | amd_comgr_get_isa_count = _libraries['libamd_comgr.so'].amd_comgr_get_isa_count 298 | amd_comgr_get_isa_count.restype = amd_comgr_status_t 299 | amd_comgr_get_isa_count.argtypes = [ctypes.POINTER(ctypes.c_uint64)] 300 | except AttributeError: 301 | pass 302 | size_t = ctypes.c_uint64 303 | try: 304 | amd_comgr_get_isa_name = _libraries['libamd_comgr.so'].amd_comgr_get_isa_name 305 | amd_comgr_get_isa_name.restype = amd_comgr_status_t 306 | amd_comgr_get_isa_name.argtypes = [size_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))] 307 | except AttributeError: 308 | pass 309 | try: 310 | amd_comgr_get_isa_metadata = _libraries['libamd_comgr.so'].amd_comgr_get_isa_metadata 311 | amd_comgr_get_isa_metadata.restype = amd_comgr_status_t 312 | amd_comgr_get_isa_metadata.argtypes = [ctypes.POINTER(ctypes.c_char), ctypes.POINTER(struct_amd_comgr_metadata_node_s)] 313 | except AttributeError: 314 | pass 315 | try: 316 | amd_comgr_create_data = _libraries['libamd_comgr.so'].amd_comgr_create_data 317 | amd_comgr_create_data.restype = amd_comgr_status_t 318 | amd_comgr_create_data.argtypes = [amd_comgr_data_kind_t, ctypes.POINTER(struct_amd_comgr_data_s)] 319 | except AttributeError: 320 | pass 321 | try: 322 | amd_comgr_release_data = _libraries['libamd_comgr.so'].amd_comgr_release_data 323 | amd_comgr_release_data.restype = amd_comgr_status_t 324 | amd_comgr_release_data.argtypes = [amd_comgr_data_t] 325 | except AttributeError: 326 | pass 327 | try: 328 | amd_comgr_get_data_kind = _libraries['libamd_comgr.so'].amd_comgr_get_data_kind 329 | amd_comgr_get_data_kind.restype = amd_comgr_status_t 330 | amd_comgr_get_data_kind.argtypes = [amd_comgr_data_t, ctypes.POINTER(amd_comgr_data_kind_s)] 331 | except AttributeError: 332 | pass 333 | try: 334 | amd_comgr_set_data = _libraries['libamd_comgr.so'].amd_comgr_set_data 335 | amd_comgr_set_data.restype = amd_comgr_status_t 336 | amd_comgr_set_data.argtypes = [amd_comgr_data_t, size_t, ctypes.POINTER(ctypes.c_char)] 337 | except AttributeError: 338 | pass 339 | uint64_t = ctypes.c_uint64 340 | try: 341 | amd_comgr_set_data_from_file_slice = _libraries['libamd_comgr.so'].amd_comgr_set_data_from_file_slice 342 | amd_comgr_set_data_from_file_slice.restype = amd_comgr_status_t 343 | amd_comgr_set_data_from_file_slice.argtypes = [amd_comgr_data_t, ctypes.c_int32, uint64_t, uint64_t] 344 | except AttributeError: 345 | pass 346 | try: 347 | amd_comgr_set_data_name = _libraries['libamd_comgr.so'].amd_comgr_set_data_name 348 | amd_comgr_set_data_name.restype = amd_comgr_status_t 349 | amd_comgr_set_data_name.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_char)] 350 | except AttributeError: 351 | pass 352 | try: 353 | amd_comgr_get_data = _libraries['libamd_comgr.so'].amd_comgr_get_data 354 | amd_comgr_get_data.restype = amd_comgr_status_t 355 | amd_comgr_get_data.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 356 | except AttributeError: 357 | pass 358 | try: 359 | amd_comgr_get_data_name = _libraries['libamd_comgr.so'].amd_comgr_get_data_name 360 | amd_comgr_get_data_name.restype = amd_comgr_status_t 361 | amd_comgr_get_data_name.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 362 | except AttributeError: 363 | pass 364 | try: 365 | amd_comgr_get_data_isa_name = _libraries['libamd_comgr.so'].amd_comgr_get_data_isa_name 366 | amd_comgr_get_data_isa_name.restype = amd_comgr_status_t 367 | amd_comgr_get_data_isa_name.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 368 | except AttributeError: 369 | pass 370 | try: 371 | amd_comgr_create_symbolizer_info = _libraries['libamd_comgr.so'].amd_comgr_create_symbolizer_info 372 | amd_comgr_create_symbolizer_info.restype = amd_comgr_status_t 373 | amd_comgr_create_symbolizer_info.argtypes = [amd_comgr_data_t, ctypes.CFUNCTYPE(None, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(None)), ctypes.POINTER(struct_amd_comgr_symbolizer_info_s)] 374 | except AttributeError: 375 | pass 376 | try: 377 | amd_comgr_destroy_symbolizer_info = _libraries['libamd_comgr.so'].amd_comgr_destroy_symbolizer_info 378 | amd_comgr_destroy_symbolizer_info.restype = amd_comgr_status_t 379 | amd_comgr_destroy_symbolizer_info.argtypes = [amd_comgr_symbolizer_info_t] 380 | except AttributeError: 381 | pass 382 | try: 383 | amd_comgr_symbolize = _libraries['libamd_comgr.so'].amd_comgr_symbolize 384 | amd_comgr_symbolize.restype = amd_comgr_status_t 385 | amd_comgr_symbolize.argtypes = [amd_comgr_symbolizer_info_t, uint64_t, ctypes.c_bool, ctypes.POINTER(None)] 386 | except AttributeError: 387 | pass 388 | try: 389 | amd_comgr_get_data_metadata = _libraries['libamd_comgr.so'].amd_comgr_get_data_metadata 390 | amd_comgr_get_data_metadata.restype = amd_comgr_status_t 391 | amd_comgr_get_data_metadata.argtypes = [amd_comgr_data_t, ctypes.POINTER(struct_amd_comgr_metadata_node_s)] 392 | except AttributeError: 393 | pass 394 | try: 395 | amd_comgr_destroy_metadata = _libraries['libamd_comgr.so'].amd_comgr_destroy_metadata 396 | amd_comgr_destroy_metadata.restype = amd_comgr_status_t 397 | amd_comgr_destroy_metadata.argtypes = [amd_comgr_metadata_node_t] 398 | except AttributeError: 399 | pass 400 | try: 401 | amd_comgr_create_data_set = _libraries['libamd_comgr.so'].amd_comgr_create_data_set 402 | amd_comgr_create_data_set.restype = amd_comgr_status_t 403 | amd_comgr_create_data_set.argtypes = [ctypes.POINTER(struct_amd_comgr_data_set_s)] 404 | except AttributeError: 405 | pass 406 | try: 407 | amd_comgr_destroy_data_set = _libraries['libamd_comgr.so'].amd_comgr_destroy_data_set 408 | amd_comgr_destroy_data_set.restype = amd_comgr_status_t 409 | amd_comgr_destroy_data_set.argtypes = [amd_comgr_data_set_t] 410 | except AttributeError: 411 | pass 412 | try: 413 | amd_comgr_data_set_add = _libraries['libamd_comgr.so'].amd_comgr_data_set_add 414 | amd_comgr_data_set_add.restype = amd_comgr_status_t 415 | amd_comgr_data_set_add.argtypes = [amd_comgr_data_set_t, amd_comgr_data_t] 416 | except AttributeError: 417 | pass 418 | try: 419 | amd_comgr_data_set_remove = _libraries['libamd_comgr.so'].amd_comgr_data_set_remove 420 | amd_comgr_data_set_remove.restype = amd_comgr_status_t 421 | amd_comgr_data_set_remove.argtypes = [amd_comgr_data_set_t, amd_comgr_data_kind_t] 422 | except AttributeError: 423 | pass 424 | try: 425 | amd_comgr_action_data_count = _libraries['libamd_comgr.so'].amd_comgr_action_data_count 426 | amd_comgr_action_data_count.restype = amd_comgr_status_t 427 | amd_comgr_action_data_count.argtypes = [amd_comgr_data_set_t, amd_comgr_data_kind_t, ctypes.POINTER(ctypes.c_uint64)] 428 | except AttributeError: 429 | pass 430 | try: 431 | amd_comgr_action_data_get_data = _libraries['libamd_comgr.so'].amd_comgr_action_data_get_data 432 | amd_comgr_action_data_get_data.restype = amd_comgr_status_t 433 | amd_comgr_action_data_get_data.argtypes = [amd_comgr_data_set_t, amd_comgr_data_kind_t, size_t, ctypes.POINTER(struct_amd_comgr_data_s)] 434 | except AttributeError: 435 | pass 436 | try: 437 | amd_comgr_create_action_info = _libraries['libamd_comgr.so'].amd_comgr_create_action_info 438 | amd_comgr_create_action_info.restype = amd_comgr_status_t 439 | amd_comgr_create_action_info.argtypes = [ctypes.POINTER(struct_amd_comgr_action_info_s)] 440 | except AttributeError: 441 | pass 442 | try: 443 | amd_comgr_destroy_action_info = _libraries['libamd_comgr.so'].amd_comgr_destroy_action_info 444 | amd_comgr_destroy_action_info.restype = amd_comgr_status_t 445 | amd_comgr_destroy_action_info.argtypes = [amd_comgr_action_info_t] 446 | except AttributeError: 447 | pass 448 | try: 449 | amd_comgr_action_info_set_isa_name = _libraries['libamd_comgr.so'].amd_comgr_action_info_set_isa_name 450 | amd_comgr_action_info_set_isa_name.restype = amd_comgr_status_t 451 | amd_comgr_action_info_set_isa_name.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_char)] 452 | except AttributeError: 453 | pass 454 | try: 455 | amd_comgr_action_info_get_isa_name = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_isa_name 456 | amd_comgr_action_info_get_isa_name.restype = amd_comgr_status_t 457 | amd_comgr_action_info_get_isa_name.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 458 | except AttributeError: 459 | pass 460 | try: 461 | amd_comgr_action_info_set_language = _libraries['libamd_comgr.so'].amd_comgr_action_info_set_language 462 | amd_comgr_action_info_set_language.restype = amd_comgr_status_t 463 | amd_comgr_action_info_set_language.argtypes = [amd_comgr_action_info_t, amd_comgr_language_t] 464 | except AttributeError: 465 | pass 466 | try: 467 | amd_comgr_action_info_get_language = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_language 468 | amd_comgr_action_info_get_language.restype = amd_comgr_status_t 469 | amd_comgr_action_info_get_language.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(amd_comgr_language_s)] 470 | except AttributeError: 471 | pass 472 | try: 473 | amd_comgr_action_info_set_options = _libraries['libamd_comgr.so'].amd_comgr_action_info_set_options 474 | amd_comgr_action_info_set_options.restype = amd_comgr_status_t 475 | amd_comgr_action_info_set_options.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_char)] 476 | except AttributeError: 477 | pass 478 | try: 479 | amd_comgr_action_info_get_options = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_options 480 | amd_comgr_action_info_get_options.restype = amd_comgr_status_t 481 | amd_comgr_action_info_get_options.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 482 | except AttributeError: 483 | pass 484 | try: 485 | amd_comgr_action_info_set_option_list = _libraries['libamd_comgr.so'].amd_comgr_action_info_set_option_list 486 | amd_comgr_action_info_set_option_list.restype = amd_comgr_status_t 487 | amd_comgr_action_info_set_option_list.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_char) * 0, size_t] 488 | except AttributeError: 489 | pass 490 | try: 491 | amd_comgr_action_info_get_option_list_count = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_option_list_count 492 | amd_comgr_action_info_get_option_list_count.restype = amd_comgr_status_t 493 | amd_comgr_action_info_get_option_list_count.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_uint64)] 494 | except AttributeError: 495 | pass 496 | try: 497 | amd_comgr_action_info_get_option_list_item = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_option_list_item 498 | amd_comgr_action_info_get_option_list_item.restype = amd_comgr_status_t 499 | amd_comgr_action_info_get_option_list_item.argtypes = [amd_comgr_action_info_t, size_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 500 | except AttributeError: 501 | pass 502 | try: 503 | amd_comgr_action_info_set_working_directory_path = _libraries['libamd_comgr.so'].amd_comgr_action_info_set_working_directory_path 504 | amd_comgr_action_info_set_working_directory_path.restype = amd_comgr_status_t 505 | amd_comgr_action_info_set_working_directory_path.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_char)] 506 | except AttributeError: 507 | pass 508 | try: 509 | amd_comgr_action_info_get_working_directory_path = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_working_directory_path 510 | amd_comgr_action_info_get_working_directory_path.restype = amd_comgr_status_t 511 | amd_comgr_action_info_get_working_directory_path.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 512 | except AttributeError: 513 | pass 514 | try: 515 | amd_comgr_action_info_set_logging = _libraries['libamd_comgr.so'].amd_comgr_action_info_set_logging 516 | amd_comgr_action_info_set_logging.restype = amd_comgr_status_t 517 | amd_comgr_action_info_set_logging.argtypes = [amd_comgr_action_info_t, ctypes.c_bool] 518 | except AttributeError: 519 | pass 520 | try: 521 | amd_comgr_action_info_get_logging = _libraries['libamd_comgr.so'].amd_comgr_action_info_get_logging 522 | amd_comgr_action_info_get_logging.restype = amd_comgr_status_t 523 | amd_comgr_action_info_get_logging.argtypes = [amd_comgr_action_info_t, ctypes.POINTER(ctypes.c_bool)] 524 | except AttributeError: 525 | pass 526 | 527 | # values for enumeration 'amd_comgr_action_kind_s' 528 | amd_comgr_action_kind_s__enumvalues = { 529 | 0: 'AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR', 530 | 1: 'AMD_COMGR_ACTION_ADD_PRECOMPILED_HEADERS', 531 | 2: 'AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC', 532 | 3: 'AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES', 533 | 4: 'AMD_COMGR_ACTION_LINK_BC_TO_BC', 534 | 5: 'AMD_COMGR_ACTION_OPTIMIZE_BC_TO_BC', 535 | 6: 'AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE', 536 | 7: 'AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY', 537 | 8: 'AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_RELOCATABLE', 538 | 9: 'AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE', 539 | 10: 'AMD_COMGR_ACTION_ASSEMBLE_SOURCE_TO_RELOCATABLE', 540 | 11: 'AMD_COMGR_ACTION_DISASSEMBLE_RELOCATABLE_TO_SOURCE', 541 | 12: 'AMD_COMGR_ACTION_DISASSEMBLE_EXECUTABLE_TO_SOURCE', 542 | 13: 'AMD_COMGR_ACTION_DISASSEMBLE_BYTES_TO_SOURCE', 543 | 14: 'AMD_COMGR_ACTION_COMPILE_SOURCE_TO_FATBIN', 544 | 15: 'AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC', 545 | 15: 'AMD_COMGR_ACTION_LAST', 546 | } 547 | AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR = 0 548 | AMD_COMGR_ACTION_ADD_PRECOMPILED_HEADERS = 1 549 | AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC = 2 550 | AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES = 3 551 | AMD_COMGR_ACTION_LINK_BC_TO_BC = 4 552 | AMD_COMGR_ACTION_OPTIMIZE_BC_TO_BC = 5 553 | AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE = 6 554 | AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY = 7 555 | AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_RELOCATABLE = 8 556 | AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE = 9 557 | AMD_COMGR_ACTION_ASSEMBLE_SOURCE_TO_RELOCATABLE = 10 558 | AMD_COMGR_ACTION_DISASSEMBLE_RELOCATABLE_TO_SOURCE = 11 559 | AMD_COMGR_ACTION_DISASSEMBLE_EXECUTABLE_TO_SOURCE = 12 560 | AMD_COMGR_ACTION_DISASSEMBLE_BYTES_TO_SOURCE = 13 561 | AMD_COMGR_ACTION_COMPILE_SOURCE_TO_FATBIN = 14 562 | AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC = 15 563 | AMD_COMGR_ACTION_LAST = 15 564 | amd_comgr_action_kind_s = ctypes.c_uint32 # enum 565 | amd_comgr_action_kind_t = amd_comgr_action_kind_s 566 | amd_comgr_action_kind_t__enumvalues = amd_comgr_action_kind_s__enumvalues 567 | try: 568 | amd_comgr_do_action = _libraries['libamd_comgr.so'].amd_comgr_do_action 569 | amd_comgr_do_action.restype = amd_comgr_status_t 570 | amd_comgr_do_action.argtypes = [amd_comgr_action_kind_t, amd_comgr_action_info_t, amd_comgr_data_set_t, amd_comgr_data_set_t] 571 | except AttributeError: 572 | pass 573 | 574 | # values for enumeration 'amd_comgr_metadata_kind_s' 575 | amd_comgr_metadata_kind_s__enumvalues = { 576 | 0: 'AMD_COMGR_METADATA_KIND_NULL', 577 | 1: 'AMD_COMGR_METADATA_KIND_STRING', 578 | 2: 'AMD_COMGR_METADATA_KIND_MAP', 579 | 3: 'AMD_COMGR_METADATA_KIND_LIST', 580 | 3: 'AMD_COMGR_METADATA_KIND_LAST', 581 | } 582 | AMD_COMGR_METADATA_KIND_NULL = 0 583 | AMD_COMGR_METADATA_KIND_STRING = 1 584 | AMD_COMGR_METADATA_KIND_MAP = 2 585 | AMD_COMGR_METADATA_KIND_LIST = 3 586 | AMD_COMGR_METADATA_KIND_LAST = 3 587 | amd_comgr_metadata_kind_s = ctypes.c_uint32 # enum 588 | amd_comgr_metadata_kind_t = amd_comgr_metadata_kind_s 589 | amd_comgr_metadata_kind_t__enumvalues = amd_comgr_metadata_kind_s__enumvalues 590 | try: 591 | amd_comgr_get_metadata_kind = _libraries['libamd_comgr.so'].amd_comgr_get_metadata_kind 592 | amd_comgr_get_metadata_kind.restype = amd_comgr_status_t 593 | amd_comgr_get_metadata_kind.argtypes = [amd_comgr_metadata_node_t, ctypes.POINTER(amd_comgr_metadata_kind_s)] 594 | except AttributeError: 595 | pass 596 | try: 597 | amd_comgr_get_metadata_string = _libraries['libamd_comgr.so'].amd_comgr_get_metadata_string 598 | amd_comgr_get_metadata_string.restype = amd_comgr_status_t 599 | amd_comgr_get_metadata_string.argtypes = [amd_comgr_metadata_node_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 600 | except AttributeError: 601 | pass 602 | try: 603 | amd_comgr_get_metadata_map_size = _libraries['libamd_comgr.so'].amd_comgr_get_metadata_map_size 604 | amd_comgr_get_metadata_map_size.restype = amd_comgr_status_t 605 | amd_comgr_get_metadata_map_size.argtypes = [amd_comgr_metadata_node_t, ctypes.POINTER(ctypes.c_uint64)] 606 | except AttributeError: 607 | pass 608 | try: 609 | amd_comgr_iterate_map_metadata = _libraries['libamd_comgr.so'].amd_comgr_iterate_map_metadata 610 | amd_comgr_iterate_map_metadata.restype = amd_comgr_status_t 611 | amd_comgr_iterate_map_metadata.argtypes = [amd_comgr_metadata_node_t, ctypes.CFUNCTYPE(amd_comgr_status_s, struct_amd_comgr_metadata_node_s, struct_amd_comgr_metadata_node_s, ctypes.POINTER(None)), ctypes.POINTER(None)] 612 | except AttributeError: 613 | pass 614 | try: 615 | amd_comgr_metadata_lookup = _libraries['libamd_comgr.so'].amd_comgr_metadata_lookup 616 | amd_comgr_metadata_lookup.restype = amd_comgr_status_t 617 | amd_comgr_metadata_lookup.argtypes = [amd_comgr_metadata_node_t, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(struct_amd_comgr_metadata_node_s)] 618 | except AttributeError: 619 | pass 620 | try: 621 | amd_comgr_get_metadata_list_size = _libraries['libamd_comgr.so'].amd_comgr_get_metadata_list_size 622 | amd_comgr_get_metadata_list_size.restype = amd_comgr_status_t 623 | amd_comgr_get_metadata_list_size.argtypes = [amd_comgr_metadata_node_t, ctypes.POINTER(ctypes.c_uint64)] 624 | except AttributeError: 625 | pass 626 | try: 627 | amd_comgr_index_list_metadata = _libraries['libamd_comgr.so'].amd_comgr_index_list_metadata 628 | amd_comgr_index_list_metadata.restype = amd_comgr_status_t 629 | amd_comgr_index_list_metadata.argtypes = [amd_comgr_metadata_node_t, size_t, ctypes.POINTER(struct_amd_comgr_metadata_node_s)] 630 | except AttributeError: 631 | pass 632 | try: 633 | amd_comgr_iterate_symbols = _libraries['libamd_comgr.so'].amd_comgr_iterate_symbols 634 | amd_comgr_iterate_symbols.restype = amd_comgr_status_t 635 | amd_comgr_iterate_symbols.argtypes = [amd_comgr_data_t, ctypes.CFUNCTYPE(amd_comgr_status_s, struct_amd_comgr_symbol_s, ctypes.POINTER(None)), ctypes.POINTER(None)] 636 | except AttributeError: 637 | pass 638 | try: 639 | amd_comgr_symbol_lookup = _libraries['libamd_comgr.so'].amd_comgr_symbol_lookup 640 | amd_comgr_symbol_lookup.restype = amd_comgr_status_t 641 | amd_comgr_symbol_lookup.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(struct_amd_comgr_symbol_s)] 642 | except AttributeError: 643 | pass 644 | 645 | # values for enumeration 'amd_comgr_symbol_type_s' 646 | amd_comgr_symbol_type_s__enumvalues = { 647 | -1: 'AMD_COMGR_SYMBOL_TYPE_UNKNOWN', 648 | 0: 'AMD_COMGR_SYMBOL_TYPE_NOTYPE', 649 | 1: 'AMD_COMGR_SYMBOL_TYPE_OBJECT', 650 | 2: 'AMD_COMGR_SYMBOL_TYPE_FUNC', 651 | 3: 'AMD_COMGR_SYMBOL_TYPE_SECTION', 652 | 4: 'AMD_COMGR_SYMBOL_TYPE_FILE', 653 | 5: 'AMD_COMGR_SYMBOL_TYPE_COMMON', 654 | 10: 'AMD_COMGR_SYMBOL_TYPE_AMDGPU_HSA_KERNEL', 655 | } 656 | AMD_COMGR_SYMBOL_TYPE_UNKNOWN = -1 657 | AMD_COMGR_SYMBOL_TYPE_NOTYPE = 0 658 | AMD_COMGR_SYMBOL_TYPE_OBJECT = 1 659 | AMD_COMGR_SYMBOL_TYPE_FUNC = 2 660 | AMD_COMGR_SYMBOL_TYPE_SECTION = 3 661 | AMD_COMGR_SYMBOL_TYPE_FILE = 4 662 | AMD_COMGR_SYMBOL_TYPE_COMMON = 5 663 | AMD_COMGR_SYMBOL_TYPE_AMDGPU_HSA_KERNEL = 10 664 | amd_comgr_symbol_type_s = ctypes.c_int32 # enum 665 | amd_comgr_symbol_type_t = amd_comgr_symbol_type_s 666 | amd_comgr_symbol_type_t__enumvalues = amd_comgr_symbol_type_s__enumvalues 667 | 668 | # values for enumeration 'amd_comgr_symbol_info_s' 669 | amd_comgr_symbol_info_s__enumvalues = { 670 | 0: 'AMD_COMGR_SYMBOL_INFO_NAME_LENGTH', 671 | 1: 'AMD_COMGR_SYMBOL_INFO_NAME', 672 | 2: 'AMD_COMGR_SYMBOL_INFO_TYPE', 673 | 3: 'AMD_COMGR_SYMBOL_INFO_SIZE', 674 | 4: 'AMD_COMGR_SYMBOL_INFO_IS_UNDEFINED', 675 | 5: 'AMD_COMGR_SYMBOL_INFO_VALUE', 676 | 5: 'AMD_COMGR_SYMBOL_INFO_LAST', 677 | } 678 | AMD_COMGR_SYMBOL_INFO_NAME_LENGTH = 0 679 | AMD_COMGR_SYMBOL_INFO_NAME = 1 680 | AMD_COMGR_SYMBOL_INFO_TYPE = 2 681 | AMD_COMGR_SYMBOL_INFO_SIZE = 3 682 | AMD_COMGR_SYMBOL_INFO_IS_UNDEFINED = 4 683 | AMD_COMGR_SYMBOL_INFO_VALUE = 5 684 | AMD_COMGR_SYMBOL_INFO_LAST = 5 685 | amd_comgr_symbol_info_s = ctypes.c_uint32 # enum 686 | amd_comgr_symbol_info_t = amd_comgr_symbol_info_s 687 | amd_comgr_symbol_info_t__enumvalues = amd_comgr_symbol_info_s__enumvalues 688 | try: 689 | amd_comgr_symbol_get_info = _libraries['libamd_comgr.so'].amd_comgr_symbol_get_info 690 | amd_comgr_symbol_get_info.restype = amd_comgr_status_t 691 | amd_comgr_symbol_get_info.argtypes = [amd_comgr_symbol_t, amd_comgr_symbol_info_t, ctypes.POINTER(None)] 692 | except AttributeError: 693 | pass 694 | try: 695 | amd_comgr_create_disassembly_info = _libraries['libamd_comgr.so'].amd_comgr_create_disassembly_info 696 | amd_comgr_create_disassembly_info.restype = amd_comgr_status_t 697 | amd_comgr_create_disassembly_info.argtypes = [ctypes.POINTER(ctypes.c_char), ctypes.CFUNCTYPE(ctypes.c_uint64, ctypes.c_uint64, ctypes.POINTER(ctypes.c_char), ctypes.c_uint64, ctypes.POINTER(None)), ctypes.CFUNCTYPE(None, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(None)), ctypes.CFUNCTYPE(None, ctypes.c_uint64, ctypes.POINTER(None)), ctypes.POINTER(struct_amd_comgr_disassembly_info_s)] 698 | except AttributeError: 699 | pass 700 | try: 701 | amd_comgr_destroy_disassembly_info = _libraries['libamd_comgr.so'].amd_comgr_destroy_disassembly_info 702 | amd_comgr_destroy_disassembly_info.restype = amd_comgr_status_t 703 | amd_comgr_destroy_disassembly_info.argtypes = [amd_comgr_disassembly_info_t] 704 | except AttributeError: 705 | pass 706 | try: 707 | amd_comgr_disassemble_instruction = _libraries['libamd_comgr.so'].amd_comgr_disassemble_instruction 708 | amd_comgr_disassemble_instruction.restype = amd_comgr_status_t 709 | amd_comgr_disassemble_instruction.argtypes = [amd_comgr_disassembly_info_t, uint64_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 710 | except AttributeError: 711 | pass 712 | try: 713 | amd_comgr_demangle_symbol_name = _libraries['libamd_comgr.so'].amd_comgr_demangle_symbol_name 714 | amd_comgr_demangle_symbol_name.restype = amd_comgr_status_t 715 | amd_comgr_demangle_symbol_name.argtypes = [amd_comgr_data_t, ctypes.POINTER(struct_amd_comgr_data_s)] 716 | except AttributeError: 717 | pass 718 | try: 719 | amd_comgr_populate_mangled_names = _libraries['libamd_comgr.so'].amd_comgr_populate_mangled_names 720 | amd_comgr_populate_mangled_names.restype = amd_comgr_status_t 721 | amd_comgr_populate_mangled_names.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_uint64)] 722 | except AttributeError: 723 | pass 724 | try: 725 | amd_comgr_get_mangled_name = _libraries['libamd_comgr.so'].amd_comgr_get_mangled_name 726 | amd_comgr_get_mangled_name.restype = amd_comgr_status_t 727 | amd_comgr_get_mangled_name.argtypes = [amd_comgr_data_t, size_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char)] 728 | except AttributeError: 729 | pass 730 | try: 731 | amd_comgr_populate_name_expression_map = _libraries['libamd_comgr.so'].amd_comgr_populate_name_expression_map 732 | amd_comgr_populate_name_expression_map.restype = amd_comgr_status_t 733 | amd_comgr_populate_name_expression_map.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_uint64)] 734 | except AttributeError: 735 | pass 736 | try: 737 | amd_comgr_map_name_expression_to_symbol_name = _libraries['libamd_comgr.so'].amd_comgr_map_name_expression_to_symbol_name 738 | amd_comgr_map_name_expression_to_symbol_name.restype = amd_comgr_status_t 739 | amd_comgr_map_name_expression_to_symbol_name.argtypes = [amd_comgr_data_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_char)] 740 | except AttributeError: 741 | pass 742 | class struct_code_object_info_s(Structure): 743 | pass 744 | 745 | struct_code_object_info_s._pack_ = 1 # source:False 746 | struct_code_object_info_s._fields_ = [ 747 | ('isa', ctypes.POINTER(ctypes.c_char)), 748 | ('size', ctypes.c_uint64), 749 | ('offset', ctypes.c_uint64), 750 | ] 751 | 752 | amd_comgr_code_object_info_t = struct_code_object_info_s 753 | try: 754 | amd_comgr_lookup_code_object = _libraries['libamd_comgr.so'].amd_comgr_lookup_code_object 755 | amd_comgr_lookup_code_object.restype = amd_comgr_status_t 756 | amd_comgr_lookup_code_object.argtypes = [amd_comgr_data_t, ctypes.POINTER(struct_code_object_info_s), size_t] 757 | except AttributeError: 758 | pass 759 | __all__ = \ 760 | ['AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES', 761 | 'AMD_COMGR_ACTION_ADD_PRECOMPILED_HEADERS', 762 | 'AMD_COMGR_ACTION_ASSEMBLE_SOURCE_TO_RELOCATABLE', 763 | 'AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY', 764 | 'AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE', 765 | 'AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC', 766 | 'AMD_COMGR_ACTION_COMPILE_SOURCE_TO_FATBIN', 767 | 'AMD_COMGR_ACTION_COMPILE_SOURCE_WITH_DEVICE_LIBS_TO_BC', 768 | 'AMD_COMGR_ACTION_DISASSEMBLE_BYTES_TO_SOURCE', 769 | 'AMD_COMGR_ACTION_DISASSEMBLE_EXECUTABLE_TO_SOURCE', 770 | 'AMD_COMGR_ACTION_DISASSEMBLE_RELOCATABLE_TO_SOURCE', 771 | 'AMD_COMGR_ACTION_LAST', 'AMD_COMGR_ACTION_LINK_BC_TO_BC', 772 | 'AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE', 773 | 'AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_RELOCATABLE', 774 | 'AMD_COMGR_ACTION_OPTIMIZE_BC_TO_BC', 775 | 'AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR', 776 | 'AMD_COMGR_DATA_KIND_AR', 'AMD_COMGR_DATA_KIND_AR_BUNDLE', 777 | 'AMD_COMGR_DATA_KIND_BC', 'AMD_COMGR_DATA_KIND_BC_BUNDLE', 778 | 'AMD_COMGR_DATA_KIND_BYTES', 'AMD_COMGR_DATA_KIND_DIAGNOSTIC', 779 | 'AMD_COMGR_DATA_KIND_EXECUTABLE', 'AMD_COMGR_DATA_KIND_FATBIN', 780 | 'AMD_COMGR_DATA_KIND_INCLUDE', 'AMD_COMGR_DATA_KIND_LAST', 781 | 'AMD_COMGR_DATA_KIND_LOG', 782 | 'AMD_COMGR_DATA_KIND_PRECOMPILED_HEADER', 783 | 'AMD_COMGR_DATA_KIND_RELOCATABLE', 'AMD_COMGR_DATA_KIND_SOURCE', 784 | 'AMD_COMGR_DATA_KIND_UNDEF', 'AMD_COMGR_LANGUAGE_HC', 785 | 'AMD_COMGR_LANGUAGE_HIP', 'AMD_COMGR_LANGUAGE_LAST', 786 | 'AMD_COMGR_LANGUAGE_NONE', 'AMD_COMGR_LANGUAGE_OPENCL_1_2', 787 | 'AMD_COMGR_LANGUAGE_OPENCL_2_0', 'AMD_COMGR_METADATA_KIND_LAST', 788 | 'AMD_COMGR_METADATA_KIND_LIST', 'AMD_COMGR_METADATA_KIND_MAP', 789 | 'AMD_COMGR_METADATA_KIND_NULL', 'AMD_COMGR_METADATA_KIND_STRING', 790 | 'AMD_COMGR_STATUS_ERROR', 791 | 'AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT', 792 | 'AMD_COMGR_STATUS_ERROR_OUT_OF_RESOURCES', 793 | 'AMD_COMGR_STATUS_SUCCESS', 'AMD_COMGR_SYMBOL_INFO_IS_UNDEFINED', 794 | 'AMD_COMGR_SYMBOL_INFO_LAST', 'AMD_COMGR_SYMBOL_INFO_NAME', 795 | 'AMD_COMGR_SYMBOL_INFO_NAME_LENGTH', 'AMD_COMGR_SYMBOL_INFO_SIZE', 796 | 'AMD_COMGR_SYMBOL_INFO_TYPE', 'AMD_COMGR_SYMBOL_INFO_VALUE', 797 | 'AMD_COMGR_SYMBOL_TYPE_AMDGPU_HSA_KERNEL', 798 | 'AMD_COMGR_SYMBOL_TYPE_COMMON', 'AMD_COMGR_SYMBOL_TYPE_FILE', 799 | 'AMD_COMGR_SYMBOL_TYPE_FUNC', 'AMD_COMGR_SYMBOL_TYPE_NOTYPE', 800 | 'AMD_COMGR_SYMBOL_TYPE_OBJECT', 'AMD_COMGR_SYMBOL_TYPE_SECTION', 801 | 'AMD_COMGR_SYMBOL_TYPE_UNKNOWN', 'amd_comgr_action_data_count', 802 | 'amd_comgr_action_data_get_data', 803 | 'amd_comgr_action_info_get_isa_name', 804 | 'amd_comgr_action_info_get_language', 805 | 'amd_comgr_action_info_get_logging', 806 | 'amd_comgr_action_info_get_option_list_count', 807 | 'amd_comgr_action_info_get_option_list_item', 808 | 'amd_comgr_action_info_get_options', 809 | 'amd_comgr_action_info_get_working_directory_path', 810 | 'amd_comgr_action_info_set_isa_name', 811 | 'amd_comgr_action_info_set_language', 812 | 'amd_comgr_action_info_set_logging', 813 | 'amd_comgr_action_info_set_option_list', 814 | 'amd_comgr_action_info_set_options', 815 | 'amd_comgr_action_info_set_working_directory_path', 816 | 'amd_comgr_action_info_t', 'amd_comgr_action_kind_s', 817 | 'amd_comgr_action_kind_t', 'amd_comgr_action_kind_t__enumvalues', 818 | 'amd_comgr_code_object_info_t', 'amd_comgr_create_action_info', 819 | 'amd_comgr_create_data', 'amd_comgr_create_data_set', 820 | 'amd_comgr_create_disassembly_info', 821 | 'amd_comgr_create_symbolizer_info', 'amd_comgr_data_kind_s', 822 | 'amd_comgr_data_kind_t', 'amd_comgr_data_kind_t__enumvalues', 823 | 'amd_comgr_data_set_add', 'amd_comgr_data_set_remove', 824 | 'amd_comgr_data_set_t', 'amd_comgr_data_t', 825 | 'amd_comgr_demangle_symbol_name', 'amd_comgr_destroy_action_info', 826 | 'amd_comgr_destroy_data_set', 827 | 'amd_comgr_destroy_disassembly_info', 828 | 'amd_comgr_destroy_metadata', 'amd_comgr_destroy_symbolizer_info', 829 | 'amd_comgr_disassemble_instruction', 830 | 'amd_comgr_disassembly_info_t', 'amd_comgr_do_action', 831 | 'amd_comgr_get_data', 'amd_comgr_get_data_isa_name', 832 | 'amd_comgr_get_data_kind', 'amd_comgr_get_data_metadata', 833 | 'amd_comgr_get_data_name', 'amd_comgr_get_isa_count', 834 | 'amd_comgr_get_isa_metadata', 'amd_comgr_get_isa_name', 835 | 'amd_comgr_get_mangled_name', 'amd_comgr_get_metadata_kind', 836 | 'amd_comgr_get_metadata_list_size', 837 | 'amd_comgr_get_metadata_map_size', 838 | 'amd_comgr_get_metadata_string', 'amd_comgr_get_version', 839 | 'amd_comgr_index_list_metadata', 'amd_comgr_iterate_map_metadata', 840 | 'amd_comgr_iterate_symbols', 'amd_comgr_language_s', 841 | 'amd_comgr_language_t', 'amd_comgr_language_t__enumvalues', 842 | 'amd_comgr_lookup_code_object', 843 | 'amd_comgr_map_name_expression_to_symbol_name', 844 | 'amd_comgr_metadata_kind_s', 'amd_comgr_metadata_kind_t', 845 | 'amd_comgr_metadata_kind_t__enumvalues', 846 | 'amd_comgr_metadata_lookup', 'amd_comgr_metadata_node_t', 847 | 'amd_comgr_populate_mangled_names', 848 | 'amd_comgr_populate_name_expression_map', 849 | 'amd_comgr_release_data', 'amd_comgr_set_data', 850 | 'amd_comgr_set_data_from_file_slice', 'amd_comgr_set_data_name', 851 | 'amd_comgr_status_s', 'amd_comgr_status_string', 852 | 'amd_comgr_status_t', 'amd_comgr_status_t__enumvalues', 853 | 'amd_comgr_symbol_get_info', 'amd_comgr_symbol_info_s', 854 | 'amd_comgr_symbol_info_t', 'amd_comgr_symbol_info_t__enumvalues', 855 | 'amd_comgr_symbol_lookup', 'amd_comgr_symbol_t', 856 | 'amd_comgr_symbol_type_s', 'amd_comgr_symbol_type_t', 857 | 'amd_comgr_symbol_type_t__enumvalues', 'amd_comgr_symbolize', 858 | 'amd_comgr_symbolizer_info_t', 'size_t', 859 | 'struct_amd_comgr_action_info_s', 'struct_amd_comgr_data_s', 860 | 'struct_amd_comgr_data_set_s', 861 | 'struct_amd_comgr_disassembly_info_s', 862 | 'struct_amd_comgr_metadata_node_s', 'struct_amd_comgr_symbol_s', 863 | 'struct_amd_comgr_symbolizer_info_s', 'struct_code_object_info_s', 864 | 'uint64_t'] 865 | -------------------------------------------------------------------------------- /gpuctypes/opencl.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # TARGET arch is: [] 4 | # WORD_SIZE is: 8 5 | # POINTER_SIZE is: 8 6 | # LONGDOUBLE_SIZE is: 16 7 | # 8 | import ctypes, ctypes.util 9 | 10 | 11 | class AsDictMixin: 12 | @classmethod 13 | def as_dict(cls, self): 14 | result = {} 15 | if not isinstance(self, AsDictMixin): 16 | # not a structure, assume it's already a python object 17 | return self 18 | if not hasattr(cls, "_fields_"): 19 | return result 20 | # sys.version_info >= (3, 5) 21 | # for (field, *_) in cls._fields_: # noqa 22 | for field_tuple in cls._fields_: # noqa 23 | field = field_tuple[0] 24 | if field.startswith('PADDING_'): 25 | continue 26 | value = getattr(self, field) 27 | type_ = type(value) 28 | if hasattr(value, "_length_") and hasattr(value, "_type_"): 29 | # array 30 | if not hasattr(type_, "as_dict"): 31 | value = [v for v in value] 32 | else: 33 | type_ = type_._type_ 34 | value = [type_.as_dict(v) for v in value] 35 | elif hasattr(value, "contents") and hasattr(value, "_type_"): 36 | # pointer 37 | try: 38 | if not hasattr(type_, "as_dict"): 39 | value = value.contents 40 | else: 41 | type_ = type_._type_ 42 | value = type_.as_dict(value.contents) 43 | except ValueError: 44 | # nullptr 45 | value = None 46 | elif isinstance(value, AsDictMixin): 47 | # other structure 48 | value = type_.as_dict(value) 49 | result[field] = value 50 | return result 51 | 52 | 53 | class Structure(ctypes.Structure, AsDictMixin): 54 | 55 | def __init__(self, *args, **kwds): 56 | # We don't want to use positional arguments fill PADDING_* fields 57 | 58 | args = dict(zip(self.__class__._field_names_(), args)) 59 | args.update(kwds) 60 | super(Structure, self).__init__(**args) 61 | 62 | @classmethod 63 | def _field_names_(cls): 64 | if hasattr(cls, '_fields_'): 65 | return (f[0] for f in cls._fields_ if not f[0].startswith('PADDING')) 66 | else: 67 | return () 68 | 69 | @classmethod 70 | def get_type(cls, field): 71 | for f in cls._fields_: 72 | if f[0] == field: 73 | return f[1] 74 | return None 75 | 76 | @classmethod 77 | def bind(cls, bound_fields): 78 | fields = {} 79 | for name, type_ in cls._fields_: 80 | if hasattr(type_, "restype"): 81 | if name in bound_fields: 82 | if bound_fields[name] is None: 83 | fields[name] = type_() 84 | else: 85 | # use a closure to capture the callback from the loop scope 86 | fields[name] = ( 87 | type_((lambda callback: lambda *args: callback(*args))( 88 | bound_fields[name])) 89 | ) 90 | del bound_fields[name] 91 | else: 92 | # default callback implementation (does nothing) 93 | try: 94 | default_ = type_(0).restype().value 95 | except TypeError: 96 | default_ = None 97 | fields[name] = type_(( 98 | lambda default_: lambda *args: default_)(default_)) 99 | else: 100 | # not a callback function, use default initialization 101 | if name in bound_fields: 102 | fields[name] = bound_fields[name] 103 | del bound_fields[name] 104 | else: 105 | fields[name] = type_() 106 | if len(bound_fields) != 0: 107 | raise ValueError( 108 | "Cannot bind the following unknown callback(s) {}.{}".format( 109 | cls.__name__, bound_fields.keys() 110 | )) 111 | return cls(**fields) 112 | 113 | 114 | class Union(ctypes.Union, AsDictMixin): 115 | pass 116 | 117 | 118 | 119 | _libraries = {} 120 | _libraries['libOpenCL.so'] = ctypes.CDLL(ctypes.util.find_library('OpenCL')) 121 | c_int128 = ctypes.c_ubyte*16 122 | c_uint128 = c_int128 123 | void = None 124 | if ctypes.sizeof(ctypes.c_longdouble) == 16: 125 | c_long_double_t = ctypes.c_longdouble 126 | else: 127 | c_long_double_t = ctypes.c_ubyte*16 128 | 129 | def string_cast(char_pointer, encoding='utf-8', errors='strict'): 130 | value = ctypes.cast(char_pointer, ctypes.c_char_p).value 131 | if value is not None and encoding is not None: 132 | value = value.decode(encoding, errors=errors) 133 | return value 134 | 135 | 136 | def char_pointer_cast(string, encoding='utf-8'): 137 | if encoding is not None: 138 | try: 139 | string = string.encode(encoding) 140 | except AttributeError: 141 | # In Python3, bytes has no encode attribute 142 | pass 143 | string = ctypes.c_char_p(string) 144 | return ctypes.cast(string, ctypes.POINTER(ctypes.c_char)) 145 | 146 | 147 | 148 | 149 | 150 | __OPENCL_CL_H = True # macro 151 | CL_NAME_VERSION_MAX_NAME_SIZE = 64 # macro 152 | CL_SUCCESS = 0 # macro 153 | CL_DEVICE_NOT_FOUND = -1 # macro 154 | CL_DEVICE_NOT_AVAILABLE = -2 # macro 155 | CL_COMPILER_NOT_AVAILABLE = -3 # macro 156 | CL_MEM_OBJECT_ALLOCATION_FAILURE = -4 # macro 157 | CL_OUT_OF_RESOURCES = -5 # macro 158 | CL_OUT_OF_HOST_MEMORY = -6 # macro 159 | CL_PROFILING_INFO_NOT_AVAILABLE = -7 # macro 160 | CL_MEM_COPY_OVERLAP = -8 # macro 161 | CL_IMAGE_FORMAT_MISMATCH = -9 # macro 162 | CL_IMAGE_FORMAT_NOT_SUPPORTED = -10 # macro 163 | CL_BUILD_PROGRAM_FAILURE = -11 # macro 164 | CL_MAP_FAILURE = -12 # macro 165 | CL_MISALIGNED_SUB_BUFFER_OFFSET = -13 # macro 166 | CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST = -14 # macro 167 | CL_COMPILE_PROGRAM_FAILURE = -15 # macro 168 | CL_LINKER_NOT_AVAILABLE = -16 # macro 169 | CL_LINK_PROGRAM_FAILURE = -17 # macro 170 | CL_DEVICE_PARTITION_FAILED = -18 # macro 171 | CL_KERNEL_ARG_INFO_NOT_AVAILABLE = -19 # macro 172 | CL_INVALID_VALUE = -30 # macro 173 | CL_INVALID_DEVICE_TYPE = -31 # macro 174 | CL_INVALID_PLATFORM = -32 # macro 175 | CL_INVALID_DEVICE = -33 # macro 176 | CL_INVALID_CONTEXT = -34 # macro 177 | CL_INVALID_QUEUE_PROPERTIES = -35 # macro 178 | CL_INVALID_COMMAND_QUEUE = -36 # macro 179 | CL_INVALID_HOST_PTR = -37 # macro 180 | CL_INVALID_MEM_OBJECT = -38 # macro 181 | CL_INVALID_IMAGE_FORMAT_DESCRIPTOR = -39 # macro 182 | CL_INVALID_IMAGE_SIZE = -40 # macro 183 | CL_INVALID_SAMPLER = -41 # macro 184 | CL_INVALID_BINARY = -42 # macro 185 | CL_INVALID_BUILD_OPTIONS = -43 # macro 186 | CL_INVALID_PROGRAM = -44 # macro 187 | CL_INVALID_PROGRAM_EXECUTABLE = -45 # macro 188 | CL_INVALID_KERNEL_NAME = -46 # macro 189 | CL_INVALID_KERNEL_DEFINITION = -47 # macro 190 | CL_INVALID_KERNEL = -48 # macro 191 | CL_INVALID_ARG_INDEX = -49 # macro 192 | CL_INVALID_ARG_VALUE = -50 # macro 193 | CL_INVALID_ARG_SIZE = -51 # macro 194 | CL_INVALID_KERNEL_ARGS = -52 # macro 195 | CL_INVALID_WORK_DIMENSION = -53 # macro 196 | CL_INVALID_WORK_GROUP_SIZE = -54 # macro 197 | CL_INVALID_WORK_ITEM_SIZE = -55 # macro 198 | CL_INVALID_GLOBAL_OFFSET = -56 # macro 199 | CL_INVALID_EVENT_WAIT_LIST = -57 # macro 200 | CL_INVALID_EVENT = -58 # macro 201 | CL_INVALID_OPERATION = -59 # macro 202 | CL_INVALID_GL_OBJECT = -60 # macro 203 | CL_INVALID_BUFFER_SIZE = -61 # macro 204 | CL_INVALID_MIP_LEVEL = -62 # macro 205 | CL_INVALID_GLOBAL_WORK_SIZE = -63 # macro 206 | CL_INVALID_PROPERTY = -64 # macro 207 | CL_INVALID_IMAGE_DESCRIPTOR = -65 # macro 208 | CL_INVALID_COMPILER_OPTIONS = -66 # macro 209 | CL_INVALID_LINKER_OPTIONS = -67 # macro 210 | CL_INVALID_DEVICE_PARTITION_COUNT = -68 # macro 211 | CL_INVALID_PIPE_SIZE = -69 # macro 212 | CL_INVALID_DEVICE_QUEUE = -70 # macro 213 | CL_INVALID_SPEC_ID = -71 # macro 214 | CL_MAX_SIZE_RESTRICTION_EXCEEDED = -72 # macro 215 | CL_FALSE = 0 # macro 216 | CL_TRUE = 1 # macro 217 | CL_BLOCKING = 1 # macro 218 | CL_NON_BLOCKING = 0 # macro 219 | CL_PLATFORM_PROFILE = 0x0900 # macro 220 | CL_PLATFORM_VERSION = 0x0901 # macro 221 | CL_PLATFORM_NAME = 0x0902 # macro 222 | CL_PLATFORM_VENDOR = 0x0903 # macro 223 | CL_PLATFORM_EXTENSIONS = 0x0904 # macro 224 | CL_PLATFORM_HOST_TIMER_RESOLUTION = 0x0905 # macro 225 | CL_PLATFORM_NUMERIC_VERSION = 0x0906 # macro 226 | CL_PLATFORM_EXTENSIONS_WITH_VERSION = 0x0907 # macro 227 | CL_DEVICE_TYPE_DEFAULT = (1<<0) # macro 228 | CL_DEVICE_TYPE_CPU = (1<<1) # macro 229 | CL_DEVICE_TYPE_GPU = (1<<2) # macro 230 | CL_DEVICE_TYPE_ACCELERATOR = (1<<3) # macro 231 | CL_DEVICE_TYPE_CUSTOM = (1<<4) # macro 232 | CL_DEVICE_TYPE_ALL = 0xFFFFFFFF # macro 233 | CL_DEVICE_TYPE = 0x1000 # macro 234 | CL_DEVICE_VENDOR_ID = 0x1001 # macro 235 | CL_DEVICE_MAX_COMPUTE_UNITS = 0x1002 # macro 236 | CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = 0x1003 # macro 237 | CL_DEVICE_MAX_WORK_GROUP_SIZE = 0x1004 # macro 238 | CL_DEVICE_MAX_WORK_ITEM_SIZES = 0x1005 # macro 239 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = 0x1006 # macro 240 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = 0x1007 # macro 241 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT = 0x1008 # macro 242 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG = 0x1009 # macro 243 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = 0x100A # macro 244 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = 0x100B # macro 245 | CL_DEVICE_MAX_CLOCK_FREQUENCY = 0x100C # macro 246 | CL_DEVICE_ADDRESS_BITS = 0x100D # macro 247 | CL_DEVICE_MAX_READ_IMAGE_ARGS = 0x100E # macro 248 | CL_DEVICE_MAX_WRITE_IMAGE_ARGS = 0x100F # macro 249 | CL_DEVICE_MAX_MEM_ALLOC_SIZE = 0x1010 # macro 250 | CL_DEVICE_IMAGE2D_MAX_WIDTH = 0x1011 # macro 251 | CL_DEVICE_IMAGE2D_MAX_HEIGHT = 0x1012 # macro 252 | CL_DEVICE_IMAGE3D_MAX_WIDTH = 0x1013 # macro 253 | CL_DEVICE_IMAGE3D_MAX_HEIGHT = 0x1014 # macro 254 | CL_DEVICE_IMAGE3D_MAX_DEPTH = 0x1015 # macro 255 | CL_DEVICE_IMAGE_SUPPORT = 0x1016 # macro 256 | CL_DEVICE_MAX_PARAMETER_SIZE = 0x1017 # macro 257 | CL_DEVICE_MAX_SAMPLERS = 0x1018 # macro 258 | CL_DEVICE_MEM_BASE_ADDR_ALIGN = 0x1019 # macro 259 | CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = 0x101A # macro 260 | CL_DEVICE_SINGLE_FP_CONFIG = 0x101B # macro 261 | CL_DEVICE_GLOBAL_MEM_CACHE_TYPE = 0x101C # macro 262 | CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE = 0x101D # macro 263 | CL_DEVICE_GLOBAL_MEM_CACHE_SIZE = 0x101E # macro 264 | CL_DEVICE_GLOBAL_MEM_SIZE = 0x101F # macro 265 | CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = 0x1020 # macro 266 | CL_DEVICE_MAX_CONSTANT_ARGS = 0x1021 # macro 267 | CL_DEVICE_LOCAL_MEM_TYPE = 0x1022 # macro 268 | CL_DEVICE_LOCAL_MEM_SIZE = 0x1023 # macro 269 | CL_DEVICE_ERROR_CORRECTION_SUPPORT = 0x1024 # macro 270 | CL_DEVICE_PROFILING_TIMER_RESOLUTION = 0x1025 # macro 271 | CL_DEVICE_ENDIAN_LITTLE = 0x1026 # macro 272 | CL_DEVICE_AVAILABLE = 0x1027 # macro 273 | CL_DEVICE_COMPILER_AVAILABLE = 0x1028 # macro 274 | CL_DEVICE_EXECUTION_CAPABILITIES = 0x1029 # macro 275 | CL_DEVICE_QUEUE_PROPERTIES = 0x102A # macro 276 | CL_DEVICE_QUEUE_ON_HOST_PROPERTIES = 0x102A # macro 277 | CL_DEVICE_NAME = 0x102B # macro 278 | CL_DEVICE_VENDOR = 0x102C # macro 279 | CL_DRIVER_VERSION = 0x102D # macro 280 | CL_DEVICE_PROFILE = 0x102E # macro 281 | CL_DEVICE_VERSION = 0x102F # macro 282 | CL_DEVICE_EXTENSIONS = 0x1030 # macro 283 | CL_DEVICE_PLATFORM = 0x1031 # macro 284 | CL_DEVICE_DOUBLE_FP_CONFIG = 0x1032 # macro 285 | CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF = 0x1034 # macro 286 | CL_DEVICE_HOST_UNIFIED_MEMORY = 0x1035 # macro 287 | CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 0x1036 # macro 288 | CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 0x1037 # macro 289 | CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 0x1038 # macro 290 | CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 0x1039 # macro 291 | CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 0x103A # macro 292 | CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 0x103B # macro 293 | CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0x103C # macro 294 | CL_DEVICE_OPENCL_C_VERSION = 0x103D # macro 295 | CL_DEVICE_LINKER_AVAILABLE = 0x103E # macro 296 | CL_DEVICE_BUILT_IN_KERNELS = 0x103F # macro 297 | CL_DEVICE_IMAGE_MAX_BUFFER_SIZE = 0x1040 # macro 298 | CL_DEVICE_IMAGE_MAX_ARRAY_SIZE = 0x1041 # macro 299 | CL_DEVICE_PARENT_DEVICE = 0x1042 # macro 300 | CL_DEVICE_PARTITION_MAX_SUB_DEVICES = 0x1043 # macro 301 | CL_DEVICE_PARTITION_PROPERTIES = 0x1044 # macro 302 | CL_DEVICE_PARTITION_AFFINITY_DOMAIN = 0x1045 # macro 303 | CL_DEVICE_PARTITION_TYPE = 0x1046 # macro 304 | CL_DEVICE_REFERENCE_COUNT = 0x1047 # macro 305 | CL_DEVICE_PREFERRED_INTEROP_USER_SYNC = 0x1048 # macro 306 | CL_DEVICE_PRINTF_BUFFER_SIZE = 0x1049 # macro 307 | CL_DEVICE_IMAGE_PITCH_ALIGNMENT = 0x104A # macro 308 | CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT = 0x104B # macro 309 | CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS = 0x104C # macro 310 | CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE = 0x104D # macro 311 | CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES = 0x104E # macro 312 | CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE = 0x104F # macro 313 | CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE = 0x1050 # macro 314 | CL_DEVICE_MAX_ON_DEVICE_QUEUES = 0x1051 # macro 315 | CL_DEVICE_MAX_ON_DEVICE_EVENTS = 0x1052 # macro 316 | CL_DEVICE_SVM_CAPABILITIES = 0x1053 # macro 317 | CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE = 0x1054 # macro 318 | CL_DEVICE_MAX_PIPE_ARGS = 0x1055 # macro 319 | CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS = 0x1056 # macro 320 | CL_DEVICE_PIPE_MAX_PACKET_SIZE = 0x1057 # macro 321 | CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT = 0x1058 # macro 322 | CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT = 0x1059 # macro 323 | CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT = 0x105A # macro 324 | CL_DEVICE_IL_VERSION = 0x105B # macro 325 | CL_DEVICE_MAX_NUM_SUB_GROUPS = 0x105C # macro 326 | CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS = 0x105D # macro 327 | CL_DEVICE_NUMERIC_VERSION = 0x105E # macro 328 | CL_DEVICE_EXTENSIONS_WITH_VERSION = 0x1060 # macro 329 | CL_DEVICE_ILS_WITH_VERSION = 0x1061 # macro 330 | CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION = 0x1062 # macro 331 | CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES = 0x1063 # macro 332 | CL_DEVICE_ATOMIC_FENCE_CAPABILITIES = 0x1064 # macro 333 | CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT = 0x1065 # macro 334 | CL_DEVICE_OPENCL_C_ALL_VERSIONS = 0x1066 # macro 335 | CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x1067 # macro 336 | CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT = 0x1068 # macro 337 | CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT = 0x1069 # macro 338 | CL_DEVICE_OPENCL_C_FEATURES = 0x106F # macro 339 | CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES = 0x1070 # macro 340 | CL_DEVICE_PIPE_SUPPORT = 0x1071 # macro 341 | CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED = 0x1072 # macro 342 | CL_FP_DENORM = (1<<0) # macro 343 | CL_FP_INF_NAN = (1<<1) # macro 344 | CL_FP_ROUND_TO_NEAREST = (1<<2) # macro 345 | CL_FP_ROUND_TO_ZERO = (1<<3) # macro 346 | CL_FP_ROUND_TO_INF = (1<<4) # macro 347 | CL_FP_FMA = (1<<5) # macro 348 | CL_FP_SOFT_FLOAT = (1<<6) # macro 349 | CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT = (1<<7) # macro 350 | CL_NONE = 0x0 # macro 351 | CL_READ_ONLY_CACHE = 0x1 # macro 352 | CL_READ_WRITE_CACHE = 0x2 # macro 353 | CL_LOCAL = 0x1 # macro 354 | CL_GLOBAL = 0x2 # macro 355 | CL_EXEC_KERNEL = (1<<0) # macro 356 | CL_EXEC_NATIVE_KERNEL = (1<<1) # macro 357 | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = (1<<0) # macro 358 | CL_QUEUE_PROFILING_ENABLE = (1<<1) # macro 359 | CL_QUEUE_ON_DEVICE = (1<<2) # macro 360 | CL_QUEUE_ON_DEVICE_DEFAULT = (1<<3) # macro 361 | CL_CONTEXT_REFERENCE_COUNT = 0x1080 # macro 362 | CL_CONTEXT_DEVICES = 0x1081 # macro 363 | CL_CONTEXT_PROPERTIES = 0x1082 # macro 364 | CL_CONTEXT_NUM_DEVICES = 0x1083 # macro 365 | CL_CONTEXT_PLATFORM = 0x1084 # macro 366 | CL_CONTEXT_INTEROP_USER_SYNC = 0x1085 # macro 367 | CL_DEVICE_PARTITION_EQUALLY = 0x1086 # macro 368 | CL_DEVICE_PARTITION_BY_COUNTS = 0x1087 # macro 369 | CL_DEVICE_PARTITION_BY_COUNTS_LIST_END = 0x0 # macro 370 | CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN = 0x1088 # macro 371 | CL_DEVICE_AFFINITY_DOMAIN_NUMA = (1<<0) # macro 372 | CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE = (1<<1) # macro 373 | CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE = (1<<2) # macro 374 | CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE = (1<<3) # macro 375 | CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE = (1<<4) # macro 376 | CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE = (1<<5) # macro 377 | CL_DEVICE_SVM_COARSE_GRAIN_BUFFER = (1<<0) # macro 378 | CL_DEVICE_SVM_FINE_GRAIN_BUFFER = (1<<1) # macro 379 | CL_DEVICE_SVM_FINE_GRAIN_SYSTEM = (1<<2) # macro 380 | CL_DEVICE_SVM_ATOMICS = (1<<3) # macro 381 | CL_QUEUE_CONTEXT = 0x1090 # macro 382 | CL_QUEUE_DEVICE = 0x1091 # macro 383 | CL_QUEUE_REFERENCE_COUNT = 0x1092 # macro 384 | CL_QUEUE_PROPERTIES = 0x1093 # macro 385 | CL_QUEUE_SIZE = 0x1094 # macro 386 | CL_QUEUE_DEVICE_DEFAULT = 0x1095 # macro 387 | CL_QUEUE_PROPERTIES_ARRAY = 0x1098 # macro 388 | CL_MEM_READ_WRITE = (1<<0) # macro 389 | CL_MEM_WRITE_ONLY = (1<<1) # macro 390 | CL_MEM_READ_ONLY = (1<<2) # macro 391 | CL_MEM_USE_HOST_PTR = (1<<3) # macro 392 | CL_MEM_ALLOC_HOST_PTR = (1<<4) # macro 393 | CL_MEM_COPY_HOST_PTR = (1<<5) # macro 394 | CL_MEM_HOST_WRITE_ONLY = (1<<7) # macro 395 | CL_MEM_HOST_READ_ONLY = (1<<8) # macro 396 | CL_MEM_HOST_NO_ACCESS = (1<<9) # macro 397 | CL_MEM_SVM_FINE_GRAIN_BUFFER = (1<<10) # macro 398 | CL_MEM_SVM_ATOMICS = (1<<11) # macro 399 | CL_MEM_KERNEL_READ_AND_WRITE = (1<<12) # macro 400 | CL_MIGRATE_MEM_OBJECT_HOST = (1<<0) # macro 401 | CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED = (1<<1) # macro 402 | CL_R = 0x10B0 # macro 403 | CL_A = 0x10B1 # macro 404 | CL_RG = 0x10B2 # macro 405 | CL_RA = 0x10B3 # macro 406 | CL_RGB = 0x10B4 # macro 407 | CL_RGBA = 0x10B5 # macro 408 | CL_BGRA = 0x10B6 # macro 409 | CL_ARGB = 0x10B7 # macro 410 | CL_INTENSITY = 0x10B8 # macro 411 | CL_LUMINANCE = 0x10B9 # macro 412 | CL_Rx = 0x10BA # macro 413 | CL_RGx = 0x10BB # macro 414 | CL_RGBx = 0x10BC # macro 415 | CL_DEPTH = 0x10BD # macro 416 | CL_DEPTH_STENCIL = 0x10BE # macro 417 | CL_sRGB = 0x10BF # macro 418 | CL_sRGBx = 0x10C0 # macro 419 | CL_sRGBA = 0x10C1 # macro 420 | CL_sBGRA = 0x10C2 # macro 421 | CL_ABGR = 0x10C3 # macro 422 | CL_SNORM_INT8 = 0x10D0 # macro 423 | CL_SNORM_INT16 = 0x10D1 # macro 424 | CL_UNORM_INT8 = 0x10D2 # macro 425 | CL_UNORM_INT16 = 0x10D3 # macro 426 | CL_UNORM_SHORT_565 = 0x10D4 # macro 427 | CL_UNORM_SHORT_555 = 0x10D5 # macro 428 | CL_UNORM_INT_101010 = 0x10D6 # macro 429 | CL_SIGNED_INT8 = 0x10D7 # macro 430 | CL_SIGNED_INT16 = 0x10D8 # macro 431 | CL_SIGNED_INT32 = 0x10D9 # macro 432 | CL_UNSIGNED_INT8 = 0x10DA # macro 433 | CL_UNSIGNED_INT16 = 0x10DB # macro 434 | CL_UNSIGNED_INT32 = 0x10DC # macro 435 | CL_HALF_FLOAT = 0x10DD # macro 436 | CL_FLOAT = 0x10DE # macro 437 | CL_UNORM_INT24 = 0x10DF # macro 438 | CL_UNORM_INT_101010_2 = 0x10E0 # macro 439 | CL_MEM_OBJECT_BUFFER = 0x10F0 # macro 440 | CL_MEM_OBJECT_IMAGE2D = 0x10F1 # macro 441 | CL_MEM_OBJECT_IMAGE3D = 0x10F2 # macro 442 | CL_MEM_OBJECT_IMAGE2D_ARRAY = 0x10F3 # macro 443 | CL_MEM_OBJECT_IMAGE1D = 0x10F4 # macro 444 | CL_MEM_OBJECT_IMAGE1D_ARRAY = 0x10F5 # macro 445 | CL_MEM_OBJECT_IMAGE1D_BUFFER = 0x10F6 # macro 446 | CL_MEM_OBJECT_PIPE = 0x10F7 # macro 447 | CL_MEM_TYPE = 0x1100 # macro 448 | CL_MEM_FLAGS = 0x1101 # macro 449 | CL_MEM_SIZE = 0x1102 # macro 450 | CL_MEM_HOST_PTR = 0x1103 # macro 451 | CL_MEM_MAP_COUNT = 0x1104 # macro 452 | CL_MEM_REFERENCE_COUNT = 0x1105 # macro 453 | CL_MEM_CONTEXT = 0x1106 # macro 454 | CL_MEM_ASSOCIATED_MEMOBJECT = 0x1107 # macro 455 | CL_MEM_OFFSET = 0x1108 # macro 456 | CL_MEM_USES_SVM_POINTER = 0x1109 # macro 457 | CL_MEM_PROPERTIES = 0x110A # macro 458 | CL_IMAGE_FORMAT = 0x1110 # macro 459 | CL_IMAGE_ELEMENT_SIZE = 0x1111 # macro 460 | CL_IMAGE_ROW_PITCH = 0x1112 # macro 461 | CL_IMAGE_SLICE_PITCH = 0x1113 # macro 462 | CL_IMAGE_WIDTH = 0x1114 # macro 463 | CL_IMAGE_HEIGHT = 0x1115 # macro 464 | CL_IMAGE_DEPTH = 0x1116 # macro 465 | CL_IMAGE_ARRAY_SIZE = 0x1117 # macro 466 | CL_IMAGE_BUFFER = 0x1118 # macro 467 | CL_IMAGE_NUM_MIP_LEVELS = 0x1119 # macro 468 | CL_IMAGE_NUM_SAMPLES = 0x111A # macro 469 | CL_PIPE_PACKET_SIZE = 0x1120 # macro 470 | CL_PIPE_MAX_PACKETS = 0x1121 # macro 471 | CL_PIPE_PROPERTIES = 0x1122 # macro 472 | CL_ADDRESS_NONE = 0x1130 # macro 473 | CL_ADDRESS_CLAMP_TO_EDGE = 0x1131 # macro 474 | CL_ADDRESS_CLAMP = 0x1132 # macro 475 | CL_ADDRESS_REPEAT = 0x1133 # macro 476 | CL_ADDRESS_MIRRORED_REPEAT = 0x1134 # macro 477 | CL_FILTER_NEAREST = 0x1140 # macro 478 | CL_FILTER_LINEAR = 0x1141 # macro 479 | CL_SAMPLER_REFERENCE_COUNT = 0x1150 # macro 480 | CL_SAMPLER_CONTEXT = 0x1151 # macro 481 | CL_SAMPLER_NORMALIZED_COORDS = 0x1152 # macro 482 | CL_SAMPLER_ADDRESSING_MODE = 0x1153 # macro 483 | CL_SAMPLER_FILTER_MODE = 0x1154 # macro 484 | CL_SAMPLER_MIP_FILTER_MODE = 0x1155 # macro 485 | CL_SAMPLER_LOD_MIN = 0x1156 # macro 486 | CL_SAMPLER_LOD_MAX = 0x1157 # macro 487 | CL_SAMPLER_PROPERTIES = 0x1158 # macro 488 | CL_MAP_READ = (1<<0) # macro 489 | CL_MAP_WRITE = (1<<1) # macro 490 | CL_MAP_WRITE_INVALIDATE_REGION = (1<<2) # macro 491 | CL_PROGRAM_REFERENCE_COUNT = 0x1160 # macro 492 | CL_PROGRAM_CONTEXT = 0x1161 # macro 493 | CL_PROGRAM_NUM_DEVICES = 0x1162 # macro 494 | CL_PROGRAM_DEVICES = 0x1163 # macro 495 | CL_PROGRAM_SOURCE = 0x1164 # macro 496 | CL_PROGRAM_BINARY_SIZES = 0x1165 # macro 497 | CL_PROGRAM_BINARIES = 0x1166 # macro 498 | CL_PROGRAM_NUM_KERNELS = 0x1167 # macro 499 | CL_PROGRAM_KERNEL_NAMES = 0x1168 # macro 500 | CL_PROGRAM_IL = 0x1169 # macro 501 | CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT = 0x116A # macro 502 | CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT = 0x116B # macro 503 | CL_PROGRAM_BUILD_STATUS = 0x1181 # macro 504 | CL_PROGRAM_BUILD_OPTIONS = 0x1182 # macro 505 | CL_PROGRAM_BUILD_LOG = 0x1183 # macro 506 | CL_PROGRAM_BINARY_TYPE = 0x1184 # macro 507 | CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE = 0x1185 # macro 508 | CL_PROGRAM_BINARY_TYPE_NONE = 0x0 # macro 509 | CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT = 0x1 # macro 510 | CL_PROGRAM_BINARY_TYPE_LIBRARY = 0x2 # macro 511 | CL_PROGRAM_BINARY_TYPE_EXECUTABLE = 0x4 # macro 512 | CL_BUILD_SUCCESS = 0 # macro 513 | CL_BUILD_NONE = -1 # macro 514 | CL_BUILD_ERROR = -2 # macro 515 | CL_BUILD_IN_PROGRESS = -3 # macro 516 | CL_KERNEL_FUNCTION_NAME = 0x1190 # macro 517 | CL_KERNEL_NUM_ARGS = 0x1191 # macro 518 | CL_KERNEL_REFERENCE_COUNT = 0x1192 # macro 519 | CL_KERNEL_CONTEXT = 0x1193 # macro 520 | CL_KERNEL_PROGRAM = 0x1194 # macro 521 | CL_KERNEL_ATTRIBUTES = 0x1195 # macro 522 | CL_KERNEL_ARG_ADDRESS_QUALIFIER = 0x1196 # macro 523 | CL_KERNEL_ARG_ACCESS_QUALIFIER = 0x1197 # macro 524 | CL_KERNEL_ARG_TYPE_NAME = 0x1198 # macro 525 | CL_KERNEL_ARG_TYPE_QUALIFIER = 0x1199 # macro 526 | CL_KERNEL_ARG_NAME = 0x119A # macro 527 | CL_KERNEL_ARG_ADDRESS_GLOBAL = 0x119B # macro 528 | CL_KERNEL_ARG_ADDRESS_LOCAL = 0x119C # macro 529 | CL_KERNEL_ARG_ADDRESS_CONSTANT = 0x119D # macro 530 | CL_KERNEL_ARG_ADDRESS_PRIVATE = 0x119E # macro 531 | CL_KERNEL_ARG_ACCESS_READ_ONLY = 0x11A0 # macro 532 | CL_KERNEL_ARG_ACCESS_WRITE_ONLY = 0x11A1 # macro 533 | CL_KERNEL_ARG_ACCESS_READ_WRITE = 0x11A2 # macro 534 | CL_KERNEL_ARG_ACCESS_NONE = 0x11A3 # macro 535 | CL_KERNEL_ARG_TYPE_NONE = 0 # macro 536 | CL_KERNEL_ARG_TYPE_CONST = (1<<0) # macro 537 | CL_KERNEL_ARG_TYPE_RESTRICT = (1<<1) # macro 538 | CL_KERNEL_ARG_TYPE_VOLATILE = (1<<2) # macro 539 | CL_KERNEL_ARG_TYPE_PIPE = (1<<3) # macro 540 | CL_KERNEL_WORK_GROUP_SIZE = 0x11B0 # macro 541 | CL_KERNEL_COMPILE_WORK_GROUP_SIZE = 0x11B1 # macro 542 | CL_KERNEL_LOCAL_MEM_SIZE = 0x11B2 # macro 543 | CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x11B3 # macro 544 | CL_KERNEL_PRIVATE_MEM_SIZE = 0x11B4 # macro 545 | CL_KERNEL_GLOBAL_WORK_SIZE = 0x11B5 # macro 546 | CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE = 0x2033 # macro 547 | CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE = 0x2034 # macro 548 | CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT = 0x11B8 # macro 549 | CL_KERNEL_MAX_NUM_SUB_GROUPS = 0x11B9 # macro 550 | CL_KERNEL_COMPILE_NUM_SUB_GROUPS = 0x11BA # macro 551 | CL_KERNEL_EXEC_INFO_SVM_PTRS = 0x11B6 # macro 552 | CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM = 0x11B7 # macro 553 | CL_EVENT_COMMAND_QUEUE = 0x11D0 # macro 554 | CL_EVENT_COMMAND_TYPE = 0x11D1 # macro 555 | CL_EVENT_REFERENCE_COUNT = 0x11D2 # macro 556 | CL_EVENT_COMMAND_EXECUTION_STATUS = 0x11D3 # macro 557 | CL_EVENT_CONTEXT = 0x11D4 # macro 558 | CL_COMMAND_NDRANGE_KERNEL = 0x11F0 # macro 559 | CL_COMMAND_TASK = 0x11F1 # macro 560 | CL_COMMAND_NATIVE_KERNEL = 0x11F2 # macro 561 | CL_COMMAND_READ_BUFFER = 0x11F3 # macro 562 | CL_COMMAND_WRITE_BUFFER = 0x11F4 # macro 563 | CL_COMMAND_COPY_BUFFER = 0x11F5 # macro 564 | CL_COMMAND_READ_IMAGE = 0x11F6 # macro 565 | CL_COMMAND_WRITE_IMAGE = 0x11F7 # macro 566 | CL_COMMAND_COPY_IMAGE = 0x11F8 # macro 567 | CL_COMMAND_COPY_IMAGE_TO_BUFFER = 0x11F9 # macro 568 | CL_COMMAND_COPY_BUFFER_TO_IMAGE = 0x11FA # macro 569 | CL_COMMAND_MAP_BUFFER = 0x11FB # macro 570 | CL_COMMAND_MAP_IMAGE = 0x11FC # macro 571 | CL_COMMAND_UNMAP_MEM_OBJECT = 0x11FD # macro 572 | CL_COMMAND_MARKER = 0x11FE # macro 573 | CL_COMMAND_ACQUIRE_GL_OBJECTS = 0x11FF # macro 574 | CL_COMMAND_RELEASE_GL_OBJECTS = 0x1200 # macro 575 | CL_COMMAND_READ_BUFFER_RECT = 0x1201 # macro 576 | CL_COMMAND_WRITE_BUFFER_RECT = 0x1202 # macro 577 | CL_COMMAND_COPY_BUFFER_RECT = 0x1203 # macro 578 | CL_COMMAND_USER = 0x1204 # macro 579 | CL_COMMAND_BARRIER = 0x1205 # macro 580 | CL_COMMAND_MIGRATE_MEM_OBJECTS = 0x1206 # macro 581 | CL_COMMAND_FILL_BUFFER = 0x1207 # macro 582 | CL_COMMAND_FILL_IMAGE = 0x1208 # macro 583 | CL_COMMAND_SVM_FREE = 0x1209 # macro 584 | CL_COMMAND_SVM_MEMCPY = 0x120A # macro 585 | CL_COMMAND_SVM_MEMFILL = 0x120B # macro 586 | CL_COMMAND_SVM_MAP = 0x120C # macro 587 | CL_COMMAND_SVM_UNMAP = 0x120D # macro 588 | CL_COMMAND_SVM_MIGRATE_MEM = 0x120E # macro 589 | CL_COMPLETE = 0x0 # macro 590 | CL_RUNNING = 0x1 # macro 591 | CL_SUBMITTED = 0x2 # macro 592 | CL_QUEUED = 0x3 # macro 593 | CL_BUFFER_CREATE_TYPE_REGION = 0x1220 # macro 594 | CL_PROFILING_COMMAND_QUEUED = 0x1280 # macro 595 | CL_PROFILING_COMMAND_SUBMIT = 0x1281 # macro 596 | CL_PROFILING_COMMAND_START = 0x1282 # macro 597 | CL_PROFILING_COMMAND_END = 0x1283 # macro 598 | CL_PROFILING_COMMAND_COMPLETE = 0x1284 # macro 599 | CL_DEVICE_ATOMIC_ORDER_RELAXED = (1<<0) # macro 600 | CL_DEVICE_ATOMIC_ORDER_ACQ_REL = (1<<1) # macro 601 | CL_DEVICE_ATOMIC_ORDER_SEQ_CST = (1<<2) # macro 602 | CL_DEVICE_ATOMIC_SCOPE_WORK_ITEM = (1<<3) # macro 603 | CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP = (1<<4) # macro 604 | CL_DEVICE_ATOMIC_SCOPE_DEVICE = (1<<5) # macro 605 | CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES = (1<<6) # macro 606 | CL_DEVICE_QUEUE_SUPPORTED = (1<<0) # macro 607 | CL_DEVICE_QUEUE_REPLACEABLE_DEFAULT = (1<<1) # macro 608 | CL_KHRONOS_VENDOR_ID_CODEPLAY = 0x10004 # macro 609 | CL_VERSION_MAJOR_BITS = (10) # macro 610 | CL_VERSION_MINOR_BITS = (10) # macro 611 | CL_VERSION_PATCH_BITS = (12) # macro 612 | # CL_VERSION_MAJOR_MASK = ((1<<(10)) # macro 613 | # CL_VERSION_MINOR_MASK = ((1<<(10)) # macro 614 | # CL_VERSION_PATCH_MASK = ((1<<(12)) # macro 615 | # def CL_VERSION_MAJOR(version): # macro 616 | # return ((version)>>((10)+(12))) 617 | # def CL_VERSION_MINOR(version): # macro 618 | # return (((version)>>(12))&((1<<(10))) 619 | # def CL_VERSION_PATCH(version): # macro 620 | # return ((version)&((1<<(12))) 621 | # def CL_MAKE_VERSION(major, minor, patch): # macro 622 | # return ((((major)&((1<<(10)))<<((10)+(12)))|(((minor)&((1<<(10)))<<(12))|((patch)&((1<<(12)))) 623 | class struct__cl_platform_id(Structure): 624 | pass 625 | 626 | cl_platform_id = ctypes.POINTER(struct__cl_platform_id) 627 | class struct__cl_device_id(Structure): 628 | pass 629 | 630 | cl_device_id = ctypes.POINTER(struct__cl_device_id) 631 | class struct__cl_context(Structure): 632 | pass 633 | 634 | cl_context = ctypes.POINTER(struct__cl_context) 635 | class struct__cl_command_queue(Structure): 636 | pass 637 | 638 | cl_command_queue = ctypes.POINTER(struct__cl_command_queue) 639 | class struct__cl_mem(Structure): 640 | pass 641 | 642 | cl_mem = ctypes.POINTER(struct__cl_mem) 643 | class struct__cl_program(Structure): 644 | pass 645 | 646 | cl_program = ctypes.POINTER(struct__cl_program) 647 | class struct__cl_kernel(Structure): 648 | pass 649 | 650 | cl_kernel = ctypes.POINTER(struct__cl_kernel) 651 | class struct__cl_event(Structure): 652 | pass 653 | 654 | cl_event = ctypes.POINTER(struct__cl_event) 655 | class struct__cl_sampler(Structure): 656 | pass 657 | 658 | cl_sampler = ctypes.POINTER(struct__cl_sampler) 659 | cl_bool = ctypes.c_uint32 660 | cl_bitfield = ctypes.c_uint64 661 | cl_properties = ctypes.c_uint64 662 | cl_device_type = ctypes.c_uint64 663 | cl_platform_info = ctypes.c_uint32 664 | cl_device_info = ctypes.c_uint32 665 | cl_device_fp_config = ctypes.c_uint64 666 | cl_device_mem_cache_type = ctypes.c_uint32 667 | cl_device_local_mem_type = ctypes.c_uint32 668 | cl_device_exec_capabilities = ctypes.c_uint64 669 | cl_device_svm_capabilities = ctypes.c_uint64 670 | cl_command_queue_properties = ctypes.c_uint64 671 | cl_device_partition_property = ctypes.c_int64 672 | cl_device_affinity_domain = ctypes.c_uint64 673 | cl_context_properties = ctypes.c_int64 674 | cl_context_info = ctypes.c_uint32 675 | cl_queue_properties = ctypes.c_uint64 676 | cl_command_queue_info = ctypes.c_uint32 677 | cl_channel_order = ctypes.c_uint32 678 | cl_channel_type = ctypes.c_uint32 679 | cl_mem_flags = ctypes.c_uint64 680 | cl_svm_mem_flags = ctypes.c_uint64 681 | cl_mem_object_type = ctypes.c_uint32 682 | cl_mem_info = ctypes.c_uint32 683 | cl_mem_migration_flags = ctypes.c_uint64 684 | cl_image_info = ctypes.c_uint32 685 | cl_buffer_create_type = ctypes.c_uint32 686 | cl_addressing_mode = ctypes.c_uint32 687 | cl_filter_mode = ctypes.c_uint32 688 | cl_sampler_info = ctypes.c_uint32 689 | cl_map_flags = ctypes.c_uint64 690 | cl_pipe_properties = ctypes.c_int64 691 | cl_pipe_info = ctypes.c_uint32 692 | cl_program_info = ctypes.c_uint32 693 | cl_program_build_info = ctypes.c_uint32 694 | cl_program_binary_type = ctypes.c_uint32 695 | cl_build_status = ctypes.c_int32 696 | cl_kernel_info = ctypes.c_uint32 697 | cl_kernel_arg_info = ctypes.c_uint32 698 | cl_kernel_arg_address_qualifier = ctypes.c_uint32 699 | cl_kernel_arg_access_qualifier = ctypes.c_uint32 700 | cl_kernel_arg_type_qualifier = ctypes.c_uint64 701 | cl_kernel_work_group_info = ctypes.c_uint32 702 | cl_kernel_sub_group_info = ctypes.c_uint32 703 | cl_event_info = ctypes.c_uint32 704 | cl_command_type = ctypes.c_uint32 705 | cl_profiling_info = ctypes.c_uint32 706 | cl_sampler_properties = ctypes.c_uint64 707 | cl_kernel_exec_info = ctypes.c_uint32 708 | cl_device_atomic_capabilities = ctypes.c_uint64 709 | cl_device_device_enqueue_capabilities = ctypes.c_uint64 710 | cl_khronos_vendor_id = ctypes.c_uint32 711 | cl_mem_properties = ctypes.c_uint64 712 | cl_version = ctypes.c_uint32 713 | class struct__cl_image_format(Structure): 714 | pass 715 | 716 | struct__cl_image_format._pack_ = 1 # source:False 717 | struct__cl_image_format._fields_ = [ 718 | ('image_channel_order', ctypes.c_uint32), 719 | ('image_channel_data_type', ctypes.c_uint32), 720 | ] 721 | 722 | cl_image_format = struct__cl_image_format 723 | class struct__cl_image_desc(Structure): 724 | pass 725 | 726 | class union__cl_image_desc_0(Union): 727 | pass 728 | 729 | union__cl_image_desc_0._pack_ = 1 # source:False 730 | union__cl_image_desc_0._fields_ = [ 731 | ('buffer', ctypes.POINTER(struct__cl_mem)), 732 | ('mem_object', ctypes.POINTER(struct__cl_mem)), 733 | ] 734 | 735 | struct__cl_image_desc._pack_ = 1 # source:False 736 | struct__cl_image_desc._anonymous_ = ('_0',) 737 | struct__cl_image_desc._fields_ = [ 738 | ('image_type', ctypes.c_uint32), 739 | ('PADDING_0', ctypes.c_ubyte * 4), 740 | ('image_width', ctypes.c_uint64), 741 | ('image_height', ctypes.c_uint64), 742 | ('image_depth', ctypes.c_uint64), 743 | ('image_array_size', ctypes.c_uint64), 744 | ('image_row_pitch', ctypes.c_uint64), 745 | ('image_slice_pitch', ctypes.c_uint64), 746 | ('num_mip_levels', ctypes.c_uint32), 747 | ('num_samples', ctypes.c_uint32), 748 | ('_0', union__cl_image_desc_0), 749 | ] 750 | 751 | cl_image_desc = struct__cl_image_desc 752 | class struct__cl_buffer_region(Structure): 753 | pass 754 | 755 | struct__cl_buffer_region._pack_ = 1 # source:False 756 | struct__cl_buffer_region._fields_ = [ 757 | ('origin', ctypes.c_uint64), 758 | ('size', ctypes.c_uint64), 759 | ] 760 | 761 | cl_buffer_region = struct__cl_buffer_region 762 | class struct__cl_name_version(Structure): 763 | pass 764 | 765 | struct__cl_name_version._pack_ = 1 # source:False 766 | struct__cl_name_version._fields_ = [ 767 | ('version', ctypes.c_uint32), 768 | ('name', ctypes.c_char * 64), 769 | ] 770 | 771 | cl_name_version = struct__cl_name_version 772 | cl_int = ctypes.c_int32 773 | cl_uint = ctypes.c_uint32 774 | try: 775 | clGetPlatformIDs = _libraries['libOpenCL.so'].clGetPlatformIDs 776 | clGetPlatformIDs.restype = cl_int 777 | clGetPlatformIDs.argtypes = [cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_platform_id)), ctypes.POINTER(ctypes.c_uint32)] 778 | except AttributeError: 779 | pass 780 | size_t = ctypes.c_uint64 781 | try: 782 | clGetPlatformInfo = _libraries['libOpenCL.so'].clGetPlatformInfo 783 | clGetPlatformInfo.restype = cl_int 784 | clGetPlatformInfo.argtypes = [cl_platform_id, cl_platform_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 785 | except AttributeError: 786 | pass 787 | try: 788 | clGetDeviceIDs = _libraries['libOpenCL.so'].clGetDeviceIDs 789 | clGetDeviceIDs.restype = cl_int 790 | clGetDeviceIDs.argtypes = [cl_platform_id, cl_device_type, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_uint32)] 791 | except AttributeError: 792 | pass 793 | try: 794 | clGetDeviceInfo = _libraries['libOpenCL.so'].clGetDeviceInfo 795 | clGetDeviceInfo.restype = cl_int 796 | clGetDeviceInfo.argtypes = [cl_device_id, cl_device_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 797 | except AttributeError: 798 | pass 799 | try: 800 | clCreateSubDevices = _libraries['libOpenCL.so'].clCreateSubDevices 801 | clCreateSubDevices.restype = cl_int 802 | clCreateSubDevices.argtypes = [cl_device_id, ctypes.POINTER(ctypes.c_int64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_uint32)] 803 | except AttributeError: 804 | pass 805 | try: 806 | clRetainDevice = _libraries['libOpenCL.so'].clRetainDevice 807 | clRetainDevice.restype = cl_int 808 | clRetainDevice.argtypes = [cl_device_id] 809 | except AttributeError: 810 | pass 811 | try: 812 | clReleaseDevice = _libraries['libOpenCL.so'].clReleaseDevice 813 | clReleaseDevice.restype = cl_int 814 | clReleaseDevice.argtypes = [cl_device_id] 815 | except AttributeError: 816 | pass 817 | try: 818 | clSetDefaultDeviceCommandQueue = _libraries['libOpenCL.so'].clSetDefaultDeviceCommandQueue 819 | clSetDefaultDeviceCommandQueue.restype = cl_int 820 | clSetDefaultDeviceCommandQueue.argtypes = [cl_context, cl_device_id, cl_command_queue] 821 | except AttributeError: 822 | pass 823 | try: 824 | clGetDeviceAndHostTimer = _libraries['libOpenCL.so'].clGetDeviceAndHostTimer 825 | clGetDeviceAndHostTimer.restype = cl_int 826 | clGetDeviceAndHostTimer.argtypes = [cl_device_id, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] 827 | except AttributeError: 828 | pass 829 | try: 830 | clGetHostTimer = _libraries['libOpenCL.so'].clGetHostTimer 831 | clGetHostTimer.restype = cl_int 832 | clGetHostTimer.argtypes = [cl_device_id, ctypes.POINTER(ctypes.c_uint64)] 833 | except AttributeError: 834 | pass 835 | try: 836 | clCreateContext = _libraries['libOpenCL.so'].clCreateContext 837 | clCreateContext.restype = cl_context 838 | clCreateContext.argtypes = [ctypes.POINTER(ctypes.c_int64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.CFUNCTYPE(None, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(None), ctypes.c_uint64, ctypes.POINTER(None)), ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 839 | except AttributeError: 840 | pass 841 | try: 842 | clCreateContextFromType = _libraries['libOpenCL.so'].clCreateContextFromType 843 | clCreateContextFromType.restype = cl_context 844 | clCreateContextFromType.argtypes = [ctypes.POINTER(ctypes.c_int64), cl_device_type, ctypes.CFUNCTYPE(None, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(None), ctypes.c_uint64, ctypes.POINTER(None)), ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 845 | except AttributeError: 846 | pass 847 | try: 848 | clRetainContext = _libraries['libOpenCL.so'].clRetainContext 849 | clRetainContext.restype = cl_int 850 | clRetainContext.argtypes = [cl_context] 851 | except AttributeError: 852 | pass 853 | try: 854 | clReleaseContext = _libraries['libOpenCL.so'].clReleaseContext 855 | clReleaseContext.restype = cl_int 856 | clReleaseContext.argtypes = [cl_context] 857 | except AttributeError: 858 | pass 859 | try: 860 | clGetContextInfo = _libraries['libOpenCL.so'].clGetContextInfo 861 | clGetContextInfo.restype = cl_int 862 | clGetContextInfo.argtypes = [cl_context, cl_context_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 863 | except AttributeError: 864 | pass 865 | try: 866 | clSetContextDestructorCallback = _libraries['libOpenCL.so'].clSetContextDestructorCallback 867 | clSetContextDestructorCallback.restype = cl_int 868 | clSetContextDestructorCallback.argtypes = [cl_context, ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_context), ctypes.POINTER(None)), ctypes.POINTER(None)] 869 | except AttributeError: 870 | pass 871 | try: 872 | clCreateCommandQueueWithProperties = _libraries['libOpenCL.so'].clCreateCommandQueueWithProperties 873 | clCreateCommandQueueWithProperties.restype = cl_command_queue 874 | clCreateCommandQueueWithProperties.argtypes = [cl_context, cl_device_id, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_int32)] 875 | except AttributeError: 876 | pass 877 | try: 878 | clRetainCommandQueue = _libraries['libOpenCL.so'].clRetainCommandQueue 879 | clRetainCommandQueue.restype = cl_int 880 | clRetainCommandQueue.argtypes = [cl_command_queue] 881 | except AttributeError: 882 | pass 883 | try: 884 | clReleaseCommandQueue = _libraries['libOpenCL.so'].clReleaseCommandQueue 885 | clReleaseCommandQueue.restype = cl_int 886 | clReleaseCommandQueue.argtypes = [cl_command_queue] 887 | except AttributeError: 888 | pass 889 | try: 890 | clGetCommandQueueInfo = _libraries['libOpenCL.so'].clGetCommandQueueInfo 891 | clGetCommandQueueInfo.restype = cl_int 892 | clGetCommandQueueInfo.argtypes = [cl_command_queue, cl_command_queue_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 893 | except AttributeError: 894 | pass 895 | try: 896 | clCreateBuffer = _libraries['libOpenCL.so'].clCreateBuffer 897 | clCreateBuffer.restype = cl_mem 898 | clCreateBuffer.argtypes = [cl_context, cl_mem_flags, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 899 | except AttributeError: 900 | pass 901 | try: 902 | clCreateSubBuffer = _libraries['libOpenCL.so'].clCreateSubBuffer 903 | clCreateSubBuffer.restype = cl_mem 904 | clCreateSubBuffer.argtypes = [cl_mem, cl_mem_flags, cl_buffer_create_type, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 905 | except AttributeError: 906 | pass 907 | try: 908 | clCreateImage = _libraries['libOpenCL.so'].clCreateImage 909 | clCreateImage.restype = cl_mem 910 | clCreateImage.argtypes = [cl_context, cl_mem_flags, ctypes.POINTER(struct__cl_image_format), ctypes.POINTER(struct__cl_image_desc), ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 911 | except AttributeError: 912 | pass 913 | try: 914 | clCreatePipe = _libraries['libOpenCL.so'].clCreatePipe 915 | clCreatePipe.restype = cl_mem 916 | clCreatePipe.argtypes = [cl_context, cl_mem_flags, cl_uint, cl_uint, ctypes.POINTER(ctypes.c_int64), ctypes.POINTER(ctypes.c_int32)] 917 | except AttributeError: 918 | pass 919 | try: 920 | clCreateBufferWithProperties = _libraries['libOpenCL.so'].clCreateBufferWithProperties 921 | clCreateBufferWithProperties.restype = cl_mem 922 | clCreateBufferWithProperties.argtypes = [cl_context, ctypes.POINTER(ctypes.c_uint64), cl_mem_flags, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 923 | except AttributeError: 924 | pass 925 | try: 926 | clCreateImageWithProperties = _libraries['libOpenCL.so'].clCreateImageWithProperties 927 | clCreateImageWithProperties.restype = cl_mem 928 | clCreateImageWithProperties.argtypes = [cl_context, ctypes.POINTER(ctypes.c_uint64), cl_mem_flags, ctypes.POINTER(struct__cl_image_format), ctypes.POINTER(struct__cl_image_desc), ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 929 | except AttributeError: 930 | pass 931 | try: 932 | clRetainMemObject = _libraries['libOpenCL.so'].clRetainMemObject 933 | clRetainMemObject.restype = cl_int 934 | clRetainMemObject.argtypes = [cl_mem] 935 | except AttributeError: 936 | pass 937 | try: 938 | clReleaseMemObject = _libraries['libOpenCL.so'].clReleaseMemObject 939 | clReleaseMemObject.restype = cl_int 940 | clReleaseMemObject.argtypes = [cl_mem] 941 | except AttributeError: 942 | pass 943 | try: 944 | clGetSupportedImageFormats = _libraries['libOpenCL.so'].clGetSupportedImageFormats 945 | clGetSupportedImageFormats.restype = cl_int 946 | clGetSupportedImageFormats.argtypes = [cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, ctypes.POINTER(struct__cl_image_format), ctypes.POINTER(ctypes.c_uint32)] 947 | except AttributeError: 948 | pass 949 | try: 950 | clGetMemObjectInfo = _libraries['libOpenCL.so'].clGetMemObjectInfo 951 | clGetMemObjectInfo.restype = cl_int 952 | clGetMemObjectInfo.argtypes = [cl_mem, cl_mem_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 953 | except AttributeError: 954 | pass 955 | try: 956 | clGetImageInfo = _libraries['libOpenCL.so'].clGetImageInfo 957 | clGetImageInfo.restype = cl_int 958 | clGetImageInfo.argtypes = [cl_mem, cl_image_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 959 | except AttributeError: 960 | pass 961 | try: 962 | clGetPipeInfo = _libraries['libOpenCL.so'].clGetPipeInfo 963 | clGetPipeInfo.restype = cl_int 964 | clGetPipeInfo.argtypes = [cl_mem, cl_pipe_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 965 | except AttributeError: 966 | pass 967 | try: 968 | clSetMemObjectDestructorCallback = _libraries['libOpenCL.so'].clSetMemObjectDestructorCallback 969 | clSetMemObjectDestructorCallback.restype = cl_int 970 | clSetMemObjectDestructorCallback.argtypes = [cl_mem, ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_mem), ctypes.POINTER(None)), ctypes.POINTER(None)] 971 | except AttributeError: 972 | pass 973 | try: 974 | clSVMAlloc = _libraries['libOpenCL.so'].clSVMAlloc 975 | clSVMAlloc.restype = ctypes.POINTER(None) 976 | clSVMAlloc.argtypes = [cl_context, cl_svm_mem_flags, size_t, cl_uint] 977 | except AttributeError: 978 | pass 979 | try: 980 | clSVMFree = _libraries['libOpenCL.so'].clSVMFree 981 | clSVMFree.restype = None 982 | clSVMFree.argtypes = [cl_context, ctypes.POINTER(None)] 983 | except AttributeError: 984 | pass 985 | try: 986 | clCreateSamplerWithProperties = _libraries['libOpenCL.so'].clCreateSamplerWithProperties 987 | clCreateSamplerWithProperties.restype = cl_sampler 988 | clCreateSamplerWithProperties.argtypes = [cl_context, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_int32)] 989 | except AttributeError: 990 | pass 991 | try: 992 | clRetainSampler = _libraries['libOpenCL.so'].clRetainSampler 993 | clRetainSampler.restype = cl_int 994 | clRetainSampler.argtypes = [cl_sampler] 995 | except AttributeError: 996 | pass 997 | try: 998 | clReleaseSampler = _libraries['libOpenCL.so'].clReleaseSampler 999 | clReleaseSampler.restype = cl_int 1000 | clReleaseSampler.argtypes = [cl_sampler] 1001 | except AttributeError: 1002 | pass 1003 | try: 1004 | clGetSamplerInfo = _libraries['libOpenCL.so'].clGetSamplerInfo 1005 | clGetSamplerInfo.restype = cl_int 1006 | clGetSamplerInfo.argtypes = [cl_sampler, cl_sampler_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1007 | except AttributeError: 1008 | pass 1009 | try: 1010 | clCreateProgramWithSource = _libraries['libOpenCL.so'].clCreateProgramWithSource 1011 | clCreateProgramWithSource.restype = cl_program 1012 | clCreateProgramWithSource.argtypes = [cl_context, cl_uint, ctypes.POINTER(ctypes.POINTER(ctypes.c_char)), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_int32)] 1013 | except AttributeError: 1014 | pass 1015 | try: 1016 | clCreateProgramWithBinary = _libraries['libOpenCL.so'].clCreateProgramWithBinary 1017 | clCreateProgramWithBinary.restype = cl_program 1018 | clCreateProgramWithBinary.argtypes = [cl_context, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.POINTER(ctypes.c_ubyte)), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_int32)] 1019 | except AttributeError: 1020 | pass 1021 | try: 1022 | clCreateProgramWithBuiltInKernels = _libraries['libOpenCL.so'].clCreateProgramWithBuiltInKernels 1023 | clCreateProgramWithBuiltInKernels.restype = cl_program 1024 | clCreateProgramWithBuiltInKernels.argtypes = [cl_context, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_int32)] 1025 | except AttributeError: 1026 | pass 1027 | try: 1028 | clCreateProgramWithIL = _libraries['libOpenCL.so'].clCreateProgramWithIL 1029 | clCreateProgramWithIL.restype = cl_program 1030 | clCreateProgramWithIL.argtypes = [cl_context, ctypes.POINTER(None), size_t, ctypes.POINTER(ctypes.c_int32)] 1031 | except AttributeError: 1032 | pass 1033 | try: 1034 | clRetainProgram = _libraries['libOpenCL.so'].clRetainProgram 1035 | clRetainProgram.restype = cl_int 1036 | clRetainProgram.argtypes = [cl_program] 1037 | except AttributeError: 1038 | pass 1039 | try: 1040 | clReleaseProgram = _libraries['libOpenCL.so'].clReleaseProgram 1041 | clReleaseProgram.restype = cl_int 1042 | clReleaseProgram.argtypes = [cl_program] 1043 | except AttributeError: 1044 | pass 1045 | try: 1046 | clBuildProgram = _libraries['libOpenCL.so'].clBuildProgram 1047 | clBuildProgram.restype = cl_int 1048 | clBuildProgram.argtypes = [cl_program, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_char), ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_program), ctypes.POINTER(None)), ctypes.POINTER(None)] 1049 | except AttributeError: 1050 | pass 1051 | try: 1052 | clCompileProgram = _libraries['libOpenCL.so'].clCompileProgram 1053 | clCompileProgram.restype = cl_int 1054 | clCompileProgram.argtypes = [cl_program, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_char), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_program)), ctypes.POINTER(ctypes.POINTER(ctypes.c_char)), ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_program), ctypes.POINTER(None)), ctypes.POINTER(None)] 1055 | except AttributeError: 1056 | pass 1057 | try: 1058 | clLinkProgram = _libraries['libOpenCL.so'].clLinkProgram 1059 | clLinkProgram.restype = cl_program 1060 | clLinkProgram.argtypes = [cl_context, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_device_id)), ctypes.POINTER(ctypes.c_char), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_program)), ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_program), ctypes.POINTER(None)), ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 1061 | except AttributeError: 1062 | pass 1063 | try: 1064 | clSetProgramReleaseCallback = _libraries['libOpenCL.so'].clSetProgramReleaseCallback 1065 | clSetProgramReleaseCallback.restype = cl_int 1066 | clSetProgramReleaseCallback.argtypes = [cl_program, ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_program), ctypes.POINTER(None)), ctypes.POINTER(None)] 1067 | except AttributeError: 1068 | pass 1069 | try: 1070 | clSetProgramSpecializationConstant = _libraries['libOpenCL.so'].clSetProgramSpecializationConstant 1071 | clSetProgramSpecializationConstant.restype = cl_int 1072 | clSetProgramSpecializationConstant.argtypes = [cl_program, cl_uint, size_t, ctypes.POINTER(None)] 1073 | except AttributeError: 1074 | pass 1075 | try: 1076 | clUnloadPlatformCompiler = _libraries['libOpenCL.so'].clUnloadPlatformCompiler 1077 | clUnloadPlatformCompiler.restype = cl_int 1078 | clUnloadPlatformCompiler.argtypes = [cl_platform_id] 1079 | except AttributeError: 1080 | pass 1081 | try: 1082 | clGetProgramInfo = _libraries['libOpenCL.so'].clGetProgramInfo 1083 | clGetProgramInfo.restype = cl_int 1084 | clGetProgramInfo.argtypes = [cl_program, cl_program_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1085 | except AttributeError: 1086 | pass 1087 | try: 1088 | clGetProgramBuildInfo = _libraries['libOpenCL.so'].clGetProgramBuildInfo 1089 | clGetProgramBuildInfo.restype = cl_int 1090 | clGetProgramBuildInfo.argtypes = [cl_program, cl_device_id, cl_program_build_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1091 | except AttributeError: 1092 | pass 1093 | try: 1094 | clCreateKernel = _libraries['libOpenCL.so'].clCreateKernel 1095 | clCreateKernel.restype = cl_kernel 1096 | clCreateKernel.argtypes = [cl_program, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_int32)] 1097 | except AttributeError: 1098 | pass 1099 | try: 1100 | clCreateKernelsInProgram = _libraries['libOpenCL.so'].clCreateKernelsInProgram 1101 | clCreateKernelsInProgram.restype = cl_int 1102 | clCreateKernelsInProgram.argtypes = [cl_program, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_kernel)), ctypes.POINTER(ctypes.c_uint32)] 1103 | except AttributeError: 1104 | pass 1105 | try: 1106 | clCloneKernel = _libraries['libOpenCL.so'].clCloneKernel 1107 | clCloneKernel.restype = cl_kernel 1108 | clCloneKernel.argtypes = [cl_kernel, ctypes.POINTER(ctypes.c_int32)] 1109 | except AttributeError: 1110 | pass 1111 | try: 1112 | clRetainKernel = _libraries['libOpenCL.so'].clRetainKernel 1113 | clRetainKernel.restype = cl_int 1114 | clRetainKernel.argtypes = [cl_kernel] 1115 | except AttributeError: 1116 | pass 1117 | try: 1118 | clReleaseKernel = _libraries['libOpenCL.so'].clReleaseKernel 1119 | clReleaseKernel.restype = cl_int 1120 | clReleaseKernel.argtypes = [cl_kernel] 1121 | except AttributeError: 1122 | pass 1123 | try: 1124 | clSetKernelArg = _libraries['libOpenCL.so'].clSetKernelArg 1125 | clSetKernelArg.restype = cl_int 1126 | clSetKernelArg.argtypes = [cl_kernel, cl_uint, size_t, ctypes.POINTER(None)] 1127 | except AttributeError: 1128 | pass 1129 | try: 1130 | clSetKernelArgSVMPointer = _libraries['libOpenCL.so'].clSetKernelArgSVMPointer 1131 | clSetKernelArgSVMPointer.restype = cl_int 1132 | clSetKernelArgSVMPointer.argtypes = [cl_kernel, cl_uint, ctypes.POINTER(None)] 1133 | except AttributeError: 1134 | pass 1135 | try: 1136 | clSetKernelExecInfo = _libraries['libOpenCL.so'].clSetKernelExecInfo 1137 | clSetKernelExecInfo.restype = cl_int 1138 | clSetKernelExecInfo.argtypes = [cl_kernel, cl_kernel_exec_info, size_t, ctypes.POINTER(None)] 1139 | except AttributeError: 1140 | pass 1141 | try: 1142 | clGetKernelInfo = _libraries['libOpenCL.so'].clGetKernelInfo 1143 | clGetKernelInfo.restype = cl_int 1144 | clGetKernelInfo.argtypes = [cl_kernel, cl_kernel_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1145 | except AttributeError: 1146 | pass 1147 | try: 1148 | clGetKernelArgInfo = _libraries['libOpenCL.so'].clGetKernelArgInfo 1149 | clGetKernelArgInfo.restype = cl_int 1150 | clGetKernelArgInfo.argtypes = [cl_kernel, cl_uint, cl_kernel_arg_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1151 | except AttributeError: 1152 | pass 1153 | try: 1154 | clGetKernelWorkGroupInfo = _libraries['libOpenCL.so'].clGetKernelWorkGroupInfo 1155 | clGetKernelWorkGroupInfo.restype = cl_int 1156 | clGetKernelWorkGroupInfo.argtypes = [cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1157 | except AttributeError: 1158 | pass 1159 | try: 1160 | clGetKernelSubGroupInfo = _libraries['libOpenCL.so'].clGetKernelSubGroupInfo 1161 | clGetKernelSubGroupInfo.restype = cl_int 1162 | clGetKernelSubGroupInfo.argtypes = [cl_kernel, cl_device_id, cl_kernel_sub_group_info, size_t, ctypes.POINTER(None), size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1163 | except AttributeError: 1164 | pass 1165 | try: 1166 | clWaitForEvents = _libraries['libOpenCL.so'].clWaitForEvents 1167 | clWaitForEvents.restype = cl_int 1168 | clWaitForEvents.argtypes = [cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1169 | except AttributeError: 1170 | pass 1171 | try: 1172 | clGetEventInfo = _libraries['libOpenCL.so'].clGetEventInfo 1173 | clGetEventInfo.restype = cl_int 1174 | clGetEventInfo.argtypes = [cl_event, cl_event_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1175 | except AttributeError: 1176 | pass 1177 | try: 1178 | clCreateUserEvent = _libraries['libOpenCL.so'].clCreateUserEvent 1179 | clCreateUserEvent.restype = cl_event 1180 | clCreateUserEvent.argtypes = [cl_context, ctypes.POINTER(ctypes.c_int32)] 1181 | except AttributeError: 1182 | pass 1183 | try: 1184 | clRetainEvent = _libraries['libOpenCL.so'].clRetainEvent 1185 | clRetainEvent.restype = cl_int 1186 | clRetainEvent.argtypes = [cl_event] 1187 | except AttributeError: 1188 | pass 1189 | try: 1190 | clReleaseEvent = _libraries['libOpenCL.so'].clReleaseEvent 1191 | clReleaseEvent.restype = cl_int 1192 | clReleaseEvent.argtypes = [cl_event] 1193 | except AttributeError: 1194 | pass 1195 | try: 1196 | clSetUserEventStatus = _libraries['libOpenCL.so'].clSetUserEventStatus 1197 | clSetUserEventStatus.restype = cl_int 1198 | clSetUserEventStatus.argtypes = [cl_event, cl_int] 1199 | except AttributeError: 1200 | pass 1201 | try: 1202 | clSetEventCallback = _libraries['libOpenCL.so'].clSetEventCallback 1203 | clSetEventCallback.restype = cl_int 1204 | clSetEventCallback.argtypes = [cl_event, cl_int, ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_event), ctypes.c_int32, ctypes.POINTER(None)), ctypes.POINTER(None)] 1205 | except AttributeError: 1206 | pass 1207 | try: 1208 | clGetEventProfilingInfo = _libraries['libOpenCL.so'].clGetEventProfilingInfo 1209 | clGetEventProfilingInfo.restype = cl_int 1210 | clGetEventProfilingInfo.argtypes = [cl_event, cl_profiling_info, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64)] 1211 | except AttributeError: 1212 | pass 1213 | try: 1214 | clFlush = _libraries['libOpenCL.so'].clFlush 1215 | clFlush.restype = cl_int 1216 | clFlush.argtypes = [cl_command_queue] 1217 | except AttributeError: 1218 | pass 1219 | try: 1220 | clFinish = _libraries['libOpenCL.so'].clFinish 1221 | clFinish.restype = cl_int 1222 | clFinish.argtypes = [cl_command_queue] 1223 | except AttributeError: 1224 | pass 1225 | try: 1226 | clEnqueueReadBuffer = _libraries['libOpenCL.so'].clEnqueueReadBuffer 1227 | clEnqueueReadBuffer.restype = cl_int 1228 | clEnqueueReadBuffer.argtypes = [cl_command_queue, cl_mem, cl_bool, size_t, size_t, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1229 | except AttributeError: 1230 | pass 1231 | try: 1232 | clEnqueueReadBufferRect = _libraries['libOpenCL.so'].clEnqueueReadBufferRect 1233 | clEnqueueReadBufferRect.restype = cl_int 1234 | clEnqueueReadBufferRect.argtypes = [cl_command_queue, cl_mem, cl_bool, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), size_t, size_t, size_t, size_t, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1235 | except AttributeError: 1236 | pass 1237 | try: 1238 | clEnqueueWriteBuffer = _libraries['libOpenCL.so'].clEnqueueWriteBuffer 1239 | clEnqueueWriteBuffer.restype = cl_int 1240 | clEnqueueWriteBuffer.argtypes = [cl_command_queue, cl_mem, cl_bool, size_t, size_t, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1241 | except AttributeError: 1242 | pass 1243 | try: 1244 | clEnqueueWriteBufferRect = _libraries['libOpenCL.so'].clEnqueueWriteBufferRect 1245 | clEnqueueWriteBufferRect.restype = cl_int 1246 | clEnqueueWriteBufferRect.argtypes = [cl_command_queue, cl_mem, cl_bool, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), size_t, size_t, size_t, size_t, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1247 | except AttributeError: 1248 | pass 1249 | try: 1250 | clEnqueueFillBuffer = _libraries['libOpenCL.so'].clEnqueueFillBuffer 1251 | clEnqueueFillBuffer.restype = cl_int 1252 | clEnqueueFillBuffer.argtypes = [cl_command_queue, cl_mem, ctypes.POINTER(None), size_t, size_t, size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1253 | except AttributeError: 1254 | pass 1255 | try: 1256 | clEnqueueCopyBuffer = _libraries['libOpenCL.so'].clEnqueueCopyBuffer 1257 | clEnqueueCopyBuffer.restype = cl_int 1258 | clEnqueueCopyBuffer.argtypes = [cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1259 | except AttributeError: 1260 | pass 1261 | try: 1262 | clEnqueueCopyBufferRect = _libraries['libOpenCL.so'].clEnqueueCopyBufferRect 1263 | clEnqueueCopyBufferRect.restype = cl_int 1264 | clEnqueueCopyBufferRect.argtypes = [cl_command_queue, cl_mem, cl_mem, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), size_t, size_t, size_t, size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1265 | except AttributeError: 1266 | pass 1267 | try: 1268 | clEnqueueReadImage = _libraries['libOpenCL.so'].clEnqueueReadImage 1269 | clEnqueueReadImage.restype = cl_int 1270 | clEnqueueReadImage.argtypes = [cl_command_queue, cl_mem, cl_bool, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), size_t, size_t, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1271 | except AttributeError: 1272 | pass 1273 | try: 1274 | clEnqueueWriteImage = _libraries['libOpenCL.so'].clEnqueueWriteImage 1275 | clEnqueueWriteImage.restype = cl_int 1276 | clEnqueueWriteImage.argtypes = [cl_command_queue, cl_mem, cl_bool, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), size_t, size_t, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1277 | except AttributeError: 1278 | pass 1279 | try: 1280 | clEnqueueFillImage = _libraries['libOpenCL.so'].clEnqueueFillImage 1281 | clEnqueueFillImage.restype = cl_int 1282 | clEnqueueFillImage.argtypes = [cl_command_queue, cl_mem, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1283 | except AttributeError: 1284 | pass 1285 | try: 1286 | clEnqueueCopyImage = _libraries['libOpenCL.so'].clEnqueueCopyImage 1287 | clEnqueueCopyImage.restype = cl_int 1288 | clEnqueueCopyImage.argtypes = [cl_command_queue, cl_mem, cl_mem, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1289 | except AttributeError: 1290 | pass 1291 | try: 1292 | clEnqueueCopyImageToBuffer = _libraries['libOpenCL.so'].clEnqueueCopyImageToBuffer 1293 | clEnqueueCopyImageToBuffer.restype = cl_int 1294 | clEnqueueCopyImageToBuffer.argtypes = [cl_command_queue, cl_mem, cl_mem, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1295 | except AttributeError: 1296 | pass 1297 | try: 1298 | clEnqueueCopyBufferToImage = _libraries['libOpenCL.so'].clEnqueueCopyBufferToImage 1299 | clEnqueueCopyBufferToImage.restype = cl_int 1300 | clEnqueueCopyBufferToImage.argtypes = [cl_command_queue, cl_mem, cl_mem, size_t, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1301 | except AttributeError: 1302 | pass 1303 | try: 1304 | clEnqueueMapBuffer = _libraries['libOpenCL.so'].clEnqueueMapBuffer 1305 | clEnqueueMapBuffer.restype = ctypes.POINTER(None) 1306 | clEnqueueMapBuffer.argtypes = [cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.c_int32)] 1307 | except AttributeError: 1308 | pass 1309 | try: 1310 | clEnqueueMapImage = _libraries['libOpenCL.so'].clEnqueueMapImage 1311 | clEnqueueMapImage.restype = ctypes.POINTER(None) 1312 | clEnqueueMapImage.argtypes = [cl_command_queue, cl_mem, cl_bool, cl_map_flags, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.c_int32)] 1313 | except AttributeError: 1314 | pass 1315 | try: 1316 | clEnqueueUnmapMemObject = _libraries['libOpenCL.so'].clEnqueueUnmapMemObject 1317 | clEnqueueUnmapMemObject.restype = cl_int 1318 | clEnqueueUnmapMemObject.argtypes = [cl_command_queue, cl_mem, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1319 | except AttributeError: 1320 | pass 1321 | try: 1322 | clEnqueueMigrateMemObjects = _libraries['libOpenCL.so'].clEnqueueMigrateMemObjects 1323 | clEnqueueMigrateMemObjects.restype = cl_int 1324 | clEnqueueMigrateMemObjects.argtypes = [cl_command_queue, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_mem)), cl_mem_migration_flags, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1325 | except AttributeError: 1326 | pass 1327 | try: 1328 | clEnqueueNDRangeKernel = _libraries['libOpenCL.so'].clEnqueueNDRangeKernel 1329 | clEnqueueNDRangeKernel.restype = cl_int 1330 | clEnqueueNDRangeKernel.argtypes = [cl_command_queue, cl_kernel, cl_uint, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1331 | except AttributeError: 1332 | pass 1333 | try: 1334 | clEnqueueNativeKernel = _libraries['libOpenCL.so'].clEnqueueNativeKernel 1335 | clEnqueueNativeKernel.restype = cl_int 1336 | clEnqueueNativeKernel.argtypes = [cl_command_queue, ctypes.CFUNCTYPE(None, ctypes.POINTER(None)), ctypes.POINTER(None), size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_mem)), ctypes.POINTER(ctypes.POINTER(None)), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1337 | except AttributeError: 1338 | pass 1339 | try: 1340 | clEnqueueMarkerWithWaitList = _libraries['libOpenCL.so'].clEnqueueMarkerWithWaitList 1341 | clEnqueueMarkerWithWaitList.restype = cl_int 1342 | clEnqueueMarkerWithWaitList.argtypes = [cl_command_queue, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1343 | except AttributeError: 1344 | pass 1345 | try: 1346 | clEnqueueBarrierWithWaitList = _libraries['libOpenCL.so'].clEnqueueBarrierWithWaitList 1347 | clEnqueueBarrierWithWaitList.restype = cl_int 1348 | clEnqueueBarrierWithWaitList.argtypes = [cl_command_queue, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1349 | except AttributeError: 1350 | pass 1351 | try: 1352 | clEnqueueSVMFree = _libraries['libOpenCL.so'].clEnqueueSVMFree 1353 | clEnqueueSVMFree.restype = cl_int 1354 | clEnqueueSVMFree.argtypes = [cl_command_queue, cl_uint, ctypes.POINTER(None) * 0, ctypes.CFUNCTYPE(None, ctypes.POINTER(struct__cl_command_queue), ctypes.c_uint32, ctypes.POINTER(ctypes.POINTER(None)), ctypes.POINTER(None)), ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1355 | except AttributeError: 1356 | pass 1357 | try: 1358 | clEnqueueSVMMemcpy = _libraries['libOpenCL.so'].clEnqueueSVMMemcpy 1359 | clEnqueueSVMMemcpy.restype = cl_int 1360 | clEnqueueSVMMemcpy.argtypes = [cl_command_queue, cl_bool, ctypes.POINTER(None), ctypes.POINTER(None), size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1361 | except AttributeError: 1362 | pass 1363 | try: 1364 | clEnqueueSVMMemFill = _libraries['libOpenCL.so'].clEnqueueSVMMemFill 1365 | clEnqueueSVMMemFill.restype = cl_int 1366 | clEnqueueSVMMemFill.argtypes = [cl_command_queue, ctypes.POINTER(None), ctypes.POINTER(None), size_t, size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1367 | except AttributeError: 1368 | pass 1369 | try: 1370 | clEnqueueSVMMap = _libraries['libOpenCL.so'].clEnqueueSVMMap 1371 | clEnqueueSVMMap.restype = cl_int 1372 | clEnqueueSVMMap.argtypes = [cl_command_queue, cl_bool, cl_map_flags, ctypes.POINTER(None), size_t, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1373 | except AttributeError: 1374 | pass 1375 | try: 1376 | clEnqueueSVMUnmap = _libraries['libOpenCL.so'].clEnqueueSVMUnmap 1377 | clEnqueueSVMUnmap.restype = cl_int 1378 | clEnqueueSVMUnmap.argtypes = [cl_command_queue, ctypes.POINTER(None), cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1379 | except AttributeError: 1380 | pass 1381 | try: 1382 | clEnqueueSVMMigrateMem = _libraries['libOpenCL.so'].clEnqueueSVMMigrateMem 1383 | clEnqueueSVMMigrateMem.restype = cl_int 1384 | clEnqueueSVMMigrateMem.argtypes = [cl_command_queue, cl_uint, ctypes.POINTER(ctypes.POINTER(None)), ctypes.POINTER(ctypes.c_uint64), cl_mem_migration_flags, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1385 | except AttributeError: 1386 | pass 1387 | try: 1388 | clGetExtensionFunctionAddressForPlatform = _libraries['libOpenCL.so'].clGetExtensionFunctionAddressForPlatform 1389 | clGetExtensionFunctionAddressForPlatform.restype = ctypes.POINTER(None) 1390 | clGetExtensionFunctionAddressForPlatform.argtypes = [cl_platform_id, ctypes.POINTER(ctypes.c_char)] 1391 | except AttributeError: 1392 | pass 1393 | try: 1394 | clCreateImage2D = _libraries['libOpenCL.so'].clCreateImage2D 1395 | clCreateImage2D.restype = cl_mem 1396 | clCreateImage2D.argtypes = [cl_context, cl_mem_flags, ctypes.POINTER(struct__cl_image_format), size_t, size_t, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 1397 | except AttributeError: 1398 | pass 1399 | try: 1400 | clCreateImage3D = _libraries['libOpenCL.so'].clCreateImage3D 1401 | clCreateImage3D.restype = cl_mem 1402 | clCreateImage3D.argtypes = [cl_context, cl_mem_flags, ctypes.POINTER(struct__cl_image_format), size_t, size_t, size_t, size_t, size_t, ctypes.POINTER(None), ctypes.POINTER(ctypes.c_int32)] 1403 | except AttributeError: 1404 | pass 1405 | try: 1406 | clEnqueueMarker = _libraries['libOpenCL.so'].clEnqueueMarker 1407 | clEnqueueMarker.restype = cl_int 1408 | clEnqueueMarker.argtypes = [cl_command_queue, ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1409 | except AttributeError: 1410 | pass 1411 | try: 1412 | clEnqueueWaitForEvents = _libraries['libOpenCL.so'].clEnqueueWaitForEvents 1413 | clEnqueueWaitForEvents.restype = cl_int 1414 | clEnqueueWaitForEvents.argtypes = [cl_command_queue, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1415 | except AttributeError: 1416 | pass 1417 | try: 1418 | clEnqueueBarrier = _libraries['libOpenCL.so'].clEnqueueBarrier 1419 | clEnqueueBarrier.restype = cl_int 1420 | clEnqueueBarrier.argtypes = [cl_command_queue] 1421 | except AttributeError: 1422 | pass 1423 | try: 1424 | clUnloadCompiler = _libraries['libOpenCL.so'].clUnloadCompiler 1425 | clUnloadCompiler.restype = cl_int 1426 | clUnloadCompiler.argtypes = [] 1427 | except AttributeError: 1428 | pass 1429 | try: 1430 | clGetExtensionFunctionAddress = _libraries['libOpenCL.so'].clGetExtensionFunctionAddress 1431 | clGetExtensionFunctionAddress.restype = ctypes.POINTER(None) 1432 | clGetExtensionFunctionAddress.argtypes = [ctypes.POINTER(ctypes.c_char)] 1433 | except AttributeError: 1434 | pass 1435 | try: 1436 | clCreateCommandQueue = _libraries['libOpenCL.so'].clCreateCommandQueue 1437 | clCreateCommandQueue.restype = cl_command_queue 1438 | clCreateCommandQueue.argtypes = [cl_context, cl_device_id, cl_command_queue_properties, ctypes.POINTER(ctypes.c_int32)] 1439 | except AttributeError: 1440 | pass 1441 | try: 1442 | clCreateSampler = _libraries['libOpenCL.so'].clCreateSampler 1443 | clCreateSampler.restype = cl_sampler 1444 | clCreateSampler.argtypes = [cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, ctypes.POINTER(ctypes.c_int32)] 1445 | except AttributeError: 1446 | pass 1447 | try: 1448 | clEnqueueTask = _libraries['libOpenCL.so'].clEnqueueTask 1449 | clEnqueueTask.restype = cl_int 1450 | clEnqueueTask.argtypes = [cl_command_queue, cl_kernel, cl_uint, ctypes.POINTER(ctypes.POINTER(struct__cl_event)), ctypes.POINTER(ctypes.POINTER(struct__cl_event))] 1451 | except AttributeError: 1452 | pass 1453 | __all__ = \ 1454 | ['CL_A', 'CL_ABGR', 'CL_ADDRESS_CLAMP', 1455 | 'CL_ADDRESS_CLAMP_TO_EDGE', 'CL_ADDRESS_MIRRORED_REPEAT', 1456 | 'CL_ADDRESS_NONE', 'CL_ADDRESS_REPEAT', 'CL_ARGB', 'CL_BGRA', 1457 | 'CL_BLOCKING', 'CL_BUFFER_CREATE_TYPE_REGION', 'CL_BUILD_ERROR', 1458 | 'CL_BUILD_IN_PROGRESS', 'CL_BUILD_NONE', 1459 | 'CL_BUILD_PROGRAM_FAILURE', 'CL_BUILD_SUCCESS', 1460 | 'CL_COMMAND_ACQUIRE_GL_OBJECTS', 'CL_COMMAND_BARRIER', 1461 | 'CL_COMMAND_COPY_BUFFER', 'CL_COMMAND_COPY_BUFFER_RECT', 1462 | 'CL_COMMAND_COPY_BUFFER_TO_IMAGE', 'CL_COMMAND_COPY_IMAGE', 1463 | 'CL_COMMAND_COPY_IMAGE_TO_BUFFER', 'CL_COMMAND_FILL_BUFFER', 1464 | 'CL_COMMAND_FILL_IMAGE', 'CL_COMMAND_MAP_BUFFER', 1465 | 'CL_COMMAND_MAP_IMAGE', 'CL_COMMAND_MARKER', 1466 | 'CL_COMMAND_MIGRATE_MEM_OBJECTS', 'CL_COMMAND_NATIVE_KERNEL', 1467 | 'CL_COMMAND_NDRANGE_KERNEL', 'CL_COMMAND_READ_BUFFER', 1468 | 'CL_COMMAND_READ_BUFFER_RECT', 'CL_COMMAND_READ_IMAGE', 1469 | 'CL_COMMAND_RELEASE_GL_OBJECTS', 'CL_COMMAND_SVM_FREE', 1470 | 'CL_COMMAND_SVM_MAP', 'CL_COMMAND_SVM_MEMCPY', 1471 | 'CL_COMMAND_SVM_MEMFILL', 'CL_COMMAND_SVM_MIGRATE_MEM', 1472 | 'CL_COMMAND_SVM_UNMAP', 'CL_COMMAND_TASK', 1473 | 'CL_COMMAND_UNMAP_MEM_OBJECT', 'CL_COMMAND_USER', 1474 | 'CL_COMMAND_WRITE_BUFFER', 'CL_COMMAND_WRITE_BUFFER_RECT', 1475 | 'CL_COMMAND_WRITE_IMAGE', 'CL_COMPILER_NOT_AVAILABLE', 1476 | 'CL_COMPILE_PROGRAM_FAILURE', 'CL_COMPLETE', 'CL_CONTEXT_DEVICES', 1477 | 'CL_CONTEXT_INTEROP_USER_SYNC', 'CL_CONTEXT_NUM_DEVICES', 1478 | 'CL_CONTEXT_PLATFORM', 'CL_CONTEXT_PROPERTIES', 1479 | 'CL_CONTEXT_REFERENCE_COUNT', 'CL_DEPTH', 'CL_DEPTH_STENCIL', 1480 | 'CL_DEVICE_ADDRESS_BITS', 'CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE', 1481 | 'CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE', 1482 | 'CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE', 1483 | 'CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE', 1484 | 'CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE', 1485 | 'CL_DEVICE_AFFINITY_DOMAIN_NUMA', 1486 | 'CL_DEVICE_ATOMIC_FENCE_CAPABILITIES', 1487 | 'CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES', 1488 | 'CL_DEVICE_ATOMIC_ORDER_ACQ_REL', 1489 | 'CL_DEVICE_ATOMIC_ORDER_RELAXED', 1490 | 'CL_DEVICE_ATOMIC_ORDER_SEQ_CST', 1491 | 'CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES', 1492 | 'CL_DEVICE_ATOMIC_SCOPE_DEVICE', 1493 | 'CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP', 1494 | 'CL_DEVICE_ATOMIC_SCOPE_WORK_ITEM', 'CL_DEVICE_AVAILABLE', 1495 | 'CL_DEVICE_BUILT_IN_KERNELS', 1496 | 'CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION', 1497 | 'CL_DEVICE_COMPILER_AVAILABLE', 1498 | 'CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES', 1499 | 'CL_DEVICE_DOUBLE_FP_CONFIG', 'CL_DEVICE_ENDIAN_LITTLE', 1500 | 'CL_DEVICE_ERROR_CORRECTION_SUPPORT', 1501 | 'CL_DEVICE_EXECUTION_CAPABILITIES', 'CL_DEVICE_EXTENSIONS', 1502 | 'CL_DEVICE_EXTENSIONS_WITH_VERSION', 1503 | 'CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT', 1504 | 'CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE', 1505 | 'CL_DEVICE_GLOBAL_MEM_CACHE_SIZE', 1506 | 'CL_DEVICE_GLOBAL_MEM_CACHE_TYPE', 'CL_DEVICE_GLOBAL_MEM_SIZE', 1507 | 'CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE', 1508 | 'CL_DEVICE_HOST_UNIFIED_MEMORY', 'CL_DEVICE_ILS_WITH_VERSION', 1509 | 'CL_DEVICE_IL_VERSION', 'CL_DEVICE_IMAGE2D_MAX_HEIGHT', 1510 | 'CL_DEVICE_IMAGE2D_MAX_WIDTH', 'CL_DEVICE_IMAGE3D_MAX_DEPTH', 1511 | 'CL_DEVICE_IMAGE3D_MAX_HEIGHT', 'CL_DEVICE_IMAGE3D_MAX_WIDTH', 1512 | 'CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT', 1513 | 'CL_DEVICE_IMAGE_MAX_ARRAY_SIZE', 1514 | 'CL_DEVICE_IMAGE_MAX_BUFFER_SIZE', 1515 | 'CL_DEVICE_IMAGE_PITCH_ALIGNMENT', 'CL_DEVICE_IMAGE_SUPPORT', 1516 | 'CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED', 1517 | 'CL_DEVICE_LINKER_AVAILABLE', 'CL_DEVICE_LOCAL_MEM_SIZE', 1518 | 'CL_DEVICE_LOCAL_MEM_TYPE', 'CL_DEVICE_MAX_CLOCK_FREQUENCY', 1519 | 'CL_DEVICE_MAX_COMPUTE_UNITS', 'CL_DEVICE_MAX_CONSTANT_ARGS', 1520 | 'CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE', 1521 | 'CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE', 1522 | 'CL_DEVICE_MAX_MEM_ALLOC_SIZE', 'CL_DEVICE_MAX_NUM_SUB_GROUPS', 1523 | 'CL_DEVICE_MAX_ON_DEVICE_EVENTS', 1524 | 'CL_DEVICE_MAX_ON_DEVICE_QUEUES', 'CL_DEVICE_MAX_PARAMETER_SIZE', 1525 | 'CL_DEVICE_MAX_PIPE_ARGS', 'CL_DEVICE_MAX_READ_IMAGE_ARGS', 1526 | 'CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS', 'CL_DEVICE_MAX_SAMPLERS', 1527 | 'CL_DEVICE_MAX_WORK_GROUP_SIZE', 1528 | 'CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS', 1529 | 'CL_DEVICE_MAX_WORK_ITEM_SIZES', 'CL_DEVICE_MAX_WRITE_IMAGE_ARGS', 1530 | 'CL_DEVICE_MEM_BASE_ADDR_ALIGN', 1531 | 'CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE', 'CL_DEVICE_NAME', 1532 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR', 1533 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE', 1534 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT', 1535 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF', 1536 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_INT', 1537 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG', 1538 | 'CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT', 1539 | 'CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT', 1540 | 'CL_DEVICE_NOT_AVAILABLE', 'CL_DEVICE_NOT_FOUND', 1541 | 'CL_DEVICE_NUMERIC_VERSION', 'CL_DEVICE_OPENCL_C_ALL_VERSIONS', 1542 | 'CL_DEVICE_OPENCL_C_FEATURES', 'CL_DEVICE_OPENCL_C_VERSION', 1543 | 'CL_DEVICE_PARENT_DEVICE', 'CL_DEVICE_PARTITION_AFFINITY_DOMAIN', 1544 | 'CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN', 1545 | 'CL_DEVICE_PARTITION_BY_COUNTS', 1546 | 'CL_DEVICE_PARTITION_BY_COUNTS_LIST_END', 1547 | 'CL_DEVICE_PARTITION_EQUALLY', 'CL_DEVICE_PARTITION_FAILED', 1548 | 'CL_DEVICE_PARTITION_MAX_SUB_DEVICES', 1549 | 'CL_DEVICE_PARTITION_PROPERTIES', 'CL_DEVICE_PARTITION_TYPE', 1550 | 'CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS', 1551 | 'CL_DEVICE_PIPE_MAX_PACKET_SIZE', 'CL_DEVICE_PIPE_SUPPORT', 1552 | 'CL_DEVICE_PLATFORM', 1553 | 'CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT', 1554 | 'CL_DEVICE_PREFERRED_INTEROP_USER_SYNC', 1555 | 'CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT', 1556 | 'CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT', 1557 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR', 1558 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE', 1559 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT', 1560 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF', 1561 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT', 1562 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG', 1563 | 'CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT', 1564 | 'CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE', 1565 | 'CL_DEVICE_PRINTF_BUFFER_SIZE', 'CL_DEVICE_PROFILE', 1566 | 'CL_DEVICE_PROFILING_TIMER_RESOLUTION', 1567 | 'CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE', 1568 | 'CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE', 1569 | 'CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES', 1570 | 'CL_DEVICE_QUEUE_ON_HOST_PROPERTIES', 1571 | 'CL_DEVICE_QUEUE_PROPERTIES', 1572 | 'CL_DEVICE_QUEUE_REPLACEABLE_DEFAULT', 1573 | 'CL_DEVICE_QUEUE_SUPPORTED', 'CL_DEVICE_REFERENCE_COUNT', 1574 | 'CL_DEVICE_SINGLE_FP_CONFIG', 1575 | 'CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS', 1576 | 'CL_DEVICE_SVM_ATOMICS', 'CL_DEVICE_SVM_CAPABILITIES', 1577 | 'CL_DEVICE_SVM_COARSE_GRAIN_BUFFER', 1578 | 'CL_DEVICE_SVM_FINE_GRAIN_BUFFER', 1579 | 'CL_DEVICE_SVM_FINE_GRAIN_SYSTEM', 'CL_DEVICE_TYPE', 1580 | 'CL_DEVICE_TYPE_ACCELERATOR', 'CL_DEVICE_TYPE_ALL', 1581 | 'CL_DEVICE_TYPE_CPU', 'CL_DEVICE_TYPE_CUSTOM', 1582 | 'CL_DEVICE_TYPE_DEFAULT', 'CL_DEVICE_TYPE_GPU', 1583 | 'CL_DEVICE_VENDOR', 'CL_DEVICE_VENDOR_ID', 'CL_DEVICE_VERSION', 1584 | 'CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT', 1585 | 'CL_DRIVER_VERSION', 'CL_EVENT_COMMAND_EXECUTION_STATUS', 1586 | 'CL_EVENT_COMMAND_QUEUE', 'CL_EVENT_COMMAND_TYPE', 1587 | 'CL_EVENT_CONTEXT', 'CL_EVENT_REFERENCE_COUNT', 'CL_EXEC_KERNEL', 1588 | 'CL_EXEC_NATIVE_KERNEL', 1589 | 'CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST', 'CL_FALSE', 1590 | 'CL_FILTER_LINEAR', 'CL_FILTER_NEAREST', 'CL_FLOAT', 1591 | 'CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT', 'CL_FP_DENORM', 1592 | 'CL_FP_FMA', 'CL_FP_INF_NAN', 'CL_FP_ROUND_TO_INF', 1593 | 'CL_FP_ROUND_TO_NEAREST', 'CL_FP_ROUND_TO_ZERO', 1594 | 'CL_FP_SOFT_FLOAT', 'CL_GLOBAL', 'CL_HALF_FLOAT', 1595 | 'CL_IMAGE_ARRAY_SIZE', 'CL_IMAGE_BUFFER', 'CL_IMAGE_DEPTH', 1596 | 'CL_IMAGE_ELEMENT_SIZE', 'CL_IMAGE_FORMAT', 1597 | 'CL_IMAGE_FORMAT_MISMATCH', 'CL_IMAGE_FORMAT_NOT_SUPPORTED', 1598 | 'CL_IMAGE_HEIGHT', 'CL_IMAGE_NUM_MIP_LEVELS', 1599 | 'CL_IMAGE_NUM_SAMPLES', 'CL_IMAGE_ROW_PITCH', 1600 | 'CL_IMAGE_SLICE_PITCH', 'CL_IMAGE_WIDTH', 'CL_INTENSITY', 1601 | 'CL_INVALID_ARG_INDEX', 'CL_INVALID_ARG_SIZE', 1602 | 'CL_INVALID_ARG_VALUE', 'CL_INVALID_BINARY', 1603 | 'CL_INVALID_BUFFER_SIZE', 'CL_INVALID_BUILD_OPTIONS', 1604 | 'CL_INVALID_COMMAND_QUEUE', 'CL_INVALID_COMPILER_OPTIONS', 1605 | 'CL_INVALID_CONTEXT', 'CL_INVALID_DEVICE', 1606 | 'CL_INVALID_DEVICE_PARTITION_COUNT', 'CL_INVALID_DEVICE_QUEUE', 1607 | 'CL_INVALID_DEVICE_TYPE', 'CL_INVALID_EVENT', 1608 | 'CL_INVALID_EVENT_WAIT_LIST', 'CL_INVALID_GLOBAL_OFFSET', 1609 | 'CL_INVALID_GLOBAL_WORK_SIZE', 'CL_INVALID_GL_OBJECT', 1610 | 'CL_INVALID_HOST_PTR', 'CL_INVALID_IMAGE_DESCRIPTOR', 1611 | 'CL_INVALID_IMAGE_FORMAT_DESCRIPTOR', 'CL_INVALID_IMAGE_SIZE', 1612 | 'CL_INVALID_KERNEL', 'CL_INVALID_KERNEL_ARGS', 1613 | 'CL_INVALID_KERNEL_DEFINITION', 'CL_INVALID_KERNEL_NAME', 1614 | 'CL_INVALID_LINKER_OPTIONS', 'CL_INVALID_MEM_OBJECT', 1615 | 'CL_INVALID_MIP_LEVEL', 'CL_INVALID_OPERATION', 1616 | 'CL_INVALID_PIPE_SIZE', 'CL_INVALID_PLATFORM', 1617 | 'CL_INVALID_PROGRAM', 'CL_INVALID_PROGRAM_EXECUTABLE', 1618 | 'CL_INVALID_PROPERTY', 'CL_INVALID_QUEUE_PROPERTIES', 1619 | 'CL_INVALID_SAMPLER', 'CL_INVALID_SPEC_ID', 'CL_INVALID_VALUE', 1620 | 'CL_INVALID_WORK_DIMENSION', 'CL_INVALID_WORK_GROUP_SIZE', 1621 | 'CL_INVALID_WORK_ITEM_SIZE', 'CL_KERNEL_ARG_ACCESS_NONE', 1622 | 'CL_KERNEL_ARG_ACCESS_QUALIFIER', 1623 | 'CL_KERNEL_ARG_ACCESS_READ_ONLY', 1624 | 'CL_KERNEL_ARG_ACCESS_READ_WRITE', 1625 | 'CL_KERNEL_ARG_ACCESS_WRITE_ONLY', 1626 | 'CL_KERNEL_ARG_ADDRESS_CONSTANT', 'CL_KERNEL_ARG_ADDRESS_GLOBAL', 1627 | 'CL_KERNEL_ARG_ADDRESS_LOCAL', 'CL_KERNEL_ARG_ADDRESS_PRIVATE', 1628 | 'CL_KERNEL_ARG_ADDRESS_QUALIFIER', 1629 | 'CL_KERNEL_ARG_INFO_NOT_AVAILABLE', 'CL_KERNEL_ARG_NAME', 1630 | 'CL_KERNEL_ARG_TYPE_CONST', 'CL_KERNEL_ARG_TYPE_NAME', 1631 | 'CL_KERNEL_ARG_TYPE_NONE', 'CL_KERNEL_ARG_TYPE_PIPE', 1632 | 'CL_KERNEL_ARG_TYPE_QUALIFIER', 'CL_KERNEL_ARG_TYPE_RESTRICT', 1633 | 'CL_KERNEL_ARG_TYPE_VOLATILE', 'CL_KERNEL_ATTRIBUTES', 1634 | 'CL_KERNEL_COMPILE_NUM_SUB_GROUPS', 1635 | 'CL_KERNEL_COMPILE_WORK_GROUP_SIZE', 'CL_KERNEL_CONTEXT', 1636 | 'CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM', 1637 | 'CL_KERNEL_EXEC_INFO_SVM_PTRS', 'CL_KERNEL_FUNCTION_NAME', 1638 | 'CL_KERNEL_GLOBAL_WORK_SIZE', 'CL_KERNEL_LOCAL_MEM_SIZE', 1639 | 'CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT', 1640 | 'CL_KERNEL_MAX_NUM_SUB_GROUPS', 1641 | 'CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE', 'CL_KERNEL_NUM_ARGS', 1642 | 'CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE', 1643 | 'CL_KERNEL_PRIVATE_MEM_SIZE', 'CL_KERNEL_PROGRAM', 1644 | 'CL_KERNEL_REFERENCE_COUNT', 1645 | 'CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE', 1646 | 'CL_KERNEL_WORK_GROUP_SIZE', 'CL_KHRONOS_VENDOR_ID_CODEPLAY', 1647 | 'CL_LINKER_NOT_AVAILABLE', 'CL_LINK_PROGRAM_FAILURE', 'CL_LOCAL', 1648 | 'CL_LUMINANCE', 'CL_MAP_FAILURE', 'CL_MAP_READ', 'CL_MAP_WRITE', 1649 | 'CL_MAP_WRITE_INVALIDATE_REGION', 1650 | 'CL_MAX_SIZE_RESTRICTION_EXCEEDED', 'CL_MEM_ALLOC_HOST_PTR', 1651 | 'CL_MEM_ASSOCIATED_MEMOBJECT', 'CL_MEM_CONTEXT', 1652 | 'CL_MEM_COPY_HOST_PTR', 'CL_MEM_COPY_OVERLAP', 'CL_MEM_FLAGS', 1653 | 'CL_MEM_HOST_NO_ACCESS', 'CL_MEM_HOST_PTR', 1654 | 'CL_MEM_HOST_READ_ONLY', 'CL_MEM_HOST_WRITE_ONLY', 1655 | 'CL_MEM_KERNEL_READ_AND_WRITE', 'CL_MEM_MAP_COUNT', 1656 | 'CL_MEM_OBJECT_ALLOCATION_FAILURE', 'CL_MEM_OBJECT_BUFFER', 1657 | 'CL_MEM_OBJECT_IMAGE1D', 'CL_MEM_OBJECT_IMAGE1D_ARRAY', 1658 | 'CL_MEM_OBJECT_IMAGE1D_BUFFER', 'CL_MEM_OBJECT_IMAGE2D', 1659 | 'CL_MEM_OBJECT_IMAGE2D_ARRAY', 'CL_MEM_OBJECT_IMAGE3D', 1660 | 'CL_MEM_OBJECT_PIPE', 'CL_MEM_OFFSET', 'CL_MEM_PROPERTIES', 1661 | 'CL_MEM_READ_ONLY', 'CL_MEM_READ_WRITE', 'CL_MEM_REFERENCE_COUNT', 1662 | 'CL_MEM_SIZE', 'CL_MEM_SVM_ATOMICS', 1663 | 'CL_MEM_SVM_FINE_GRAIN_BUFFER', 'CL_MEM_TYPE', 1664 | 'CL_MEM_USES_SVM_POINTER', 'CL_MEM_USE_HOST_PTR', 1665 | 'CL_MEM_WRITE_ONLY', 'CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED', 1666 | 'CL_MIGRATE_MEM_OBJECT_HOST', 'CL_MISALIGNED_SUB_BUFFER_OFFSET', 1667 | 'CL_NAME_VERSION_MAX_NAME_SIZE', 'CL_NONE', 'CL_NON_BLOCKING', 1668 | 'CL_OUT_OF_HOST_MEMORY', 'CL_OUT_OF_RESOURCES', 1669 | 'CL_PIPE_MAX_PACKETS', 'CL_PIPE_PACKET_SIZE', 1670 | 'CL_PIPE_PROPERTIES', 'CL_PLATFORM_EXTENSIONS', 1671 | 'CL_PLATFORM_EXTENSIONS_WITH_VERSION', 1672 | 'CL_PLATFORM_HOST_TIMER_RESOLUTION', 'CL_PLATFORM_NAME', 1673 | 'CL_PLATFORM_NUMERIC_VERSION', 'CL_PLATFORM_PROFILE', 1674 | 'CL_PLATFORM_VENDOR', 'CL_PLATFORM_VERSION', 1675 | 'CL_PROFILING_COMMAND_COMPLETE', 'CL_PROFILING_COMMAND_END', 1676 | 'CL_PROFILING_COMMAND_QUEUED', 'CL_PROFILING_COMMAND_START', 1677 | 'CL_PROFILING_COMMAND_SUBMIT', 'CL_PROFILING_INFO_NOT_AVAILABLE', 1678 | 'CL_PROGRAM_BINARIES', 'CL_PROGRAM_BINARY_SIZES', 1679 | 'CL_PROGRAM_BINARY_TYPE', 1680 | 'CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT', 1681 | 'CL_PROGRAM_BINARY_TYPE_EXECUTABLE', 1682 | 'CL_PROGRAM_BINARY_TYPE_LIBRARY', 'CL_PROGRAM_BINARY_TYPE_NONE', 1683 | 'CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE', 1684 | 'CL_PROGRAM_BUILD_LOG', 'CL_PROGRAM_BUILD_OPTIONS', 1685 | 'CL_PROGRAM_BUILD_STATUS', 'CL_PROGRAM_CONTEXT', 1686 | 'CL_PROGRAM_DEVICES', 'CL_PROGRAM_IL', 'CL_PROGRAM_KERNEL_NAMES', 1687 | 'CL_PROGRAM_NUM_DEVICES', 'CL_PROGRAM_NUM_KERNELS', 1688 | 'CL_PROGRAM_REFERENCE_COUNT', 1689 | 'CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT', 1690 | 'CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT', 'CL_PROGRAM_SOURCE', 1691 | 'CL_QUEUED', 'CL_QUEUE_CONTEXT', 'CL_QUEUE_DEVICE', 1692 | 'CL_QUEUE_DEVICE_DEFAULT', 'CL_QUEUE_ON_DEVICE', 1693 | 'CL_QUEUE_ON_DEVICE_DEFAULT', 1694 | 'CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE', 1695 | 'CL_QUEUE_PROFILING_ENABLE', 'CL_QUEUE_PROPERTIES', 1696 | 'CL_QUEUE_PROPERTIES_ARRAY', 'CL_QUEUE_REFERENCE_COUNT', 1697 | 'CL_QUEUE_SIZE', 'CL_R', 'CL_RA', 'CL_READ_ONLY_CACHE', 1698 | 'CL_READ_WRITE_CACHE', 'CL_RG', 'CL_RGB', 'CL_RGBA', 'CL_RGBx', 1699 | 'CL_RGx', 'CL_RUNNING', 'CL_Rx', 'CL_SAMPLER_ADDRESSING_MODE', 1700 | 'CL_SAMPLER_CONTEXT', 'CL_SAMPLER_FILTER_MODE', 1701 | 'CL_SAMPLER_LOD_MAX', 'CL_SAMPLER_LOD_MIN', 1702 | 'CL_SAMPLER_MIP_FILTER_MODE', 'CL_SAMPLER_NORMALIZED_COORDS', 1703 | 'CL_SAMPLER_PROPERTIES', 'CL_SAMPLER_REFERENCE_COUNT', 1704 | 'CL_SIGNED_INT16', 'CL_SIGNED_INT32', 'CL_SIGNED_INT8', 1705 | 'CL_SNORM_INT16', 'CL_SNORM_INT8', 'CL_SUBMITTED', 'CL_SUCCESS', 1706 | 'CL_TRUE', 'CL_UNORM_INT16', 'CL_UNORM_INT24', 'CL_UNORM_INT8', 1707 | 'CL_UNORM_INT_101010', 'CL_UNORM_INT_101010_2', 1708 | 'CL_UNORM_SHORT_555', 'CL_UNORM_SHORT_565', 'CL_UNSIGNED_INT16', 1709 | 'CL_UNSIGNED_INT32', 'CL_UNSIGNED_INT8', 'CL_VERSION_MAJOR_BITS', 1710 | 'CL_VERSION_MAJOR_MASK', 'CL_VERSION_MINOR_BITS', 1711 | 'CL_VERSION_MINOR_MASK', 'CL_VERSION_PATCH_BITS', 1712 | 'CL_VERSION_PATCH_MASK', 'CL_sBGRA', 'CL_sRGB', 'CL_sRGBA', 1713 | 'CL_sRGBx', '__OPENCL_CL_H', 'clBuildProgram', 'clCloneKernel', 1714 | 'clCompileProgram', 'clCreateBuffer', 1715 | 'clCreateBufferWithProperties', 'clCreateCommandQueue', 1716 | 'clCreateCommandQueueWithProperties', 'clCreateContext', 1717 | 'clCreateContextFromType', 'clCreateImage', 'clCreateImage2D', 1718 | 'clCreateImage3D', 'clCreateImageWithProperties', 1719 | 'clCreateKernel', 'clCreateKernelsInProgram', 'clCreatePipe', 1720 | 'clCreateProgramWithBinary', 'clCreateProgramWithBuiltInKernels', 1721 | 'clCreateProgramWithIL', 'clCreateProgramWithSource', 1722 | 'clCreateSampler', 'clCreateSamplerWithProperties', 1723 | 'clCreateSubBuffer', 'clCreateSubDevices', 'clCreateUserEvent', 1724 | 'clEnqueueBarrier', 'clEnqueueBarrierWithWaitList', 1725 | 'clEnqueueCopyBuffer', 'clEnqueueCopyBufferRect', 1726 | 'clEnqueueCopyBufferToImage', 'clEnqueueCopyImage', 1727 | 'clEnqueueCopyImageToBuffer', 'clEnqueueFillBuffer', 1728 | 'clEnqueueFillImage', 'clEnqueueMapBuffer', 'clEnqueueMapImage', 1729 | 'clEnqueueMarker', 'clEnqueueMarkerWithWaitList', 1730 | 'clEnqueueMigrateMemObjects', 'clEnqueueNDRangeKernel', 1731 | 'clEnqueueNativeKernel', 'clEnqueueReadBuffer', 1732 | 'clEnqueueReadBufferRect', 'clEnqueueReadImage', 1733 | 'clEnqueueSVMFree', 'clEnqueueSVMMap', 'clEnqueueSVMMemFill', 1734 | 'clEnqueueSVMMemcpy', 'clEnqueueSVMMigrateMem', 1735 | 'clEnqueueSVMUnmap', 'clEnqueueTask', 'clEnqueueUnmapMemObject', 1736 | 'clEnqueueWaitForEvents', 'clEnqueueWriteBuffer', 1737 | 'clEnqueueWriteBufferRect', 'clEnqueueWriteImage', 'clFinish', 1738 | 'clFlush', 'clGetCommandQueueInfo', 'clGetContextInfo', 1739 | 'clGetDeviceAndHostTimer', 'clGetDeviceIDs', 'clGetDeviceInfo', 1740 | 'clGetEventInfo', 'clGetEventProfilingInfo', 1741 | 'clGetExtensionFunctionAddress', 1742 | 'clGetExtensionFunctionAddressForPlatform', 'clGetHostTimer', 1743 | 'clGetImageInfo', 'clGetKernelArgInfo', 'clGetKernelInfo', 1744 | 'clGetKernelSubGroupInfo', 'clGetKernelWorkGroupInfo', 1745 | 'clGetMemObjectInfo', 'clGetPipeInfo', 'clGetPlatformIDs', 1746 | 'clGetPlatformInfo', 'clGetProgramBuildInfo', 'clGetProgramInfo', 1747 | 'clGetSamplerInfo', 'clGetSupportedImageFormats', 'clLinkProgram', 1748 | 'clReleaseCommandQueue', 'clReleaseContext', 'clReleaseDevice', 1749 | 'clReleaseEvent', 'clReleaseKernel', 'clReleaseMemObject', 1750 | 'clReleaseProgram', 'clReleaseSampler', 'clRetainCommandQueue', 1751 | 'clRetainContext', 'clRetainDevice', 'clRetainEvent', 1752 | 'clRetainKernel', 'clRetainMemObject', 'clRetainProgram', 1753 | 'clRetainSampler', 'clSVMAlloc', 'clSVMFree', 1754 | 'clSetContextDestructorCallback', 1755 | 'clSetDefaultDeviceCommandQueue', 'clSetEventCallback', 1756 | 'clSetKernelArg', 'clSetKernelArgSVMPointer', 1757 | 'clSetKernelExecInfo', 'clSetMemObjectDestructorCallback', 1758 | 'clSetProgramReleaseCallback', 1759 | 'clSetProgramSpecializationConstant', 'clSetUserEventStatus', 1760 | 'clUnloadCompiler', 'clUnloadPlatformCompiler', 'clWaitForEvents', 1761 | 'cl_addressing_mode', 'cl_bitfield', 'cl_bool', 1762 | 'cl_buffer_create_type', 'cl_buffer_region', 'cl_build_status', 1763 | 'cl_channel_order', 'cl_channel_type', 'cl_command_queue', 1764 | 'cl_command_queue_info', 'cl_command_queue_properties', 1765 | 'cl_command_type', 'cl_context', 'cl_context_info', 1766 | 'cl_context_properties', 'cl_device_affinity_domain', 1767 | 'cl_device_atomic_capabilities', 1768 | 'cl_device_device_enqueue_capabilities', 1769 | 'cl_device_exec_capabilities', 'cl_device_fp_config', 1770 | 'cl_device_id', 'cl_device_info', 'cl_device_local_mem_type', 1771 | 'cl_device_mem_cache_type', 'cl_device_partition_property', 1772 | 'cl_device_svm_capabilities', 'cl_device_type', 'cl_event', 1773 | 'cl_event_info', 'cl_filter_mode', 'cl_image_desc', 1774 | 'cl_image_format', 'cl_image_info', 'cl_int', 'cl_kernel', 1775 | 'cl_kernel_arg_access_qualifier', 1776 | 'cl_kernel_arg_address_qualifier', 'cl_kernel_arg_info', 1777 | 'cl_kernel_arg_type_qualifier', 'cl_kernel_exec_info', 1778 | 'cl_kernel_info', 'cl_kernel_sub_group_info', 1779 | 'cl_kernel_work_group_info', 'cl_khronos_vendor_id', 1780 | 'cl_map_flags', 'cl_mem', 'cl_mem_flags', 'cl_mem_info', 1781 | 'cl_mem_migration_flags', 'cl_mem_object_type', 1782 | 'cl_mem_properties', 'cl_name_version', 'cl_pipe_info', 1783 | 'cl_pipe_properties', 'cl_platform_id', 'cl_platform_info', 1784 | 'cl_profiling_info', 'cl_program', 'cl_program_binary_type', 1785 | 'cl_program_build_info', 'cl_program_info', 'cl_properties', 1786 | 'cl_queue_properties', 'cl_sampler', 'cl_sampler_info', 1787 | 'cl_sampler_properties', 'cl_svm_mem_flags', 'cl_uint', 1788 | 'cl_version', 'size_t', 'struct__cl_buffer_region', 1789 | 'struct__cl_command_queue', 'struct__cl_context', 1790 | 'struct__cl_device_id', 'struct__cl_event', 1791 | 'struct__cl_image_desc', 'struct__cl_image_format', 1792 | 'struct__cl_kernel', 'struct__cl_mem', 'struct__cl_name_version', 1793 | 'struct__cl_platform_id', 'struct__cl_program', 1794 | 'struct__cl_sampler', 'union__cl_image_desc_0'] 1795 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from setuptools import setup 3 | from pathlib import Path 4 | 5 | description = (Path(__file__).resolve().parent / "README.md").read_text() 6 | setup(name='gpuctypes', 7 | version='0.3.0', 8 | description='ctypes wrappers for HIP, CUDA, and OpenCL', 9 | author='George Hotz', 10 | long_description=description, 11 | long_description_content_type='text/markdown', 12 | license='MIT', 13 | packages = ['gpuctypes'], 14 | python_requires='>=3.8', 15 | include_package_data=True) 16 | -------------------------------------------------------------------------------- /test/helpers.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | import unittest, os, ctypes, platform 3 | 4 | CI = os.getenv("CI", "") != "" 5 | OSX = platform.system() == "Darwin" 6 | 7 | def expectedFailureIf(condition): 8 | def wrapper(func): 9 | if condition: return unittest.expectedFailure(func) 10 | else: return func 11 | return wrapper 12 | 13 | # helpers for RTC 14 | 15 | def get_bytes(arg, get_sz, get_str, check) -> bytes: 16 | check(get_sz(arg, ctypes.byref(sz := ctypes.c_size_t()))) 17 | check(get_str(arg, mstr := ctypes.create_string_buffer(sz.value))) 18 | return ctypes.string_at(mstr, size=sz.value) 19 | 20 | def to_char_p_p(options: List[str]): 21 | c_options = (ctypes.POINTER(ctypes.c_char) * len(options))() 22 | c_options[:] = [ctypes.cast(ctypes.create_string_buffer(o.encode("utf-8")), ctypes.POINTER(ctypes.c_char)) for o in options] 23 | return c_options 24 | 25 | def cuda_compile(prg, options, f, check): 26 | check(f.create(ctypes.pointer(prog := f.new()), prg.encode(), "".encode(), 0, None, None)) 27 | status = f.compile(prog, len(options), to_char_p_p(options)) 28 | if status != 0: raise RuntimeError(f"compile failed: {get_bytes(prog, f.getLogSize, f.getLog, check)}") 29 | return get_bytes(prog, f.getCodeSize, f.getCode, check) 30 | -------------------------------------------------------------------------------- /test/test_cuda.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import unittest 3 | import gpuctypes.cuda as cuda 4 | from helpers import CI, cuda_compile 5 | 6 | def check(status): 7 | if status != 0: 8 | error = ctypes.POINTER(ctypes.c_char)() 9 | check(cuda.cuGetErrorString(status, ctypes.byref(error))) 10 | raise RuntimeError(f"CUDA Error {status}, {ctypes.string_at(error).decode()}") 11 | 12 | class CUDACompile: 13 | new = cuda.nvrtcProgram 14 | create = cuda.nvrtcCreateProgram 15 | compile = cuda.nvrtcCompileProgram 16 | getLogSize = cuda.nvrtcGetProgramLogSize 17 | getLog = cuda.nvrtcGetProgramLog 18 | getCodeSize = cuda.nvrtcGetCUBINSize 19 | getCode = cuda.nvrtcGetCUBIN 20 | 21 | class TestCUDA(unittest.TestCase): 22 | def test_has_methods(self): 23 | assert cuda.cuInit is not None 24 | assert cuda.cuDeviceGetCount is not None 25 | assert cuda.cuMemAlloc_v2 is not None 26 | 27 | def test_compile_fail(self): 28 | with self.assertRaises(RuntimeError): 29 | cuda_compile("__device__ void test() { {", ["--gpu-architecture=sm_60"], CUDACompile, check) 30 | 31 | def test_compile(self): 32 | prg = cuda_compile("__device__ int test() { return 42; }", ["--gpu-architecture=sm_60"], CUDACompile, check) 33 | assert len(prg) > 10 34 | 35 | @unittest.skipIf(CI, "cuda doesn't work in CI") 36 | class TestCUDADevice(unittest.TestCase): 37 | @classmethod 38 | def setUpClass(cls): 39 | check(cuda.cuInit(0)) 40 | cls.device = cuda.CUdevice() 41 | check(cuda.cuDeviceGet(ctypes.byref(cls.device), 0)) 42 | cls.context = cuda.CUcontext() 43 | check(cuda.cuCtxCreate_v2(ctypes.byref(cls.context), 0, cls.device)) 44 | 45 | # NOTE: this requires cuInit, so it doesn't run in CI 46 | def test_device_count(self): 47 | check(cuda.cuDeviceGetCount(ctypes.byref(count := ctypes.c_int()))) 48 | print(f"got {count.value} devices") 49 | assert count.value > 0 50 | 51 | def test_malloc(self): 52 | check(cuda.cuMemAlloc_v2(ctypes.byref(ptr := ctypes.c_ulong()), 16)) 53 | assert ptr.value != 0 54 | print(ptr.value) 55 | 56 | if __name__ == '__main__': 57 | unittest.main() -------------------------------------------------------------------------------- /test/test_hip.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import ctypes 3 | import gpuctypes.hip as hip 4 | import gpuctypes.comgr as comgr 5 | from helpers import CI, expectedFailureIf, cuda_compile 6 | 7 | def check(status): 8 | if status != 0: raise RuntimeError(f"HIP Error {status}, {ctypes.string_at(hip.hipGetErrorString(status)).decode()}") 9 | 10 | class HIPCompile: 11 | new = hip.hiprtcProgram 12 | create = hip.hiprtcCreateProgram 13 | compile = hip.hiprtcCompileProgram 14 | getLogSize = hip.hiprtcGetProgramLogSize 15 | getLog = hip.hiprtcGetProgramLog 16 | getCodeSize = hip.hiprtcGetCodeSize 17 | getCode = hip.hiprtcGetCode 18 | 19 | class TestHIP(unittest.TestCase): 20 | def test_has_methods(self): 21 | assert hip.hipMalloc is not None 22 | assert hip.hiprtcCompileProgram is not None 23 | assert hip.hipGetDeviceProperties is not None 24 | 25 | def test_compile_fail(self): 26 | with self.assertRaises(RuntimeError): 27 | cuda_compile("void test() { {", ["--offload-arch=gfx1100"], HIPCompile, check) 28 | 29 | def test_compile(self): 30 | prg = cuda_compile("int test() { return 42; }", ["--offload-arch=gfx1100"], HIPCompile, check) 31 | assert len(prg) > 10 32 | 33 | def test_comgr(self): 34 | status = comgr.amd_comgr_create_action_info(ctypes.byref(action_info := comgr.amd_comgr_action_info_t())) 35 | assert status == 0 36 | 37 | class TestHIPDevice(unittest.TestCase): 38 | @expectedFailureIf(CI) 39 | def test_malloc(self): 40 | ptr = ctypes.c_void_p() 41 | check(hip.hipMalloc(ctypes.byref(ptr), 100)) 42 | assert ptr.value != 0 43 | check(hip.hipFree(ptr)) 44 | 45 | @expectedFailureIf(CI) 46 | def test_device_count(self): 47 | check(hip.hipGetDeviceCount(ctypes.byref(count := ctypes.c_int()))) 48 | print(f"got {count.value} devices") 49 | assert count.value > 0 50 | 51 | @expectedFailureIf(CI) 52 | def test_get_device_properties(self) -> hip.hipDeviceProp_t: 53 | device_properties = hip.hipDeviceProp_t() 54 | check(hip.hipGetDeviceProperties(device_properties, 0)) 55 | print(device_properties.gcnArchName) 56 | return device_properties 57 | 58 | if __name__ == '__main__': 59 | unittest.main() -------------------------------------------------------------------------------- /test/test_opencl.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | import ctypes 3 | import unittest 4 | from helpers import to_char_p_p 5 | import gpuctypes.opencl as cl 6 | 7 | def check(status, info:Optional[str]=None): 8 | if status != 0: raise RuntimeError(f"OpenCL Error {status}" + (("\n\n"+info) if info else "")) 9 | 10 | def cl_compile(context, device_array, prog): 11 | num_programs = 1 12 | sizes = (ctypes.c_size_t * num_programs)() 13 | sizes[0] = len(prog) 14 | status = ctypes.c_int32() 15 | program = cl.clCreateProgramWithSource(context, num_programs, to_char_p_p([prog]), sizes, ctypes.byref(status)) 16 | assert program is not None 17 | status = cl.clBuildProgram(program, len(device_array), device_array, None, ctypes.cast(None, cl.clBuildProgram.argtypes[4]), None) 18 | if status != 0: 19 | cl.clGetProgramBuildInfo(program, device_array[0], cl.CL_PROGRAM_BUILD_LOG, 0, None, ctypes.byref(log_size := ctypes.c_size_t())) 20 | cl.clGetProgramBuildInfo(program, device_array[0], cl.CL_PROGRAM_BUILD_LOG, log_size.value, mstr := ctypes.create_string_buffer(log_size.value), None) 21 | check(status, ctypes.string_at(mstr, size=log_size.value).decode()) 22 | return program 23 | 24 | class TestOpenCL(unittest.TestCase): 25 | @classmethod 26 | def setUpClass(cls): 27 | num_platforms = ctypes.c_uint32() 28 | platform_array = (cl.cl_platform_id * 1)() 29 | check(cl.clGetPlatformIDs(1, platform_array, ctypes.byref(num_platforms))) 30 | assert num_platforms.value > 0, "didn't get platform" 31 | 32 | cls.device_array = (cl.cl_device_id * 1)() 33 | num_devices = ctypes.c_uint32() 34 | check(cl.clGetDeviceIDs(platform_array[0], cl.CL_DEVICE_TYPE_DEFAULT, 1, cls.device_array, ctypes.byref(num_devices))) 35 | assert num_devices.value > 0, "didn't get device" 36 | 37 | status = ctypes.c_int32() 38 | cls.context = cl.clCreateContext(None, 1, cls.device_array, ctypes.cast(None, cl.clCreateContext.argtypes[3]), None, ctypes.byref(status)) 39 | check(status.value) 40 | assert cls.context is not None 41 | 42 | cls.queue = cl.clCreateCommandQueue(cls.context, cls.device_array[0], 0, ctypes.byref(status)) 43 | check(status.value) 44 | assert cls.queue is not None 45 | 46 | def test_malloc(self): 47 | status = ctypes.c_int32() 48 | buf = cl.clCreateBuffer(self.context, cl.CL_MEM_READ_ONLY, 4 * 5, None, ctypes.byref(status)) 49 | assert buf is not None 50 | 51 | def test_bad_program(self): 52 | with self.assertRaises(RuntimeError): 53 | cl_compile(self.context, self.device_array, "__kernel void vector_add() { x }") 54 | 55 | def test_create_program(self): 56 | program = cl_compile(self.context, self.device_array, """ 57 | __kernel void vector_add(__global int *A, __global const int *B, __global const int *C) { 58 | int i = get_global_id(0); 59 | A[i] = B[i] + C[i]; 60 | }""") 61 | 62 | binary_sizes = (ctypes.c_size_t * len(self.device_array))() 63 | cl.clGetProgramInfo(program, cl.CL_PROGRAM_BINARY_SIZES, ctypes.sizeof(binary_sizes), ctypes.byref(binary_sizes), None) 64 | 65 | binaries = [ctypes.create_string_buffer(binary_sizes[i]) for i in range(len(self.device_array))] 66 | binary_pointers = (ctypes.c_char_p * len(self.device_array))(*map(ctypes.addressof, binaries)) 67 | cl.clGetProgramInfo(program, cl.CL_PROGRAM_BINARIES, ctypes.sizeof(binary_pointers), ctypes.byref(binary_pointers), None) 68 | 69 | assert binary_sizes[0] > 0 70 | assert len(binary_pointers[0]) > 0 71 | 72 | def test_run_program(self): 73 | program = cl_compile(self.context, self.device_array, """ 74 | __kernel void vector_add(__global int *A, __global const int *B, __global const int *C) { 75 | int i = get_global_id(0); 76 | A[i] = B[i] + C[i]; 77 | }""") 78 | status = ctypes.c_int32() 79 | kernel = cl.clCreateKernel(program, b"vector_add", ctypes.byref(status)) 80 | check(status.value) 81 | assert kernel is not None 82 | 83 | A = (ctypes.c_int32 * 5)() 84 | B = (ctypes.c_int32 * 5)(1, 2, 3, 4, 5) 85 | C = (ctypes.c_int32 * 5)(5, 4, 3, 2, 1) 86 | 87 | bufA = cl.clCreateBuffer(self.context, cl.CL_MEM_WRITE_ONLY, ctypes.sizeof(A), None, ctypes.byref(status)) 88 | bufB = cl.clCreateBuffer(self.context, cl.CL_MEM_READ_ONLY | cl.CL_MEM_COPY_HOST_PTR, ctypes.sizeof(B), ctypes.byref(B), ctypes.byref(status)) 89 | bufC = cl.clCreateBuffer(self.context, cl.CL_MEM_READ_ONLY | cl.CL_MEM_COPY_HOST_PTR, ctypes.sizeof(C), ctypes.byref(C), ctypes.byref(status)) 90 | cl.clSetKernelArg(kernel, 0, ctypes.sizeof(bufA), ctypes.byref(bufA)) 91 | cl.clSetKernelArg(kernel, 1, ctypes.sizeof(bufB), ctypes.byref(bufB)) 92 | cl.clSetKernelArg(kernel, 2, ctypes.sizeof(bufC), ctypes.byref(bufC)) 93 | 94 | global_size = ctypes.c_size_t(5) 95 | cl.clEnqueueNDRangeKernel(self.queue, kernel, 1, None, ctypes.byref(global_size), None, 0, None, None) 96 | cl.clFinish(self.queue) 97 | cl.clEnqueueReadBuffer(self.queue, bufA, cl.CL_TRUE, 0, ctypes.sizeof(A), ctypes.byref(A), 0, None, None) 98 | self.assertEqual(list(A), [6, 6, 6, 6, 6]) 99 | 100 | if __name__ == '__main__': 101 | unittest.main() 102 | --------------------------------------------------------------------------------