opencl_ruby_ffi 1.3.7 → 1.3.8
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.
- checksums.yaml +4 -4
- data/lib/opencl_ruby_ffi/Buffer.rb +7 -1
- data/lib/opencl_ruby_ffi/CommandQueue.rb +9 -2
- data/lib/opencl_ruby_ffi/Context.rb +66 -2
- data/lib/opencl_ruby_ffi/Device.rb +84 -4
- data/lib/opencl_ruby_ffi/Image.rb +7 -1
- data/lib/opencl_ruby_ffi/Mem.rb +6 -0
- data/lib/opencl_ruby_ffi/Pipe.rb +8 -0
- data/lib/opencl_ruby_ffi/Platform.rb +25 -0
- data/lib/opencl_ruby_ffi/ext.rb +1 -0
- data/lib/opencl_ruby_ffi/khr/device_uuid.rb +119 -0
- data/lib/opencl_ruby_ffi/opencl_ruby_ffi_base.rb +88 -20
- data/lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb +91 -3
- data/lib/opencl_ruby_ffi/opencl_types.rb +4 -0
- data/opencl_ruby_ffi.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 409ed20eac2dc9aa0d410563053699e18528cd62471903fd862ee2f31bb60a81
|
4
|
+
data.tar.gz: 670b281a4ab283be7a8c429474008e9e280987e8d81bc5222a853c32a10a569b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9301ea0a86feed2d72684a63366ad1b6862cd8238497854b768044814940c3f7ec39a7badfa11d56cead96d0c01fddb64092b56d1399d5a8395ce6d9305754f9
|
7
|
+
data.tar.gz: 8fa725c1e61931b3d9cdff0cf5d557055398ecf058d56289a72bca1ee3d2e54f80d279266e2185177ac59f9386f32422054e6437e19f23f452a65c060c45fe0c
|
@@ -13,11 +13,17 @@ module OpenCL
|
|
13
13
|
#
|
14
14
|
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Buffer
|
15
15
|
# * +:host_ptr+ - if provided, the Pointer (or convertible to Pointer using to_ptr) to the memory area to use
|
16
|
+
# * +:properties+ - if provided, an array of :cl_mem_properties (OpenCL 3.0)
|
16
17
|
def self.create_buffer( context, size, options = {} )
|
17
18
|
flags = get_flags( options )
|
18
19
|
host_ptr = options[:host_ptr]
|
19
20
|
error = MemoryPointer::new( :cl_int )
|
20
|
-
|
21
|
+
if context.platform.version_number < 3.0 then
|
22
|
+
buff = clCreateBuffer(context, flags, size, host_ptr, error)
|
23
|
+
else
|
24
|
+
properties = get_mem_properties( options )
|
25
|
+
buff = clCreateBufferWithProperties(context, properties, flags, size, host_ptr, error)
|
26
|
+
end
|
21
27
|
error_check(error.read_cl_int)
|
22
28
|
return Buffer::new( buff, false )
|
23
29
|
end
|
@@ -566,7 +566,7 @@ module OpenCL
|
|
566
566
|
objs = nil
|
567
567
|
if num_objs > 0 then
|
568
568
|
objs = MemoryPointer::new( Mem, num_objs )
|
569
|
-
[mem_objects].flatten.each_with_index { |
|
569
|
+
[mem_objects].flatten.each_with_index { |e, i|
|
570
570
|
objs[i].write_pointer(e)
|
571
571
|
}
|
572
572
|
end
|
@@ -600,7 +600,7 @@ module OpenCL
|
|
600
600
|
objs = nil
|
601
601
|
if num_objs > 0 then
|
602
602
|
objs = MemoryPointer::new( Mem, num_objs )
|
603
|
-
[mem_objects].flatten.each_with_index { |
|
603
|
+
[mem_objects].flatten.each_with_index { |e, i|
|
604
604
|
objs[i].write_pointer(e)
|
605
605
|
}
|
606
606
|
end
|
@@ -1790,10 +1790,17 @@ module OpenCL
|
|
1790
1790
|
|
1791
1791
|
end
|
1792
1792
|
|
1793
|
+
module OpenCL30
|
1794
|
+
extend InnerGenerator
|
1795
|
+
|
1796
|
+
get_info_array("CommandQueue", :cl_queue_properties, "properties_array")
|
1797
|
+
end
|
1798
|
+
|
1793
1799
|
register_extension( :v11, OpenCL11, "device.platform.version_number >= 1.1" )
|
1794
1800
|
register_extension( :v12, OpenCL12, "device.platform.version_number >= 1.2" )
|
1795
1801
|
register_extension( :v20, OpenCL20, "device.platform.version_number >= 2.0" )
|
1796
1802
|
register_extension( :v21, OpenCL21, "device.platform.version_number >= 2.1" )
|
1803
|
+
register_extension( :v30, OpenCL30, "device.platform.version_number >= 3.0" )
|
1797
1804
|
|
1798
1805
|
end
|
1799
1806
|
|
@@ -25,7 +25,16 @@ module OpenCL
|
|
25
25
|
error = MemoryPointer::new( :cl_int )
|
26
26
|
ptr = clCreateContext(properties, devs.size, pointer, block, user_data, error)
|
27
27
|
error_check(error.read_cl_int)
|
28
|
-
|
28
|
+
context = Context::new(ptr, false)
|
29
|
+
if block && context.platform.version_number >= 3.0
|
30
|
+
callback_destructor_callback = lambda { |c, u|
|
31
|
+
@@callbacks.delete(block)
|
32
|
+
@@callbacks.delete(callback_destructor_callback)
|
33
|
+
}
|
34
|
+
@@callbacks[callback_destructor_callback] = nil
|
35
|
+
context.set_destructor_callback(&callback_destructor_callback)
|
36
|
+
end
|
37
|
+
return context
|
29
38
|
end
|
30
39
|
|
31
40
|
# Creates an Context using devices of the selected type
|
@@ -49,7 +58,16 @@ module OpenCL
|
|
49
58
|
error = MemoryPointer::new( :cl_int )
|
50
59
|
ptr = clCreateContextFromType(properties, type, block, user_data, error)
|
51
60
|
error_check(error.read_cl_int)
|
52
|
-
|
61
|
+
context = Context::new(ptr, false)
|
62
|
+
if block && context.platform.version_number >= 3.0
|
63
|
+
callback_destructor_callback = lambda { |c, u|
|
64
|
+
@@callbacks.delete(block)
|
65
|
+
@@callbacks.delete(callback_destructor_callback)
|
66
|
+
}
|
67
|
+
@@callbacks[callback_destructor_callback] = nil
|
68
|
+
context.set_destructor_callback(&callback_destructor_callback)
|
69
|
+
end
|
70
|
+
return context
|
53
71
|
end
|
54
72
|
|
55
73
|
def self.set_default_device_command_queue( context, device, command_queue )
|
@@ -59,6 +77,32 @@ module OpenCL
|
|
59
77
|
return context
|
60
78
|
end
|
61
79
|
|
80
|
+
# Attaches a callback to context that will be called on context destruction
|
81
|
+
#
|
82
|
+
# ==== Attributes
|
83
|
+
#
|
84
|
+
# * +context+ - the Program to attach the callback to
|
85
|
+
# * +options+ - a hash containing named options
|
86
|
+
# * +block+ - if provided, a callback invoked when program is released. Signature of the callback is { |Pointer to the context, Pointer to user_data| ... }
|
87
|
+
#
|
88
|
+
# ==== Options
|
89
|
+
#
|
90
|
+
# * +:user_data+ - a Pointer (or convertible to Pointer using to_ptr) to the memory area to pass to the callback
|
91
|
+
def self.set_context_destructor_callback( context, options = {}, &block )
|
92
|
+
if block
|
93
|
+
wrapper_block = lambda { |p, u|
|
94
|
+
block.call(p, u)
|
95
|
+
@@callbacks.delete(wrapper_block)
|
96
|
+
}
|
97
|
+
@@callbacks[wrapper_block] = options[:user_data]
|
98
|
+
else
|
99
|
+
wrapper_block = nil
|
100
|
+
end
|
101
|
+
error = clSetContextDestructorCallback( context, wrapper_block, options[:user_data] )
|
102
|
+
error_check(error)
|
103
|
+
return context
|
104
|
+
end
|
105
|
+
|
62
106
|
#Maps the cl_context object of OpenCL
|
63
107
|
class Context
|
64
108
|
include InnerInterface
|
@@ -459,16 +503,36 @@ module OpenCL
|
|
459
503
|
return OpenCL.create_program_with_il(self, il)
|
460
504
|
end
|
461
505
|
|
506
|
+
#
|
462
507
|
def set_default_device_command_queue( device, command_queue )
|
463
508
|
return OpenCL.set_default_device_command_queue( self, device, command_queue )
|
464
509
|
end
|
465
510
|
|
466
511
|
end
|
467
512
|
|
513
|
+
module OpenCL30
|
514
|
+
|
515
|
+
# Attaches a callback to context that will be called on context destruction
|
516
|
+
#
|
517
|
+
# ==== Attributes
|
518
|
+
#
|
519
|
+
# * +options+ - a hash containing named options
|
520
|
+
# * +block+ - if provided, a callback invoked when program is released. Signature of the callback is { |Pointer to the context, Pointer to user_data| ... }
|
521
|
+
#
|
522
|
+
# ==== Options
|
523
|
+
#
|
524
|
+
# * +:user_data+ - a Pointer (or convertible to Pointer using to_ptr) to the memory area to pass to the callback
|
525
|
+
def set_destructor_callback( options = {}, &block )
|
526
|
+
OpenCL.set_context_destructor_callback( self, option, &block )
|
527
|
+
return self
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
468
531
|
register_extension( :v11, OpenCL11, "platform.version_number >= 1.1" )
|
469
532
|
register_extension( :v12, OpenCL12, "platform.version_number >= 1.2" )
|
470
533
|
register_extension( :v20, OpenCL20, "platform.version_number >= 2.0" )
|
471
534
|
register_extension( :v21, OpenCL21, "platform.version_number >= 2.1" )
|
535
|
+
register_extension( :v30, OpenCL30, "platform.version_number >= 3.0" )
|
472
536
|
|
473
537
|
end
|
474
538
|
|
@@ -366,10 +366,90 @@ module OpenCL
|
|
366
366
|
|
367
367
|
end
|
368
368
|
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
369
|
+
module OpenCL30
|
370
|
+
extend InnerGenerator
|
371
|
+
get_info("Device", :cl_device_atomic_capabilities, "atomic_memory_capabilities")
|
372
|
+
get_info("Device", :cl_device_atomic_capabilities, "atomic_fence_capabilities")
|
373
|
+
get_info("Device", :cl_bool, "non_uniform_work_group_support")
|
374
|
+
get_info("Device", :size_t, "preferred_work_group_size_multiple")
|
375
|
+
get_info("Device", :cl_bool, "work_group_collective_functions_support")
|
376
|
+
get_info("Device", :cl_bool, "generic_address_space_support")
|
377
|
+
get_info("Device", :cl_bool, "device_enqueue_support")
|
378
|
+
get_info("Device", :cl_bool, "pipe_support")
|
379
|
+
|
380
|
+
def numeric_version
|
381
|
+
ptr = MemoryPointer::new( :cl_version )
|
382
|
+
error = OpenCL.clGetDeviceInfo( self, NUMERIC_VERSION, 4, ptr, nil)
|
383
|
+
error_check(error)
|
384
|
+
return Version::from_int(ptr.read_cl_version)
|
385
|
+
end
|
386
|
+
|
387
|
+
def extensions_with_version
|
388
|
+
sz = MemoryPointer::new( :size_t )
|
389
|
+
error = OpenCL.clGetDeviceInfo( self, EXTENSIONS_WITH_VERSION, 0, nil, sz)
|
390
|
+
error_check(error)
|
391
|
+
sz = sz.read_size_t
|
392
|
+
ptr = MemoryPointer::new( sz )
|
393
|
+
error = OpenCL.clGetDeviceInfo( self, EXTENSIONS_WITH_VERSION, sz, ptr, nil)
|
394
|
+
error_check(error)
|
395
|
+
nvsz = NameVersion.size
|
396
|
+
return (sz/nvsz).times.collect { |i| NameVersion::new(ptr + i*nvsz) }
|
397
|
+
end
|
398
|
+
|
399
|
+
def ils_with_version
|
400
|
+
sz = MemoryPointer::new( :size_t )
|
401
|
+
error = OpenCL.clGetDeviceInfo( self, ILS_WITH_VERSION, 0, nil, sz)
|
402
|
+
error_check(error)
|
403
|
+
sz = sz.read_size_t
|
404
|
+
ptr = MemoryPointer::new( sz )
|
405
|
+
error = OpenCL.clGetDeviceInfo( self, ILS_WITH_VERSION, sz, ptr, nil)
|
406
|
+
error_check(error)
|
407
|
+
nvsz = NameVersion.size
|
408
|
+
return (sz/nvsz).times.collect { |i| NameVersion::new(ptr + i*nvsz) }
|
409
|
+
end
|
410
|
+
|
411
|
+
def built_in_kernels_with_version
|
412
|
+
sz = MemoryPointer::new( :size_t )
|
413
|
+
error = OpenCL.clGetDeviceInfo( self, BUILT_IN_KERNELS_WITH_VERSION, 0, nil, sz)
|
414
|
+
error_check(error)
|
415
|
+
sz = sz.read_size_t
|
416
|
+
ptr = MemoryPointer::new( sz )
|
417
|
+
error = OpenCL.clGetDeviceInfo( self, BUILT_IN_KERNELS_WITH_VERSION, sz, ptr, nil)
|
418
|
+
error_check(error)
|
419
|
+
nvsz = NameVersion.size
|
420
|
+
return (sz/nvsz).times.collect { |i| NameVersion::new(ptr + i*nvsz) }
|
421
|
+
end
|
422
|
+
|
423
|
+
def opencl_c_all_versions
|
424
|
+
sz = MemoryPointer::new( :size_t )
|
425
|
+
error = OpenCL.clGetDeviceInfo( self, OPENCL_C_ALL_VERSIONS, 0, nil, sz)
|
426
|
+
error_check(error)
|
427
|
+
sz = sz.read_size_t
|
428
|
+
ptr = MemoryPointer::new( sz )
|
429
|
+
error = OpenCL.clGetDeviceInfo( self, OPENCL_C_ALL_VERSIONS, sz, ptr, nil)
|
430
|
+
error_check(error)
|
431
|
+
nvsz = NameVersion.size
|
432
|
+
return (sz/nvsz).times.collect { |i| NameVersion::new(ptr + i*nvsz) }
|
433
|
+
end
|
434
|
+
|
435
|
+
def opencl_c_features
|
436
|
+
sz = MemoryPointer::new( :size_t )
|
437
|
+
error = OpenCL.clGetDeviceInfo( self, OPENCL_C_FEATURES, 0, nil, sz)
|
438
|
+
error_check(error)
|
439
|
+
sz = sz.read_size_t
|
440
|
+
ptr = MemoryPointer::new( sz )
|
441
|
+
error = OpenCL.clGetDeviceInfo( self, OPENCL_C_FEATURES, sz, ptr, nil)
|
442
|
+
error_check(error)
|
443
|
+
nvsz = NameVersion.size
|
444
|
+
return (sz/nvsz).times.collect { |i| NameVersion::new(ptr + i*nvsz) }
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
register_extension( :v11, OpenCL11, "platform.version_number >= 1.1" )
|
449
|
+
register_extension( :v12, OpenCL12, "platform.version_number >= 1.2" )
|
450
|
+
register_extension( :v20, OpenCL20, "platform.version_number >= 2.0" )
|
451
|
+
register_extension( :v21, OpenCL21, "platform.version_number >= 2.1" )
|
452
|
+
register_extension( :v30, OpenCL30, "platform.version_number >= 3.0" )
|
373
453
|
|
374
454
|
end
|
375
455
|
|
@@ -13,11 +13,17 @@ module OpenCL
|
|
13
13
|
#
|
14
14
|
# * +:flags+ - a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Image
|
15
15
|
# * +:host_ptr+ - if provided, the Pointer (or convertible to Pointer using to_ptr) to the memory area to use
|
16
|
+
# * +:properties+ - if provided, an array of :cl_mem_properties (OpenCL 3.0)
|
16
17
|
def self.create_image( context, format, desc, options = {} )
|
17
18
|
flags = get_flags( options )
|
18
19
|
host_ptr = options[:host_ptr]
|
19
20
|
error = MemoryPointer::new( :cl_int )
|
20
|
-
|
21
|
+
if context.platform.version_number < 3.0 then
|
22
|
+
img_ptr = clCreateImage( context, flags, format, desc, host_ptr, error )
|
23
|
+
else
|
24
|
+
properties = get_mem_properties( options )
|
25
|
+
img_ptr = clCreateImageWithProperties( context, properties, flags, format, desc, host_ptr, error )
|
26
|
+
end
|
21
27
|
error_check(error.read_cl_int)
|
22
28
|
return Image::new(img_ptr, false)
|
23
29
|
end
|
data/lib/opencl_ruby_ffi/Mem.rb
CHANGED
@@ -130,11 +130,17 @@ module OpenCL
|
|
130
130
|
extend InnerGenerator
|
131
131
|
|
132
132
|
get_info("Mem", :cl_bool, "uses_svm_pointer", true)
|
133
|
+
end
|
134
|
+
|
135
|
+
module OpenCL30
|
136
|
+
extend InnerGenerator
|
133
137
|
|
138
|
+
get_info_array("Mem", :cl_mem_properties, "properties")
|
134
139
|
end
|
135
140
|
|
136
141
|
register_extension( :v11, OpenCL11, "platform.version_number >= 1.1" )
|
137
142
|
register_extension( :v20, OpenCL20, "platform.version_number >= 2.0" )
|
143
|
+
register_extension( :v30, OpenCL30, "platform.version_number >= 3.0" )
|
138
144
|
|
139
145
|
end
|
140
146
|
|
data/lib/opencl_ruby_ffi/Pipe.rb
CHANGED
@@ -34,6 +34,14 @@ module OpenCL
|
|
34
34
|
get_info("Pipe", :cl_uint, "packet_size")
|
35
35
|
get_info("Pipe", :cl_uint, "max_packets")
|
36
36
|
|
37
|
+
module OpenCL30
|
38
|
+
extend InnerGenerator
|
39
|
+
|
40
|
+
get_info_array("Pipe", :cl_pipe_properties, "properties")
|
41
|
+
end
|
42
|
+
|
43
|
+
register_extension( :v30, Pipe::OpenCL30, "platform.version_number >= 3.0" )
|
44
|
+
|
37
45
|
end
|
38
46
|
|
39
47
|
end
|
@@ -181,8 +181,33 @@ module OpenCL
|
|
181
181
|
|
182
182
|
end
|
183
183
|
|
184
|
+
module OpenCL30
|
185
|
+
extend InnerGenerator
|
186
|
+
|
187
|
+
def numeric_version
|
188
|
+
ptr = MemoryPointer::new( :cl_version )
|
189
|
+
error = OpenCL.clGetPlatformInfo( self, NUMERIC_VERSION, 4, ptr, nil)
|
190
|
+
error_check(error)
|
191
|
+
return Version::from_int(ptr.read_cl_version)
|
192
|
+
end
|
193
|
+
|
194
|
+
def extensions_with_version
|
195
|
+
sz = MemoryPointer::new( :size_t )
|
196
|
+
error = OpenCL.clGetPlatformInfo( self, EXTENSIONS_WITH_VERSION, 0, nil, sz)
|
197
|
+
error_check(error)
|
198
|
+
sz = sz.read_size_t
|
199
|
+
ptr = MemoryPointer::new( sz )
|
200
|
+
error = OpenCL.clGetPlatformInfo( self, EXTENSIONS_WITH_VERSION, sz, ptr, nil)
|
201
|
+
error_check(error)
|
202
|
+
nvsz = NameVersion.size
|
203
|
+
return (sz/nvsz).times.collect { |i| NameVersion::new(ptr + i*nvsz) }
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|
184
208
|
register_extension( :v12, OpenCL12, "version_number >= 1.2" )
|
185
209
|
register_extension( :v21, OpenCL21, "version_number >= 2.1" )
|
210
|
+
register_extension( :v30, OpenCL30, "version_number >= 3.0" )
|
186
211
|
|
187
212
|
end
|
188
213
|
|
data/lib/opencl_ruby_ffi/ext.rb
CHANGED
@@ -0,0 +1,119 @@
|
|
1
|
+
using OpenCLRefinements if RUBY_VERSION.scan(/\d+/).collect(&:to_i).first >= 2
|
2
|
+
|
3
|
+
module OpenCL
|
4
|
+
|
5
|
+
UUID_SIZE_KHR = 16
|
6
|
+
LUID_SIZE_KHR = 8
|
7
|
+
|
8
|
+
DEVICE_UUID_KHR = 0x106A
|
9
|
+
DRIVER_UUID_KHR = 0x106B
|
10
|
+
DEVICE_LUID_VALID_KHR = 0x106C
|
11
|
+
DEVICE_LUID_KHR = 0x106D
|
12
|
+
DEVICE_NODE_MASK_KHR = 0x106E
|
13
|
+
|
14
|
+
class UUID < Struct
|
15
|
+
layout :id, [ OpenCL.find_type(:cl_uchar), UUID_SIZE_KHR ]
|
16
|
+
def to_s
|
17
|
+
a = self[:id].to_a
|
18
|
+
s = ""
|
19
|
+
s << "%02x" % a[15]
|
20
|
+
s << "%02x" % a[14]
|
21
|
+
s << "%02x" % a[13]
|
22
|
+
s << "%02x" % a[12]
|
23
|
+
s << "-"
|
24
|
+
s << "%02x" % a[11]
|
25
|
+
s << "%02x" % a[10]
|
26
|
+
s << "-"
|
27
|
+
s << "%02x" % a[9]
|
28
|
+
s << "%02x" % a[8]
|
29
|
+
s << "-"
|
30
|
+
s << "%02x" % a[7]
|
31
|
+
s << "%02x" % a[6]
|
32
|
+
s << "-"
|
33
|
+
s << "%02x" % a[5]
|
34
|
+
s << "%02x" % a[4]
|
35
|
+
s << "%02x" % a[3]
|
36
|
+
s << "%02x" % a[2]
|
37
|
+
s << "%02x" % a[1]
|
38
|
+
s << "%02x" % a[0]
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.from_string(uuid)
|
42
|
+
new.from_string(uuid)
|
43
|
+
end
|
44
|
+
|
45
|
+
def from_string(uuid)
|
46
|
+
m = uuid.match(/(\h\h)(\h\h)(\h\h)(\h\h)-(\h\h)(\h\h)-(\h\h)(\h\h)-(\h\h)(\h\h)-(\h\h)(\h\h)(\h\h)(\h\h)(\h\h)(\h\h)/)
|
47
|
+
raise "invalid format" unless m
|
48
|
+
UUID_SIZE_KHR.times { |i|
|
49
|
+
self[:id][UUID_SIZE_KHR-1-i] = m[i+1].to_i(16)
|
50
|
+
}
|
51
|
+
self
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class LUID < Struct
|
56
|
+
layout :id, [ OpenCL.find_type(:cl_uchar), LUID_SIZE_KHR ]
|
57
|
+
def to_s
|
58
|
+
a = self[:id].to_a
|
59
|
+
s = ""
|
60
|
+
s << "%02x" % a[7]
|
61
|
+
s << "%02x" % a[6]
|
62
|
+
s << "%02x" % a[5]
|
63
|
+
s << "%02x" % a[4]
|
64
|
+
s << "%02x" % a[3]
|
65
|
+
s << "%02x" % a[2]
|
66
|
+
s << "%02x" % a[1]
|
67
|
+
s << "%02x" % a[0]
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.from_string(uuid)
|
71
|
+
new.from_string(uuid)
|
72
|
+
end
|
73
|
+
|
74
|
+
def from_string(uuid)
|
75
|
+
m = uuid.match(/(\h\h)(\h\h)(\h\h)(\h\h)(\h\h)(\h\h)(\h\h)(\h\h)/)
|
76
|
+
raise "invalid format" unless m
|
77
|
+
LUID_SIZE_KHR.times { |i|
|
78
|
+
self[:id][LUID_SIZE_KHR-1-i] = m[i+1].to_i(16)
|
79
|
+
}
|
80
|
+
self
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class Device
|
85
|
+
UUID_KHR = 0x106A
|
86
|
+
LUID_VALID_KHR = 0x106C
|
87
|
+
LUID_KHR = 0x106D
|
88
|
+
NODE_MASK_KHR = 0x106E
|
89
|
+
|
90
|
+
module KHRDeviceUUID
|
91
|
+
extend InnerGenerator
|
92
|
+
get_info("Device", :cl_bool, "luid_valid_khr")
|
93
|
+
get_info("Device", :cl_uint, "node_mask_khr")
|
94
|
+
|
95
|
+
def uuid_khr
|
96
|
+
id = UUID.new
|
97
|
+
error = OpenCL.clGetDeviceInfo( self, UUID_KHR, UUID_SIZE_KHR, id, nil)
|
98
|
+
error_check(error)
|
99
|
+
return id
|
100
|
+
end
|
101
|
+
|
102
|
+
def driver_uuid_khr
|
103
|
+
id = UUID.new
|
104
|
+
error = OpenCL.clGetDeviceInfo( self, DRIVER_UUID_KHR, UUID_SIZE_KHR, id, nil)
|
105
|
+
error_check(error)
|
106
|
+
return id
|
107
|
+
end
|
108
|
+
|
109
|
+
def luid_khr
|
110
|
+
id = LUID.new
|
111
|
+
error = OpenCL.clGetDeviceInfo( self, LUID_KHR, LUID_SIZE_KHR, id, nil)
|
112
|
+
error_check(error)
|
113
|
+
return id
|
114
|
+
end
|
115
|
+
end
|
116
|
+
register_extension( :cl_khr_device_uuid, KHRDeviceUUID, "extensions.include?(\"cl_khr_device_uuid\")" )
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
@@ -126,6 +126,76 @@ module OpenCL
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
class Version
|
130
|
+
include Comparable
|
131
|
+
MAJOR_BITS = 10
|
132
|
+
MINOR_BITS = 10
|
133
|
+
PATCH_BITS = 12
|
134
|
+
MAJOR_MASK = (1 << MAJOR_BITS) - 1
|
135
|
+
MINOR_MASK = (1 << MINOR_BITS) - 1
|
136
|
+
PATCH_MASK = (1 << PATCH_BITS) - 1
|
137
|
+
|
138
|
+
attr_reader :major, :minor, :patch
|
139
|
+
def initialize(major, minor = 0, patch = 0)
|
140
|
+
@major = major
|
141
|
+
@minor = minor
|
142
|
+
@patch = patch
|
143
|
+
end
|
144
|
+
|
145
|
+
def to_int
|
146
|
+
Version.make(@major, @minor, @patch)
|
147
|
+
end
|
148
|
+
alias to_i to_int
|
149
|
+
|
150
|
+
def <=>(other)
|
151
|
+
res = (@major <=> other.major)
|
152
|
+
res = (@minor <=> other.minor) if res == 0
|
153
|
+
res = (@patch <=> other.patch) if res == 0
|
154
|
+
res
|
155
|
+
end
|
156
|
+
|
157
|
+
def to_s
|
158
|
+
"#{@major}.#{@minor}.#{@patch}"
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.major(v)
|
162
|
+
v >> (MINOR_BITS + PATCH_BITS)
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.minor(v)
|
166
|
+
(v >> (PATCH_BITS)) & MINOR_MASK
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.patch(v)
|
170
|
+
v & PATCH_MASK
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.make(major, minor = 0, patch = 0)
|
174
|
+
((major & MAJOR_MASK) << (MINOR_BITS + PATCH_BITS)) +
|
175
|
+
((minor & MINOR_MASK) << PATCH_BITS) +
|
176
|
+
(patch & PATCH_MASK)
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.from_int(v)
|
180
|
+
self.new(major(v), minor(v), patch(v))
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Maps the :cl_name_version type of OpenCL
|
185
|
+
class NameVersion < Struct
|
186
|
+
MAX_NAME_SIZE = 64
|
187
|
+
layout :version, :cl_version,
|
188
|
+
:name, [:char, MAX_NAME_SIZE]
|
189
|
+
|
190
|
+
def version
|
191
|
+
Version.from_int(self[:version])
|
192
|
+
end
|
193
|
+
|
194
|
+
def name
|
195
|
+
self[:name].to_s
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
129
199
|
module InnerInterface
|
130
200
|
|
131
201
|
private
|
@@ -169,7 +239,7 @@ module OpenCL
|
|
169
239
|
end
|
170
240
|
return properties
|
171
241
|
end
|
172
|
-
|
242
|
+
|
173
243
|
# Extracts the origin_symbol and region_symbol named options for image from the given hash. Returns the read (or detemined suitable) origin and region in a tuple
|
174
244
|
def get_origin_region( image, options, origin_symbol, region_symbol )
|
175
245
|
origin = MemoryPointer::new( :size_t, 3 )
|
@@ -214,6 +284,19 @@ module OpenCL
|
|
214
284
|
return properties
|
215
285
|
end
|
216
286
|
|
287
|
+
# EXtracts the :properties named option (for a Mem) from the hash given and returns the properties values
|
288
|
+
def get_mem_properties( options )
|
289
|
+
properties = nil
|
290
|
+
if options[:properties] then
|
291
|
+
properties = MemoryPointer::new( :cl_mem_properties, options[:properties].length + 1 )
|
292
|
+
options[:properties].each_with_index { |e,i|
|
293
|
+
properties[i].write_cl_mem_properties(e.respond_to?(:to_ptr) ? e : e.to_i)
|
294
|
+
}
|
295
|
+
properties[options[:properties].length].write_cl_mem_properties(0)
|
296
|
+
end
|
297
|
+
return properties
|
298
|
+
end
|
299
|
+
|
217
300
|
# Extracts the :device_list named option from the hash given and returns [ number of devices, an Pointer to the list of Device or nil ]
|
218
301
|
def get_device_list( options )
|
219
302
|
devices = options[:device_list]
|
@@ -248,6 +331,7 @@ module OpenCL
|
|
248
331
|
:cl_command_queue_properties => CommandQueue::Properties,
|
249
332
|
:cl_device_affinity_domain => Device::AffinityDomain,
|
250
333
|
:cl_device_svm_capabilities => Device::SVMCapabilities,
|
334
|
+
:cl_device_atomic_capabilities => Device::AtomicCapabilities,
|
251
335
|
:cl_channel_order => ChannelOrder,
|
252
336
|
:cl_channel_type => ChannelType,
|
253
337
|
:cl_mem_flags => Mem::Flags,
|
@@ -287,11 +371,8 @@ module OpenCL
|
|
287
371
|
module ExtensionInnerGenerator
|
288
372
|
|
289
373
|
private
|
290
|
-
|
291
|
-
#
|
292
|
-
# @param [Symbol] type of the property
|
293
|
-
# @param [String] name of the property
|
294
|
-
# @!macro [attach] get_info
|
374
|
+
|
375
|
+
# @!macro [attach] get_info_ext
|
295
376
|
# @!method $3
|
296
377
|
# Returns the OpenCL::$1::$3 info
|
297
378
|
# @return $2
|
@@ -347,11 +428,7 @@ EOF
|
|
347
428
|
module_eval s
|
348
429
|
end
|
349
430
|
|
350
|
-
#
|
351
|
-
# @param [String] klass the property is to be found
|
352
|
-
# @param [Symbol] type of the property
|
353
|
-
# @param [String] name of the property
|
354
|
-
# @!macro [attach] get_info_array
|
431
|
+
# @!macro [attach] get_info_array_ext
|
355
432
|
# @!method $3
|
356
433
|
# Returns the OpenCL::$1::$3 info
|
357
434
|
# @return an Array of $2
|
@@ -409,10 +486,6 @@ EOF
|
|
409
486
|
|
410
487
|
private
|
411
488
|
|
412
|
-
# Generates a new method for klass that use the apropriate clGetKlassInfo, to read an info of the given type. The info queried is specified by name.
|
413
|
-
# @param [String] klass the property is to be found
|
414
|
-
# @param [Symbol] type of the property
|
415
|
-
# @param [String] name of the property
|
416
489
|
# @!macro [attach] get_info
|
417
490
|
# @!method $3
|
418
491
|
# Returns the OpenCL::$1::$3 info
|
@@ -465,11 +538,6 @@ EOF
|
|
465
538
|
module_eval s
|
466
539
|
end
|
467
540
|
|
468
|
-
# Generates a new method for klass that use the apropriate clGetKlassInfo, to read an Array of element of the given type. The info queried is specified by name.
|
469
|
-
# @param [String] klass the property is to be found
|
470
|
-
# @param [Symbol] type of the property
|
471
|
-
# @param [String] name of the property
|
472
|
-
# @param [Bool]
|
473
541
|
# @!macro [attach] get_info_array
|
474
542
|
# @!method $3
|
475
543
|
# Returns the OpenCL::$1::$3 info
|
@@ -102,6 +102,8 @@ module OpenCL
|
|
102
102
|
PLATFORM_VENDOR = 0x0903
|
103
103
|
PLATFORM_EXTENSIONS = 0x0904
|
104
104
|
PLATFORM_HOST_TIMER_RESOLUTION = 0x0905
|
105
|
+
PLATFORM_NUMERIC_VERSION = 0x0906
|
106
|
+
PLATFORM_EXTENSIONS_WITH_VERSION = 0x0907
|
105
107
|
DEVICE_TYPE_DEFAULT = (1 << 0)
|
106
108
|
DEVICE_TYPE_CPU = (1 << 1)
|
107
109
|
DEVICE_TYPE_GPU = (1 << 2)
|
@@ -201,6 +203,20 @@ module OpenCL
|
|
201
203
|
DEVICE_IL_VERSION = 0x105B
|
202
204
|
DEVICE_MAX_NUM_SUB_GROUPS = 0x105C
|
203
205
|
DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS = 0x105D
|
206
|
+
DEVICE_NUMERIC_VERSION = 0x105E
|
207
|
+
DEVICE_EXTENSIONS_WITH_VERSION = 0x1060
|
208
|
+
DEVICE_ILS_WITH_VERSION = 0x1061
|
209
|
+
DEVICE_BUILT_IN_KERNELS_WITH_VERSION = 0x1062
|
210
|
+
DEVICE_ATOMIC_MEMORY_CAPABILITIES = 0x1063
|
211
|
+
DEVICE_ATOMIC_FENCE_CAPABILITIES = 0x1064
|
212
|
+
DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT = 0x1065
|
213
|
+
DEVICE_OPENCL_C_ALL_VERSIONS = 0x1066
|
214
|
+
DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x1067
|
215
|
+
DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT = 0x1068
|
216
|
+
DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT = 0x1069
|
217
|
+
DEVICE_OPENCL_C_FEATURES = 0x106F
|
218
|
+
DEVICE_DEVICE_ENQUEUE_SUPPORT = 0x1070
|
219
|
+
DEVICE_PIPE_SUPPORT = 0x1071
|
204
220
|
FP_DENORM = (1 << 0)
|
205
221
|
FP_INF_NAN = (1 << 1)
|
206
222
|
FP_ROUND_TO_NEAREST = (1 << 2)
|
@@ -240,12 +256,20 @@ module OpenCL
|
|
240
256
|
DEVICE_SVM_FINE_GRAIN_BUFFER = (1 << 1)
|
241
257
|
DEVICE_SVM_FINE_GRAIN_SYSTEM = (1 << 2)
|
242
258
|
DEVICE_SVM_ATOMICS = (1 << 3)
|
259
|
+
DEVICE_ATOMIC_ORDER_RELAXED = (1 << 0)
|
260
|
+
DEVICE_ATOMIC_ORDER_ACQ_REL = (1 << 1)
|
261
|
+
DEVICE_ATOMIC_ORDER_SEQ_CST = (1 << 2)
|
262
|
+
DEVICE_ATOMIC_SCOPE_WORK_ITEM = (1 << 3)
|
263
|
+
DEVICE_ATOMIC_SCOPE_WORK_GROUP = (1 << 4)
|
264
|
+
DEVICE_ATOMIC_SCOPE_DEVICE = (1 << 5)
|
265
|
+
DEVICE_ATOMIC_SCOPE_ALL_DEVICES = (1 << 6)
|
243
266
|
QUEUE_CONTEXT = 0x1090
|
244
267
|
QUEUE_DEVICE = 0x1091
|
245
268
|
QUEUE_REFERENCE_COUNT = 0x1092
|
246
269
|
QUEUE_PROPERTIES = 0x1093
|
247
270
|
QUEUE_SIZE = 0x1094
|
248
271
|
QUEUE_DEVICE_DEFAULT = 0x1095
|
272
|
+
QUEUE_PROPERTIES_ARRAY = 0x1098
|
249
273
|
MEM_READ_WRITE = (1 << 0)
|
250
274
|
MEM_WRITE_ONLY = (1 << 1)
|
251
275
|
MEM_READ_ONLY = (1 << 2)
|
@@ -323,6 +347,7 @@ module OpenCL
|
|
323
347
|
MEM_ASSOCIATED_MEMOBJECT = 0x1107
|
324
348
|
MEM_OFFSET = 0x1108
|
325
349
|
MEM_USES_SVM_POINTER = 0x1109
|
350
|
+
MEM_PROPERTIES = 0x110A
|
326
351
|
IMAGE_FORMAT = 0x1110
|
327
352
|
IMAGE_ELEMENT_SIZE = 0x1111
|
328
353
|
IMAGE_ROW_PITCH = 0x1112
|
@@ -336,6 +361,7 @@ module OpenCL
|
|
336
361
|
IMAGE_NUM_SAMPLES = 0x111A
|
337
362
|
PIPE_PACKET_SIZE = 0x1120
|
338
363
|
PIPE_MAX_PACKETS = 0x1121
|
364
|
+
PIPE_PROPERTIES = 0x1122
|
339
365
|
ADDRESS_NONE = 0x1130
|
340
366
|
ADDRESS_CLAMP_TO_EDGE = 0x1131
|
341
367
|
ADDRESS_CLAMP = 0x1132
|
@@ -451,6 +477,7 @@ module OpenCL
|
|
451
477
|
COMMAND_SVM_MEMFILL = 0x120B
|
452
478
|
COMMAND_SVM_MAP = 0x120C
|
453
479
|
COMMAND_SVM_UNMAP = 0x120D
|
480
|
+
COMMAND_SVM_MIGRATE_MEM = 0x120E
|
454
481
|
COMPLETE = 0x0
|
455
482
|
RUNNING = 0x1
|
456
483
|
SUBMITTED = 0x2
|
@@ -482,6 +509,13 @@ module OpenCL
|
|
482
509
|
MEM_HOST_WRITETHROUGH_QCOM = 0x40A6
|
483
510
|
MEM_HOST_WRITE_COMBINING_QCOM = 0x40A7
|
484
511
|
MEM_ION_HOST_PTR_QCOM = 0x40A8
|
512
|
+
NAME_VERSION_MAX_NAME_SIZE = 64
|
513
|
+
VERSION_MAJOR_BITS = 10
|
514
|
+
VERSION_MINOR_BITS = 10
|
515
|
+
VERSION_PATCH_BITS = 12
|
516
|
+
VERSION_MAJOR_MASK = (1 << VERSION_MAJOR_BITS) - 1
|
517
|
+
VERSION_MINOR_MASK = (1 << VERSION_MINOR_BITS) - 1
|
518
|
+
VERSION_PATCH_MASK = (1 << VERSION_PATCH_BITS) - 1
|
485
519
|
# Parent class to map OpenCL errors, and is used to raise unknown errors
|
486
520
|
class Error < StandardError
|
487
521
|
attr_reader :code
|
@@ -695,8 +729,7 @@ EOF
|
|
695
729
|
|
696
730
|
# Returns true if flag is bitwise included in the Bitfield
|
697
731
|
def include?(flag)
|
698
|
-
return
|
699
|
-
return false
|
732
|
+
return ( @val & flag ) == flag
|
700
733
|
end
|
701
734
|
|
702
735
|
# Returns a String corresponding to the Bitfield description
|
@@ -744,7 +777,7 @@ EOF
|
|
744
777
|
return @val
|
745
778
|
end
|
746
779
|
|
747
|
-
#
|
780
|
+
# Sets the internal representation of the Bitfield to val
|
748
781
|
def flags=(val)
|
749
782
|
@val = val
|
750
783
|
end
|
@@ -799,6 +832,8 @@ EOF
|
|
799
832
|
VENDOR = 0x0903
|
800
833
|
EXTENSIONS = 0x0904
|
801
834
|
HOST_TIMER_RESOLUTION = 0x0905
|
835
|
+
NUMERIC_VERSION = 0x0906
|
836
|
+
EXTENSIONS_WITH_VERSION = 0x0907
|
802
837
|
|
803
838
|
# Creates a new Platform and retains it if specified and aplicable
|
804
839
|
def initialize(ptr, retain = true)
|
@@ -914,6 +949,20 @@ EOF
|
|
914
949
|
IL_VERSION = 0x105B
|
915
950
|
MAX_NUM_SUB_GROUPS = 0x105C
|
916
951
|
SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS = 0x105D
|
952
|
+
NUMERIC_VERSION = 0x105E
|
953
|
+
EXTENSIONS_WITH_VERSION = 0x1060
|
954
|
+
ILS_WITH_VERSION = 0x1061
|
955
|
+
BUILT_IN_KERNELS_WITH_VERSION = 0x1062
|
956
|
+
ATOMIC_MEMORY_CAPABILITIES = 0x1063
|
957
|
+
ATOMIC_FENCE_CAPABILITIES = 0x1064
|
958
|
+
NON_UNIFORM_WORK_GROUP_SUPPORT = 0x1065
|
959
|
+
OPENCL_C_ALL_VERSIONS = 0x1066
|
960
|
+
PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x1067
|
961
|
+
WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT = 0x1068
|
962
|
+
GENERIC_ADDRESS_SPACE_SUPPORT = 0x1069
|
963
|
+
OPENCL_C_FEATURES = 0x106F
|
964
|
+
DEVICE_ENQUEUE_SUPPORT = 0x1070
|
965
|
+
PIPE_SUPPORT = 0x1071
|
917
966
|
PARTITION_EQUALLY = 0x1086
|
918
967
|
PARTITION_BY_COUNTS = 0x1087
|
919
968
|
PARTITION_BY_COUNTS_LIST_END = 0x0
|
@@ -929,6 +978,13 @@ EOF
|
|
929
978
|
SVM_FINE_GRAIN_SYSTEM = (1 << 2)
|
930
979
|
SVM_ATOMICS = (1 << 3)
|
931
980
|
PAGE_SIZE_QCOM = 0x40A1
|
981
|
+
ATOMIC_ORDER_RELAXED = (1 << 0)
|
982
|
+
ATOMIC_ORDER_ACQ_REL = (1 << 1)
|
983
|
+
ATOMIC_ORDER_SEQ_CST = (1 << 2)
|
984
|
+
ATOMIC_SCOPE_WORK_ITEM = (1 << 3)
|
985
|
+
ATOMIC_SCOPE_WORK_GROUP = (1 << 4)
|
986
|
+
ATOMIC_SCOPE_DEVICE = (1 << 5)
|
987
|
+
ATOMIC_SCOPE_ALL_DEVICES = (1 << 6)
|
932
988
|
|
933
989
|
#DEFINED in ext/device_fission.rb
|
934
990
|
# # Creates a new Device and retains it if specified and aplicable
|
@@ -1079,6 +1135,25 @@ EOF
|
|
1079
1135
|
end
|
1080
1136
|
end
|
1081
1137
|
|
1138
|
+
# Bitfield that maps the :cl_device_atomic_capabilities
|
1139
|
+
class AtomicCapabilities < Bitfield
|
1140
|
+
ORDER_RELAXED = (1 << 0)
|
1141
|
+
ORDER_ACQ_REL = (1 << 1)
|
1142
|
+
ORDER_SEQ_CST = (1 << 2)
|
1143
|
+
SCOPE_WORK_ITEM = (1 << 3)
|
1144
|
+
SCOPE_WORK_GROUP = (1 << 4)
|
1145
|
+
SCOPE_DEVICE = (1 << 5)
|
1146
|
+
SCOPE_ALL_DEVICES = (1 << 6)
|
1147
|
+
# Returns an Array of String representing the different flags set
|
1148
|
+
def names
|
1149
|
+
fs = []
|
1150
|
+
%w( ORDER_RELAXED ORDER_ACQ_REL ORDER_SEQ_CST SCOPE_WORK_ITEM SCOPE_WORK_GROUP SCOPE_DEVICE SCOPE_ALL_DEVICES ).each { |f|
|
1151
|
+
fs.push(f) if self.include?( self.class.const_get(f) )
|
1152
|
+
}
|
1153
|
+
return fs
|
1154
|
+
end
|
1155
|
+
end
|
1156
|
+
|
1082
1157
|
end
|
1083
1158
|
class Context < ExtendedStruct
|
1084
1159
|
layout :dummy, :pointer
|
@@ -1132,6 +1207,7 @@ EOF
|
|
1132
1207
|
PROPERTIES = 0x1093
|
1133
1208
|
SIZE = 0x1094
|
1134
1209
|
DEVICE_DEFAULT = 0x1095
|
1210
|
+
PROPERTIES_ARRAY = 0x1098
|
1135
1211
|
# Creates a new CommandQueue and retains it if specified and aplicable
|
1136
1212
|
def initialize(ptr, retain = true)
|
1137
1213
|
super(ptr)
|
@@ -1202,6 +1278,7 @@ EOF
|
|
1202
1278
|
ASSOCIATED_MEMOBJECT = 0x1107
|
1203
1279
|
OFFSET = 0x1108
|
1204
1280
|
USES_SVM_POINTER = 0x1109
|
1281
|
+
PROPERTIES = 0x110A
|
1205
1282
|
HOST_UNCACHED_QCOM = 0x40A4
|
1206
1283
|
HOST_WRITEBACK_QCOM = 0x40A5
|
1207
1284
|
HOST_WRITETHROUGH_QCOM = 0x40A6
|
@@ -1737,6 +1814,7 @@ EOF
|
|
1737
1814
|
SVM_MEMFILL = 0x120B
|
1738
1815
|
SVM_MAP = 0x120C
|
1739
1816
|
SVM_UNMAP = 0x120D
|
1817
|
+
SVM_MIGRATE_MEM = 0x120E
|
1740
1818
|
@codes = {}
|
1741
1819
|
@codes[0x11F0] = 'NDRANGE_KERNEL'
|
1742
1820
|
@codes[0x11F1] = 'TASK'
|
@@ -1768,6 +1846,7 @@ EOF
|
|
1768
1846
|
@codes[0x120B] = 'SVM_MEMFILL'
|
1769
1847
|
@codes[0x120C] = 'SVM_MAP'
|
1770
1848
|
@codes[0x120D] = 'SVM_UNMAP'
|
1849
|
+
@codes[0x120E] = 'SVM_MIGRATE_MEM'
|
1771
1850
|
end
|
1772
1851
|
|
1773
1852
|
# Enum that maps the :cl_gl_object_type type
|
@@ -1839,6 +1918,7 @@ EOF
|
|
1839
1918
|
layout :dummy, :pointer
|
1840
1919
|
PACKET_SIZE = 0x1120
|
1841
1920
|
MAX_PACKETS = 0x1121
|
1921
|
+
PROPERTIES = 0x1122
|
1842
1922
|
end
|
1843
1923
|
attach_function :clGetPlatformIDs, [:cl_uint,:pointer,:pointer], :cl_int
|
1844
1924
|
attach_function :clGetPlatformInfo, [Platform,:cl_platform_info,:size_t,:pointer,:pointer], :cl_int
|
@@ -1974,6 +2054,14 @@ EOF
|
|
1974
2054
|
callback :clSetProgramReleaseCallback_notify, [Program.by_ref,:pointer], :void
|
1975
2055
|
attach_function :clSetProgramReleaseCallback, [Program,:clSetProgramReleaseCallback_notify,:pointer], :cl_int
|
1976
2056
|
attach_function :clSetProgramSpecializationConstant, [Program,:cl_uint,:size_t,:pointer], :cl_int
|
2057
|
+
begin # OpenCL 3.0
|
2058
|
+
attach_function :clCreateBufferWithProperties, [Context,:pointer,:cl_mem_flags,:size_t,:pointer,:pointer], Mem
|
2059
|
+
attach_function :clCreateImageWithProperties, [Context,:pointer,:cl_mem_flags,:pointer,:pointer,:pointer,:pointer], Mem
|
2060
|
+
callback :clSetContextDestructorCallback_notify, [Context.by_ref,:pointer], :void
|
2061
|
+
attach_function :clSetContextDestructorCallback, [Context,:clSetContextDestructorCallback_notify,:pointer], :cl_int
|
2062
|
+
rescue NotFoundError => e
|
2063
|
+
warn "Warning OpenCL 2.2 loader detected!"
|
2064
|
+
end
|
1977
2065
|
rescue NotFoundError => e
|
1978
2066
|
warn "Warning OpenCL 2.1 loader detected!"
|
1979
2067
|
end
|
@@ -67,6 +67,10 @@ module OpenCL
|
|
67
67
|
[ :cl_uint, :cl_profiling_info ],
|
68
68
|
[ :cl_bitfield, :cl_sampler_properties ],
|
69
69
|
[ :cl_uint, :cl_kernel_exec_info ],
|
70
|
+
[ :cl_bitfield, :cl_device_atomic_capabilities ],
|
71
|
+
[ :cl_uint, :cl_khronos_vendor_id ],
|
72
|
+
[ :cl_bitfield, :cl_mem_properties ],
|
73
|
+
[ :cl_uint, :cl_version ],
|
70
74
|
[ :cl_uint, :cl_gl_object_type ],
|
71
75
|
[ :cl_uint, :cl_gl_texture_info ],
|
72
76
|
[ :cl_uint, :cl_gl_platform_info ],
|
data/opencl_ruby_ffi.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'opencl_ruby_ffi'
|
3
|
-
s.version = "1.3.
|
3
|
+
s.version = "1.3.8"
|
4
4
|
s.author = "Brice Videau"
|
5
5
|
s.email = "bvideau@anl.gov"
|
6
6
|
s.homepage = "https://github.com/Nanosim-LIG/opencl-ruby"
|
7
7
|
s.summary = "Ruby OpenCL FFI bindings"
|
8
|
-
s.description = "Ruby OpenCL FFI bindings. OpenCL
|
8
|
+
s.description = "Ruby OpenCL FFI bindings. OpenCL 3.0 ready"
|
9
9
|
s.files = Dir[ 'opencl_ruby_ffi.gemspec', 'LICENSE', 'lib/**/**/*.rb', '.yardopts', 'templates_custom/default/module/setup.rb' ]
|
10
10
|
s.license = 'BSD-2-Clause'
|
11
11
|
s.required_ruby_version = '>= 1.8.7'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opencl_ruby_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Videau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: narray
|
@@ -70,7 +70,7 @@ dependencies:
|
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 1.0.0
|
73
|
-
description: Ruby OpenCL FFI bindings. OpenCL
|
73
|
+
description: Ruby OpenCL FFI bindings. OpenCL 3.0 ready
|
74
74
|
email: bvideau@anl.gov
|
75
75
|
executables: []
|
76
76
|
extensions: []
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/opencl_ruby_ffi/intel/unofficial.rb
|
107
107
|
- lib/opencl_ruby_ffi/khr/d3d10_sharing.rb
|
108
108
|
- lib/opencl_ruby_ffi/khr/d3d11_sharing.rb
|
109
|
+
- lib/opencl_ruby_ffi/khr/device_uuid.rb
|
109
110
|
- lib/opencl_ruby_ffi/khr/dx9_media_sharing.rb
|
110
111
|
- lib/opencl_ruby_ffi/khr/egl_event.rb
|
111
112
|
- lib/opencl_ruby_ffi/khr/egl_image.rb
|