forked from oneapi-src/level-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathze.py
6196 lines (5337 loc) · 401 KB
/
ze.py
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
"""
Copyright (C) 2019-2021 Intel Corporation
SPDX-License-Identifier: MIT
@file ze.py
@version v1.11-r1.11.0
"""
import platform
from ctypes import *
from enum import *
###############################################################################
__version__ = "1.0"
###############################################################################
## @brief Generates generic 'oneAPI' API versions
def ZE_MAKE_VERSION( _major, _minor ):
return (( _major << 16 )|( _minor & 0x0000ffff))
###############################################################################
## @brief Extracts 'oneAPI' API major version
def ZE_MAJOR_VERSION( _ver ):
return ( _ver >> 16 )
###############################################################################
## @brief Extracts 'oneAPI' API minor version
def ZE_MINOR_VERSION( _ver ):
return ( _ver & 0x0000ffff )
###############################################################################
## @brief Calling convention for all API functions
# ZE_APICALL not required for python
###############################################################################
## @brief Microsoft-specific dllexport storage-class attribute
# ZE_APIEXPORT not required for python
###############################################################################
## @brief GCC-specific dllexport storage-class attribute
# ZE_APIEXPORT not required for python
###############################################################################
## @brief Microsoft-specific dllexport storage-class attribute
# ZE_DLLEXPORT not required for python
###############################################################################
## @brief GCC-specific dllexport storage-class attribute
# ZE_DLLEXPORT not required for python
###############################################################################
## @brief compiler-independent type
class ze_bool_t(c_ubyte):
pass
###############################################################################
## @brief Handle of a driver instance
class ze_driver_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's device object
class ze_device_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's context object
class ze_context_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's command queue object
class ze_command_queue_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's command list object
class ze_command_list_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's fence object
class ze_fence_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's event pool object
class ze_event_pool_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's event object
class ze_event_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's image object
class ze_image_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's module object
class ze_module_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of module's build log object
class ze_module_build_log_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's kernel object
class ze_kernel_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's sampler object
class ze_sampler_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of physical memory object
class ze_physical_mem_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's fabric vertex object
class ze_fabric_vertex_handle_t(c_void_p):
pass
###############################################################################
## @brief Handle of driver's fabric edge object
class ze_fabric_edge_handle_t(c_void_p):
pass
###############################################################################
## @brief Maximum IPC handle size
ZE_MAX_IPC_HANDLE_SIZE = 64
###############################################################################
## @brief IPC handle to a memory allocation
class ze_ipc_mem_handle_t(Structure):
_fields_ = [
("data", c_char * ZE_MAX_IPC_HANDLE_SIZE) ## [out] Opaque data representing an IPC handle
]
###############################################################################
## @brief IPC handle to a event pool allocation
class ze_ipc_event_pool_handle_t(Structure):
_fields_ = [
("data", c_char * ZE_MAX_IPC_HANDLE_SIZE) ## [out] Opaque data representing an IPC handle
]
###############################################################################
## @brief Generic macro for enumerator bit masks
def ZE_BIT( _i ):
return ( 1 << _i )
###############################################################################
## @brief Defines Return/Error codes
class ze_result_v(IntEnum):
SUCCESS = 0 ## [Core] success
NOT_READY = 1 ## [Core] synchronization primitive not signaled
ERROR_DEVICE_LOST = 0x70000001 ## [Core] device hung, reset, was removed, or driver update occurred
ERROR_OUT_OF_HOST_MEMORY = 0x70000002 ## [Core] insufficient host memory to satisfy call
ERROR_OUT_OF_DEVICE_MEMORY = 0x70000003 ## [Core] insufficient device memory to satisfy call
ERROR_MODULE_BUILD_FAILURE = 0x70000004 ## [Core] error occurred when building module, see build log for details
ERROR_MODULE_LINK_FAILURE = 0x70000005 ## [Core] error occurred when linking modules, see build log for details
ERROR_DEVICE_REQUIRES_RESET = 0x70000006 ## [Core] device requires a reset
ERROR_DEVICE_IN_LOW_POWER_STATE = 0x70000007 ## [Core] device currently in low power state
EXP_ERROR_DEVICE_IS_NOT_VERTEX = 0x7ff00001 ## [Core, Experimental] device is not represented by a fabric vertex
EXP_ERROR_VERTEX_IS_NOT_DEVICE = 0x7ff00002 ## [Core, Experimental] fabric vertex does not represent a device
EXP_ERROR_REMOTE_DEVICE = 0x7ff00003 ## [Core, Experimental] fabric vertex represents a remote device or
## subdevice
EXP_ERROR_OPERANDS_INCOMPATIBLE = 0x7ff00004 ## [Core, Experimental] operands of comparison are not compatible
EXP_RTAS_BUILD_RETRY = 0x7ff00005 ## [Core, Experimental] ray tracing acceleration structure build
## operation failed due to insufficient resources, retry with a larger
## acceleration structure buffer allocation
EXP_RTAS_BUILD_DEFERRED = 0x7ff00006 ## [Core, Experimental] ray tracing acceleration structure build
## operation deferred to parallel operation join
ERROR_INSUFFICIENT_PERMISSIONS = 0x70010000 ## [Sysman] access denied due to permission level
ERROR_NOT_AVAILABLE = 0x70010001 ## [Sysman] resource already in use and simultaneous access not allowed
## or resource was removed
ERROR_DEPENDENCY_UNAVAILABLE = 0x70020000 ## [Common] external required dependency is unavailable or missing
WARNING_DROPPED_DATA = 0x70020001 ## [Tools] data may have been dropped
ERROR_UNINITIALIZED = 0x78000001 ## [Validation] driver is not initialized
ERROR_UNSUPPORTED_VERSION = 0x78000002 ## [Validation] generic error code for unsupported versions
ERROR_UNSUPPORTED_FEATURE = 0x78000003 ## [Validation] generic error code for unsupported features
ERROR_INVALID_ARGUMENT = 0x78000004 ## [Validation] generic error code for invalid arguments
ERROR_INVALID_NULL_HANDLE = 0x78000005 ## [Validation] handle argument is not valid
ERROR_HANDLE_OBJECT_IN_USE = 0x78000006 ## [Validation] object pointed to by handle still in-use by device
ERROR_INVALID_NULL_POINTER = 0x78000007 ## [Validation] pointer argument may not be nullptr
ERROR_INVALID_SIZE = 0x78000008 ## [Validation] size argument is invalid (e.g., must not be zero)
ERROR_UNSUPPORTED_SIZE = 0x78000009 ## [Validation] size argument is not supported by the device (e.g., too
## large)
ERROR_UNSUPPORTED_ALIGNMENT = 0x7800000a ## [Validation] alignment argument is not supported by the device (e.g.,
## too small)
ERROR_INVALID_SYNCHRONIZATION_OBJECT = 0x7800000b ## [Validation] synchronization object in invalid state
ERROR_INVALID_ENUMERATION = 0x7800000c ## [Validation] enumerator argument is not valid
ERROR_UNSUPPORTED_ENUMERATION = 0x7800000d ## [Validation] enumerator argument is not supported by the device
ERROR_UNSUPPORTED_IMAGE_FORMAT = 0x7800000e ## [Validation] image format is not supported by the device
ERROR_INVALID_NATIVE_BINARY = 0x7800000f ## [Validation] native binary is not supported by the device
ERROR_INVALID_GLOBAL_NAME = 0x78000010 ## [Validation] global variable is not found in the module
ERROR_INVALID_KERNEL_NAME = 0x78000011 ## [Validation] kernel name is not found in the module
ERROR_INVALID_FUNCTION_NAME = 0x78000012 ## [Validation] function name is not found in the module
ERROR_INVALID_GROUP_SIZE_DIMENSION = 0x78000013 ## [Validation] group size dimension is not valid for the kernel or
## device
ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 0x78000014 ## [Validation] global width dimension is not valid for the kernel or
## device
ERROR_INVALID_KERNEL_ARGUMENT_INDEX = 0x78000015 ## [Validation] kernel argument index is not valid for kernel
ERROR_INVALID_KERNEL_ARGUMENT_SIZE = 0x78000016 ## [Validation] kernel argument size does not match kernel
ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE = 0x78000017 ## [Validation] value of kernel attribute is not valid for the kernel or
## device
ERROR_INVALID_MODULE_UNLINKED = 0x78000018 ## [Validation] module with imports needs to be linked before kernels can
## be created from it.
ERROR_INVALID_COMMAND_LIST_TYPE = 0x78000019 ## [Validation] command list type does not match command queue type
ERROR_OVERLAPPING_REGIONS = 0x7800001a ## [Validation] copy operations do not support overlapping regions of
## memory
WARNING_ACTION_REQUIRED = 0x7800001b ## [Sysman] an action is required to complete the desired operation
ERROR_INVALID_KERNEL_HANDLE = 0x7800001c ## [Core, Validation] kernel handle is invalid for the operation
ERROR_UNKNOWN = 0x7ffffffe ## [Core] unknown or internal error
class ze_result_t(c_int):
def __str__(self):
return str(ze_result_v(self.value))
###############################################################################
## @brief Defines structure types
class ze_structure_type_v(IntEnum):
DRIVER_PROPERTIES = 0x1 ## ::ze_driver_properties_t
DRIVER_IPC_PROPERTIES = 0x2 ## ::ze_driver_ipc_properties_t
DEVICE_PROPERTIES = 0x3 ## ::ze_device_properties_t
DEVICE_COMPUTE_PROPERTIES = 0x4 ## ::ze_device_compute_properties_t
DEVICE_MODULE_PROPERTIES = 0x5 ## ::ze_device_module_properties_t
COMMAND_QUEUE_GROUP_PROPERTIES = 0x6 ## ::ze_command_queue_group_properties_t
DEVICE_MEMORY_PROPERTIES = 0x7 ## ::ze_device_memory_properties_t
DEVICE_MEMORY_ACCESS_PROPERTIES = 0x8 ## ::ze_device_memory_access_properties_t
DEVICE_CACHE_PROPERTIES = 0x9 ## ::ze_device_cache_properties_t
DEVICE_IMAGE_PROPERTIES = 0xa ## ::ze_device_image_properties_t
DEVICE_P2P_PROPERTIES = 0xb ## ::ze_device_p2p_properties_t
DEVICE_EXTERNAL_MEMORY_PROPERTIES = 0xc ## ::ze_device_external_memory_properties_t
CONTEXT_DESC = 0xd ## ::ze_context_desc_t
COMMAND_QUEUE_DESC = 0xe ## ::ze_command_queue_desc_t
COMMAND_LIST_DESC = 0xf ## ::ze_command_list_desc_t
EVENT_POOL_DESC = 0x10 ## ::ze_event_pool_desc_t
EVENT_DESC = 0x11 ## ::ze_event_desc_t
FENCE_DESC = 0x12 ## ::ze_fence_desc_t
IMAGE_DESC = 0x13 ## ::ze_image_desc_t
IMAGE_PROPERTIES = 0x14 ## ::ze_image_properties_t
DEVICE_MEM_ALLOC_DESC = 0x15 ## ::ze_device_mem_alloc_desc_t
HOST_MEM_ALLOC_DESC = 0x16 ## ::ze_host_mem_alloc_desc_t
MEMORY_ALLOCATION_PROPERTIES = 0x17 ## ::ze_memory_allocation_properties_t
EXTERNAL_MEMORY_EXPORT_DESC = 0x18 ## ::ze_external_memory_export_desc_t
EXTERNAL_MEMORY_IMPORT_FD = 0x19 ## ::ze_external_memory_import_fd_t
EXTERNAL_MEMORY_EXPORT_FD = 0x1a ## ::ze_external_memory_export_fd_t
MODULE_DESC = 0x1b ## ::ze_module_desc_t
MODULE_PROPERTIES = 0x1c ## ::ze_module_properties_t
KERNEL_DESC = 0x1d ## ::ze_kernel_desc_t
KERNEL_PROPERTIES = 0x1e ## ::ze_kernel_properties_t
SAMPLER_DESC = 0x1f ## ::ze_sampler_desc_t
PHYSICAL_MEM_DESC = 0x20 ## ::ze_physical_mem_desc_t
KERNEL_PREFERRED_GROUP_SIZE_PROPERTIES = 0x21 ## ::ze_kernel_preferred_group_size_properties_t
EXTERNAL_MEMORY_IMPORT_WIN32 = 0x22 ## ::ze_external_memory_import_win32_handle_t
EXTERNAL_MEMORY_EXPORT_WIN32 = 0x23 ## ::ze_external_memory_export_win32_handle_t
DEVICE_RAYTRACING_EXT_PROPERTIES = 0x00010001 ## ::ze_device_raytracing_ext_properties_t
RAYTRACING_MEM_ALLOC_EXT_DESC = 0x10002 ## ::ze_raytracing_mem_alloc_ext_desc_t
FLOAT_ATOMIC_EXT_PROPERTIES = 0x10003 ## ::ze_float_atomic_ext_properties_t
CACHE_RESERVATION_EXT_DESC = 0x10004 ## ::ze_cache_reservation_ext_desc_t
EU_COUNT_EXT = 0x10005 ## ::ze_eu_count_ext_t
SRGB_EXT_DESC = 0x10006 ## ::ze_srgb_ext_desc_t
LINKAGE_INSPECTION_EXT_DESC = 0x10007 ## ::ze_linkage_inspection_ext_desc_t
PCI_EXT_PROPERTIES = 0x10008 ## ::ze_pci_ext_properties_t
DRIVER_MEMORY_FREE_EXT_PROPERTIES = 0x10009 ## ::ze_driver_memory_free_ext_properties_t
MEMORY_FREE_EXT_DESC = 0x1000a ## ::ze_memory_free_ext_desc_t
MEMORY_COMPRESSION_HINTS_EXT_DESC = 0x1000b ## ::ze_memory_compression_hints_ext_desc_t
IMAGE_ALLOCATION_EXT_PROPERTIES = 0x1000c ## ::ze_image_allocation_ext_properties_t
DEVICE_LUID_EXT_PROPERTIES = 0x1000d ## ::ze_device_luid_ext_properties_t
DEVICE_MEMORY_EXT_PROPERTIES = 0x1000e ## ::ze_device_memory_ext_properties_t
DEVICE_IP_VERSION_EXT = 0x1000f ## ::ze_device_ip_version_ext_t
IMAGE_VIEW_PLANAR_EXT_DESC = 0x10010 ## ::ze_image_view_planar_ext_desc_t
EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_PROPERTIES = 0x10011 ## ::ze_event_query_kernel_timestamps_ext_properties_t
EVENT_QUERY_KERNEL_TIMESTAMPS_RESULTS_EXT_PROPERTIES = 0x10012 ## ::ze_event_query_kernel_timestamps_results_ext_properties_t
KERNEL_MAX_GROUP_SIZE_EXT_PROPERTIES = 0x10013 ## ::ze_kernel_max_group_size_ext_properties_t
RELAXED_ALLOCATION_LIMITS_EXP_DESC = 0x00020001 ## ::ze_relaxed_allocation_limits_exp_desc_t
MODULE_PROGRAM_EXP_DESC = 0x00020002 ## ::ze_module_program_exp_desc_t
SCHEDULING_HINT_EXP_PROPERTIES = 0x00020003 ## ::ze_scheduling_hint_exp_properties_t
SCHEDULING_HINT_EXP_DESC = 0x00020004 ## ::ze_scheduling_hint_exp_desc_t
IMAGE_VIEW_PLANAR_EXP_DESC = 0x00020005 ## ::ze_image_view_planar_exp_desc_t
DEVICE_PROPERTIES_1_2 = 0x00020006 ## ::ze_device_properties_t
IMAGE_MEMORY_EXP_PROPERTIES = 0x00020007 ## ::ze_image_memory_properties_exp_t
POWER_SAVING_HINT_EXP_DESC = 0x00020008 ## ::ze_context_power_saving_hint_exp_desc_t
COPY_BANDWIDTH_EXP_PROPERTIES = 0x00020009 ## ::ze_copy_bandwidth_exp_properties_t
DEVICE_P2P_BANDWIDTH_EXP_PROPERTIES = 0x0002000A ## ::ze_device_p2p_bandwidth_exp_properties_t
FABRIC_VERTEX_EXP_PROPERTIES = 0x0002000B ## ::ze_fabric_vertex_exp_properties_t
FABRIC_EDGE_EXP_PROPERTIES = 0x0002000C ## ::ze_fabric_edge_exp_properties_t
MEMORY_SUB_ALLOCATIONS_EXP_PROPERTIES = 0x0002000D ## ::ze_memory_sub_allocations_exp_properties_t
RTAS_BUILDER_EXP_DESC = 0x0002000E ## ::ze_rtas_builder_exp_desc_t
RTAS_BUILDER_BUILD_OP_EXP_DESC = 0x0002000F ## ::ze_rtas_builder_build_op_exp_desc_t
RTAS_BUILDER_EXP_PROPERTIES = 0x00020010 ## ::ze_rtas_builder_exp_properties_t
RTAS_PARALLEL_OPERATION_EXP_PROPERTIES = 0x00020011 ## ::ze_rtas_parallel_operation_exp_properties_t
RTAS_DEVICE_EXP_PROPERTIES = 0x00020012 ## ::ze_rtas_device_exp_properties_t
RTAS_GEOMETRY_AABBS_EXP_CB_PARAMS = 0x00020013 ## ::ze_rtas_geometry_aabbs_exp_cb_params_t
COUNTER_BASED_EVENT_POOL_EXP_DESC = 0x00020014 ## ::ze_event_pool_counter_based_exp_desc_t
MUTABLE_COMMAND_LIST_EXP_PROPERTIES = 0x00020015 ## ::ze_mutable_command_list_exp_properties_t
MUTABLE_COMMAND_LIST_EXP_DESC = 0x00020016 ## ::ze_mutable_command_list_exp_desc_t
MUTABLE_COMMAND_ID_EXP_DESC = 0x00020017 ## ::ze_mutable_command_id_exp_desc_t
MUTABLE_COMMANDS_EXP_DESC = 0x00020018 ## ::ze_mutable_commands_exp_desc_t
MUTABLE_KERNEL_ARGUMENT_EXP_DESC = 0x00020019 ## ::ze_mutable_kernel_argument_exp_desc_t
MUTABLE_GROUP_COUNT_EXP_DESC = 0x0002001A ## ::ze_mutable_group_count_exp_desc_t
MUTABLE_GROUP_SIZE_EXP_DESC = 0x0002001B ## ::ze_mutable_group_size_exp_desc_t
MUTABLE_GLOBAL_OFFSET_EXP_DESC = 0x0002001C ## ::ze_mutable_global_offset_exp_desc_t
PITCHED_ALLOC_DEVICE_EXP_PROPERTIES = 0x0002001D ## ::ze_device_pitched_alloc_exp_properties_t
BINDLESS_IMAGE_EXP_DESC = 0x0002001E ## ::ze_image_bindless_exp_desc_t
PITCHED_IMAGE_EXP_DESC = 0x0002001F ## ::ze_image_pitched_exp_desc_t
MUTABLE_GRAPH_ARGUMENT_EXP_DESC = 0x00020020 ## ::ze_mutable_graph_argument_exp_desc_t
INIT_DRIVER_TYPE_DESC = 0x00020021 ## ::ze_init_driver_type_desc_t
class ze_structure_type_t(c_int):
def __str__(self):
return str(ze_structure_type_v(self.value))
###############################################################################
## @brief External memory type flags
class ze_external_memory_type_flags_v(IntEnum):
OPAQUE_FD = ZE_BIT(0) ## an opaque POSIX file descriptor handle
DMA_BUF = ZE_BIT(1) ## a file descriptor handle for a Linux dma_buf
OPAQUE_WIN32 = ZE_BIT(2) ## an NT handle
OPAQUE_WIN32_KMT = ZE_BIT(3) ## a global share (KMT) handle
D3D11_TEXTURE = ZE_BIT(4) ## an NT handle referring to a Direct3D 10 or 11 texture resource
D3D11_TEXTURE_KMT = ZE_BIT(5) ## a global share (KMT) handle referring to a Direct3D 10 or 11 texture
## resource
D3D12_HEAP = ZE_BIT(6) ## an NT handle referring to a Direct3D 12 heap resource
D3D12_RESOURCE = ZE_BIT(7) ## an NT handle referring to a Direct3D 12 committed resource
class ze_external_memory_type_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Bandwidth unit
class ze_bandwidth_unit_v(IntEnum):
UNKNOWN = 0 ## The unit used for bandwidth is unknown
BYTES_PER_NANOSEC = 1 ## Bandwidth is provided in bytes/nanosec
BYTES_PER_CLOCK = 2 ## Bandwidth is provided in bytes/clock
class ze_bandwidth_unit_t(c_int):
def __str__(self):
return str(ze_bandwidth_unit_v(self.value))
###############################################################################
## @brief Latency unit
class ze_latency_unit_v(IntEnum):
UNKNOWN = 0 ## The unit used for latency is unknown
NANOSEC = 1 ## Latency is provided in nanosecs
CLOCK = 2 ## Latency is provided in clocks
HOP = 3 ## Latency is provided in hops (normalized so that the lowest latency
## link has a latency of 1 hop)
class ze_latency_unit_t(c_int):
def __str__(self):
return str(ze_latency_unit_v(self.value))
###############################################################################
## @brief Maximum universal unique id (UUID) size in bytes
ZE_MAX_UUID_SIZE = 16
###############################################################################
## @brief Universal unique id (UUID)
class ze_uuid_t(Structure):
_fields_ = [
("id", c_ubyte * ZE_MAX_UUID_SIZE) ## [out] opaque data representing a UUID
]
###############################################################################
## @brief Base for all callback function parameter types
class ze_base_cb_params_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p) ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
]
###############################################################################
## @brief Base for all properties types
class ze_base_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p) ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
]
###############################################################################
## @brief Base for all descriptor types
class ze_base_desc_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
]
###############################################################################
## @brief Forces driver to only report devices (and sub-devices) as specified by
## values
###############################################################################
## @brief Forces driver to report devices from lowest to highest PCI bus ID
###############################################################################
## @brief Forces all shared allocations into device memory
###############################################################################
## @brief Defines the device hierarchy model exposed by Level Zero driver
## implementation
###############################################################################
## @brief Supported initialization flags
class ze_init_flags_v(IntEnum):
GPU_ONLY = ZE_BIT(0) ## only initialize GPU drivers
VPU_ONLY = ZE_BIT(1) ## only initialize VPU drivers
class ze_init_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Supported driver initialization type flags
##
## @details
## - Bit Field which details the driver types to be initialized and
## returned to the user.
## - Value Definition:
## - 0, do not init or retrieve any drivers.
## - ZE_INIT_DRIVER_TYPE_FLAG_GPU, GPU Drivers are Init and driver handles
## retrieved.
## - ZE_INIT_DRIVER_TYPE_FLAG_NPU, NPU Drivers are Init and driver handles
## retrieved.
## - ZE_INIT_DRIVER_TYPE_FLAG_GPU | ZE_INIT_DRIVER_TYPE_FLAG_NPU, NPU & GPU
## Drivers are Init and driver handles retrieved.
## - UINT32_MAX All Drivers of any type are Init and driver handles
## retrieved.
class ze_init_driver_type_flags_v(IntEnum):
GPU = ZE_BIT(0) ## initialize and retrieve GPU drivers
NPU = ZE_BIT(1) ## initialize and retrieve NPU drivers
class ze_init_driver_type_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Init Driver Type descriptor
class ze_init_driver_type_desc_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_init_driver_type_flags_t) ## [in] driver type init flags.
## must be a valid combination of ::ze_init_driver_type_flag_t or UINT32_MAX;
## driver types are init and retrieved based on these init flags in zeInitDrivers().
]
###############################################################################
## @brief Supported API versions
##
## @details
## - API versions contain major and minor attributes, use
## ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION
class ze_api_version_v(IntEnum):
_1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0
_1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1
_1_2 = ZE_MAKE_VERSION( 1, 2 ) ## version 1.2
_1_3 = ZE_MAKE_VERSION( 1, 3 ) ## version 1.3
_1_4 = ZE_MAKE_VERSION( 1, 4 ) ## version 1.4
_1_5 = ZE_MAKE_VERSION( 1, 5 ) ## version 1.5
_1_6 = ZE_MAKE_VERSION( 1, 6 ) ## version 1.6
_1_7 = ZE_MAKE_VERSION( 1, 7 ) ## version 1.7
_1_8 = ZE_MAKE_VERSION( 1, 8 ) ## version 1.8
_1_9 = ZE_MAKE_VERSION( 1, 9 ) ## version 1.9
_1_10 = ZE_MAKE_VERSION( 1, 10 ) ## version 1.10
_1_11 = ZE_MAKE_VERSION( 1, 11 ) ## version 1.11
CURRENT = ZE_MAKE_VERSION( 1, 11 ) ## latest known version
class ze_api_version_t(c_int):
def __str__(self):
return str(ze_api_version_v(self.value))
###############################################################################
## @brief Current API version as a macro
ZE_API_VERSION_CURRENT_M = ZE_MAKE_VERSION( 1, 11 )
###############################################################################
## @brief Maximum driver universal unique id (UUID) size in bytes
ZE_MAX_DRIVER_UUID_SIZE = 16
###############################################################################
## @brief Driver universal unique id (UUID)
class ze_driver_uuid_t(Structure):
_fields_ = [
("id", c_ubyte * ZE_MAX_DRIVER_UUID_SIZE) ## [out] opaque data representing a driver UUID
]
###############################################################################
## @brief Driver properties queried using ::zeDriverGetProperties
class ze_driver_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("uuid", ze_driver_uuid_t), ## [out] universal unique identifier.
("driverVersion", c_ulong) ## [out] driver version
## The driver version is a non-zero, monotonically increasing value where
## higher values always indicate a more recent version.
]
###############################################################################
## @brief Supported IPC property flags
class ze_ipc_property_flags_v(IntEnum):
MEMORY = ZE_BIT(0) ## Supports passing memory allocations between processes. See
## ::zeMemGetIpcHandle.
EVENT_POOL = ZE_BIT(1) ## Supports passing event pools between processes. See
## ::zeEventPoolGetIpcHandle.
class ze_ipc_property_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief IPC properties queried using ::zeDriverGetIpcProperties
class ze_driver_ipc_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_ipc_property_flags_t) ## [out] 0 (none) or a valid combination of ::ze_ipc_property_flag_t
]
###############################################################################
## @brief Maximum extension name string size
ZE_MAX_EXTENSION_NAME = 256
###############################################################################
## @brief Extension properties queried using ::zeDriverGetExtensionProperties
class ze_driver_extension_properties_t(Structure):
_fields_ = [
("name", c_char * ZE_MAX_EXTENSION_NAME), ## [out] extension name
("version", c_ulong) ## [out] extension version using ::ZE_MAKE_VERSION
]
###############################################################################
## @brief Supported device types
class ze_device_type_v(IntEnum):
GPU = 1 ## Graphics Processing Unit
CPU = 2 ## Central Processing Unit
FPGA = 3 ## Field Programmable Gate Array
MCA = 4 ## Memory Copy Accelerator
VPU = 5 ## Vision Processing Unit
class ze_device_type_t(c_int):
def __str__(self):
return str(ze_device_type_v(self.value))
###############################################################################
## @brief Maximum device universal unique id (UUID) size in bytes
ZE_MAX_DEVICE_UUID_SIZE = 16
###############################################################################
## @brief Device universal unique id (UUID)
class ze_device_uuid_t(Structure):
_fields_ = [
("id", c_ubyte * ZE_MAX_DEVICE_UUID_SIZE) ## [out] opaque data representing a device UUID
]
###############################################################################
## @brief Maximum device name string size
ZE_MAX_DEVICE_NAME = 256
###############################################################################
## @brief Supported device property flags
class ze_device_property_flags_v(IntEnum):
INTEGRATED = ZE_BIT(0) ## Device is integrated with the Host.
SUBDEVICE = ZE_BIT(1) ## Device handle used for query represents a sub-device.
ECC = ZE_BIT(2) ## Device supports error correction memory access.
ONDEMANDPAGING = ZE_BIT(3) ## Device supports on-demand page-faulting.
class ze_device_property_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Device properties queried using ::zeDeviceGetProperties
class ze_device_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("type", ze_device_type_t), ## [out] generic device type
("vendorId", c_ulong), ## [out] vendor id from PCI configuration
("deviceId", c_ulong), ## [out] device id from PCI configuration.
## Note, the device id uses little-endian format.
("flags", ze_device_property_flags_t), ## [out] 0 (none) or a valid combination of ::ze_device_property_flag_t
("subdeviceId", c_ulong), ## [out] sub-device id. Only valid if ::ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE
## is set.
("coreClockRate", c_ulong), ## [out] Clock rate for device core.
("maxMemAllocSize", c_ulonglong), ## [out] Maximum memory allocation size.
("maxHardwareContexts", c_ulong), ## [out] Maximum number of logical hardware contexts.
("maxCommandQueuePriority", c_ulong), ## [out] Maximum priority for command queues. Higher value is higher
## priority.
("numThreadsPerEU", c_ulong), ## [out] Maximum number of threads per EU.
("physicalEUSimdWidth", c_ulong), ## [out] The physical EU simd width.
("numEUsPerSubslice", c_ulong), ## [out] Maximum number of EUs per sub-slice.
("numSubslicesPerSlice", c_ulong), ## [out] Maximum number of sub-slices per slice.
("numSlices", c_ulong), ## [out] Maximum number of slices.
("timerResolution", c_ulonglong), ## [out] Returns the resolution of device timer used for profiling,
## timestamps, etc. When stype==::ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES the
## units are in nanoseconds. When
## stype==::ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 units are in
## cycles/sec
("timestampValidBits", c_ulong), ## [out] Returns the number of valid bits in the timestamp value.
("kernelTimestampValidBits", c_ulong), ## [out] Returns the number of valid bits in the kernel timestamp values
("uuid", ze_device_uuid_t), ## [out] universal unique identifier. Note: Subdevices will have their
## own uuid.
("name", c_char * ZE_MAX_DEVICE_NAME) ## [out] Device name
]
###############################################################################
## @brief Device thread identifier.
class ze_device_thread_t(Structure):
_fields_ = [
("slice", c_ulong), ## [in,out] the slice number.
## Must be `UINT32_MAX` (all) or less than the `numSlices` member of ::ze_device_properties_t.
("subslice", c_ulong), ## [in,out] the sub-slice number within its slice.
## Must be `UINT32_MAX` (all) or less than the `numSubslicesPerSlice`
## member of ::ze_device_properties_t.
("eu", c_ulong), ## [in,out] the EU number within its sub-slice.
## Must be `UINT32_MAX` (all) or less than the `numEUsPerSubslice` member
## of ::ze_device_properties_t.
("thread", c_ulong) ## [in,out] the thread number within its EU.
## Must be `UINT32_MAX` (all) or less than the `numThreadsPerEU` member
## of ::ze_device_properties_t.
]
###############################################################################
## @brief Maximum number of subgroup sizes supported.
ZE_SUBGROUPSIZE_COUNT = 8
###############################################################################
## @brief Device compute properties queried using ::zeDeviceGetComputeProperties
class ze_device_compute_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("maxTotalGroupSize", c_ulong), ## [out] Maximum items per compute group. (groupSizeX * groupSizeY *
## groupSizeZ) <= maxTotalGroupSize
("maxGroupSizeX", c_ulong), ## [out] Maximum items for X dimension in group
("maxGroupSizeY", c_ulong), ## [out] Maximum items for Y dimension in group
("maxGroupSizeZ", c_ulong), ## [out] Maximum items for Z dimension in group
("maxGroupCountX", c_ulong), ## [out] Maximum groups that can be launched for x dimension
("maxGroupCountY", c_ulong), ## [out] Maximum groups that can be launched for y dimension
("maxGroupCountZ", c_ulong), ## [out] Maximum groups that can be launched for z dimension
("maxSharedLocalMemory", c_ulong), ## [out] Maximum shared local memory per group.
("numSubGroupSizes", c_ulong), ## [out] Number of subgroup sizes supported. This indicates number of
## entries in subGroupSizes.
("subGroupSizes", c_ulong * ZE_SUBGROUPSIZE_COUNT) ## [out] Size group sizes supported.
]
###############################################################################
## @brief Maximum native kernel universal unique id (UUID) size in bytes
ZE_MAX_NATIVE_KERNEL_UUID_SIZE = 16
###############################################################################
## @brief Native kernel universal unique id (UUID)
class ze_native_kernel_uuid_t(Structure):
_fields_ = [
("id", c_ubyte * ZE_MAX_NATIVE_KERNEL_UUID_SIZE) ## [out] opaque data representing a native kernel UUID
]
###############################################################################
## @brief Supported device module flags
class ze_device_module_flags_v(IntEnum):
FP16 = ZE_BIT(0) ## Device supports 16-bit floating-point operations
FP64 = ZE_BIT(1) ## Device supports 64-bit floating-point operations
INT64_ATOMICS = ZE_BIT(2) ## Device supports 64-bit atomic operations
DP4A = ZE_BIT(3) ## Device supports four component dot product and accumulate operations
class ze_device_module_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Supported floating-Point capability flags
class ze_device_fp_flags_v(IntEnum):
DENORM = ZE_BIT(0) ## Supports denorms
INF_NAN = ZE_BIT(1) ## Supports INF and quiet NaNs
ROUND_TO_NEAREST = ZE_BIT(2) ## Supports rounding to nearest even rounding mode
ROUND_TO_ZERO = ZE_BIT(3) ## Supports rounding to zero.
ROUND_TO_INF = ZE_BIT(4) ## Supports rounding to both positive and negative INF.
FMA = ZE_BIT(5) ## Supports IEEE754-2008 fused multiply-add.
ROUNDED_DIVIDE_SQRT = ZE_BIT(6) ## Supports rounding as defined by IEEE754 for divide and sqrt
## operations.
SOFT_FLOAT = ZE_BIT(7) ## Uses software implementation for basic floating-point operations.
class ze_device_fp_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Device module properties queried using ::zeDeviceGetModuleProperties
class ze_device_module_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("spirvVersionSupported", c_ulong), ## [out] Maximum supported SPIR-V version.
## Returns zero if SPIR-V is not supported.
## Contains major and minor attributes, use ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION.
("flags", ze_device_module_flags_t), ## [out] 0 or a valid combination of ::ze_device_module_flag_t
("fp16flags", ze_device_fp_flags_t), ## [out] Capabilities for half-precision floating-point operations.
## returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP16 is not set) or a
## combination of ::ze_device_fp_flag_t.
("fp32flags", ze_device_fp_flags_t), ## [out] Capabilities for single-precision floating-point operations.
## returns a combination of ::ze_device_fp_flag_t.
("fp64flags", ze_device_fp_flags_t), ## [out] Capabilities for double-precision floating-point operations.
## returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP64 is not set) or a
## combination of ::ze_device_fp_flag_t.
("maxArgumentsSize", c_ulong), ## [out] Maximum kernel argument size that is supported.
("printfBufferSize", c_ulong), ## [out] Maximum size of internal buffer that holds output of printf
## calls from kernel.
("nativeKernelSupported", ze_native_kernel_uuid_t) ## [out] Compatibility UUID of supported native kernel.
## UUID may or may not be the same across driver release, devices, or
## operating systems.
## Application is responsible for ensuring UUID matches before creating
## module using
## previously created native kernel.
]
###############################################################################
## @brief Supported command queue group property flags
class ze_command_queue_group_property_flags_v(IntEnum):
COMPUTE = ZE_BIT(0) ## Command queue group supports enqueing compute commands.
COPY = ZE_BIT(1) ## Command queue group supports enqueing copy commands.
COOPERATIVE_KERNELS = ZE_BIT(2) ## Command queue group supports cooperative kernels.
## See ::zeCommandListAppendLaunchCooperativeKernel for more details.
METRICS = ZE_BIT(3) ## Command queue groups supports metric queries.
class ze_command_queue_group_property_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Command queue group properties queried using
## ::zeDeviceGetCommandQueueGroupProperties
class ze_command_queue_group_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_command_queue_group_property_flags_t), ## [out] 0 (none) or a valid combination of
## ::ze_command_queue_group_property_flag_t
("maxMemoryFillPatternSize", c_size_t), ## [out] maximum `pattern_size` supported by command queue group.
## See ::zeCommandListAppendMemoryFill for more details.
("numQueues", c_ulong) ## [out] the number of physical engines within the group.
]
###############################################################################
## @brief Supported device memory property flags
class ze_device_memory_property_flags_v(IntEnum):
TBD = ZE_BIT(0) ## reserved for future use
class ze_device_memory_property_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Device local memory properties queried using
## ::zeDeviceGetMemoryProperties
class ze_device_memory_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_device_memory_property_flags_t), ## [out] 0 (none) or a valid combination of
## ::ze_device_memory_property_flag_t
("maxClockRate", c_ulong), ## [out] Maximum clock rate for device memory.
("maxBusWidth", c_ulong), ## [out] Maximum bus width between device and memory.
("totalSize", c_ulonglong), ## [out] Total memory size in bytes that is available to the device.
("name", c_char * ZE_MAX_DEVICE_NAME) ## [out] Memory name
]
###############################################################################
## @brief Memory access capability flags
##
## @details
## - Supported access capabilities for different types of memory
## allocations
class ze_memory_access_cap_flags_v(IntEnum):
RW = ZE_BIT(0) ## Supports load/store access
ATOMIC = ZE_BIT(1) ## Supports atomic access
CONCURRENT = ZE_BIT(2) ## Supports concurrent access
CONCURRENT_ATOMIC = ZE_BIT(3) ## Supports concurrent atomic access
class ze_memory_access_cap_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Device memory access properties queried using
## ::zeDeviceGetMemoryAccessProperties
class ze_device_memory_access_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("hostAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] host memory capabilities.
## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t.
("deviceAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] device memory capabilities.
## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t.
("sharedSingleDeviceAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] shared, single-device memory capabilities.
## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t.
("sharedCrossDeviceAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] shared, cross-device memory capabilities.
## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t.
("sharedSystemAllocCapabilities", ze_memory_access_cap_flags_t) ## [out] shared, system memory capabilities.
## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t.
]
###############################################################################
## @brief Supported cache control property flags
class ze_device_cache_property_flags_v(IntEnum):
USER_CONTROL = ZE_BIT(0) ## Device support User Cache Control (i.e. SLM section vs Generic Cache)
class ze_device_cache_property_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Device cache properties queried using ::zeDeviceGetCacheProperties
class ze_device_cache_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_device_cache_property_flags_t), ## [out] 0 (none) or a valid combination of
## ::ze_device_cache_property_flag_t
("cacheSize", c_size_t) ## [out] Per-cache size, in bytes
]
###############################################################################
## @brief Device image properties queried using ::zeDeviceGetImageProperties
class ze_device_image_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("maxImageDims1D", c_ulong), ## [out] Maximum image dimensions for 1D resources. if 0, then 1D images
## are unsupported.
("maxImageDims2D", c_ulong), ## [out] Maximum image dimensions for 2D resources. if 0, then 2D images
## are unsupported.
("maxImageDims3D", c_ulong), ## [out] Maximum image dimensions for 3D resources. if 0, then 3D images
## are unsupported.
("maxImageBufferSize", c_ulonglong), ## [out] Maximum image buffer size in bytes. if 0, then buffer images are
## unsupported.
("maxImageArraySlices", c_ulong), ## [out] Maximum image array slices. if 0, then image arrays are
## unsupported.
("maxSamplers", c_ulong), ## [out] Max samplers that can be used in kernel. if 0, then sampling is
## unsupported.
("maxReadImageArgs", c_ulong), ## [out] Returns the maximum number of simultaneous image objects that
## can be read from by a kernel. if 0, then reading images is
## unsupported.
("maxWriteImageArgs", c_ulong) ## [out] Returns the maximum number of simultaneous image objects that
## can be written to by a kernel. if 0, then writing images is
## unsupported.
]
###############################################################################
## @brief Device external memory import and export properties
class ze_device_external_memory_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("memoryAllocationImportTypes", ze_external_memory_type_flags_t), ## [out] Supported external memory import types for memory allocations.
("memoryAllocationExportTypes", ze_external_memory_type_flags_t), ## [out] Supported external memory export types for memory allocations.
("imageImportTypes", ze_external_memory_type_flags_t), ## [out] Supported external memory import types for images.
("imageExportTypes", ze_external_memory_type_flags_t) ## [out] Supported external memory export types for images.
]
###############################################################################
## @brief Supported device peer-to-peer property flags
class ze_device_p2p_property_flags_v(IntEnum):
ACCESS = ZE_BIT(0) ## Device supports access between peer devices.
ATOMICS = ZE_BIT(1) ## Device supports atomics between peer devices.
class ze_device_p2p_property_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Device peer-to-peer properties queried using
## ::zeDeviceGetP2PProperties
class ze_device_p2p_properties_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_device_p2p_property_flags_t) ## [out] 0 (none) or a valid combination of
## ::ze_device_p2p_property_flag_t
]
###############################################################################
## @brief Supported context creation flags
class ze_context_flags_v(IntEnum):
TBD = ZE_BIT(0) ## reserved for future use
class ze_context_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Context descriptor
class ze_context_desc_t(Structure):
_fields_ = [
("stype", ze_structure_type_t), ## [in] type of this structure
("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific
## structure (i.e. contains stype and pNext).
("flags", ze_context_flags_t) ## [in] creation flags.
## must be 0 (default) or a valid combination of ::ze_context_flag_t;
## default behavior may use implicit driver-based heuristics.
]
###############################################################################
## @brief Supported command queue flags
class ze_command_queue_flags_v(IntEnum):
EXPLICIT_ONLY = ZE_BIT(0) ## command queue should be optimized for submission to a single device engine.
## driver **must** disable any implicit optimizations for distributing
## work across multiple engines.
## this flag should be used when applications want full control over
## multi-engine submission and scheduling.
IN_ORDER = ZE_BIT(1) ## To be used only when creating immediate command lists. Commands
## appended to the immediate command
## list are executed in-order, with driver implementation enforcing
## dependencies between them.
## Application is not required to have the signal event of a given
## command being the wait event of
## the next to define an in-order list, and application is allowed to
## pass signal and wait events
## to each appended command to implement more complex dependency graphs.
class ze_command_queue_flags_t(c_int):
def __str__(self):
return hex(self.value)
###############################################################################
## @brief Supported command queue modes
class ze_command_queue_mode_v(IntEnum):
DEFAULT = 0 ## implicit default behavior; uses driver-based heuristics
SYNCHRONOUS = 1 ## Device execution always completes immediately on execute;
## Host thread is blocked using wait on implicit synchronization object
ASYNCHRONOUS = 2 ## Device execution is scheduled and will complete in future;
## explicit synchronization object must be used to determine completeness
class ze_command_queue_mode_t(c_int):
def __str__(self):
return str(ze_command_queue_mode_v(self.value))
###############################################################################
## @brief Supported command queue priorities
class ze_command_queue_priority_v(IntEnum):
NORMAL = 0 ## [default] normal priority
PRIORITY_LOW = 1 ## lower priority than normal
PRIORITY_HIGH = 2 ## higher priority than normal
class ze_command_queue_priority_t(c_int):
def __str__(self):
return str(ze_command_queue_priority_v(self.value))
###############################################################################
## @brief Command Queue descriptor
class ze_command_queue_desc_t(Structure):