-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathopencl.vapi
2546 lines (2465 loc) · 113 KB
/
opencl.vapi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Homepage: http://www.khronos.org/registry/cl/sdk/
* VAPI Homepage: https://github.com/apmasell/vapis/blob/master/opencl.vapi
* VAPI Maintainer: Andre Masella <[email protected]>
*
* Copyright © 2007-2011 The Khronos Group Inc. Permission is hereby granted,
* free of charge, to any person obtaining a copy of this software and/or
* associated documentation files (the "Materials"), to deal in the Materials
* without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Materials, and to permit persons to whom the Materials are furnished to do
* so, subject to the condition that this copyright notice and permission
* notice shall be included in all copies or substantial portions of the
* Materials.
*/
# if APPLE
[CCode (cheader_filename = "OpenCL/cl.h")]
# else
[CCode (cheader_filename = "CL/cl.h")]
# endif
namespace OpenCL {
[CCode (cname = "pfn_event_notify", always_declare = true, has_type_id = false)]
public delegate void EventNotify (Event event, Event.State exec_status);
[CCode (cname = "user_func", has_target = false, always_declare = true, has_type_id = false)]
public delegate void NativeFunction ([CCode (array_length = false)] uint8[] args);
[CCode (cname = "pfn_notify", always_declare = true, has_type_id = false)]
public delegate void Notify (string error, [CCode (array_length_type = "size_t")] uint8[] data);
[CCode (cname = "struct _cl_command_queue", ref_function = "clRetainCommandQueue", unref_function = "clReleaseCommandQueue", ref_function_void = true, has_type_id = false)]
public class CommandQueue {
[CCode (cname = "cl_command_queue_info", cprefix = "CL_QUEUE_")]
public enum Info {
/**
* The context specified when the command-queue is created. ({@link Context})
*/
CONTEXT,
/**
* The device specified when the command-queue is created. ({@link Device})
*/
DEVICE,
/**
* The command-queue reference count.
*
* The reference count returned should be considered immediately stale.
* It is unsuitable for general use in applications. This feature is
* provided for identifying memory leaks.
*/
REFERENCE_COUNT,
/**
* The currently specified properties for the command-queue. ({@link Properties})
*/
PROPERTIES
}
[CCode (cname = "cl_map_flags", cprefix = "CL_MAP_", has_type_id = false)]
[Flags]
public enum MapFlags {
/**
* The region specified by (offset, cb) in the buffer object is being mapped for reading
*/
READ,
/**
* The region specified by (offset, cb) in the buffer object is being mapped for writing
*/
WRITE
}
[CCode (cname = "cl_command_queue_properties", cprefix = "CL_QUEUE_", has_type_id = false)]
[Flags]
public enum Properties {
/**
* Determines whether the commands queued in the command-queue are executed in-order or out-of-order.
*
* If set, the commands in the command-queue are executed out-of-order. Otherwise, commands are executed in-order.
*/
OUT_OF_ORDER_EXEC_MODE_ENABLE,
/**
* Determines whether to profile commands in the command-queue.
*
* If set, the profiling of commands is enabled. Otherwise profiling of commands is disabled.
* @see Event.get_profiling_info
* @see Event.get_profiling_info_auto
*/
PROFILING_ENABLE
}
/**
* A synchronization point that enqueues a barrier operation.
*
* Add a synchronization point that ensures that all queued commands in the command queue have finished execution before the next batch of commands can begin execution.
*/
[CCode (cname = "clEnqueueBarrier")]
public Error enqueue_barrier ();
/**
* Enqueues a command to copy a buffer object to an image object.
*
* The size in bytes of the region to be copied from source is computed as
* //width// * //height// * //depth// * //bytes/image// element if //dest//
* is a 3D image object and is computed as //width// * //height// *
* //bytes/image// element if it is a 2D image object.
*
* @param source A valid buffer object.
*
* @param dest A valid image object.
*
* @param source_offset The offset where to begin copying data from src_buffer.
*
* @param dest_origin The (x, y, z) offset in pixels where to begin copying
* data to dst_image. If //dest// is a 2D image object, the z value given
* by //dst_origin[2]// must be 0.
*
* @param region Defines the (width, height, depth) in pixels of the 2D or
* 3D rectangle to copy. If //dest// is a 2D image object, the depth value
* given by //region[2]// must be 1.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified in
* event_wait_list act as synchronization points. The context associated
* with events and command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete. {@link enqueue_barrier} can be used instead.
*/
[CCode (cname = "clEnqueueCopyBufferToImage")]
public Error enqueue_copy_buffer_to_image (Memory source, Memory dest, size_t source_offset, [CCode (array_length = false)] size_t[] dest_origin, [CCode (array_length = false)] size_t region[], [CCode (array_length_pos = 5.1)] Event[]? event_wait_list, out Event event);
/**
* Enqueues a command to copy a rectangular region from the buffer object to another buffer object.
*
* The command-queue in which the copy command will be queued. The OpenCL
* context associated with the command queue and both buffers must be the
* same.
*
* @param source_origin The (x, y, z) offset in the memory region
* associated with //source//. For a 2D rectangle region, the z value
* given by //source_origin[2]// should be 0. The offset in bytes is
* computed as //source_origin[2]// * //source_slice_pitch// +
* //source_origin[1]// * //source_row_pitch// + //source_origin[0]//.
*
* @param dest_origin The (x, y, z) offset in the memory region associated
* with //dest//. For a 2D rectangle region, the z value given by
* //dest_origin[2]// should be 0. The offset in bytes is computed as
* //dst_origin[2]// * //dst_slice_pitch// + //dst_origin[1]// *
* //dst_row_pitch// + //dst_origin[0]//.
*
* @param source_row_pitch The length of each row in bytes to be used for
* the memory region associated with //source//. If zero, it is computed
* as //region[0]//.
*
* @param source_slice_pitch The length of each 2D slice in bytes to be
* used for the memory region associated with //source//. If zero, it is
* computed as //region[1] * source_row_pitch//.
*
* @param dest_row_pitch The length of each row in bytes to be used for the
* memory region associated with //dest//. If zero, it is computed as
* //region[0]//.
*
* @param dest_slice_pitch The length of each 2D slice in bytes to be used
* for the memory region associated with //dest//. If zero, it is computed
* as //region[1] * dest_row_pitch//.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified in
* event_wait_list act as synchronization points. The context associated
* with the events and command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete. {@link enqueue_barrier} can be used instead.
*/
[CCode (cname = "clEnqueueCopyBufferRect")]
public Error enqueue_copy_buffer_rect (Memory source, Memory dest, [CCode (array_length = false)] size_t[] source_origin, [CCode (array_length = false)] size_t[] dest_origin, size_t source_row_pitch, size_t source_slice_pitch, size_t dest_row_pitch, size_t dest_slice_pitch, [CCode (array_length_pos = 8.1)] Event[]? event_wait_list, out Event event);
/**
* Enqueues a command to copy image objects.
*
* It is currently a requirement that the images memory objects must have
* the exact same image format (i.e., the {@link image_format} descriptor
* specified when the source and destination image are created must match).
*
* The source and destination images can be 2D or 3D image objects
* allowing us to perform the following actions:<<BR>> Copy a 2D image
* object to a 2D image object.<<BR>> Copy a 2D image
* object to a 2D slice of a 3D image object.<<BR>> Copy a 2D slice of a 3D
* image object to a 2D image object.<<BR>> Copy a 3D image object to a 3D
* image object.
*
* @param source_origin Defines the starting (x, y, z) location in pixels
* in the source image from where to start the data copy. If the source
* image is a 2D image object, the z value given by //source_origin[2]//
* must be 0.
*
* @param dest_origin Defines the starting (x, y, z) location in pixels in
* the destination image from where to start the data copy. If destination
* image is a 2D image object, the z value given by //dest_origin[2]// must
* be 0.
*
* @param region Defines the (width, height, depth) in pixels of the 2D or
* 3D rectangle to copy. If either image is a 2D image object, the depth
* value given by //region[2]// must be 1.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with the events and
* the command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete. {@link enqueue_barrier} can be used instead.
*/
[CCode (cname = "clEnqueueCopyImage")]
public Error enqueue_copy_image (Memory source, Memory dest, [CCode (array_length = false)] size_t[] source_origin, [CCode (array_length = false)] size_t[] dest_origin, [CCode (array_length = false)] size_t[] region, [CCode (array_length_pos = 5.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to copy an image object to a buffer object.
*
* @param origin Defines the (x, y, z) offset in pixels in the image from
* where to copy. If the image is a 2D image object, the z value given by
* //origin[2]// must be 0.
*
* @param region Defines the (width, height, depth) in pixels of the 2D or
* 3D rectangle to copy. If the image is a 2D image object, the depth value
* given by //region[2]// must be 1.
*
* @param offset The offset where to begin copying data into dst_buffer.
* The size in bytes of the region to be copied computed as //width// *
* //height// * //depth// * //bytes_per_image_element//, if the image is a
* 3D image object, and is computed as //width// * //height// *
* //bytes_per_image_element// if the image is a 2D image object.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null then this particular command
* does not wait on any event to complete. The events specified act as
* synchronization points. The context associated with events and the
* command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete. {@link enqueue_barrier} can be used instead.
*/
[CCode (cname = "clEnqueueCopyImageToBuffer")]
public Error enqueue_copy_image_to_buffer (Memory image, Memory buffer, [CCode (array_length = false)] size_t[] origin[3], [CCode (array_length = false)] size_t[] region, size_t offset, [CCode (array_length_pos = 5.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to map a region of the buffer object given by buffer into the host address space and returns a pointer to this mapped region.
*
* @param blocking Indicates if the map operation is blocking or
* non-blocking. If true, this method does not return until the specified
* region in buffer can be mapped. Otherwise, the pointer to the mapped
* region returned by this method cannot be used until the map command has
* completed. The event argument returns an event object which can be used
* to query the execution status of the map command. When the map command
* is completed, the application can access the contents of the mapped
* region using the pointer returned.
*
* @param buffer A valid buffer object. The OpenCL context associated with
* the command queue and the buffer must be the same.
*
* @param offset The offset in bytes in the buffer object that is being mapped.
*
* @param cb The size of the region in the buffer object that is being mapped.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with events and the
* command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete.
*
* @param errcode Returns an appropriate error code. If null, no error code
* is returned.
*/
[CCode (cname = "clEnqueueMapBuffer")]
public void * enqueue_map (Memory buffer, bool blocking, MapFlags flags, size_t offset, size_t cb, [CCode (array_length_pos = 5.1)] Event[]? event_wait_list, out Event? event, out Error errcode);
/**
* Enqueues a command to map a region of an image object into the host address space and returns a pointer to this mapped region.
*
* If the image object is created with {@link Memory.Flags.USE_HOST_PTR}
* set, the following will be true:<<BR>> The //host_ptr// specified in
* {@link Context.create_image_2d} or {@link Context.create_image_3d} is
* guaranteed to contain the latest bits in the region being mapped when
* the method has completed.<<BR>> The pointer value returned will be
* derived from the //host_ptr// specified when the image object is
* creat.<<BR>> Mapped image objects are unmapped using
* {@link enqueue_unmap}.
*
* The contents of the regions of a memory object mapped for writing (i.e.,
* {@link MapFlags.WRITE} is set) are considered to be undefined until this
* region is unmapped. Reads and writes by a kernel executing on a device
* to a memory region(s) mapped for writing are undefined.
*
* Multiple command-queues can map a region or overlapping regions of a
* memory object for reading (i.e., {@link MapFlags.READ}). The contents of
* the regions of a memory object mapped for reading can also be read by
* kernels executing on a device(s). The behavior of writes by a kernel
* executing on a device to a mapped region of a memory object is
* undefined. Mapping (and unmapping) overlapped regions of a memory object
* for writing is undefined.
*
* The behavior of OpenCL function calls that enqueue commands that write
* or copy to regions of a memory object that are mapped is undefined.
*
* The pointer returned maps a 2D or 3D region starting at origin and is at
* least (//image_row_pitch// * //region[1]//) pixels in size for a 2D
* image, and is at least (//image_slice_pitch// * //region[2]//) pixels in
* size for a 3D image. The result of a memory access outside this region
* is undefined.
*
* @param image A valid image object. The OpenCL context associated with
* the command queue and the image must be the same.
*
* @param blocking Indicates if the map operation is blocking or
* non-blocking. If true, this method does not return until the specified
* region in image can be mapped. Otherwise the pointer to the mapped
* region returned cannot be used until the map command has completed. The
* event argument returns an event object which can be used to query the
* execution status of the map command. When the map command is completed,
* the application can access the contents of the mapped region using the
* pointer returned.
*
* @param origin Define the (x, y, z) offset in pixels of the 2D or 3D
* rectangle region that is to be mapped. If image is a 2D image object,
* the z value given by //origin[2]// must be 0.
*
* @param region Define the (width, height, depth) in pixels of the 2D or
* 3D rectangle region that is to be mapped. If image is a 2D image object,
* the z value given by //region[2]// must be 1.
*
* @param image_row_pitch Returns the scan-line pitch in bytes for the
* mapped region.
*
* @param image_slice_pitch Returns the size in bytes of each 2D slice for
* the mapped region. For a 2D image, zero is returned.
*
* @param event_wait_list Specify events that need to complete before this
* method can be executed. If null, then the method does not wait on any
* event to complete. The events specified act as synchronization points.
* The context associated with the events and the command queue must be the
* same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete.
*
* @param errcode Returns an appropriate error code. If null, no error code
* is returned.
*/
[CCode (cname = "clEnqueueMapImage")]
public void * enqueue_map_image (Memory image, bool blocking, MapFlags flags, [CCode (array_length = false)] size_t[] origin, [CCode (array_length = false)] size_t[] region, out size_t image_row_pitch, out size_t image_slice_pitch, [CCode (array_length_pos = 7.1)] Event[]? event_wait_list, out Event event, out Error errcode);
/**
* Enqueues a marker command.
*
* The marker command is not completed until all commands enqueued before
* it have completed. The marker command returns an event which can be
* waited on, i.e., this event can be waited on to ensure that all commands
* which have been queued before the market command have been completed.
*/
[CCode (cname = "clEnqueueMarker")]
public Error enqueue_marker (Event event);
/**
* Enqueues a command to execute a native C/C++ function not compiled using
* the OpenCL compiler.
*
* A native user function can only be executed on a command-queue created
* on a device that has {@link ExecutionCapabilities.NATIVE_KERNEL}
* capability set in {@link DeviceInfo.EXECUTION_CAPABILITIES}.
*
* The data pointed to by args will be copied and a pointer to this copied
* region will be passed to func. The copy needs to be done because the
* memory objects that args may contain need to be modified and replaced by
* appropriate pointers to global memory. When this method returns, the
* memory region pointed to by args can be reused by the application.
*
* @param func the native function to be called.
*
* @param args the data that will be passed to the native function.
*
* @param mem_list A list of valid buffer objects. The buffer object values
* specified are memory object handles returned by {@link Context.create_buffer}
* or null.
*
* @param args_mem_loc A pointer to appropriate locations that args points
* to where memory object handles are stored. Before the user function is
* executed, the memory object handles are replaced by pointers to global
* memory.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If the list is null, then this
* particular command does not wait on any event to complete. Otherwise,
* the events specified act as synchronization points. The context
* associated with events in the list and this command queue must be the
* same.
*
* @param event Returns an event object that identifies this particular
* kernel execution instance. Event objects are unique and can be used to
* identify a particular kernel execution instance later on. If event is
* null, no event will be created for this kernel execution instance and
* therefore it will not be possible for the application to query or queue
* a wait for this particular kernel execution instance.
*/
[CCode (cname = "clEnqueueNativeKernel")]
public Error enqueue_native (NativeFunction func, uint8[]? args, [CCode (array_length_pos = 2.1)] Memory[]? mem_list, void** args_mem_loc, [CCode (array_length_pos = 2.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueue commands to read from a buffer object to host memory.
*
* Calling this method to read a region of the buffer object with the
* //ptr// argument value set to //host_ptr// + //offset//, where host_ptr
* is a pointer to the memory region specified when the buffer object being
* read is created with {@link Memory.Flags.USE_HOST_PTR}, must meet the following
* requirements in order to avoid undefined behavior:<<BR>> All commands
* that use this buffer object or a memory object (buffer or image) created
* from this buffer object have finished execution before the read command
* begins execution.<<BR>> The buffer object or memory objects created from
* this buffer object are not mapped.<<BR>> The buffer object or memory
* objects created from this buffer object are not used by any
* command-queue until the read command has finished execution.<<BR>>
*
* @param buffer Refers to a valid buffer object.
*
* @param blocking_read Indicates if the read operations are blocking or
* non-blocking. If true, this method does not return until the buffer data
* has been read and copied into memory pointed to by //ptr//. Otherwise,
* this method queues a non-blocking read command and returns. The contents
* of the buffer that //ptr// points to cannot be used until the read
* command has completed. The event argument returns an event object which
* can be used to query the execution status of the read command. When the
* read command has completed, the contents of the buffer that //ptr//
* points to can be used by the application.
*
* @param offset The offset in bytes in the buffer object to read from.
*
* @param cb The size in bytes of data being read.
*
* @param ptr The pointer to buffer in host memory where data is to be read into.
*
* @param event_wait_list Events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with events and
* command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* read command and can be used to query or queue a wait for this
* particular command to complete. This can be null in which case it will
* not be possible for the application to query the status of this command
* or queue a wait for this command to complete.
*/
[CCode (cname = "clEnqueueReadBuffer")]
public Error enqueue_read_buffer (Memory buffer, bool blocking_read, size_t offset, size_t cb, void* ptr, [CCode (array_length_pos = 5.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueue commands to read from a rectangular region from a buffer object
* to host memory.
*
* Calling this method to read a region of the buffer object with the
* //ptr// argument value set to //host_ptr// and //host_origin//,
* //buffer_origin// values are the same, where //host_ptr// is a pointer
* to the memory region specified when the buffer object being read is
* created with {@link Memory.Flags.USE_HOST_PTR}, must meet the same
* requirements given for {@link enqueue_read_buffer}.
* @param buffer Refers to a valid buffer object.
*
* @param blocking_read Indicates if the read operations are blocking or
* non-blocking. If true, the method does not return until the buffer data
* has been read and copied into memory pointed to by //ptr//. Otherwise,
* this method queues a non-blocking read command and returns. The contents
* of the buffer that //ptr// points to cannot be used until the read
* command has completed. The event argument argument returns an event
* object which can be used to query the execution status of the read
* command. When the read command has completed, the contents of the buffer
* that //ptr// points to can be used by the application.
*
* @param buffer_origin The (x, y, z) offset in the memory region
* associated with buffer. For a 2D rectangle region, the z value given by
* //buffer_origin[2]// should be 0. The offset in bytes is computed as
* //buffer_origin[2]// * //buffer_slice_pitch// + //buffer_origin[1]// *
* //buffer_row_pitch// + //buffer_origin[0]//.
*
* @param host_origin The (x, y, z) offset in the memory region pointed to
* by ptr. For a 2D rectangle region, the z value given by
* //host_origin[2]// should be 0. The offset in bytes is computed as
* //host_origin[2]// * //host_slice_pitch// + //host_origin[1]// *
* //host_row_pitch// + //host_origin[0]//.
*
* @param region The (width, height, depth) in bytes of the 2D or 3D
* rectangle being read or written. For a 2D rectangle copy, the depth
* value given by //region[2]// should be 1.
*
* @param buffer_row_pitch The length of each row in bytes to be used for
* the memory region associated with buffer. If zero, its is computed as
* //region[0]//.
*
* @param buffer_slice_pitch The length of each 2D slice in bytes to be
* used for the memory region associated with buffer. If zero, it is
* computed as //region[1]// * //buffer_row_pitch//.
*
* @param host_row_pitch The length of each row in bytes to be used for the
* memory region pointed to by //ptr//. If zero, it is computed as
* //region[0]//.
*
* @param host_slice_pitch The length of each 2D slice in bytes to be used
* for the memory region pointed to by //ptr//. If zero, it is computed as
* //region[1]// * //host_row_pitch//.
*
* @param ptr The pointer to buffer in host memory where data is to be read
* into.
*
* @param event_wait_list The events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with events and
* command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* read command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete.
*/
[CCode (cname = "clEnqueueReadBufferRect")]
public Error enqueue_read_buffer_rect (Memory buffer, bool blocking_read, [CCode (array_length = false)] size_t[] buffer_origin, [CCode (array_length = false)] size_t[] host_origin, [CCode (array_length = false)] size_t[] region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void* ptr, [CCode (array_length_pos = 10.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to read from a 2D or 3D image object to host memory.
*
* Calling this method to read a region of the image with the //ptr//
* argument value set to //host_ptr// + (//origin//[2] *
* //image_slice_pitch// + //origin//[1] * //image_row_pitch// +
* //origin//[0] * //bytes_per_pixel//), where host_ptr is a pointer to the
* memory region specified when the image being read is created with
* {@link Memory.Flags.USE_HOST_PTR}, must meet the following requirements
* in order to avoid undefined behavior:<<BR> All commands that use this
* image object have finished execution before the read command begins
* execution.<<BR> The //row_pitch// and //slice_pitch// argument values
* must be set to the image row pitch and slice pitch.<<BR> The image
* object is not mapped.<<BR> The image object is not used by any
* command-queue until the read command has finished execution.
*
* @param image Refers to a valid 2D or 3D image object.
*
* @param blocking_read Indicates if the read operations are blocking or
* non-blocking. If true, this method does not return until the buffer data
* has been read and copied into memory pointed to by //ptr//. Otherwise,
* this method queues a non-blocking read command and returns. The contents
* of the buffer that //ptr// points to cannot be used until the read
* command has completed. The event argument returns an event object which
* can be used to query the execution status of the read command. When the
* read command has completed, the contents of the buffer that //ptr// points
* to can be used by the application.
*
* @param origin Defines the (x, y, z) offset in pixels in the image from where to read. If image is a 2D image object, the z value given by //origin[2]// must be 0.
*
* @param region Defines the (width, height, depth) in pixels of the 2D or
* 3D rectangle being read. If image is a 2D image object, the depth value
* given by //region[2]// must be 1.
*
* @param row_pitch The length of each row in bytes. This value must be
* greater than or equal to the element size in bytes multiplied by width.
* If //row_pitch// is set to 0, the appropriate row pitch is calculated
* based on the size of each element in bytes multiplied by width.
*
* @param slice_pitch Size in bytes of the 2D slice of the 3D region of a
* 3D image being read. This must be 0 if image is a 2D image. This value
* must be greater than or equal to //row_pitch// * //height//. If
* //slice_pitch// is set to 0, the appropriate slice pitch is calculated
* based on the //row_pitch// * //height//.
*
* @param ptr The pointer to a buffer in host memory where image data is to
* be read from.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with the events and
* the command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* read command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete.
*/
[CCode (cname = "clEnqueueReadImage")]
public Error enqueue_read_image (Memory image, bool blocking_read, [CCode (array_length = false)] size_t[] origin, [CCode (array_length = false)] size_t[] region, size_t row_pitch, size_t slice_pitch, void* ptr, [CCode (array_length_pos = 8.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to execute a kernel on a device.
*
* The values specified in global_work_size + corresponding values
* specified in global_work_offset cannot exceed the range given by the
* sizeof(size_t) for the device on which the kernel execution will be
* enqueued. The sizeof(size_t) for a device can be determined using
* {@link DeviceInfo.ADDRESS_BITS}. If, for example, {@link DeviceInfo.ADDRESS_BITS}
* = 32, i.e. the device uses a 32-bit address space, size_t is a 32-bit
* unsigned integer and global_work_size values must be in the range 1 ..
* 2^32 - 1. Values outside this range return a {@link Error.OUT_OF_RESOURCES} error.
*
* These work-group instances are executed in parallel across multiple
* compute units or concurrently on the same compute unit.
*
* Each work-item is uniquely identified by a global identifier. The global
* ID, which can be read inside the kernel, is computed using the value
* given by global_work_size and global_work_offset. In addition, a
* work-item is also identified within a work-group by a unique local ID.
* The local ID, which can also be read by the kernel, is computed using
* the value given by local_work_size. The starting local ID is always (0,
* 0, ... 0).
*
* @param kernel A valid kernel object. The OpenCL context associated with
* kernel and command queue must be the same.
*
* @param work_dim The number of dimensions used to specify the global
* work-items and work-items in the work-group. This must be greater than
* zero and less than or equal to {@link DeviceInfo.MAX_WORK_ITEM_DIMENSIONS}.
*
* @param global_work_offset An array of //work_dim// unsigned values that
* describe the offset used to calculate the global ID of a work-item. If
* null, the global IDs start at offset (0, 0, ... 0).
*
* @param global_work_size An array of //work_dim// unsigned values that
* describe the number of global work-items in work_dim dimensions that
* will execute the kernel function. The total number of global work-items
* is computed as global_work_size[0] ... global_work_size[work_dim - 1].
*
* @param local_work_size An array of //work_dim// unsigned values that
* describe the number of work-items that make up a work-group (also
* referred to as the size of the work-group) that will execute the kernel
* specified by kernel. The total number of work-items in a work-group is
* computed as local_work_size[0] ... local_work_size[work_dim - 1]. The
* total number of work-items in the work-group must be less than or equal
* to the {@link DeviceInfo.MAX_WORK_GROUP_SIZE} value specified in table of OpenCL
* Device Queries for {@link Device.get_info} and the number of work-items
* specified in local_work_size[0],... local_work_size[work_dim - 1] must
* be less than or equal to the corresponding values specified by
* {@link DeviceInfo.MAX_WORK_GROUP_SIZE}[0],....
* {@link DeviceInfo.MAX_WORK_GROUP_SIZE}[work_dim - 1]. The explicitly
* specified local_work_size will be used to determine how to break the
* global work-items specified by global_work_size into appropriate
* work-group instances. If local_work_size is specified, the values
* specified in global_work_size[0],... global_work_size[work_dim - 1] must
* be evenly divisible by the corresponding values specified in
* local_work_size[0],... local_work_size[work_dim - 1].<<BR>>
* The work-group size to be used for kernel can also be specified in the
* program source using the _\_attribute_\_((reqd_work_group_size(X, Y,
* Z))) qualifier. In this case the size of work group specified by
* local_work_size must match the value specified by the
* reqd_work_group_size _\_attribute_\_ qualifier.<<BR>>
* If null, the OpenCL implementation will determine how to be break the
* global work-items into appropriate work-group instances.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If list is null, then this
* particular command does not wait on any event to complete. The events
* specified act as synchronization points. The context associated with
* events in this_list and command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* kernel execution instance. Event objects are unique and can be used to
* identify a particular kernel execution instance later on. If event is
* null, no event will be created for this kernel execution instance and
* therefore it will not be possible for the application to query or queue
* a wait for this particular kernel execution instance.
*/
[CCode (cname = "clEnqueueNDRangeKernel")]
public Error enqueue_range (Kernel kernel, uint work_dim, [CCode (array_length = false)] size_t[]? global_work_offset, [CCode (array_length = false)] size_t[]? global_work_size, [CCode (array_length = false)] size_t[]? local_work_size, [CCode (array_length_pos = 1.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to execute a kernel on a device.
*
*
* The kernel is executed using a single work-item.
*
* This method is equivalent to calling {@link enqueue_range}(kernel, 1,
* null, size_t[] {1}, size_t[] {1}, event_wait_list, out event).
*
* @param kernel A valid kernel object. The OpenCL context associated with
* kernel and command queue must be the same.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If list is null, then this
* particular command does not wait on any event to complete. The events
* specified act as synchronization points. The context associated with
* events in this_list and command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* kernel execution instance. Event objects are unique and can be used to
* identify a particular kernel execution instance later on. If event is
* null, no event will be created for this kernel execution instance and
* therefore it will not be possible for the application to query or queue
* a wait for this particular kernel execution instance.
*/
[CCode (cname = "clEnqueueTask")]
public Error enqueue_task (Kernel kernel, [CCode (array_length_pos = 1.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to unmap a previously mapped region of a memory object.
*
* Reads or writes from the host using the pointer returned by {@link enqueue_map}
* or {@link enqueue_map_image} considered to be complete.
*
* {@link enqueue_map} and {@link enqueue_map_image} increment the mapped
* count of the memory object. The initial mapped count value of a memory
* object is zero. Multiple calls to {@link enqueue_map} or {@link enqueue_map_image}
* on the same memory object will increment this mapped count by
* appropriate number of calls. This method decrements the mapped
* count of the memory object.
*
* {@link enqueue_map} and {@link enqueue_map_image} act as synchronization
* points for a region of the buffer object being mapped.
*
* @param memobj A valid memory object. The OpenCL context associated with
* the command queue and memobj must be the same.
*
* @param mapped_ptr The host address returned by a previous call to
* {@link enqueue_map} or {@link enqueue_map_image} for memobj.
*
* @param event_wait_list Specify events that need to complete before this
* call can be executed. If null, then this method does not wait on any
* event to complete. The events specified act as synchronization points.
* The context associated with the events and the command queue must be the
* same.
*
* @param event Returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete. {@link enqueue_barrier} can be used instead.
*/
[CCode (cname = "clEnqueueUnmapMemObject")]
public Error enqueue_unmap (Memory memobj, void* mapped_ptr, [CCode (array_length_pos = 2.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueue commands to write to a buffer object from host memory.
*
* Calling this method to update the latest bits in a region of the buffer
* object with the //ptr// argument value set to //host_ptr// + //offset//,
* where host_ptr is a pointer to the memory region specified when the
* buffer object being written is created with {@link Memory.Flags.USE_HOST_PTR},
* must meet the following requirements in order to avoid undefined
* behavior:<<BR>>
* All commands that use this buffer object or a memory object (buffer or
* image) created from this buffer object have finished execution before
* the read command begins execution.<<BR>> The buffer object or memory
* objects created from this buffer object are not mapped.<<BR>> The buffer
* object or memory objects created from this buffer object are not used by
* any command-queue until the read command has finished execution.<<BR>>
*
* @param buffer Refers to a valid buffer object.
*
* @param blocking_write Indicates if the write operations are blocking or
* nonblocking. If true, the OpenCL implementation copies the data
* referred to by ptr and enqueues the write operation in the
* command-queue. The memory pointed to by //ptr// can be reused by the
* application after the method returns. Otherwise the OpenCL
* implementation will use //ptr// to perform a non-blocking write. As the
* write is non-blocking the implementation can return immediately. The
* memory pointed to by ptr cannot be reused by the application after the
* call returns. The event argument returns an event object which can be
* used to query the execution status of the write command. When the write
* command has completed, the memory pointed to by //ptr// can then be
* reused by the application.
*
* @param offset The offset in bytes in the buffer object to write to.
*
* @param cb The size in bytes of daa being written.
*
* @param ptr The pointer to buffer in host memory where data is to be written from.
*
* @param event_wait_list The events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified in
* event_wait_list act as synchronization points. The context associated
* with events and command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* write command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete.
*/
[CCode (cname = "clEnqueueWriteBuffer")]
public Error enqueue_write_buffer (Memory buffer, bool blocking_write, size_t offset, size_t cb, void* ptr, [CCode (array_length_pos = 5.1)] Event[]? event_wait_list, out Event event);
/**
* Enqueue commands to write a rectangular region to a buffer object from
* host memory.
*
* Calling this method to update the latest bits in a region of the buffer
* object with the //ptr// argument value set to //host_ptr// and
* //host_origin//, //buffer_origin// values are the same, where
* //host_ptr// is a pointer to the memory region specified when the buffer
* object being written is created with {@link Memory.Flags.USE_HOST_PTR},
* must meet the following requirements in order to avoid undefined
* behavior:<<BR>> The host memory region given by (//buffer_origin//
* region) contains the latest bits when the enqueued write command begins
* execution.<<BR>> The buffer object or memory objects created from this
* buffer object are not mapped.<<BR>> The buffer object or memory objects
* created from this buffer object are not used by any command-queue until
* the write command has finished execution.
*
* @param buffer Refers to a valid buffer object.
*
* @param blocking_write Indicates if the write operations are blocking or
* nonblocking. If true, the OpenCL implementation copies the data
* referred to by ptr and enqueues the write operation in the
* command-queue. The memory pointed to by //ptr// can be reused by the
* application after the method returns. Otherwise the OpenCL
* implementation will use //ptr// to perform a non-blocking write. As the
* write is non-blocking the implementation can return immediately. The
* memory pointed to by ptr cannot be reused by the application after the
* call returns. The event argument returns an event object which can be
* used to query the execution status of the write command. When the write
* command has completed, the memory pointed to by //ptr// can then be
* reused by the application.
*
* @param buffer_origin The (x, y, z) offset in the memory region
* associated with buffer. For a 2D rectangle region, the z value given by
* //buffer_origin[2]// should be 0. The offset in bytes is computed as
* //buffer_origin[2]// * //buffer_slice_pitch// + //buffer_origin[1]// *
* //buffer_row_pitch// + //buffer_origin[0]//.
*
* @param host_origin The (x, y, z) offset in the memory region pointed to
* by ptr. For a 2D rectangle region, the z value given by
* //host_origin[2]// should be 0. The offset in bytes is computed as
* //host_origin[2]// * //host_slice_pitch// + //host_origin[1]// *
* //host_row_pitch// + //host_origin[0]//.
*
* @param region The (width, height, depth) in bytes of the 2D or 3D
* rectangle being read or written. For a 2D rectangle copy, the depth
* value given by //region[2]// should be 1.
*
* @param buffer_row_pitch The length of each row in bytes to be used for
* the memory region associated with buffer. If zero, its is computed as
* //region[0]//.
*
* @param buffer_slice_pitch The length of each 2D slice in bytes to be
* used for the memory region associated with buffer. If zero, it is
* computed as //region[1]// * //buffer_row_pitch//.
*
* @param host_row_pitch The length of each row in bytes to be used for the
* memory region pointed to by //ptr//. If zero, it is computed as
* //region[0]//.
*
* @param host_slice_pitch The length of each 2D slice in bytes to be used
* for the memory region pointed to by //ptr//. If zero, it is computed as
* //region[1]// * //host_row_pitch//.
*
* @param ptr The pointer to buffer in host memory where data is to be
* written from.
*
* @param event_wait_list The events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with events and
* command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* read command and can be used to query or queue a wait for this
* particular command to complete. If null, it will not be possible for the
* application to query the status of this command or queue a wait for this
* command to complete.
*/
[CCode (cname = "clEnqueueWriteBufferRect")]
public Error enqueue_write_buffer_rect (Memory buffer, bool blocking_write, [CCode (array_length = false)] size_t[] buffer_origin, [CCode (array_length = false)] size_t[] host_origin, [CCode (array_length = false)] size_t[] region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void* ptr, [CCode (array_length_pos = 10.1)] Event[]? event_wait_list, out Event? event);
/**
* Enqueues a command to write to a 2D or 3D image object from host memory.
*
* The command queue and image must be created with the same OpenCL context.
*
* Calling this method to update the latest bits in a region of the image
* with the //ptr// argument value set to //host_ptr// + (//origin[2]// *
* //image_slice_pitch// + //origin[1]// * //image_row_pitch// +
* //origin[0]// * //bytes_per_pixel//), where //host_ptr// is a pointer to
* the memory region specified when the image being written is created with
* {@link Memory.Flags.USE_HOST_PTR}, must meet the following requirements
* in order to avoid undefined behavior:<<BR>> The host memory region being
* written contains the latest bits when the enqueued write command begins
* execution.<<BR>> The //input_row_pitch// and //input_slice_pitch//
* argument values must be set to the image row pitch and slice
* pitch.<<BR>> The image object is not mapped.<<BR>> The image object is
* not used by any command-queue until the write command has finished
* execution.
*
* @param image Refers to a valid 2D or 3D image object.
*
* @param blocking_write Indicates if the write operation is blocking or
* non-blocking. If true, the OpenCL implementation copies the data
* referred to by ptr and enqueues the write command in the command queue.
* The memory pointed to by //ptr// can be reused by the application after
* the call returns. Otherwise, the OpenCL implementation will use //ptr//
* to perform a nonblocking write. As the write is non-blocking the
* implementation can return immediately. The memory pointed to by ptr
* cannot be reused by the application after the call returns. The event
* argument returns an event object which can be used to query the
* execution status of the write command. When the write command has
* completed, the memory pointed to by //ptr// can then be reused by the
* application.
*
* @param origin Defines the (x, y, z) offset in pixels in the image from
* where to write. If image is a 2D image object, the z value given by
* //origin[2]// must be 0.
*
* @param region Defines the (width, height, depth) in pixels of the 2D or
* 3D rectangle being written. If image is a 2D image object, the depth
* value given by //region[2]// must be 1.
*
* @param input_row_pitch The length of each row in bytes. This value must
* be greater than or equal to the element size in bytes times the width.
* If //input_row_pitch// is set to 0, the appropriate row pitch is
* calculated based on the size of each element in bytes multiplied by
* width.
*
* @param input_slice_pitch Size in bytes of the 2D slice of the 3D region
* of a 3D image being written. This must be 0 if image is a 2D image. This
* value must be greater than or equal to row_pitch times the height. If
* //input_slice_pitch// is set to 0, the appropriate slice pitch is
* calculated based on the row_pitch multiplied by the height.
*
* @param ptr The pointer to a buffer in host memory where image data is to
* be written to.
*
* @param event_wait_list Specify events that need to complete before this
* particular command can be executed. If null, then this particular
* command does not wait on any event to complete. The events specified act
* as synchronization points. The context associated with events and the
* command queue must be the same.
*
* @param event Returns an event object that identifies this particular
* write command and can be used to query or queue a wait for this
* particular command to complete. This can be null, in which case it will
* not be possible for the application to query the status of this command
* or queue a wait for this command to complete.
*/
[CCode (cname = "clEnqueueWriteImage")]
public Error enqueue_write_image (Memory image, bool blocking_write, [CCode (array_length = false)] size_t[] origin, [CCode (array_length = false)] size_t[] region, size_t input_row_pitch, size_t input_slice_pitch, void* ptr, [CCode (array_length_pos = 7.1)] Event[]? event_wait_list, out Event? event);
/**
* Blocks until all previously queued OpenCL commands in a command-queue are issued to the associated device and have completed.
*/
[CCode (cname = "clFinish")]
public Error finish ();
/**
* Issues all previously queued OpenCL commands in a command-queue to the
* device associated with the command-queue.
*
* This method only guarantees that all queued commands get issued to the
* appropriate device. There is no guarantee that they will be complete
* after it returns.
*
* Any blocking commands queued in a command-queue perform an implicit
* flush of the command-queue. These blocking commands are {@link enqueue_read_buffer},
* {@link enqueue_read_buffer_rect}, or {@link enqueue_read_image} with
* //blocking_read// set to true; {@link enqueue_write_buffer},
* {@link enqueue_write_buffer_rect}, or {@link enqueue_write_image} with
* //blocking_write// set to true; {@link enqueue_map} or
* {@link enqueue_map_image} with //blocking_map// set to true; or
* {@link wait_for_events}.
*
* To use event objects that refer to commands enqueued in a command-queue
* as event objects to wait on by commands enqueued in a different
* command-queue, the application must call a {@link flush} or any blocking
* commands that perform an implicit flush of the command-queue where the
* commands that refer to these event objects are enqueued.
*/
[CCode (cname = "clFlush")]
public Error flush ();
[CCode (cname = "clGetCommandQueueInfo")]
public Error get_info (Info info, [CCode (array_length_pos = 1.1)] uint8[]? buffer, out size_t size);
/**
* Call {@link get_info} with automatic space allocation.
*/