opencl_ruby_ffi 1.3.6 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,6 @@
1
1
  using OpenCLRefinements if RUBY_VERSION.scan(/\d+/).collect(&:to_i).first >= 2
2
2
  # Maps the OpenCL API using FFI
3
3
  module OpenCL
4
- begin
5
- if ENV["LIBOPENCL_SO"]
6
- ffi_lib ENV["LIBOPENCL_SO"]
7
- else
8
- raise LoadError
9
- end
10
- rescue LoadError => e
11
- begin
12
- ffi_lib "OpenCL"
13
- rescue LoadError => e
14
- begin
15
- ffi_lib "libOpenCL.so.1"
16
- rescue LoadError => e
17
- begin
18
- ffi_lib '/System/Library/Frameworks/OpenCL.framework/OpenCL'
19
- rescue LoadError => e
20
- raise "OpenCL implementation not found!"
21
- end
22
- end
23
- end
24
- end
25
4
  SUCCESS = 0
26
5
  DEVICE_NOT_FOUND = -1
27
6
  DEVICE_NOT_AVAILABLE = -2
@@ -102,6 +81,8 @@ module OpenCL
102
81
  PLATFORM_VENDOR = 0x0903
103
82
  PLATFORM_EXTENSIONS = 0x0904
104
83
  PLATFORM_HOST_TIMER_RESOLUTION = 0x0905
84
+ PLATFORM_NUMERIC_VERSION = 0x0906
85
+ PLATFORM_EXTENSIONS_WITH_VERSION = 0x0907
105
86
  DEVICE_TYPE_DEFAULT = (1 << 0)
106
87
  DEVICE_TYPE_CPU = (1 << 1)
107
88
  DEVICE_TYPE_GPU = (1 << 2)
@@ -201,6 +182,20 @@ module OpenCL
201
182
  DEVICE_IL_VERSION = 0x105B
202
183
  DEVICE_MAX_NUM_SUB_GROUPS = 0x105C
203
184
  DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS = 0x105D
185
+ DEVICE_NUMERIC_VERSION = 0x105E
186
+ DEVICE_EXTENSIONS_WITH_VERSION = 0x1060
187
+ DEVICE_ILS_WITH_VERSION = 0x1061
188
+ DEVICE_BUILT_IN_KERNELS_WITH_VERSION = 0x1062
189
+ DEVICE_ATOMIC_MEMORY_CAPABILITIES = 0x1063
190
+ DEVICE_ATOMIC_FENCE_CAPABILITIES = 0x1064
191
+ DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT = 0x1065
192
+ DEVICE_OPENCL_C_ALL_VERSIONS = 0x1066
193
+ DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x1067
194
+ DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT = 0x1068
195
+ DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT = 0x1069
196
+ DEVICE_OPENCL_C_FEATURES = 0x106F
197
+ DEVICE_DEVICE_ENQUEUE_SUPPORT = 0x1070
198
+ DEVICE_PIPE_SUPPORT = 0x1071
204
199
  FP_DENORM = (1 << 0)
205
200
  FP_INF_NAN = (1 << 1)
206
201
  FP_ROUND_TO_NEAREST = (1 << 2)
@@ -240,12 +235,20 @@ module OpenCL
240
235
  DEVICE_SVM_FINE_GRAIN_BUFFER = (1 << 1)
241
236
  DEVICE_SVM_FINE_GRAIN_SYSTEM = (1 << 2)
242
237
  DEVICE_SVM_ATOMICS = (1 << 3)
238
+ DEVICE_ATOMIC_ORDER_RELAXED = (1 << 0)
239
+ DEVICE_ATOMIC_ORDER_ACQ_REL = (1 << 1)
240
+ DEVICE_ATOMIC_ORDER_SEQ_CST = (1 << 2)
241
+ DEVICE_ATOMIC_SCOPE_WORK_ITEM = (1 << 3)
242
+ DEVICE_ATOMIC_SCOPE_WORK_GROUP = (1 << 4)
243
+ DEVICE_ATOMIC_SCOPE_DEVICE = (1 << 5)
244
+ DEVICE_ATOMIC_SCOPE_ALL_DEVICES = (1 << 6)
243
245
  QUEUE_CONTEXT = 0x1090
244
246
  QUEUE_DEVICE = 0x1091
245
247
  QUEUE_REFERENCE_COUNT = 0x1092
246
248
  QUEUE_PROPERTIES = 0x1093
247
249
  QUEUE_SIZE = 0x1094
248
250
  QUEUE_DEVICE_DEFAULT = 0x1095
251
+ QUEUE_PROPERTIES_ARRAY = 0x1098
249
252
  MEM_READ_WRITE = (1 << 0)
250
253
  MEM_WRITE_ONLY = (1 << 1)
251
254
  MEM_READ_ONLY = (1 << 2)
@@ -323,6 +326,7 @@ module OpenCL
323
326
  MEM_ASSOCIATED_MEMOBJECT = 0x1107
324
327
  MEM_OFFSET = 0x1108
325
328
  MEM_USES_SVM_POINTER = 0x1109
329
+ MEM_PROPERTIES = 0x110A
326
330
  IMAGE_FORMAT = 0x1110
327
331
  IMAGE_ELEMENT_SIZE = 0x1111
328
332
  IMAGE_ROW_PITCH = 0x1112
@@ -336,6 +340,7 @@ module OpenCL
336
340
  IMAGE_NUM_SAMPLES = 0x111A
337
341
  PIPE_PACKET_SIZE = 0x1120
338
342
  PIPE_MAX_PACKETS = 0x1121
343
+ PIPE_PROPERTIES = 0x1122
339
344
  ADDRESS_NONE = 0x1130
340
345
  ADDRESS_CLAMP_TO_EDGE = 0x1131
341
346
  ADDRESS_CLAMP = 0x1132
@@ -451,6 +456,7 @@ module OpenCL
451
456
  COMMAND_SVM_MEMFILL = 0x120B
452
457
  COMMAND_SVM_MAP = 0x120C
453
458
  COMMAND_SVM_UNMAP = 0x120D
459
+ COMMAND_SVM_MIGRATE_MEM = 0x120E
454
460
  COMPLETE = 0x0
455
461
  RUNNING = 0x1
456
462
  SUBMITTED = 0x2
@@ -482,6 +488,13 @@ module OpenCL
482
488
  MEM_HOST_WRITETHROUGH_QCOM = 0x40A6
483
489
  MEM_HOST_WRITE_COMBINING_QCOM = 0x40A7
484
490
  MEM_ION_HOST_PTR_QCOM = 0x40A8
491
+ NAME_VERSION_MAX_NAME_SIZE = 64
492
+ VERSION_MAJOR_BITS = 10
493
+ VERSION_MINOR_BITS = 10
494
+ VERSION_PATCH_BITS = 12
495
+ VERSION_MAJOR_MASK = (1 << VERSION_MAJOR_BITS) - 1
496
+ VERSION_MINOR_MASK = (1 << VERSION_MINOR_BITS) - 1
497
+ VERSION_PATCH_MASK = (1 << VERSION_PATCH_BITS) - 1
485
498
  # Parent class to map OpenCL errors, and is used to raise unknown errors
486
499
  class Error < StandardError
487
500
  attr_reader :code
@@ -695,8 +708,7 @@ EOF
695
708
 
696
709
  # Returns true if flag is bitwise included in the Bitfield
697
710
  def include?(flag)
698
- return true if ( @val & flag ) == flag
699
- return false
711
+ return ( @val & flag ) == flag
700
712
  end
701
713
 
702
714
  # Returns a String corresponding to the Bitfield description
@@ -744,7 +756,7 @@ EOF
744
756
  return @val
745
757
  end
746
758
 
747
- # Setss the internal representation of the Bitfield to val
759
+ # Sets the internal representation of the Bitfield to val
748
760
  def flags=(val)
749
761
  @val = val
750
762
  end
@@ -799,6 +811,8 @@ EOF
799
811
  VENDOR = 0x0903
800
812
  EXTENSIONS = 0x0904
801
813
  HOST_TIMER_RESOLUTION = 0x0905
814
+ NUMERIC_VERSION = 0x0906
815
+ EXTENSIONS_WITH_VERSION = 0x0907
802
816
 
803
817
  # Creates a new Platform and retains it if specified and aplicable
804
818
  def initialize(ptr, retain = true)
@@ -914,6 +928,20 @@ EOF
914
928
  IL_VERSION = 0x105B
915
929
  MAX_NUM_SUB_GROUPS = 0x105C
916
930
  SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS = 0x105D
931
+ NUMERIC_VERSION = 0x105E
932
+ EXTENSIONS_WITH_VERSION = 0x1060
933
+ ILS_WITH_VERSION = 0x1061
934
+ BUILT_IN_KERNELS_WITH_VERSION = 0x1062
935
+ ATOMIC_MEMORY_CAPABILITIES = 0x1063
936
+ ATOMIC_FENCE_CAPABILITIES = 0x1064
937
+ NON_UNIFORM_WORK_GROUP_SUPPORT = 0x1065
938
+ OPENCL_C_ALL_VERSIONS = 0x1066
939
+ PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x1067
940
+ WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT = 0x1068
941
+ GENERIC_ADDRESS_SPACE_SUPPORT = 0x1069
942
+ OPENCL_C_FEATURES = 0x106F
943
+ DEVICE_ENQUEUE_SUPPORT = 0x1070
944
+ PIPE_SUPPORT = 0x1071
917
945
  PARTITION_EQUALLY = 0x1086
918
946
  PARTITION_BY_COUNTS = 0x1087
919
947
  PARTITION_BY_COUNTS_LIST_END = 0x0
@@ -929,6 +957,13 @@ EOF
929
957
  SVM_FINE_GRAIN_SYSTEM = (1 << 2)
930
958
  SVM_ATOMICS = (1 << 3)
931
959
  PAGE_SIZE_QCOM = 0x40A1
960
+ ATOMIC_ORDER_RELAXED = (1 << 0)
961
+ ATOMIC_ORDER_ACQ_REL = (1 << 1)
962
+ ATOMIC_ORDER_SEQ_CST = (1 << 2)
963
+ ATOMIC_SCOPE_WORK_ITEM = (1 << 3)
964
+ ATOMIC_SCOPE_WORK_GROUP = (1 << 4)
965
+ ATOMIC_SCOPE_DEVICE = (1 << 5)
966
+ ATOMIC_SCOPE_ALL_DEVICES = (1 << 6)
932
967
 
933
968
  #DEFINED in ext/device_fission.rb
934
969
  # # Creates a new Device and retains it if specified and aplicable
@@ -1079,6 +1114,25 @@ EOF
1079
1114
  end
1080
1115
  end
1081
1116
 
1117
+ # Bitfield that maps the :cl_device_atomic_capabilities
1118
+ class AtomicCapabilities < Bitfield
1119
+ ORDER_RELAXED = (1 << 0)
1120
+ ORDER_ACQ_REL = (1 << 1)
1121
+ ORDER_SEQ_CST = (1 << 2)
1122
+ SCOPE_WORK_ITEM = (1 << 3)
1123
+ SCOPE_WORK_GROUP = (1 << 4)
1124
+ SCOPE_DEVICE = (1 << 5)
1125
+ SCOPE_ALL_DEVICES = (1 << 6)
1126
+ # Returns an Array of String representing the different flags set
1127
+ def names
1128
+ fs = []
1129
+ %w( ORDER_RELAXED ORDER_ACQ_REL ORDER_SEQ_CST SCOPE_WORK_ITEM SCOPE_WORK_GROUP SCOPE_DEVICE SCOPE_ALL_DEVICES ).each { |f|
1130
+ fs.push(f) if self.include?( self.class.const_get(f) )
1131
+ }
1132
+ return fs
1133
+ end
1134
+ end
1135
+
1082
1136
  end
1083
1137
  class Context < ExtendedStruct
1084
1138
  layout :dummy, :pointer
@@ -1132,6 +1186,7 @@ EOF
1132
1186
  PROPERTIES = 0x1093
1133
1187
  SIZE = 0x1094
1134
1188
  DEVICE_DEFAULT = 0x1095
1189
+ PROPERTIES_ARRAY = 0x1098
1135
1190
  # Creates a new CommandQueue and retains it if specified and aplicable
1136
1191
  def initialize(ptr, retain = true)
1137
1192
  super(ptr)
@@ -1202,6 +1257,7 @@ EOF
1202
1257
  ASSOCIATED_MEMOBJECT = 0x1107
1203
1258
  OFFSET = 0x1108
1204
1259
  USES_SVM_POINTER = 0x1109
1260
+ PROPERTIES = 0x110A
1205
1261
  HOST_UNCACHED_QCOM = 0x40A4
1206
1262
  HOST_WRITEBACK_QCOM = 0x40A5
1207
1263
  HOST_WRITETHROUGH_QCOM = 0x40A6
@@ -1737,6 +1793,7 @@ EOF
1737
1793
  SVM_MEMFILL = 0x120B
1738
1794
  SVM_MAP = 0x120C
1739
1795
  SVM_UNMAP = 0x120D
1796
+ SVM_MIGRATE_MEM = 0x120E
1740
1797
  @codes = {}
1741
1798
  @codes[0x11F0] = 'NDRANGE_KERNEL'
1742
1799
  @codes[0x11F1] = 'TASK'
@@ -1768,6 +1825,7 @@ EOF
1768
1825
  @codes[0x120B] = 'SVM_MEMFILL'
1769
1826
  @codes[0x120C] = 'SVM_MAP'
1770
1827
  @codes[0x120D] = 'SVM_UNMAP'
1828
+ @codes[0x120E] = 'SVM_MIGRATE_MEM'
1771
1829
  end
1772
1830
 
1773
1831
  # Enum that maps the :cl_gl_object_type type
@@ -1839,154 +1897,6 @@ EOF
1839
1897
  layout :dummy, :pointer
1840
1898
  PACKET_SIZE = 0x1120
1841
1899
  MAX_PACKETS = 0x1121
1842
- end
1843
- attach_function :clGetPlatformIDs, [:cl_uint,:pointer,:pointer], :cl_int
1844
- attach_function :clGetPlatformInfo, [Platform,:cl_platform_info,:size_t,:pointer,:pointer], :cl_int
1845
- attach_function :clGetDeviceIDs, [Platform,:cl_device_type,:cl_uint,:pointer,:pointer], :cl_int
1846
- attach_function :clGetDeviceInfo, [Device,:cl_device_info,:size_t,:pointer,:pointer], :cl_int
1847
- callback :clCreateContext_notify, [:string,:pointer,:size_t,:pointer], :void
1848
- attach_function :clCreateContext, [:pointer,:cl_uint,:pointer,:clCreateContext_notify,:pointer,:pointer], Context
1849
- callback :clCreateContextFromType_notify, [:string,:pointer,:size_t,:pointer], :void
1850
- attach_function :clCreateContextFromType, [:pointer,:cl_device_type,:clCreateContextFromType_notify,:pointer,:pointer], Context
1851
- attach_function :clRetainContext, [Context], :cl_int
1852
- attach_function :clReleaseContext, [Context], :cl_int
1853
- attach_function :clGetContextInfo, [Context,:cl_context_info,:size_t,:pointer,:pointer], :cl_int
1854
- attach_function :clRetainCommandQueue, [CommandQueue], :cl_int
1855
- attach_function :clReleaseCommandQueue, [CommandQueue], :cl_int
1856
- attach_function :clGetCommandQueueInfo, [CommandQueue,:cl_command_queue_info,:size_t,:pointer,:pointer], :cl_int
1857
- attach_function :clCreateBuffer, [Context,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
1858
- attach_function :clRetainMemObject, [Mem], :cl_int
1859
- attach_function :clReleaseMemObject, [Mem], :cl_int
1860
- attach_function :clGetSupportedImageFormats, [Context,:cl_mem_flags,:cl_mem_object_type,:cl_uint,:pointer,:pointer], :cl_int
1861
- attach_function :clGetMemObjectInfo, [Mem,:cl_mem_info,:size_t,:pointer,:pointer], :cl_int
1862
- attach_function :clGetImageInfo, [Mem,:cl_image_info,:size_t,:pointer,:pointer], :cl_int
1863
- attach_function :clRetainSampler, [Sampler], :cl_int
1864
- attach_function :clReleaseSampler, [Sampler], :cl_int
1865
- attach_function :clGetSamplerInfo, [Sampler,:cl_sampler_info,:size_t,:pointer,:pointer], :cl_int
1866
- attach_function :clCreateProgramWithSource, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
1867
- attach_function :clCreateProgramWithBinary, [Context,:cl_uint,:pointer,:pointer,:pointer,:pointer,:pointer], Program
1868
- attach_function :clRetainProgram, [Program], :cl_int
1869
- attach_function :clReleaseProgram, [Program], :cl_int
1870
- callback :clBuildProgram_notify, [Program.by_ref,:pointer], :void
1871
- attach_function :clBuildProgram, [Program,:cl_uint,:pointer,:pointer,:clBuildProgram_notify,:pointer], :cl_int
1872
- attach_function :clGetProgramInfo, [Program,:cl_program_info,:size_t,:pointer,:pointer], :cl_int
1873
- attach_function :clGetProgramBuildInfo, [Program,Device,:cl_program_build_info,:size_t,:pointer,:pointer], :cl_int
1874
- attach_function :clCreateKernel, [Program,:pointer,:pointer], Kernel
1875
- attach_function :clCreateKernelsInProgram, [Program,:cl_uint,:pointer,:pointer], :cl_int
1876
- attach_function :clRetainKernel, [Kernel], :cl_int
1877
- attach_function :clReleaseKernel, [Kernel], :cl_int
1878
- attach_function :clSetKernelArg, [Kernel,:cl_uint,:size_t,:pointer], :cl_int
1879
- attach_function :clGetKernelInfo, [Kernel,:cl_kernel_info,:size_t,:pointer,:pointer], :cl_int
1880
- attach_function :clGetKernelWorkGroupInfo, [Kernel,Device,:cl_kernel_work_group_info,:size_t,:pointer,:pointer], :cl_int
1881
- attach_function :clWaitForEvents, [:cl_uint,:pointer], :cl_int
1882
- attach_function :clGetEventInfo, [Event,:cl_event_info,:size_t,:pointer,:pointer], :cl_int
1883
- attach_function :clRetainEvent, [Event], :cl_int
1884
- attach_function :clReleaseEvent, [Event], :cl_int
1885
- attach_function :clGetEventProfilingInfo, [Event,:cl_profiling_info,:size_t,:pointer,:pointer], :cl_int
1886
- attach_function :clFlush, [CommandQueue], :cl_int
1887
- attach_function :clFinish, [CommandQueue], :cl_int
1888
- attach_function :clEnqueueReadBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1889
- attach_function :clEnqueueWriteBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1890
- attach_function :clEnqueueCopyBuffer, [CommandQueue,Mem,Mem,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1891
- attach_function :clEnqueueReadImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1892
- attach_function :clEnqueueWriteImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1893
- attach_function :clEnqueueCopyImage, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1894
- attach_function :clEnqueueCopyImageToBuffer, [CommandQueue,Mem,Mem,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1895
- attach_function :clEnqueueCopyBufferToImage, [CommandQueue,Mem,Mem,:size_t,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1896
- attach_function :clEnqueueMapBuffer, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:size_t,:size_t,:cl_uint,:pointer,:pointer,:pointer], :pointer
1897
- attach_function :clEnqueueMapImage, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:pointer,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer,:pointer], :pointer
1898
- attach_function :clEnqueueUnmapMemObject, [CommandQueue,Mem,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1899
- attach_function :clEnqueueNDRangeKernel, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1900
- callback :clEnqueueNativeKernel_notify, [:pointer], :void
1901
- attach_function :clEnqueueNativeKernel, [CommandQueue,:clEnqueueNativeKernel_notify,:pointer,:size_t,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1902
- attach_function :clCreateImage2D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
1903
- attach_function :clCreateImage3D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
1904
- attach_function :clEnqueueMarker, [CommandQueue,:pointer], :cl_int
1905
- attach_function :clEnqueueWaitForEvents, [CommandQueue,:cl_uint,:pointer], :cl_int
1906
- attach_function :clEnqueueBarrier, [CommandQueue], :cl_int
1907
- attach_function :clUnloadCompiler, [:void], :cl_int
1908
- attach_function :clGetExtensionFunctionAddress, [:pointer], :pointer
1909
- attach_function :clCreateCommandQueue, [Context,Device,:cl_command_queue_properties,:pointer], CommandQueue
1910
- attach_function :clCreateSampler, [Context,:cl_bool,:cl_addressing_mode,:cl_filter_mode,:pointer], Sampler
1911
- attach_function :clEnqueueTask, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer], :cl_int
1912
- attach_function :clCreateFromGLBuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
1913
- attach_function :clCreateFromGLRenderbuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
1914
- attach_function :clGetGLObjectInfo, [Mem,:pointer,:pointer], :cl_int
1915
- attach_function :clGetGLTextureInfo, [Mem,:cl_gl_texture_info,:size_t,:pointer,:pointer], :cl_int
1916
- attach_function :clEnqueueAcquireGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1917
- attach_function :clEnqueueReleaseGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1918
- attach_function :clCreateFromGLTexture2D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
1919
- attach_function :clCreateFromGLTexture3D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
1920
- begin # OpenCL 1.1
1921
- attach_function :clCreateSubBuffer, [Mem,:cl_mem_flags,:cl_buffer_create_type,:pointer,:pointer], Mem
1922
- attach_function :clEnqueueReadBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1923
- attach_function :clEnqueueWriteBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1924
- attach_function :clEnqueueCopyBufferRect, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1925
- callback :clSetMemObjectDestructorCallback_notify, [:pointer,:pointer], :void
1926
- attach_function :clSetMemObjectDestructorCallback, [Mem,:clSetMemObjectDestructorCallback_notify,:pointer], :cl_int
1927
- attach_function :clCreateUserEvent, [Context,:pointer], Event
1928
- attach_function :clSetUserEventStatus, [Event,:cl_int], :cl_int
1929
- callback :clSetEventCallback_notify, [Event.by_ref,:cl_int,:pointer], :void
1930
- attach_function :clSetEventCallback, [Event,:cl_int,:clSetEventCallback_notify,:pointer], :cl_int
1931
- begin # OpenCL 1.2
1932
- attach_function :clCreateSubDevices, [Device,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1933
- attach_function :clRetainDevice, [Device], :cl_int
1934
- attach_function :clReleaseDevice, [Device], :cl_int
1935
- attach_function :clCreateImage, [Context,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
1936
- attach_function :clCreateProgramWithBuiltInKernels, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
1937
- callback :clCompileProgram_notify, [Program.by_ref,:pointer], :void
1938
- attach_function :clCompileProgram, [Program,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer,:clCompileProgram_notify,:pointer], :cl_int
1939
- callback :clLinkProgram_notify, [Program.by_ref,:pointer], :void
1940
- attach_function :clLinkProgram, [Context,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:clLinkProgram_notify,:pointer,:pointer], Program
1941
- attach_function :clUnloadPlatformCompiler, [Platform], :cl_int
1942
- attach_function :clGetKernelArgInfo, [Kernel,:cl_uint,:cl_kernel_arg_info,:size_t,:pointer,:pointer], :cl_int
1943
- attach_function :clEnqueueFillBuffer, [CommandQueue,Mem,:pointer,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1944
- attach_function :clEnqueueFillImage, [CommandQueue,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1945
- attach_function :clEnqueueMigrateMemObjects, [CommandQueue,:cl_uint,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
1946
- attach_function :clEnqueueMarkerWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
1947
- attach_function :clEnqueueBarrierWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
1948
- attach_function :clGetExtensionFunctionAddressForPlatform, [Platform,:pointer], :pointer
1949
- attach_function :clCreateFromGLTexture, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
1950
- begin # OpenCL 2.0
1951
- attach_function :clCreateCommandQueueWithProperties, [Context,Device,:pointer,:pointer], CommandQueue
1952
- attach_function :clCreatePipe, [Context,:cl_mem_flags,:cl_uint,:cl_uint,:pointer,:pointer], Mem
1953
- attach_function :clGetPipeInfo, [Mem,:cl_pipe_info,:size_t,:pointer,:pointer], :cl_int
1954
- attach_function :clSVMAlloc, [Context,:cl_svm_mem_flags,:size_t,:cl_uint], :pointer
1955
- attach_function :clSVMFree, [Context,:pointer], :void
1956
- attach_function :clCreateSamplerWithProperties, [Context,:pointer,:pointer], Sampler
1957
- attach_function :clSetKernelArgSVMPointer, [Kernel,:cl_uint,:pointer], :cl_int
1958
- attach_function :clSetKernelExecInfo, [Kernel,:cl_kernel_exec_info,:size_t,:pointer], :cl_int
1959
- callback :clEnqueueSVMFree_notify, [CommandQueue.by_ref,:cl_uint,:pointer,:pointer], :void
1960
- attach_function :clEnqueueSVMFree, [CommandQueue,:cl_uint,:pointer,:clEnqueueSVMFree_notify,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1961
- attach_function :clEnqueueSVMMemcpy, [CommandQueue,:cl_bool,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1962
- attach_function :clEnqueueSVMMemFill, [CommandQueue,:pointer,:pointer,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1963
- attach_function :clEnqueueSVMMap, [CommandQueue,:cl_bool,:cl_map_flags,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
1964
- attach_function :clEnqueueSVMUnmap, [CommandQueue,:pointer,:cl_uint,:pointer,:pointer], :cl_int
1965
- begin # OpenCL 2.1
1966
- attach_function :clSetDefaultDeviceCommandQueue, [Context,Device,CommandQueue], :cl_int
1967
- attach_function :clGetDeviceAndHostTimer, [Device,:pointer,:pointer], :cl_int
1968
- attach_function :clGetHostTimer, [Device,:pointer], :cl_int
1969
- attach_function :clCreateProgramWithIL, [Context,:pointer,:size_t,:pointer], Program
1970
- attach_function :clCloneKernel, [Kernel,:pointer], Kernel
1971
- attach_function :clGetKernelSubGroupInfo, [Kernel,Device,:cl_kernel_sub_group_info,:size_t,:pointer,:size_t,:pointer,:pointer], :cl_int
1972
- attach_function :clEnqueueSVMMigrateMem, [CommandQueue,:cl_uint,:pointer,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
1973
- begin # OpenCL 2.2
1974
- callback :clSetProgramReleaseCallback_notify, [Program.by_ref,:pointer], :void
1975
- attach_function :clSetProgramReleaseCallback, [Program,:clSetProgramReleaseCallback_notify,:pointer], :cl_int
1976
- attach_function :clSetProgramSpecializationConstant, [Program,:cl_uint,:size_t,:pointer], :cl_int
1977
- rescue NotFoundError => e
1978
- warn "Warning OpenCL 2.1 loader detected!"
1979
- end
1980
- rescue NotFoundError => e
1981
- warn "Warning OpenCL 2.0 loader detected!"
1982
- end
1983
- rescue NotFoundError => e
1984
- warn "Warning OpenCL 1.2 loader detected!"
1985
- end
1986
- rescue NotFoundError => e
1987
- warn "Warning OpenCL 1.1 loader detected!"
1988
- end
1989
- rescue NotFoundError => e
1990
- warn "Warning OpenCL 1.0 loader detected!"
1900
+ PROPERTIES = 0x1122
1991
1901
  end
1992
1902
  end
@@ -0,0 +1,181 @@
1
+ using OpenCLRefinements if RUBY_VERSION.scan(/\d+/).collect(&:to_i).first >= 2
2
+ module OpenCL
3
+ begin
4
+ if ENV["LIBOPENCL_SO"]
5
+ ffi_lib ENV["LIBOPENCL_SO"]
6
+ else
7
+ raise LoadError
8
+ end
9
+ rescue LoadError
10
+ begin
11
+ ffi_lib "OpenCL"
12
+ rescue LoadError
13
+ begin
14
+ ffi_lib "libOpenCL.so.1"
15
+ rescue LoadError
16
+ begin
17
+ ffi_lib '/System/Library/Frameworks/OpenCL.framework/OpenCL'
18
+ rescue LoadError
19
+ raise "OpenCL implementation not found!"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ attach_function :clGetPlatformIDs, [:cl_uint,:pointer,:pointer], :cl_int
25
+ attach_function :clGetPlatformInfo, [Platform,:cl_platform_info,:size_t,:pointer,:pointer], :cl_int
26
+ attach_function :clGetDeviceIDs, [Platform,:cl_device_type,:cl_uint,:pointer,:pointer], :cl_int
27
+ attach_function :clGetDeviceInfo, [Device,:cl_device_info,:size_t,:pointer,:pointer], :cl_int
28
+ callback :clCreateContext_notify, [:string,:pointer,:size_t,:pointer], :void
29
+ attach_function :clCreateContext, [:pointer,:cl_uint,:pointer,:clCreateContext_notify,:pointer,:pointer], Context
30
+ callback :clCreateContextFromType_notify, [:string,:pointer,:size_t,:pointer], :void
31
+ attach_function :clCreateContextFromType, [:pointer,:cl_device_type,:clCreateContextFromType_notify,:pointer,:pointer], Context
32
+ attach_function :clRetainContext, [Context], :cl_int
33
+ attach_function :clReleaseContext, [Context], :cl_int
34
+ attach_function :clGetContextInfo, [Context,:cl_context_info,:size_t,:pointer,:pointer], :cl_int
35
+ attach_function :clRetainCommandQueue, [CommandQueue], :cl_int
36
+ attach_function :clReleaseCommandQueue, [CommandQueue], :cl_int
37
+ attach_function :clGetCommandQueueInfo, [CommandQueue,:cl_command_queue_info,:size_t,:pointer,:pointer], :cl_int
38
+ attach_function :clCreateBuffer, [Context,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
39
+ attach_function :clRetainMemObject, [Mem], :cl_int
40
+ attach_function :clReleaseMemObject, [Mem], :cl_int
41
+ attach_function :clGetSupportedImageFormats, [Context,:cl_mem_flags,:cl_mem_object_type,:cl_uint,:pointer,:pointer], :cl_int
42
+ attach_function :clGetMemObjectInfo, [Mem,:cl_mem_info,:size_t,:pointer,:pointer], :cl_int
43
+ attach_function :clGetImageInfo, [Mem,:cl_image_info,:size_t,:pointer,:pointer], :cl_int
44
+ attach_function :clRetainSampler, [Sampler], :cl_int
45
+ attach_function :clReleaseSampler, [Sampler], :cl_int
46
+ attach_function :clGetSamplerInfo, [Sampler,:cl_sampler_info,:size_t,:pointer,:pointer], :cl_int
47
+ attach_function :clCreateProgramWithSource, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
48
+ attach_function :clCreateProgramWithBinary, [Context,:cl_uint,:pointer,:pointer,:pointer,:pointer,:pointer], Program
49
+ attach_function :clRetainProgram, [Program], :cl_int
50
+ attach_function :clReleaseProgram, [Program], :cl_int
51
+ callback :clBuildProgram_notify, [Program.by_ref,:pointer], :void
52
+ attach_function :clBuildProgram, [Program,:cl_uint,:pointer,:pointer,:clBuildProgram_notify,:pointer], :cl_int
53
+ attach_function :clGetProgramInfo, [Program,:cl_program_info,:size_t,:pointer,:pointer], :cl_int
54
+ attach_function :clGetProgramBuildInfo, [Program,Device,:cl_program_build_info,:size_t,:pointer,:pointer], :cl_int
55
+ attach_function :clCreateKernel, [Program,:pointer,:pointer], Kernel
56
+ attach_function :clCreateKernelsInProgram, [Program,:cl_uint,:pointer,:pointer], :cl_int
57
+ attach_function :clRetainKernel, [Kernel], :cl_int
58
+ attach_function :clReleaseKernel, [Kernel], :cl_int
59
+ attach_function :clSetKernelArg, [Kernel,:cl_uint,:size_t,:pointer], :cl_int
60
+ attach_function :clGetKernelInfo, [Kernel,:cl_kernel_info,:size_t,:pointer,:pointer], :cl_int
61
+ attach_function :clGetKernelWorkGroupInfo, [Kernel,Device,:cl_kernel_work_group_info,:size_t,:pointer,:pointer], :cl_int
62
+ attach_function :clWaitForEvents, [:cl_uint,:pointer], :cl_int
63
+ attach_function :clGetEventInfo, [Event,:cl_event_info,:size_t,:pointer,:pointer], :cl_int
64
+ attach_function :clRetainEvent, [Event], :cl_int
65
+ attach_function :clReleaseEvent, [Event], :cl_int
66
+ attach_function :clGetEventProfilingInfo, [Event,:cl_profiling_info,:size_t,:pointer,:pointer], :cl_int
67
+ attach_function :clFlush, [CommandQueue], :cl_int
68
+ attach_function :clFinish, [CommandQueue], :cl_int
69
+ attach_function :clEnqueueReadBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
70
+ attach_function :clEnqueueWriteBuffer, [CommandQueue,Mem,:cl_bool,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
71
+ attach_function :clEnqueueCopyBuffer, [CommandQueue,Mem,Mem,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
72
+ attach_function :clEnqueueReadImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
73
+ attach_function :clEnqueueWriteImage, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
74
+ attach_function :clEnqueueCopyImage, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
75
+ attach_function :clEnqueueCopyImageToBuffer, [CommandQueue,Mem,Mem,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
76
+ attach_function :clEnqueueCopyBufferToImage, [CommandQueue,Mem,Mem,:size_t,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
77
+ attach_function :clEnqueueMapBuffer, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:size_t,:size_t,:cl_uint,:pointer,:pointer,:pointer], :pointer
78
+ attach_function :clEnqueueMapImage, [CommandQueue,Mem,:cl_bool,:cl_map_flags,:pointer,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer,:pointer], :pointer
79
+ attach_function :clEnqueueUnmapMemObject, [CommandQueue,Mem,:pointer,:cl_uint,:pointer,:pointer], :cl_int
80
+ attach_function :clEnqueueNDRangeKernel, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
81
+ callback :clEnqueueNativeKernel_notify, [:pointer], :void
82
+ attach_function :clEnqueueNativeKernel, [CommandQueue,:clEnqueueNativeKernel_notify,:pointer,:size_t,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
83
+ attach_function :clCreateImage2D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
84
+ attach_function :clCreateImage3D, [Context,:cl_mem_flags,:pointer,:size_t,:size_t,:size_t,:size_t,:size_t,:pointer,:pointer], Mem
85
+ attach_function :clEnqueueMarker, [CommandQueue,:pointer], :cl_int
86
+ attach_function :clEnqueueWaitForEvents, [CommandQueue,:cl_uint,:pointer], :cl_int
87
+ attach_function :clEnqueueBarrier, [CommandQueue], :cl_int
88
+ attach_function :clUnloadCompiler, [:void], :cl_int
89
+ attach_function :clGetExtensionFunctionAddress, [:pointer], :pointer
90
+ attach_function :clCreateCommandQueue, [Context,Device,:cl_command_queue_properties,:pointer], CommandQueue
91
+ attach_function :clCreateSampler, [Context,:cl_bool,:cl_addressing_mode,:cl_filter_mode,:pointer], Sampler
92
+ attach_function :clEnqueueTask, [CommandQueue,Kernel,:cl_uint,:pointer,:pointer], :cl_int
93
+ attach_function :clCreateFromGLBuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
94
+ attach_function :clCreateFromGLRenderbuffer, [Context,:cl_mem_flags,:cl_GLuint,:pointer], Mem
95
+ attach_function :clGetGLObjectInfo, [Mem,:pointer,:pointer], :cl_int
96
+ attach_function :clGetGLTextureInfo, [Mem,:cl_gl_texture_info,:size_t,:pointer,:pointer], :cl_int
97
+ attach_function :clEnqueueAcquireGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
98
+ attach_function :clEnqueueReleaseGLObjects, [CommandQueue,:cl_uint,:pointer,:cl_uint,:pointer,:pointer], :cl_int
99
+ attach_function :clCreateFromGLTexture2D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
100
+ attach_function :clCreateFromGLTexture3D, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
101
+ begin # OpenCL 1.1
102
+ attach_function :clCreateSubBuffer, [Mem,:cl_mem_flags,:cl_buffer_create_type,:pointer,:pointer], Mem
103
+ attach_function :clEnqueueReadBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
104
+ attach_function :clEnqueueWriteBufferRect, [CommandQueue,Mem,:cl_bool,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:pointer,:cl_uint,:pointer,:pointer], :cl_int
105
+ attach_function :clEnqueueCopyBufferRect, [CommandQueue,Mem,Mem,:pointer,:pointer,:pointer,:size_t,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
106
+ callback :clSetMemObjectDestructorCallback_notify, [:pointer,:pointer], :void
107
+ attach_function :clSetMemObjectDestructorCallback, [Mem,:clSetMemObjectDestructorCallback_notify,:pointer], :cl_int
108
+ attach_function :clCreateUserEvent, [Context,:pointer], Event
109
+ attach_function :clSetUserEventStatus, [Event,:cl_int], :cl_int
110
+ callback :clSetEventCallback_notify, [Event.by_ref,:cl_int,:pointer], :void
111
+ attach_function :clSetEventCallback, [Event,:cl_int,:clSetEventCallback_notify,:pointer], :cl_int
112
+ begin # OpenCL 1.2
113
+ attach_function :clCreateSubDevices, [Device,:pointer,:cl_uint,:pointer,:pointer], :cl_int
114
+ attach_function :clRetainDevice, [Device], :cl_int
115
+ attach_function :clReleaseDevice, [Device], :cl_int
116
+ attach_function :clCreateImage, [Context,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
117
+ attach_function :clCreateProgramWithBuiltInKernels, [Context,:cl_uint,:pointer,:pointer,:pointer], Program
118
+ callback :clCompileProgram_notify, [Program.by_ref,:pointer], :void
119
+ attach_function :clCompileProgram, [Program,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:pointer,:clCompileProgram_notify,:pointer], :cl_int
120
+ callback :clLinkProgram_notify, [Program.by_ref,:pointer], :void
121
+ attach_function :clLinkProgram, [Context,:cl_uint,:pointer,:pointer,:cl_uint,:pointer,:clLinkProgram_notify,:pointer,:pointer], Program
122
+ attach_function :clUnloadPlatformCompiler, [Platform], :cl_int
123
+ attach_function :clGetKernelArgInfo, [Kernel,:cl_uint,:cl_kernel_arg_info,:size_t,:pointer,:pointer], :cl_int
124
+ attach_function :clEnqueueFillBuffer, [CommandQueue,Mem,:pointer,:size_t,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
125
+ attach_function :clEnqueueFillImage, [CommandQueue,Mem,:pointer,:pointer,:pointer,:cl_uint,:pointer,:pointer], :cl_int
126
+ attach_function :clEnqueueMigrateMemObjects, [CommandQueue,:cl_uint,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
127
+ attach_function :clEnqueueMarkerWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
128
+ attach_function :clEnqueueBarrierWithWaitList, [CommandQueue,:cl_uint,:pointer,:pointer], :cl_int
129
+ attach_function :clGetExtensionFunctionAddressForPlatform, [Platform,:pointer], :pointer
130
+ attach_function :clCreateFromGLTexture, [Context,:cl_mem_flags,:cl_GLenum,:cl_GLint,:cl_GLuint,:pointer], Mem
131
+ begin # OpenCL 2.0
132
+ attach_function :clCreateCommandQueueWithProperties, [Context,Device,:pointer,:pointer], CommandQueue
133
+ attach_function :clCreatePipe, [Context,:cl_mem_flags,:cl_uint,:cl_uint,:pointer,:pointer], Mem
134
+ attach_function :clGetPipeInfo, [Mem,:cl_pipe_info,:size_t,:pointer,:pointer], :cl_int
135
+ attach_function :clSVMAlloc, [Context,:cl_svm_mem_flags,:size_t,:cl_uint], :pointer
136
+ attach_function :clSVMFree, [Context,:pointer], :void
137
+ attach_function :clCreateSamplerWithProperties, [Context,:pointer,:pointer], Sampler
138
+ attach_function :clSetKernelArgSVMPointer, [Kernel,:cl_uint,:pointer], :cl_int
139
+ attach_function :clSetKernelExecInfo, [Kernel,:cl_kernel_exec_info,:size_t,:pointer], :cl_int
140
+ callback :clEnqueueSVMFree_notify, [CommandQueue.by_ref,:cl_uint,:pointer,:pointer], :void
141
+ attach_function :clEnqueueSVMFree, [CommandQueue,:cl_uint,:pointer,:clEnqueueSVMFree_notify,:pointer,:cl_uint,:pointer,:pointer], :cl_int
142
+ attach_function :clEnqueueSVMMemcpy, [CommandQueue,:cl_bool,:pointer,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
143
+ attach_function :clEnqueueSVMMemFill, [CommandQueue,:pointer,:pointer,:size_t,:size_t,:cl_uint,:pointer,:pointer], :cl_int
144
+ attach_function :clEnqueueSVMMap, [CommandQueue,:cl_bool,:cl_map_flags,:pointer,:size_t,:cl_uint,:pointer,:pointer], :cl_int
145
+ attach_function :clEnqueueSVMUnmap, [CommandQueue,:pointer,:cl_uint,:pointer,:pointer], :cl_int
146
+ begin # OpenCL 2.1
147
+ attach_function :clSetDefaultDeviceCommandQueue, [Context,Device,CommandQueue], :cl_int
148
+ attach_function :clGetDeviceAndHostTimer, [Device,:pointer,:pointer], :cl_int
149
+ attach_function :clGetHostTimer, [Device,:pointer], :cl_int
150
+ attach_function :clCreateProgramWithIL, [Context,:pointer,:size_t,:pointer], Program
151
+ attach_function :clCloneKernel, [Kernel,:pointer], Kernel
152
+ attach_function :clGetKernelSubGroupInfo, [Kernel,Device,:cl_kernel_sub_group_info,:size_t,:pointer,:size_t,:pointer,:pointer], :cl_int
153
+ attach_function :clEnqueueSVMMigrateMem, [CommandQueue,:cl_uint,:pointer,:pointer,:cl_mem_migration_flags,:cl_uint,:pointer,:pointer], :cl_int
154
+ begin # OpenCL 2.2
155
+ callback :clSetProgramReleaseCallback_notify, [Program.by_ref,:pointer], :void
156
+ attach_function :clSetProgramReleaseCallback, [Program,:clSetProgramReleaseCallback_notify,:pointer], :cl_int
157
+ attach_function :clSetProgramSpecializationConstant, [Program,:cl_uint,:size_t,:pointer], :cl_int
158
+ begin # OpenCL 3.0
159
+ attach_function :clCreateBufferWithProperties, [Context,:pointer,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
160
+ attach_function :clCreateImageWithProperties, [Context,:pointer,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
161
+ callback :clSetContextDestructorCallback_notify, [Context.by_ref,:pointer], :void
162
+ attach_function :clSetContextDestructorCallback, [Context,:clSetContextDestructorCallback_notify,:pointer], :cl_int
163
+ rescue NotFoundError
164
+ warn "Warning OpenCL 2.2 loader detected!"
165
+ end
166
+ rescue NotFoundError
167
+ warn "Warning OpenCL 2.1 loader detected!"
168
+ end
169
+ rescue NotFoundError
170
+ warn "Warning OpenCL 2.0 loader detected!"
171
+ end
172
+ rescue NotFoundError
173
+ warn "Warning OpenCL 1.2 loader detected!"
174
+ end
175
+ rescue NotFoundError
176
+ warn "Warning OpenCL 1.1 loader detected!"
177
+ end
178
+ rescue NotFoundError
179
+ warn "Warning OpenCL 1.0 loader detected!"
180
+ end
181
+ end