-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathclfortran.f90
1931 lines (1631 loc) · 81.3 KB
/
clfortran.f90
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
! -----------------------------------------------------------------------------
! CLFORTRAN - OpenCL bindings module for Fortran.
!
! This is the main module file and contains all OpenCL API definitions to be
! invoked from Fortran programs.
!
! -----------------------------------------------------------------------------
!
! Copyright (C) 2013 Company for Advanced Supercomputing Solutions LTD
! Bosmat 2a St.
! Shoham
! Israel 60850
! http://www.cass-hpc.com
!
! Author: Mordechai Butrashvily <[email protected]>
!
! -----------------------------------------------------------------------------
!
! This program is free software: you can redistribute it and/or modify
! it under the terms of the GNU Lesser General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
! -----------------------------------------------------------------------------
module clfortran
USE ISO_C_BINDING
implicit none
! Error Codes
integer(c_int32_t), parameter :: CL_SUCCESS = 0
integer(c_int32_t), parameter :: CL_DEVICE_NOT_FOUND = -1
integer(c_int32_t), parameter :: CL_DEVICE_NOT_AVAILABLE = -2
integer(c_int32_t), parameter :: CL_COMPILER_NOT_AVAILABLE = -3
integer(c_int32_t), parameter :: CL_MEM_OBJECT_ALLOCATION_FAILURE = -4
integer(c_int32_t), parameter :: CL_OUT_OF_RESOURCES = -5
integer(c_int32_t), parameter :: CL_OUT_OF_HOST_MEMORY = -6
integer(c_int32_t), parameter :: CL_PROFILING_INFO_NOT_AVAILABLE = -7
integer(c_int32_t), parameter :: CL_MEM_COPY_OVERLAP = -8
integer(c_int32_t), parameter :: CL_IMAGE_FORMAT_MISMATCH = -9
integer(c_int32_t), parameter :: CL_IMAGE_FORMAT_NOT_SUPPORTED = -10
integer(c_int32_t), parameter :: CL_BUILD_PROGRAM_FAILURE = -11
integer(c_int32_t), parameter :: CL_MAP_FAILURE = -12
integer(c_int32_t), parameter :: CL_MISALIGNED_SUB_BUFFER_OFFSET = -13
integer(c_int32_t), parameter :: CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST = -14
integer(c_int32_t), parameter :: CL_COMPILE_PROGRAM_FAILURE = -15
integer(c_int32_t), parameter :: CL_LINKER_NOT_AVAILABLE = -16
integer(c_int32_t), parameter :: CL_LINK_PROGRAM_FAILURE = -17
integer(c_int32_t), parameter :: CL_DEVICE_PARTITION_FAILED = -18
integer(c_int32_t), parameter :: CL_KERNEL_ARG_INFO_NOT_AVAILABLE = -19
integer(c_int32_t), parameter :: CL_INVALID_VALUE = -30
integer(c_int32_t), parameter :: CL_INVALID_DEVICE_TYPE = -31
integer(c_int32_t), parameter :: CL_INVALID_PLATFORM = -32
integer(c_int32_t), parameter :: CL_INVALID_DEVICE = -33
integer(c_int32_t), parameter :: CL_INVALID_CONTEXT = -34
integer(c_int32_t), parameter :: CL_INVALID_QUEUE_PROPERTIES = -35
integer(c_int32_t), parameter :: CL_INVALID_COMMAND_QUEUE = -36
integer(c_int32_t), parameter :: CL_INVALID_HOST_PTR = -37
integer(c_int32_t), parameter :: CL_INVALID_MEM_OBJECT = -38
integer(c_int32_t), parameter :: CL_INVALID_IMAGE_FORMAT_DESCRIPTOR = -39
integer(c_int32_t), parameter :: CL_INVALID_IMAGE_SIZE = -40
integer(c_int32_t), parameter :: CL_INVALID_SAMPLER = -41
integer(c_int32_t), parameter :: CL_INVALID_BINARY = -42
integer(c_int32_t), parameter :: CL_INVALID_BUILD_OPTIONS = -43
integer(c_int32_t), parameter :: CL_INVALID_PROGRAM = -44
integer(c_int32_t), parameter :: CL_INVALID_PROGRAM_EXECUTABLE = -45
integer(c_int32_t), parameter :: CL_INVALID_KERNEL_NAME = -46
integer(c_int32_t), parameter :: CL_INVALID_KERNEL_DEFINITION = -47
integer(c_int32_t), parameter :: CL_INVALID_KERNEL = -48
integer(c_int32_t), parameter :: CL_INVALID_ARG_INDEX = -49
integer(c_int32_t), parameter :: CL_INVALID_ARG_VALUE = -50
integer(c_int32_t), parameter :: CL_INVALID_ARG_SIZE = -51
integer(c_int32_t), parameter :: CL_INVALID_KERNEL_ARGS = -52
integer(c_int32_t), parameter :: CL_INVALID_WORK_DIMENSION = -53
integer(c_int32_t), parameter :: CL_INVALID_WORK_GROUP_SIZE = -54
integer(c_int32_t), parameter :: CL_INVALID_WORK_ITEM_SIZE = -55
integer(c_int32_t), parameter :: CL_INVALID_GLOBAL_OFFSET = -56
integer(c_int32_t), parameter :: CL_INVALID_EVENT_WAIT_LIST = -57
integer(c_int32_t), parameter :: CL_INVALID_EVENT = -58
integer(c_int32_t), parameter :: CL_INVALID_OPERATION = -59
integer(c_int32_t), parameter :: CL_INVALID_GL_OBJECT = -60
integer(c_int32_t), parameter :: CL_INVALID_BUFFER_SIZE = -61
integer(c_int32_t), parameter :: CL_INVALID_MIP_LEVEL = -62
integer(c_int32_t), parameter :: CL_INVALID_GLOBAL_WORK_SIZE = -63
integer(c_int32_t), parameter :: CL_INVALID_PROPERTY = -64
integer(c_int32_t), parameter :: CL_INVALID_IMAGE_DESCRIPTOR = -65
integer(c_int32_t), parameter :: CL_INVALID_COMPILER_OPTIONS = -66
integer(c_int32_t), parameter :: CL_INVALID_LINKER_OPTIONS = -67
integer(c_int32_t), parameter :: CL_INVALID_DEVICE_PARTITION_COUNT = -68
! OpenCL Version
integer(c_int32_t), parameter :: CL_VERSION_1_0 = 1
integer(c_int32_t), parameter :: CL_VERSION_1_1 = 1
integer(c_int32_t), parameter :: CL_VERSION_1_2 = 1
! cl_bool
integer(c_int32_t), parameter :: CL_FALSE = 0
integer(c_int32_t), parameter :: CL_TRUE = 1
integer(c_int32_t), parameter :: CL_BLOCKING = CL_TRUE
integer(c_int32_t), parameter :: CL_NON_BLOCKING = CL_FALSE
! cl_platform_info
integer(c_int32_t), parameter :: CL_PLATFORM_PROFILE = Z'0900'
integer(c_int32_t), parameter :: CL_PLATFORM_VERSION = Z'0901'
integer(c_int32_t), parameter :: CL_PLATFORM_NAME = Z'0902'
integer(c_int32_t), parameter :: CL_PLATFORM_VENDOR = Z'0903'
integer(c_int32_t), parameter :: CL_PLATFORM_EXTENSIONS = Z'0904'
! cl_device_type - bitfield
integer(c_int64_t), parameter :: CL_DEVICE_TYPE_DEFAULT = b'00001'
integer(c_int64_t), parameter :: CL_DEVICE_TYPE_CPU = b'00010'
integer(c_int64_t), parameter :: CL_DEVICE_TYPE_GPU = b'00100'
integer(c_int64_t), parameter :: CL_DEVICE_TYPE_ACCELERATOR = b'01000'
integer(c_int64_t), parameter :: CL_DEVICE_TYPE_CUSTOM = b'10000'
integer(c_int64_t), parameter :: CL_DEVICE_TYPE_ALL = Z'FFFFFFFF'
! cl_device_info
integer(c_int32_t), parameter :: CL_DEVICE_TYPE = Z'1000'
integer(c_int32_t), parameter :: CL_DEVICE_VENDOR_ID = Z'1001'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_COMPUTE_UNITS = Z'1002'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = Z'1003'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_WORK_GROUP_SIZE = Z'1004'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_WORK_ITEM_SIZES = Z'1005'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = Z'1006'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = Z'1007'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT = Z'1008'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG = Z'1009'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = Z'100A'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = Z'100B'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_CLOCK_FREQUENCY = Z'100C'
integer(c_int32_t), parameter :: CL_DEVICE_ADDRESS_BITS = Z'100D'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_READ_IMAGE_ARGS = Z'100E'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_WRITE_IMAGE_ARGS = Z'100F'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_MEM_ALLOC_SIZE = Z'1010'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE2D_MAX_WIDTH = Z'1011'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE2D_MAX_HEIGHT = Z'1012'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE3D_MAX_WIDTH = Z'1013'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE3D_MAX_HEIGHT = Z'1014'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE3D_MAX_DEPTH = Z'1015'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE_SUPPORT = Z'1016'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_PARAMETER_SIZE = Z'1017'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_SAMPLERS = Z'1018'
integer(c_int32_t), parameter :: CL_DEVICE_MEM_BASE_ADDR_ALIGN = Z'1019'
integer(c_int32_t), parameter :: CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = Z'101A'
integer(c_int32_t), parameter :: CL_DEVICE_SINGLE_FP_CONFIG = Z'101B'
integer(c_int32_t), parameter :: CL_DEVICE_GLOBAL_MEM_CACHE_TYPE = Z'101C'
integer(c_int32_t), parameter :: CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE = Z'101D'
integer(c_int32_t), parameter :: CL_DEVICE_GLOBAL_MEM_CACHE_SIZE = Z'101E'
integer(c_int32_t), parameter :: CL_DEVICE_GLOBAL_MEM_SIZE = Z'101F'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE = Z'1020'
integer(c_int32_t), parameter :: CL_DEVICE_MAX_CONSTANT_ARGS = Z'1021'
integer(c_int32_t), parameter :: CL_DEVICE_LOCAL_MEM_TYPE = Z'1022'
integer(c_int32_t), parameter :: CL_DEVICE_LOCAL_MEM_SIZE = Z'1023'
integer(c_int32_t), parameter :: CL_DEVICE_ERROR_CORRECTION_SUPPORT = Z'1024'
integer(c_int32_t), parameter :: CL_DEVICE_PROFILING_TIMER_RESOLUTION = Z'1025'
integer(c_int32_t), parameter :: CL_DEVICE_ENDIAN_LITTLE = Z'1026'
integer(c_int32_t), parameter :: CL_DEVICE_AVAILABLE = Z'1027'
integer(c_int32_t), parameter :: CL_DEVICE_COMPILER_AVAILABLE = Z'1028'
integer(c_int32_t), parameter :: CL_DEVICE_EXECUTION_CAPABILITIES = Z'1029'
integer(c_int32_t), parameter :: CL_DEVICE_QUEUE_PROPERTIES = Z'102A'
integer(c_int32_t), parameter :: CL_DEVICE_NAME = Z'102B'
integer(c_int32_t), parameter :: CL_DEVICE_VENDOR = Z'102C'
integer(c_int32_t), parameter :: CL_DRIVER_VERSION = Z'102D'
integer(c_int32_t), parameter :: CL_DEVICE_PROFILE = Z'102E'
integer(c_int32_t), parameter :: CL_DEVICE_VERSION = Z'102F'
integer(c_int32_t), parameter :: CL_DEVICE_EXTENSIONS = Z'1030'
integer(c_int32_t), parameter :: CL_DEVICE_PLATFORM = Z'1031'
integer(c_int32_t), parameter :: CL_DEVICE_DOUBLE_FP_CONFIG = Z'1032'
! 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF = Z'1034'
integer(c_int32_t), parameter :: CL_DEVICE_HOST_UNIFIED_MEMORY = Z'1035'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = Z'1036'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = Z'1037'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = Z'1038'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = Z'1039'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = Z'103A'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = Z'103B'
integer(c_int32_t), parameter :: CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = Z'103C'
integer(c_int32_t), parameter :: CL_DEVICE_OPENCL_C_VERSION = Z'103D'
integer(c_int32_t), parameter :: CL_DEVICE_LINKER_AVAILABLE = Z'103E'
integer(c_int32_t), parameter :: CL_DEVICE_BUILT_IN_KERNELS = Z'103F'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE_MAX_BUFFER_SIZE = Z'1040'
integer(c_int32_t), parameter :: CL_DEVICE_IMAGE_MAX_ARRAY_SIZE = Z'1041'
integer(c_int32_t), parameter :: CL_DEVICE_PARENT_DEVICE = Z'1042'
integer(c_int32_t), parameter :: CL_DEVICE_PARTITION_MAX_SUB_DEVICES = Z'1043'
integer(c_int32_t), parameter :: CL_DEVICE_PARTITION_PROPERTIES = Z'1044'
integer(c_int32_t), parameter :: CL_DEVICE_PARTITION_AFFINITY_DOMAIN = Z'1045'
integer(c_int32_t), parameter :: CL_DEVICE_PARTITION_TYPE = Z'1046'
integer(c_int32_t), parameter :: CL_DEVICE_REFERENCE_COUNT = Z'1047'
integer(c_int32_t), parameter :: CL_DEVICE_PREFERRED_INTEROP_USER_SYNC = Z'1048'
integer(c_int32_t), parameter :: CL_DEVICE_PRINTF_BUFFER_SIZE = Z'1049'
! cl_device_fp_config - bitfield
integer(c_int64_t), parameter :: CL_FP_DENORM = b'00000001'
integer(c_int64_t), parameter :: CL_FP_INF_NAN = b'00000010'
integer(c_int64_t), parameter :: CL_FP_ROUND_TO_NEAREST = b'00000100'
integer(c_int64_t), parameter :: CL_FP_ROUND_TO_ZERO = b'00001000'
integer(c_int64_t), parameter :: CL_FP_ROUND_TO_INF = b'00010000'
integer(c_int64_t), parameter :: CL_FP_FMA = b'00100000'
integer(c_int64_t), parameter :: CL_FP_SOFT_FLOAT = b'01000000'
integer(c_int64_t), parameter :: CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT = b'10000000'
! cl_device_mem_cache_type
integer(c_int32_t), parameter :: CL_NONE = Z'0'
integer(c_int32_t), parameter :: CL_READ_ONLY_CACHE = Z'1'
integer(c_int32_t), parameter :: CL_READ_WRITE_CACHE = Z'2'
! cl_device_local_mem_type
integer(c_int32_t), parameter :: CL_LOCAL = Z'1'
integer(c_int32_t), parameter :: CL_GLOBAL = Z'2'
! cl_device_exec_capabilities - bitfield
integer(c_int64_t), parameter :: CL_EXEC_KERNEL = b'01'
integer(c_int64_t), parameter :: CL_EXEC_NATIVE_KERNEL = b'10'
! cl_command_queue_properties - bitfield
integer(c_int64_t), parameter :: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = b'01'
integer(c_int64_t), parameter :: CL_QUEUE_PROFILING_ENABLE = b'10'
! cl_context_info
integer(c_int32_t), parameter :: CL_CONTEXT_REFERENCE_COUNT = Z'1080'
integer(c_int32_t), parameter :: CL_CONTEXT_DEVICES = Z'1081'
integer(c_int32_t), parameter :: CL_CONTEXT_PROPERTIES = Z'1082'
integer(c_int32_t), parameter :: CL_CONTEXT_NUM_DEVICES = Z'1083'
! cl_context_properties type(c_ptr)
integer(c_intptr_t), parameter :: CL_CONTEXT_PLATFORM = Z'1084'
integer(c_intptr_t), parameter :: CL_CONTEXT_INTEROP_USER_SYNC = Z'1085'
! cl_command_queue_info
integer(c_int32_t), parameter :: CL_QUEUE_CONTEXT = Z'1090'
integer(c_int32_t), parameter :: CL_QUEUE_DEVICE = Z'1091'
integer(c_int32_t), parameter :: CL_QUEUE_REFERENCE_COUNT = Z'1092'
integer(c_int32_t), parameter :: CL_QUEUE_PROPERTIES = Z'1093'
! cl_mem_flags - bitfield (int64)
integer(c_int64_t), parameter :: CL_MEM_READ_WRITE = b'0000000001'
integer(c_int64_t), parameter :: CL_MEM_WRITE_ONLY = b'0000000010'
integer(c_int64_t), parameter :: CL_MEM_READ_ONLY = b'0000000100'
integer(c_int64_t), parameter :: CL_MEM_USE_HOST_PTR = b'0000001000'
integer(c_int64_t), parameter :: CL_MEM_ALLOC_HOST_PTR = b'0000010000'
integer(c_int64_t), parameter :: CL_MEM_COPY_HOST_PTR = b'0000100000'
!integer(c_int64_t), parameter :: reserved = b'0001000000'
integer(c_int64_t), parameter :: CL_MEM_HOST_WRITE_ONLY = b'0010000000'
integer(c_int64_t), parameter :: CL_MEM_HOST_READ_ONLY = b'0100000000'
integer(c_int64_t), parameter :: CL_MEM_HOST_NO_ACCESS = b'1000000000'
! cl_buffer_create_type
integer(c_int32_t), parameter :: CL_BUFFER_CREATE_TYPE_REGION = Z'1220'
! cl_channel_order
integer(c_int32_t), parameter :: CL_R = Z'10B0'
integer(c_int32_t), parameter :: CL_A = Z'10B1'
integer(c_int32_t), parameter :: CL_RG = Z'10B2'
integer(c_int32_t), parameter :: CL_RA = Z'10B3'
integer(c_int32_t), parameter :: CL_RGB = Z'10B4'
integer(c_int32_t), parameter :: CL_RGBA = Z'10B5'
integer(c_int32_t), parameter :: CL_BGRA = Z'10B6'
integer(c_int32_t), parameter :: CL_ARGB = Z'10B7'
integer(c_int32_t), parameter :: CL_INTENSITY = Z'10B8'
integer(c_int32_t), parameter :: CL_LUMINANCE = Z'10B9'
integer(c_int32_t), parameter :: CL_Rx = Z'10BA'
integer(c_int32_t), parameter :: CL_RGx = Z'10BB'
integer(c_int32_t), parameter :: CL_RGBx = Z'10BC'
integer(c_int32_t), parameter :: CL_DEPTH = Z'10BD'
integer(c_int32_t), parameter :: CL_DEPTH_STENCIL = Z'10BE'
! cl_channel_type
integer(c_int32_t), parameter :: CL_SNORM_INT8 = Z'10D0'
integer(c_int32_t), parameter :: CL_SNORM_INT16 = Z'10D1'
integer(c_int32_t), parameter :: CL_UNORM_INT8 = Z'10D2'
integer(c_int32_t), parameter :: CL_UNORM_INT16 = Z'10D3'
integer(c_int32_t), parameter :: CL_UNORM_SHORT_565 = Z'10D4'
integer(c_int32_t), parameter :: CL_UNORM_SHORT_555 = Z'10D5'
integer(c_int32_t), parameter :: CL_UNORM_INT_101010 = Z'10D6'
integer(c_int32_t), parameter :: CL_SIGNED_INT8 = Z'10D7'
integer(c_int32_t), parameter :: CL_SIGNED_INT16 = Z'10D8'
integer(c_int32_t), parameter :: CL_SIGNED_INT32 = Z'10D9'
integer(c_int32_t), parameter :: CL_UNSIGNED_INT8 = Z'10DA'
integer(c_int32_t), parameter :: CL_UNSIGNED_INT16 = Z'10DB'
integer(c_int32_t), parameter :: CL_UNSIGNED_INT32 = Z'10DC'
integer(c_int32_t), parameter :: CL_HALF_FLOAT = Z'10DD'
integer(c_int32_t), parameter :: CL_FLOAT = Z'10DE'
integer(c_int32_t), parameter :: CL_UNORM_INT24 = Z'10DF'
! cl_mem_object_type
integer(c_int32_t), parameter :: CL_MEM_OBJECT_BUFFER = Z'10F0'
integer(c_int32_t), parameter :: CL_MEM_OBJECT_IMAGE2D = Z'10F1'
integer(c_int32_t), parameter :: CL_MEM_OBJECT_IMAGE3D = Z'10F2'
integer(c_int32_t), parameter :: CL_MEM_OBJECT_IMAGE2D_ARRAY = Z'10F3'
integer(c_int32_t), parameter :: CL_MEM_OBJECT_IMAGE1D = Z'10F4'
integer(c_int32_t), parameter :: CL_MEM_OBJECT_IMAGE1D_ARRAY = Z'10F5'
integer(c_int32_t), parameter :: CL_MEM_OBJECT_IMAGE1D_BUFFER = Z'10F6'
! cl_mem_info
integer(c_int32_t), parameter :: CL_MEM_TYPE = Z'1100'
integer(c_int32_t), parameter :: CL_MEM_FLAGS = Z'1101'
integer(c_int32_t), parameter :: CL_MEM_SIZE = Z'1102'
integer(c_int32_t), parameter :: CL_MEM_HOST_PTR = Z'1103'
integer(c_int32_t), parameter :: CL_MEM_MAP_COUNT = Z'1104'
integer(c_int32_t), parameter :: CL_MEM_REFERENCE_COUNT = Z'1105'
integer(c_int32_t), parameter :: CL_MEM_CONTEXT = Z'1106'
integer(c_int32_t), parameter :: CL_MEM_ASSOCIATED_MEMOBJECT = Z'1107'
integer(c_int32_t), parameter :: CL_MEM_OFFSET = Z'1108'
! cl_image_info - Note that INFO was added to resolve naming conflicts.
integer(c_int32_t), parameter :: CL_IMAGE_INFO_FORMAT = Z'1110'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_ELEMENT_SIZE = Z'1111'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_ROW_PITCH = Z'1112'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_SLICE_PITCH = Z'1113'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_WIDTH = Z'1114'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_HEIGHT = Z'1115'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_DEPTH = Z'1116'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_ARRAY_SIZE = Z'1117'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_BUFFER = Z'1118'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_NUM_MIP_LEVELS = Z'1119'
integer(c_int32_t), parameter :: CL_IMAGE_INFO_NUM_SAMPLES = Z'111A'
! cl_addressing_mode
integer(c_int32_t), parameter :: CL_ADDRESS_NONE = Z'1130'
integer(c_int32_t), parameter :: CL_ADDRESS_CLAMP_TO_EDGE = Z'1131'
integer(c_int32_t), parameter :: CL_ADDRESS_CLAMP = Z'1132'
integer(c_int32_t), parameter :: CL_ADDRESS_REPEAT = Z'1133'
integer(c_int32_t), parameter :: CL_ADDRESS_MIRRORED_REPEAT = Z'1134'
! cl_filter_mode
integer(c_int32_t), parameter :: CL_FILTER_NEAREST = Z'1140'
integer(c_int32_t), parameter :: CL_FILTER_LINEAR = Z'1141'
! cl_sampler_info
integer(c_int32_t), parameter :: CL_SAMPLER_REFERENCE_COUNT = Z'1150'
integer(c_int32_t), parameter :: CL_SAMPLER_CONTEXT = Z'1151'
integer(c_int32_t), parameter :: CL_SAMPLER_NORMALIZED_COORDS = Z'1152'
integer(c_int32_t), parameter :: CL_SAMPLER_ADDRESSING_MODE = Z'1153'
integer(c_int32_t), parameter :: CL_SAMPLER_FILTER_MODE = Z'1154'
! cl_program_info
integer(c_int32_t), parameter :: CL_PROGRAM_REFERENCE_COUNT = Z'1160'
integer(c_int32_t), parameter :: CL_PROGRAM_CONTEXT = Z'1161'
integer(c_int32_t), parameter :: CL_PROGRAM_NUM_DEVICES = Z'1162'
integer(c_int32_t), parameter :: CL_PROGRAM_DEVICES = Z'1163'
integer(c_int32_t), parameter :: CL_PROGRAM_SOURCE = Z'1164'
integer(c_int32_t), parameter :: CL_PROGRAM_BINARY_SIZES = Z'1165'
integer(c_int32_t), parameter :: CL_PROGRAM_BINARIES = Z'1166'
integer(c_int32_t), parameter :: CL_PROGRAM_NUM_KERNELS = Z'1167'
integer(c_int32_t), parameter :: CL_PROGRAM_KERNEL_NAMES = Z'1168'
! cl_program_build_info
integer(c_int32_t), parameter :: CL_PROGRAM_BUILD_STATUS = Z'1181'
integer(c_int32_t), parameter :: CL_PROGRAM_BUILD_OPTIONS = Z'1182'
integer(c_int32_t), parameter :: CL_PROGRAM_BUILD_LOG = Z'1183'
integer(c_int32_t), parameter :: CL_PROGRAM_BINARY_TYPE = Z'1184'
! cl_program_binary_type
integer(c_int32_t), parameter :: CL_PROGRAM_BINARY_TYPE_NONE = Z'0'
integer(c_int32_t), parameter :: CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT = Z'1'
integer(c_int32_t), parameter :: CL_PROGRAM_BINARY_TYPE_LIBRARY = Z'2'
integer(c_int32_t), parameter :: CL_PROGRAM_BINARY_TYPE_EXECUTABLE = Z'4'
! cl_build_status
integer(c_int32_t), parameter :: CL_BUILD_SUCCESS = 0
integer(c_int32_t), parameter :: CL_BUILD_NONE = -1
integer(c_int32_t), parameter :: CL_BUILD_ERROR = -2
integer(c_int32_t), parameter :: CL_BUILD_IN_PROGRESS = -3
! cl_kernel_info
integer(c_int32_t), parameter :: CL_KERNEL_FUNCTION_NAME = Z'1190'
integer(c_int32_t), parameter :: CL_KERNEL_NUM_ARGS = Z'1191'
integer(c_int32_t), parameter :: CL_KERNEL_REFERENCE_COUNT = Z'1192'
integer(c_int32_t), parameter :: CL_KERNEL_CONTEXT = Z'1193'
integer(c_int32_t), parameter :: CL_KERNEL_PROGRAM = Z'1194'
integer(c_int32_t), parameter :: CL_KERNEL_ATTRIBUTES = Z'1195'
! cl_kernel_arg_info
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ADDRESS_QUALIFIER = Z'1196'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ACCESS_QUALIFIER = Z'1197'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_TYPE_NAME = Z'1198'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_TYPE_QUALIFIER = Z'1199'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_NAME = Z'119A'
! cl_kernel_arg_address_qualifier
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ADDRESS_GLOBAL = Z'119B'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ADDRESS_LOCAL = Z'119C'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ADDRESS_CONSTANT = Z'119D'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ADDRESS_PRIVATE = Z'119E'
! cl_kernel_arg_access_qualifier
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ACCESS_READ_ONLY = Z'11A0'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ACCESS_WRITE_ONLY = Z'11A1'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ACCESS_READ_WRITE = Z'11A2'
integer(c_int32_t), parameter :: CL_KERNEL_ARG_ACCESS_NONE = Z'11A3'
! cl_kernel_arg_type_qualifer - bitfield (int64)
integer(c_int64_t), parameter :: CL_KERNEL_ARG_TYPE_NONE = b'000'
integer(c_int64_t), parameter :: CL_KERNEL_ARG_TYPE_CONST = b'001'
integer(c_int64_t), parameter :: CL_KERNEL_ARG_TYPE_RESTRICT = b'010'
integer(c_int64_t), parameter :: CL_KERNEL_ARG_TYPE_VOLATILE = b'100'
! cl_kernel_work_group_info
integer(c_int32_t), parameter :: CL_KERNEL_WORK_GROUP_SIZE = Z'11B0'
integer(c_int32_t), parameter :: CL_KERNEL_COMPILE_WORK_GROUP_SIZE = Z'11B1'
integer(c_int32_t), parameter :: CL_KERNEL_LOCAL_MEM_SIZE = Z'11B2'
integer(c_int32_t), parameter :: CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE= Z'11B3'
integer(c_int32_t), parameter :: CL_KERNEL_PRIVATE_MEM_SIZE = Z'11B4'
integer(c_int32_t), parameter :: CL_KERNEL_GLOBAL_WORK_SIZE = Z'11B5'
! cl_event_info
integer(c_int32_t), parameter :: CL_EVENT_COMMAND_QUEUE = Z'11D0'
integer(c_int32_t), parameter :: CL_EVENT_COMMAND_TYPE = Z'11D1'
integer(c_int32_t), parameter :: CL_EVENT_REFERENCE_COUNT = Z'11D2'
integer(c_int32_t), parameter :: CL_EVENT_COMMAND_EXECUTION_STATUS = Z'11D3'
integer(c_int32_t), parameter :: CL_EVENT_CONTEXT = Z'11D4'
! cl_profiling_info
integer(c_int32_t), parameter :: CL_PROFILING_COMMAND_QUEUED = Z'1280'
integer(c_int32_t), parameter :: CL_PROFILING_COMMAND_SUBMIT = Z'1281'
integer(c_int32_t), parameter :: CL_PROFILING_COMMAND_START = Z'1282'
integer(c_int32_t), parameter :: CL_PROFILING_COMMAND_END = Z'1283'
! ------------
! Types
! ------------
type, BIND(C) :: cl_image_format
integer(c_int32_t) :: image_channel_order
integer(c_int32_t) :: image_channel_data_type
end type
type, BIND(C) :: cl_image_desc
integer(c_int32_t) :: image_type
integer(c_size_t) :: image_width
integer(c_size_t) :: image_height
integer(c_size_t) :: image_depth
integer(c_size_t) :: image_array_size
integer(c_size_t) :: image_row_pitch
integer(c_size_t) :: image_slice_pitch
integer(c_int32_t) :: num_mip_levels
integer(c_int32_t) :: num_samples
integer(c_intptr_t) :: buffer
end type
!
! Start interfaces.
!
contains
! ------------
! Platform API
! ------------
! clGetPlatformIDs
integer(c_int32_t) function clGetPlatformIDs(num_entries, &
platforms, num_platforms) &
BIND(C, NAME='clGetPlatformIDs')
USE ISO_C_BINDING
integer(c_int32_t), value, intent(in) :: num_entries
type(c_ptr), value, intent(in) :: platforms
integer(c_int32_t), intent(out) :: num_platforms
end function
! clGetPlatformInfo
integer(c_int32_t) function clGetPlatformInfo(platform, param_name, &
param_value_size, param_value, param_value_size_ret) &
BIND(C, NAME='clGetPlatformInfo')
USE ISO_C_BINDING
integer(c_intptr_t), value, intent(in) :: platform
integer(c_int32_t), value, intent(in) :: param_name
integer(c_size_t), value, intent(in) :: param_value_size
type(c_ptr), value, intent(in) :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! ----------
! Device API
! ----------
! clGetDeviceIDs
integer(c_int32_t) function clGetDeviceIDs(platform, &
device_type, &
num_entries, &
devices, &
num_devices) &
BIND(C, NAME='clGetDeviceIDs')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: platform
integer(c_int64_t), value :: device_type
integer(c_int32_t), value :: num_entries
type(c_ptr), value :: devices
integer(c_int32_t), intent(out) :: num_devices
end function
! clGetDeviceInfo
integer(c_int) function clGetDeviceInfo(device, &
param_name, &
param_value_size, &
param_value, &
param_value_size_ret) &
BIND(C, NAME='clGetDeviceInfo')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: device
integer(c_int32_t), value :: param_name
integer(c_size_t), value :: param_value_size
type(c_ptr), value :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! clCreateSubDevices
integer(c_int32_t) function clCreateSubDevices(in_device, &
properties, &
num_devices, &
out_devices, &
num_devices_ret) &
BIND(C, NAME='clCreateSubDevices')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: in_device
type(c_ptr), value :: properties
integer(c_int32_t), value :: num_devices
type(c_ptr), value :: out_devices
integer(c_int32_t), intent(out) :: num_devices_ret
end function
! clRetainDevice
integer(c_int32_t) function clRetainDevice(device) &
BIND(C, NAME='clRetainDevice')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: device
end function
! clReleaseDevice
integer(c_int32_t) function clReleaseDevice(device) &
BIND(C, NAME='clReleaseDevice')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: device
end function
! ------------
! Context APIs
! ------------
! clCreateContext
integer(c_intptr_t) function clCreateContext(properties, &
num_devices, &
devices, &
pfn_notify, &
user_data, &
errcode_ret) &
BIND(C, NAME='clCreateContext')
USE ISO_C_BINDING
! Define parameters.
type(c_ptr), value :: properties
integer(c_int32_t), value :: num_devices
type(c_ptr), value :: devices
type(c_funptr), value :: pfn_notify
type(c_ptr), value :: user_data
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clCreateContextFromType
integer(c_intptr_t) function clCreateContextFromType(properties, &
device_type, &
pfn_notify, &
user_data, &
errcode_ret) &
BIND(C, NAME='clCreateContextFromType')
USE ISO_C_BINDING
! Define parameters.
type(c_ptr), value :: properties
integer(c_int64_t), value :: device_type
type(c_funptr), value :: pfn_notify
type(c_ptr), value :: user_data
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clRetainContext
integer(c_int32_t) function clRetainContext(context) &
BIND(C, NAME='clRetainContext')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: context
end function
! clReleaseContext
integer(c_int32_t) function clReleaseContext(context) &
BIND(C, NAME='clReleaseContext')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: context
end function
! clGetContextInfo
integer(c_int32_t) function clGetContextInfo(context, &
param_name, &
param_value_size, &
param_value, &
param_value_size_ret) &
BIND(C, NAME='clGetContextInfo')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int32_t), value :: param_name
integer(c_size_t), value :: param_value_size
type(c_ptr), value :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! ------------------
! Command Queue APIs
! ------------------
! clCreateCommandQueue
integer(c_intptr_t) function clCreateCommandQueue(context, &
device, &
properties, &
errcode_ret) &
BIND(C, NAME='clCreateCommandQueue')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_intptr_t), value :: device
integer(c_int64_t), value :: properties
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clRetainCommandQueue
integer(c_int32_t) function clRetainCommandQueue(command_queue) &
BIND(C, NAME='clRetainCommandQueue')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: command_queue
end function
! clReleaseCommandQueue
integer(c_int32_t) function clReleaseCommandQueue(command_queue) &
BIND(C, NAME='clReleaseCommandQueue')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: command_queue
end function
! clGetCommandQueueInfo
integer(c_int32_t) function clGetCommandQueueInfo(command_queue, &
param_name, &
param_value_size, &
param_value, &
param_value_size_ret) &
BIND(C, NAME='clGetCommandQueueInfo')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: command_queue
integer(c_int32_t), value :: param_name
integer(c_size_t), value :: param_value_size
type(c_ptr), value :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! ------------------
! Memory Object APIs
! ------------------
! clCreateBuffer
integer(c_intptr_t) function clCreateBuffer(context, &
flags, &
sizeb, &
host_ptr, &
errcode_ret) &
BIND(C, NAME='clCreateBuffer')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int64_t), value :: flags
integer(c_size_t), value :: sizeb
type(c_ptr), value :: host_ptr
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clCreateSubBuffer
integer(c_intptr_t) function clCreateSubBuffer(buffer, &
flags, &
buffer_create_type, &
buffer_create_info, &
errcode_ret) &
BIND(C, NAME='clCreateSubBuffer')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: buffer
integer(c_int64_t), value :: flags
integer(c_int32_t), value :: buffer_create_type
type(c_ptr), value :: buffer_create_info
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clCreateImage
integer(c_intptr_t) function clCreateImage(context, &
flags, &
image_format, &
image_desc, &
host_ptr, &
errcode_ret) &
BIND(C, NAME='clCreateImage')
USE ISO_C_BINDING
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int64_t), value :: flags
type(cl_image_format) :: image_format
type(cl_image_desc) :: image_desc
type(c_ptr), value :: host_ptr
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clRetainMemObject
integer(c_int32_t) function clRetainMemObject(mem_obj) &
BIND(C, NAME='clRetainMemObject')
! Define parameters.
integer(c_intptr_t), value :: mem_obj
end function
! clReleaseMemObject
integer(c_int32_t) function clReleaseMemObject(mem_obj) &
BIND(C, NAME='clReleaseMemObject')
! Define parameters.
integer(c_intptr_t), value :: mem_obj
end function
! clGetSupportedImageFormats
integer(c_int32_t) function clGetSupportedImageFormats(context, &
flags, &
image_type, &
num_entries, &
image_formats, &
num_image_formats) &
BIND(C, NAME='clGetSupportedImageFormats')
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int64_t), value :: flags
integer(c_int32_t), value :: image_type
integer(c_int32_t), value :: num_entries
type(c_ptr), value :: image_formats
integer(c_int32_t), intent(out) :: num_image_formats
end function
! clGetMemObjectInfo
integer(c_int32_t) function clGetMemObjectInfo(memobj, &
param_name, &
param_value_size, &
param_value, &
param_value_size_ret) &
BIND(C, NAME='clGetMemObjectInfo')
! Define parameters.
integer(c_intptr_t), value :: memobj
integer(c_int32_t), value :: param_name
integer(c_size_t), value :: param_value_size
type(c_ptr), value :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! clGetImageInfo
integer(c_int32_t) function clGetImageInfo(image, &
param_name, &
param_value_size, &
param_value, &
param_value_size_ret) &
BIND(C, NAME='clGetImageInfo')
! Define parameters.
integer(c_intptr_t), value :: image
integer(c_int32_t), value :: param_name
integer(c_size_t), value :: param_value_size
type(c_ptr), value :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! clSetMemObjectDestructorCallback
integer(c_int32_t) function clSetMemObjectDestructorCallback(memobj, &
pfn_notify, &
user_data) &
BIND(C, NAME='clSetMemObjectDestructorCallback')
! Define parameters.
integer(c_intptr_t), value :: memobj
type(c_funptr), value :: pfn_notify
type(c_ptr), value :: user_data
end function
! ------------
! Sampler APIs
! ------------
! clCreateSampler
integer(c_intptr_t) function clCreateSampler(context, &
normalized_coords, &
addressing_mode, &
filter_mode, &
errcode_ret) &
BIND(C, NAME='clCreateSampler')
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int32_t), value :: normalized_coords
integer(c_int32_t), value :: addressing_mode
integer(c_int32_t), value :: filter_mode
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clRetainSampler
integer(c_int32_t) function clRetainSampler(sampler) &
BIND(C, NAME='clRetainSampler')
! Define parameters.
integer(c_intptr_t), value :: sampler
end function
! clReleaseSampler
integer(c_int32_t) function clReleaseSampler(sampler) &
BIND(C, NAME='clReleaseSampler')
! Define parameters.
integer(c_intptr_t), value :: sampler
end function
! clGetSamplerInfo
integer(c_int32_t) function clGetSamplerInfo(sampler, &
param_name, &
param_value_size, &
param_value, &
param_value_size_ret) &
BIND(C, NAME='clGetSamplerInfo')
! Define parameters.
integer(c_intptr_t), value :: sampler
integer(c_int32_t), value :: param_name
integer(c_size_t), value :: param_value_size
type(c_ptr), value :: param_value
integer(c_size_t), intent(out) :: param_value_size_ret
end function
! -------------------
! Program Object APIs
! -------------------
! clCreateProgramWithSource
integer(c_intptr_t) function clCreateProgramWithSource(context, &
count, &
strings, &
lengths, &
errcode_ret) &
BIND(C, NAME='clCreateProgramWithSource')
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int32_t), value :: count
type(c_ptr), value :: strings
type(c_ptr), value :: lengths
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clCreateProgramWithBinary
integer(c_intptr_t) function clCreateProgramWithBinary(context, &
num_devices, &
device_list, &
lengths, &
binaries, &
binary_status, &
errcode_ret) &
BIND(C, NAME='clCreateProgramWithBinary')
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int32_t), value :: num_devices
type(c_ptr), value :: device_list
type(c_ptr), value :: lengths
type(c_ptr), value :: binaries
type(c_ptr), value :: binary_status
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clCreateProgramWithBuiltInKernels
integer(c_intptr_t) function clCreateProgramWithBuiltInKernels(context, &
num_devices, &
device_list, &
kernel_names, &
errcode_ret) &
BIND(C, NAME='clCreateProgramWithBuiltInKernels')
! Define parameters.
integer(c_intptr_t), value :: context
integer(c_int32_t), value :: num_devices
type(c_ptr), value :: device_list
type(c_ptr), value :: kernel_names
integer(c_int32_t), intent(out) :: errcode_ret
end function
! clRetainProgram
integer(c_int32_t) function clRetainProgram(program) &
BIND(C, NAME='clRetainProgram')
! Define parameters.
integer(c_intptr_t), value :: program
end function
! clReleaseProgram
integer(c_int32_t) function clReleaseProgram(program) &
BIND(C, NAME='clReleaseProgram')
! Define parameters.
integer(c_intptr_t), value :: program
end function
! clBuildProgram
integer(c_int32_t) function clBuildProgram(program, &
num_devices, &
device_list, &
options, &
pfn_notify, &
user_data) &
BIND(C, NAME='clBuildProgram')
! Define parameters.
integer(c_intptr_t), value :: program
integer(c_int32_t), value :: num_devices
type(c_ptr), value :: device_list
type(c_ptr), value :: options
type(c_funptr), value :: pfn_notify
type(c_ptr), value :: user_data
end function
! clCompileProgram
integer(c_int32_t) function clCompileProgram(program, &
num_devices, &
device_list, &
options, &
num_input_headers, &