-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathze_graph_ext.h
More file actions
943 lines (782 loc) · 59 KB
/
ze_graph_ext.h
File metadata and controls
943 lines (782 loc) · 59 KB
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
/*
*
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#ifndef _ZE_GRAPH_EXT_H
#define _ZE_GRAPH_EXT_H
#if defined(__cplusplus)
#pragma once
#endif
#include "ze_api.h"
#include "ze_graph_profiling_ext.h"
#ifndef ZE_GRAPH_EXT_NAME
#define ZE_GRAPH_EXT_NAME "ZE_extension_graph"
#endif
#if defined(__cplusplus)
extern "C" {
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Supported Graph Extension versions
///
/// @details
/// - Graph extension versions contain major and minor attributes, use
/// ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION
typedef enum _ze_graph_ext_version_t
{
ZE_GRAPH_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0
ZE_GRAPH_EXT_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1
ZE_GRAPH_EXT_VERSION_1_2 = ZE_MAKE_VERSION( 1, 2 ), ///< version 1.2
ZE_GRAPH_EXT_VERSION_1_3 = ZE_MAKE_VERSION( 1, 3 ), ///< version 1.3
ZE_GRAPH_EXT_VERSION_1_4 = ZE_MAKE_VERSION( 1, 4 ), ///< version 1.4
ZE_GRAPH_EXT_VERSION_1_5 = ZE_MAKE_VERSION( 1, 5 ), ///< version 1.5
ZE_GRAPH_EXT_VERSION_1_6 = ZE_MAKE_VERSION( 1, 6 ), ///< version 1.6
ZE_GRAPH_EXT_VERSION_1_7 = ZE_MAKE_VERSION( 1, 7 ), ///< version 1.7
ZE_GRAPH_EXT_VERSION_1_8 = ZE_MAKE_VERSION( 1, 8 ), ///< version 1.8
ZE_GRAPH_EXT_VERSION_1_9 = ZE_MAKE_VERSION( 1, 9 ), ///< version 1.9
ZE_GRAPH_EXT_VERSION_1_10 = ZE_MAKE_VERSION( 1, 10 ), ///< version 1.10
ZE_GRAPH_EXT_VERSION_1_11 = ZE_MAKE_VERSION( 1, 11 ), ///< version 1.11
ZE_GRAPH_EXT_VERSION_1_12 = ZE_MAKE_VERSION( 1, 12 ), ///< version 1.12
ZE_GRAPH_EXT_VERSION_1_13 = ZE_MAKE_VERSION( 1, 13 ), ///< version 1.13
ZE_GRAPH_EXT_VERSION_1_14 = ZE_MAKE_VERSION( 1, 14), ///< version 1.14
ZE_GRAPH_EXT_VERSION_1_15 = ZE_MAKE_VERSION( 1, 15), ///< version 1.15
ZE_GRAPH_EXT_VERSION_1_16 = ZE_MAKE_VERSION( 1, 16), ///< version 1.16
ZE_GRAPH_EXT_VERSION_1_17 = ZE_MAKE_VERSION( 1, 17), ///< version 1.17
ZE_GRAPH_EXT_VERSION_1_18 = ZE_MAKE_VERSION( 1, 18), ///< version 1.18
ZE_GRAPH_EXT_VERSION_CURRENT = ZE_GRAPH_EXT_VERSION_1_18, ///< latest known version
ZE_GRAPH_EXT_VERSION_FORCE_UINT32 = 0x7fffffff
} ze_graph_ext_version_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Supported graph creation input formats
typedef enum _ze_graph_format_t
{
ZE_GRAPH_FORMAT_NATIVE = 0x1, ///< Format is pre-compiled blob (elf, flatbuffers)
ZE_GRAPH_FORMAT_NGRAPH_LITE = 0x2, ///< Format is ngraph lite IR
ZE_GRAPH_FORMAT_FORCE_UINT32 = 0x7fffffff
} ze_graph_format_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Compiler version information
typedef struct _ze_graph_compiler_version_info_t
{
uint16_t major;
uint16_t minor;
} ze_graph_compiler_version_info_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Defines structure types
typedef enum _ze_structure_type_graph_ext_t
{
ZE_STRUCTURE_TYPE_DEVICE_GRAPH_PROPERTIES = 0x1, ///< ::ze_device_graph_properties_t
ZE_STRUCTURE_TYPE_DEVICE_GRAPH_PROPERTIES_2 = 0xF, ///< ::ze_device_graph_properties_2_t
ZE_STRUCTURE_TYPE_GRAPH_DESC = 0x2, ///< ::ze_graph_desc_t
ZE_STRUCTURE_TYPE_GRAPH_DESC_2 = 0xE, ///< ::ze_graph_desc_2_t
ZE_STRUCTURE_TYPE_GRAPH_PROPERTIES = 0x3, ///< ::ze_graph_properties_t
ZE_STRUCTURE_TYPE_GRAPH_PROPERTIES_2 = 0x10, ///< ::ze_graph_properties_2_t
ZE_STRUCTURE_TYPE_GRAPH_PROPERTIES_3 = 0x11, ///< ::ze_graph_properties_3_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_PROPERTIES = 0x4, ///< ::ze_graph_argument_properties_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_PROPERTIES_2 = 0xC, ///< ::ze_graph_argument_properties_2_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_PROPERTIES_3 = 0xD, ///< ::ze_graph_argument_properties_3_t
ZE_STRUCTURE_TYPE_GRAPH_ACTIVATION_KERNEL = 0x5, ///< ::ze_graph_activation_kernel_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_METADATA = 0x6, ///< ::ze_graph_argument_metadata_t
ZE_STRUCTURE_TYPE_GRAPH_INPUT_HASH = 0x8, ///< ::ze_graph_input_hash_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_PROPERTY_STRIDES = 0x9, ///< ::ze_graph_argument_property_strides_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_TENSOR = 0xA, ///< ::ze_graph_argument_value_tensor_t
ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_STRIDES = 0xB, ///< ::ze_graph_argument_value_strides_t
ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC_DEPRECATED = 0x7, ///< ::ze_mutable_graph_argument_exp_desc_t
ZE_STRUCTURE_TYPE_GRAPH_FORCE_UINT32 = 0x7fffffff
} ze_structure_type_graph_ext_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Device graph properties
typedef struct _ze_device_graph_properties_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
ze_graph_ext_version_t graphExtensionVersion; ///< [out] graph extension version
ze_graph_compiler_version_info_t compilerVersion; ///< [out] compiler version
ze_graph_format_t graphFormatsSupported; ///< [out] graph formats supported
uint32_t maxOVOpsetVersionSupported; ///< [out] max OV opset version supported by the compiler
} ze_device_graph_properties_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph argument properties
typedef enum _ze_graph_argument_precision_t
{
ZE_GRAPH_ARGUMENT_PRECISION_UNKNOWN = 0x00,
ZE_GRAPH_ARGUMENT_PRECISION_FP64 = 0x0F,
ZE_GRAPH_ARGUMENT_PRECISION_FP32 = 0x01,
ZE_GRAPH_ARGUMENT_PRECISION_FP16 = 0x02,
ZE_GRAPH_ARGUMENT_PRECISION_FP8_E4M3 = 0x13,
ZE_GRAPH_ARGUMENT_PRECISION_FP8_E5M2 = 0x14,
ZE_GRAPH_ARGUMENT_PRECISION_FP8_E8M0 = 0x15,
ZE_GRAPH_ARGUMENT_PRECISION_BF16 = 0x09,
ZE_GRAPH_ARGUMENT_PRECISION_UINT64 = 0x10,
ZE_GRAPH_ARGUMENT_PRECISION_UINT32 = 0x0A,
ZE_GRAPH_ARGUMENT_PRECISION_UINT16 = 0x03,
ZE_GRAPH_ARGUMENT_PRECISION_UINT8 = 0x04,
ZE_GRAPH_ARGUMENT_PRECISION_UINT4 = 0x0B,
ZE_GRAPH_ARGUMENT_PRECISION_UINT2 = 0x16,
ZE_GRAPH_ARGUMENT_PRECISION_INT64 = 0x011,
ZE_GRAPH_ARGUMENT_PRECISION_INT32 = 0x05,
ZE_GRAPH_ARGUMENT_PRECISION_INT16 = 0x06,
ZE_GRAPH_ARGUMENT_PRECISION_INT8 = 0x07,
ZE_GRAPH_ARGUMENT_PRECISION_INT4 = 0x0C,
ZE_GRAPH_ARGUMENT_PRECISION_INT2 = 0x17,
ZE_GRAPH_ARGUMENT_PRECISION_BIN = 0x08,
ZE_GRAPH_ARGUMENT_PRECISION_DYNAMIC = 0x0D,
ZE_GRAPH_ARGUMENT_PRECISION_BOOLEAN = 0x0E,
ZE_GRAPH_ARGUMENT_PRECISION_NF4 = 0x12,
ZE_GRAPH_ARGUMENT_PRECISION_FORCE_UINT32 = 0x7fffffff
} ze_graph_argument_precision_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph argument properties
typedef enum _ze_graph_argument_layout_t
{
ZE_GRAPH_ARGUMENT_LAYOUT_ANY = 0x00,
ZE_GRAPH_ARGUMENT_LAYOUT_NCHW,
ZE_GRAPH_ARGUMENT_LAYOUT_NHWC,
ZE_GRAPH_ARGUMENT_LAYOUT_NCDHW,
ZE_GRAPH_ARGUMENT_LAYOUT_NDHWC,
ZE_GRAPH_ARGUMENT_LAYOUT_OIHW = 0x40,
ZE_GRAPH_ARGUMENT_LAYOUT_C = 0x60,
ZE_GRAPH_ARGUMENT_LAYOUT_CHW = 0x80,
ZE_GRAPH_ARGUMENT_LAYOUT_HW = 0xC0,
ZE_GRAPH_ARGUMENT_LAYOUT_NC,
ZE_GRAPH_ARGUMENT_LAYOUT_CN,
ZE_GRAPH_ARGUMENT_LAYOUT_BLOCKED = 0xC8,
ZE_GRAPH_ARGUMENT_LAYOUT_FORCE_UINT32 = 0x7fffffff
} ze_graph_argument_layout_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Activation Shave Desc (passed through ze_graph_desc pNext)
typedef struct _ze_activation_kernel_desc_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
size_t kernelDataSize; ///< [in] Size of kernel data buffer in bytes
const uint8_t* pKernelData; ///< [in] Pointer to kernel data buffer
} ze_activation_kernel_desc_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph descriptor
typedef struct _ze_graph_desc_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
ze_graph_format_t format; ///< [in] Graph format passed in with input
size_t inputSize; ///< [in] Size of input buffer in bytes
const uint8_t* pInput; ///< [in] Pointer to input buffer
const char* pBuildFlags; ///< [in][optional] Null terminated string containing build flags. Options:
///< - '--inputs_precisions="<arg>:<precision> <arg2>:<precision> ..."'
///< '--outputs_precisions="<arg>:<precision> <arg2>:<precision> ..."'
///< - Set input and output arguments precision. Supported precisions:
///< FP64, FP32, FP16, BF16, U64, U32, U16, U8, U4, I64, I32, I16, I8, I4, BIN
///< - '--inputs_layouts="<arg>:<layout> <arg2>:<layout> ..."'
///< '--outputs_layouts="<arg>:<layout> <arg2>:<layout> ..."'
///< - Set input and output arguments layout. Supported layouts:
///< NCHW, NHWC, NCDHW, NDHWC, OIHW, C, CHW, HW, NC, CN
///< - '--config PARAM="VALUE" PARAM2="VALUE" ...'
///< - compile options string passed directly to compiler
} ze_graph_desc_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Example ze_graph_desc pBuildFlags
///
/// --inputs_precisions="in1:U8" --inputs_layouts="in1:NCHW" --outputs_precisions="out1:FP16 out2:FP16" --outputs_layouts="out1:NCHW out2:NCHW" --config PERFORMANCE_HINT="THROUGHPUT"
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph properties
typedef struct _ze_graph_properties_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
uint32_t numGraphArgs; ///< [out] number of graph arguments
} ze_graph_properties_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph argument properties
typedef enum _ze_graph_argument_type_t
{
ZE_GRAPH_ARGUMENT_TYPE_INPUT,
ZE_GRAPH_ARGUMENT_TYPE_OUTPUT,
ZE_GRAPH_ARGUMENT_TYPE_FORCE_UINT32 = 0x7fffffff
} ze_graph_argument_type_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ZE_MAX_GRAPH_ARGUMENT_NAME
/// @brief Maximum device name string size
#define ZE_MAX_GRAPH_ARGUMENT_NAME 256
#endif // ZE_MAX_GRAPH_ARGUMENT_NAME
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE
/// @brief Maximum device name string size
#define ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE 5
#endif // ZE_MAX_GRAPH_ARGUMENT_SIZE
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph argument properties
typedef struct _ze_graph_argument_properties_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
char name[ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] name from input IR
ze_graph_argument_type_t type; ///< [out] type of graph argument
uint32_t dims[ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE]; ///< [out] tensor dimensions upto 5D
ze_graph_argument_precision_t networkPrecision; ///< [out] precision from input IR
ze_graph_argument_layout_t networkLayout; ///< [out] layout from input IR
ze_graph_argument_precision_t devicePrecision; ///< [out] precision from compiled executable
ze_graph_argument_layout_t deviceLayout; ///< [out] layout from compiled executable
} ze_graph_argument_properties_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetGraphProperties_ext_t)(
ze_device_handle_t hDevice, ///< [in] handle of the device
ze_device_graph_properties_t *pDeviceGraphProperties ///< [out] query result for graph properties of the device
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphCreate_ext_t)(
ze_context_handle_t hContext, ///< [in] handle of the context
ze_device_handle_t hDevice, ///< [in] handle of the device
const ze_graph_desc_t* desc, ///< [in] pointer to graph descriptor
ze_graph_handle_t* phGraph ///< [out] pointer to handle of graph object created
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphDestroy_ext_t)(
ze_graph_handle_t hGraph ///< [in][release] handle of graph object to destroy
);
//////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetNativeBinary_ext_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
size_t* pSize, ///< [in,out] size of native binary in bytes.
uint8_t* pGraphNativeBinary ///< [in,out][optional] byte pointer to native binary
///< Usage
///< 1. Call first to query required size of pGraphNativeBinary (pGraphNativeBinary is nullptr)
///< 2. Allocate pGraphNativeBinary of required size
///< 3. Call second time to retrieve pGraphNativeBinary (caller owns the memory)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetProperties_ext_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
ze_graph_properties_t* pGraphProperties ///< [in,out] query result for graph properties.
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetArgumentProperties_ext_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
uint32_t argIndex, ///< [in] index of the argument to get properties
ze_graph_argument_properties_t* pGraphArgumentProperties ///< [in,out] query result for graph argument properties.
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphSetArgumentValue_ext_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
uint32_t argIndex, ///< [in] index of the argument
const void* pArgValue ///< [in] Pointer to graph argument
///< Usage
///< 1. pointer to tensor (backwards compatabile)
///< 2. pointer to struct containing argument property (v1.15)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnAppendGraphInitialize_ext_t)(
ze_command_list_handle_t hCommandList, ///< [in] handle of the command list
ze_graph_handle_t hGraph, ///< [in] handle of the graph
ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion
uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching
ze_event_handle_t* phWaitEvents ///< [in][optional] handle of the events to wait on before launching
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnAppendGraphExecute_ext_t)(
ze_command_list_handle_t hCommandList, ///< [in] handle of the command list
ze_graph_handle_t hGraph, ///< [in] handle of the graph
ze_graph_profiling_query_handle_t hProfilingQuery, ///< [in][optional] handle of profiling query
ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion
uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching
ze_event_handle_t* phWaitEvents ///< [in][optional] handle of the events to wait on before launching
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.1
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ZE_MAX_GRAPH_TENSOR_REF_DIMS
/// @brief Maximum tensor reference dimensions size
#define ZE_MAX_GRAPH_TENSOR_REF_DIMS 8
#endif // ZE_MAX_GRAPH_TENSOR_REF_DIMS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef ZE_MAX_GRAPH_TENSOR_NAMES_SIZE
/// @brief Maximum tensor names size
#define ZE_MAX_GRAPH_TENSOR_NAMES_SIZE 32
#endif // ZE_MAX_GRAPH_TENSOR_NAMES_SIZE
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph argument properties
typedef enum _ze_graph_metadata_type
{
ZE_GRAPH_METADATA_TYPE_UNDEFINED = 0,
ZE_GRAPH_METADATA_TYPE_DYNAMIC = 1,
ZE_GRAPH_METADATA_TYPE_BOOLEAN = 2,
ZE_GRAPH_METADATA_TYPE_BF16 = 3,
ZE_GRAPH_METADATA_TYPE_F16 = 4,
ZE_GRAPH_METADATA_TYPE_F32 = 5,
ZE_GRAPH_METADATA_TYPE_F64 = 6,
ZE_GRAPH_METADATA_TYPE_I4 = 7,
ZE_GRAPH_METADATA_TYPE_I8 = 8,
ZE_GRAPH_METADATA_TYPE_I16 = 9,
ZE_GRAPH_METADATA_TYPE_I32 = 10,
ZE_GRAPH_METADATA_TYPE_I64 = 11,
ZE_GRAPH_METADATA_TYPE_U1 = 12,
ZE_GRAPH_METADATA_TYPE_U4 = 13,
ZE_GRAPH_METADATA_TYPE_U8 = 14,
ZE_GRAPH_METADATA_TYPE_U16 = 15,
ZE_GRAPH_METADATA_TYPE_U32 = 16,
ZE_GRAPH_METADATA_TYPE_U64 = 17,
ZE_GRAPH_METADATA_TYPE_FORCE_UINT32 = 0x7fffffff
} ze_graph_metadata_type;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph argument metadata
typedef struct _ze_graph_argument_metadata_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
ze_graph_argument_type_t type; ///< [out] type of argument
char friendly_name[ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] friendly name
ze_graph_metadata_type data_type; ///< [out] data type of argument
uint64_t shape[ZE_MAX_GRAPH_TENSOR_REF_DIMS]; ///< [out] tensor shape
uint32_t shape_size; ///< [out] size of shape array
char tensor_names[ZE_MAX_GRAPH_TENSOR_NAMES_SIZE][ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] tensor name array
uint32_t tensor_names_count; ///< [out] size of tensor name array
char input_name[ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] input name
} ze_graph_argument_metadata_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ze_graph_argument_properties_2_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
char name[ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] name from input IR
ze_graph_argument_type_t type; ///< [out] type of graph argument
uint32_t dims[ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE]; ///< [out] tensor dimensions upto 5D
ze_graph_argument_precision_t networkPrecision; ///< [out] precision from input IR
ze_graph_argument_layout_t networkLayout; ///< [out] layout from input IR
ze_graph_argument_precision_t devicePrecision; ///< [out] precision from compiled executable
ze_graph_argument_layout_t deviceLayout; ///< [out] layout from compiled executable
// version 2
float quantReverseScale; ///< [out] Quantized tensor reverse scale value for input argument
uint8_t quantZeroPoint; ///< [out] Quantized tesnor zero point value for input argument
} ze_graph_argument_properties_2_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetArgumentProperties_ext_2_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
uint32_t argIndex, ///< [in] index of the argument to get properties
ze_graph_argument_properties_2_t* pGraphArgumentProperties ///< [in,out] query result for graph argument properties.
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetArgumentMetadata_ext_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
uint32_t argIndex, ///< [in] index of the argument to get metadata
ze_graph_argument_metadata_t* pGraphArgumentMetadata ///< [in,out] query result for graph argument metadata
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.2
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ze_graph_argument_properties_3_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
char name[ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] name from input IR
ze_graph_argument_type_t type; ///< [out] type of graph argument
uint32_t dims[ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE]; ///< [out] tensor dimensions upto 5D
ze_graph_argument_precision_t networkPrecision; ///< [out] precision from input IR
ze_graph_argument_layout_t networkLayout; ///< [out] layout from input IR
ze_graph_argument_precision_t devicePrecision; ///< [out] precision from compiled executable
ze_graph_argument_layout_t deviceLayout; ///< [out] layout from compiled executable
// version 2
float quantReverseScale; ///< [out] Quantized tensor reverse scale value for input argument
uint8_t quantZeroPoint; ///< [out] Quantized tesnor zero point value for input argument
// version 3
uint32_t dims_count; ///< [out] size of shape array
char debug_friendly_name[ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] debug friendly name
char associated_tensor_names[ZE_MAX_GRAPH_TENSOR_NAMES_SIZE][ZE_MAX_GRAPH_ARGUMENT_NAME]; ///< [out] tensor name array
uint32_t associated_tensor_names_count; ///< [out] size of tensor name array
} ze_graph_argument_properties_3_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetArgumentProperties_ext_3_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
uint32_t argIndex, ///< [in] index of the argument to get properties
ze_graph_argument_properties_3_t* pGraphArgumentProperties ///< [in,out] query result for graph argument properties.
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.3
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Handle of driver's graph query network object
typedef struct _ze_graph_query_network_handle_t *ze_graph_query_network_handle_t;
typedef ze_result_t (ZE_APICALL *ze_pfnGraphQueryNetworkCreate_ext_t)(
ze_context_handle_t hContext, ///< [in] handle of the context object
ze_device_handle_t hDevice, ///< [in] handle of the device
const ze_graph_desc_t* desc, ///< [in] pointer to graph descriptor
ze_graph_query_network_handle_t* phGraphQueryNetwork ///< [out] pointer to handle of graph query network object created
);
typedef ze_result_t (ZE_APICALL *ze_pfnGraphQueryNetworkDestroy_ext_t)(
ze_graph_query_network_handle_t hGraphQueryNetwork ///< [in][release] handle of the graph query network
);
typedef ze_result_t (ZE_APICALL *ze_pfnGraphQueryNetworkGetSupportedLayers_ext_t)(
ze_graph_query_network_handle_t hGraphQueryNetwork, ///< [in] handle of the graph query network
size_t *pSize, ///< [in,out] size of supported layers string
char *pSupportedLayers ///< [in,out][optional] pointer to null-terminated string of the supported layers
///< Usage
///< 1. Call first to query required size of pSupportedLayers (pSupportedLayers is nullptr)
///< 2. Allocate pSupportedLayers of required size
///< 3. Call second time to retrieve pSupportedLayers (caller owns the memory)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.4
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphBuildLogGetString_ext_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
uint32_t* pSize, ///< [in,out] pointer to the size of the error message
char* pBuildLog ///< [in] pointer to buffer to return error message
///< Usage
///< 1. Call first to query required size of pBuildLog (pBuildLog is nullptr)
///< 2. Allocate pBuildLog of required size
///< 3. Call second time to retrieve pBuildLog (caller owns the memory)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.5
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Bitfield of graph flags
typedef enum _ze_graph_flags_t
{
ZE_GRAPH_FLAG_NONE = 0x0,
ZE_GRAPH_FLAG_DISABLE_CACHING = ZE_BIT(0), ///< Disable driver managed caching
ZE_GRAPH_FLAG_ENABLE_PROFILING = ZE_BIT(1), ///< Enable layer and task level timings
ZE_GRAPH_FLAG_INPUT_GRAPH_PERSISTENT = ZE_BIT(2), ///< Input graph buffer pointer is persistent and driver can avoid additional copy
///< 1. Invalidating before destroying graph handle results in undefined behavior
///< 2. inputSize and pInput address must be page-aligned
///< 3. non-aligned values will result in ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT
ZE_GRAPH_FLAG_SECURE_COMPILE = ZE_BIT(3), ///< Compile graph in secure mode where the driver applies additional protections to the compilation process
ZE_GRAPH_FLAG_OPTIMIZE_FOR_DYNAMIC_SHAPES = ZE_BIT(4), ///< Driver will cache strides and re-apply when arguments are mutated, no need to set strides when they haven't changed
ZE_GRAPH_FLAG_FORCE_UINT32 = 0x7fffffff
} ze_graph_flags_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph descriptor
typedef struct _ze_graph_desc_2_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
ze_graph_format_t format; ///< [in] Format of input graph buffer
size_t inputSize; ///< [in] Size of input graph buffer in bytes
const uint8_t* pInput; ///< [in] Pointer to input graph buffer
const char* pBuildFlags; ///< [in][optional] Null terminated string containing build flags. Options:
///< - '--inputs_precisions="<arg>:<precision> <arg2>:<precision> ..."'
///< '--outputs_precisions="<arg>:<precision> <arg2>:<precision> ..."'
///< - Set input and output arguments precision. Supported precisions:
///< FP64, FP32, FP16, BF16, U64, U32, U16, U8, U4, I64, I32, I16, I8, I4, BIN
///< - '--inputs_layouts="<arg>:<layout> <arg2>:<layout> ..."'
///< '--outputs_layouts="<arg>:<layout> <arg2>:<layout> ..."'
///< - Set input and output arguments layout. Supported layouts:
///< NCHW, NHWC, NCDHW, NDHWC, OIHW, C, CHW, HW, NC, CN
///< - '--config PARAM="VALUE" PARAM2="VALUE" ...'
///< - compile options string passed directly to compiler
uint32_t flags; ///< [in][optional] Graph creation flags
} ze_graph_desc_2_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphCreate_ext_2_t)(
ze_context_handle_t hContext, ///< [in] handle of the context
ze_device_handle_t hDevice, ///< [in] handle of the device
const ze_graph_desc_2_t* desc, ///< [in] pointer to graph descriptor
ze_graph_handle_t* phGraph ///< [out] pointer to handle of graph object created
);
typedef ze_result_t (ZE_APICALL *ze_pfnGraphQueryNetworkCreate_ext_2_t)(
ze_context_handle_t hContext, ///< [in] handle of the context object
ze_device_handle_t hDevice, ///< [in] handle of the device
const ze_graph_desc_2_t* desc, ///< [in] pointer to graph descriptor
ze_graph_query_network_handle_t* phGraphQueryNetwork ///< [out] pointer to handle of graph query network object created
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph memory query types
typedef enum _ze_graph_memory_query_type_t
{
ZE_GRAPH_QUERY_MEMORY_DDR = 0x01, ///< DDR memory allocations
ZE_GRAPH_QUERY_MEMORY_DRIVER_CACHE = 0x02, ///< Driver total cache size
ZE_GRAPH_QUERY_MEMORY_PROGRAM_CACHE = 0x03, ///< Program total cache size
ZE_GRAPH_QUERY_MEMORY_FORCE_UINT32 = 0x7fffffff
} ze_graph_memory_query_type_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph memory query
typedef struct _ze_graph_memory_query_t
{
uint64_t total; ///< total memory allowed per process for specified type (reported in bytes)
uint64_t allocated; ///< context's current total memory allocated for specified type (reported in bytes)
} ze_graph_memory_query_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphQueryContextMemory_ext_t)(
ze_context_handle_t hContext, ///< [in] handle of the context object
ze_graph_memory_query_type_t type, ///< [in] type of memory query
ze_graph_memory_query_t* query ///< [out] result of query
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.6
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph version information
typedef struct _ze_graph_version_info_t
{
uint32_t major;
uint32_t minor;
uint32_t patch;
} ze_graph_version_info_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Device graph properties
typedef struct _ze_device_graph_properties_2_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
ze_graph_ext_version_t graphExtensionVersion; ///< [out] graph extension version
ze_graph_compiler_version_info_t compilerVersion; ///< [out] compiler version
ze_graph_format_t graphFormatsSupported; ///< [out] graph formats supported
uint32_t maxOVOpsetVersionSupported; ///< [out] max OV opset version supported by the compiler
ze_graph_version_info_t elfVersion; ///< [out] elf container version
ze_graph_version_info_t runtimeVersion; ///< [out] firmware runtime version
} ze_device_graph_properties_2_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetGraphProperties_ext_2_t)(
ze_device_handle_t hDevice, ///< [in] handle of the device
ze_device_graph_properties_2_t *pDeviceGraphProperties ///< [out] query result for graph properties of the device
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.7
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetNativeBinary_ext_2_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
size_t* pSize, ///< [out] size of native binary in bytes
const uint8_t** pGraphNativeBinary ///< [out] double pointer to view of native binary (driver owns the memory)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.8
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Stage required to initialize the graph
typedef enum _ze_graph_init_stage_t
{
ZE_GRAPH_STAGE_COMMAND_LIST_INITIALIZE = 0x1, ///< Call to pfnAppendGraphInitialize is required
ZE_GRAPH_STAGE_INITIALIZE = 0x2, ///< Call to pfnGraphInitialize is required
ZE_GRAPH_STAGE_FORCE_UINT32 = 0x7fffffff
} ze_graph_init_stage_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph properties
typedef struct _ze_graph_properties_2_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
uint32_t numGraphArgs; ///< [out] number of graph arguments
ze_graph_init_stage_t initStageRequired; ///< [out] stage required to initialize the graph
} ze_graph_properties_2_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetProperties_ext_2_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
ze_graph_properties_2_t* pGraphProperties ///< [in,out] query result for graph properties
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphInitialize_ext_t)(
ze_graph_handle_t hGraph ///< [in] handle of the graph
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.9
// Version 1.9 ze_graph_memory_query_t reports values in bytes on Linux and Windows (previously reported in KB on Windows)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.10
// Version 1.10 ze_graph_memory_query_t adds query of driver caching sizes and NF4 precision format
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.11
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Supported options to query
typedef enum _ze_npu_options_type_t
{
ZE_NPU_COMPILER_OPTIONS = 0x1, ///< Query compiler options
ZE_NPU_DRIVER_OPTIONS = 0x2, ///< Query driver options
ZE_NPU_OPTIONS_FORCE_UINT32 = 0x7fffffff
} ze_npu_options_type_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGetSupportedOptions_ext_t)(
ze_device_handle_t hDevice, ///< [in] handle of the device
ze_npu_options_type_t type, ///< [in] Options type to query (compiler, driver)
size_t* pSize, ///< [in,out] pointer to the required size of the supported options string
char* pSupportedOptions ///< [in][optional] pointer to null terminated string to return supported options
///< Usage
///< 1. Call first to query required size of pSupportedOptions (pSupportedOptions is nullptr)
///< 2. Allocate pSupportedOptions of required size
///< 3. Call second time to retrieve pSupportedOptions (caller owns the memory)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnIsOptionSupported_ext_t)(
ze_device_handle_t hDevice, ///< [in] handle of the device
ze_npu_options_type_t type, ///< [in] Option type to query (compiler, driver)
const char* pOption, ///< [in] pointer to null terminated string of option to query support
const char* pValue ///< [in][optional] pointer to null terminated string of specific compiler option/value pair
///< Usage:
///< 1. Passing pValue as nullptr will check if the option is generally supported by the compiler
///< 2. Passing pValue as null terminated string will check if the specific value is supported by the compiler option
///< 3. returns ZE_RESULT_SUCCESS or ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.12
///
/// Adds ::pfnCreate3 that optionally returns ze_graph_build_log_handle_t
/// Adds ::pfnBuildLogGetString2 and ::pfnBuildLogDestroy to use with ze_graph_build_log_handle_t
/// Adds ze_graph_properties_3_t with new field ::ze_graph_properties_flag_t that is returned by ::pfnGetProperties3
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Handle of driver's graph log object
typedef struct _ze_graph_build_log_handle_t *ze_graph_build_log_handle_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphCreate_ext_3_t)(
ze_context_handle_t hContext, ///< [in] handle of the context
ze_device_handle_t hDevice, ///< [in] handle of the device
const ze_graph_desc_2_t* desc, ///< [in] pointer to graph descriptor
ze_graph_handle_t* phGraph, ///< [out] pointer to handle of graph object created
ze_graph_build_log_handle_t* phGraphBuildLog ///< [out][optional] pointer to handle of graph build log
/// Graph build log handle is returned to user if pointer is not null.
/// The caller is responsible for destroying Graph build log using ::pfnBuildLogDestroy.
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Supported Graph properties flags
typedef uint32_t ze_graph_properties_flags_t;
typedef enum _ze_graph_properties_flag_t
{
ZE_GRAPH_PROPERTIES_FLAG_LOADED_FROM_CACHE = ZE_BIT(0), ///< graph object is loaded from driver cache
ZE_GRAPH_PROPERTIES_FLAG_COMPILED = ZE_BIT(1), ///< graph object is compiled
ZE_GRAPH_PROPERTIES_FLAG_PRE_COMPILED = ZE_BIT(2), ///< graph object is pre-compiled
ZE_GRAPH_PROPERTIES_FLAG_NO_STANDARD_ALLOCATION = ZE_BIT(3), ///< graph object not backed by standard allocation (caller can free input blob)
ZE_GRAPH_PROPERTIES_FLAG_PROFILING_ENABLED = ZE_BIT(4), ///< graph object was compiled with profiling enabled, profiling buffer handle required for inference execution
ZE_GRAPH_PROPERTIES_FLAG_FORCE_UINT32 = 0x7fffffff
} ze_graph_properties_flag_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph properties
typedef struct _ze_graph_properties_3_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
uint32_t numGraphArgs; ///< [out] number of graph arguments
ze_graph_init_stage_t initStageRequired; ///< [out] stage required to initialize the graph
ze_graph_properties_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_graph_properties_flag_t
} ze_graph_properties_3_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphGetProperties_ext_3_t)(
ze_graph_handle_t hGraph, ///< [in] handle of the graph object
ze_graph_properties_3_t* pGraphProperties ///< [in,out] query result for graph properties
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphBuildLogGetString_ext_2_t)(
ze_graph_build_log_handle_t hGraphBuildLog, ///< [in] handle of the graph build log
uint32_t* pSize, ///< [in,out] pointer to the size of the error message
char* pBuildLog ///< [in] pointer to buffer to return error message
///< Usage
///< 1. Call first to query required size of pBuildLog (pBuildLog is nullptr)
///< 2. Allocate pBuildLog of required size
///< 3. Call second time to retrieve pBuildLog (caller owns the memory)
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphBuildLogDestroy_ext_t)(
ze_graph_build_log_handle_t hGraphBuildLog ///< [in][release] handle of graph log object to destroy
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.14
///
/// Adds ::ze_graph_input_hash_t optionally passed in through ze_graph_desc_t::pNext
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Graph input hash
typedef struct _ze_graph_input_hash_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
uint64_t hash; ///< [in] hash value
} ze_graph_input_hash_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.15
///
/// Adds: ze_graph_argument_property_strides_t returned through pNext of ze_graph_properties_t
/// Adds: ze_graph_argument_value_tensor_t struct for setting tensor gpuva through pfnSetArgumentValue2
/// Adds: ze_graph_argument_property_strides_t struct for setting tensor strides through pfnSetArgumentValue2
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ze_graph_argument_property_strides_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
bool supportsDynamicStrides; ///< [out] indicates that tensor supports dynamic strides
} ze_graph_argument_property_strides_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ze_graph_argument_value_tensor_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
const void* pTensor; ///< [in] gpuva of IO tensor
} ze_graph_argument_value_tensor_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct _ze_graph_argument_value_strides_t
{
ze_structure_type_graph_ext_t stype; ///< [in] type of this structure
void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
uint32_t userStrides[ZE_MAX_GRAPH_ARGUMENT_DIMENSIONS_SIZE]; ///< [in] arguments strides
} ze_graph_argument_value_strides_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Extension version 1.16
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef ze_result_t (ZE_APICALL *ze_pfnGraphEvict_ext_t)(
ze_graph_handle_t hGraph ///< [in] handle of graph object's memory to evict
///< Usage
///< 1. Will attempt to evict memory of all inferences recorded across command lists
///< 2. Inferences currently executing on device will not evict memory
///< 3. For optimal results, host synchronize before calling
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Table of Graph functions pointers
typedef struct _ze_graph_dditable_ext_t
{
// version 1.0
ze_pfnGraphCreate_ext_t pfnCreate;
ze_pfnGraphDestroy_ext_t pfnDestroy;
ze_pfnGraphGetProperties_ext_t pfnGetProperties;
ze_pfnGraphGetArgumentProperties_ext_t pfnGetArgumentProperties;
ze_pfnGraphSetArgumentValue_ext_t pfnSetArgumentValue;
ze_pfnAppendGraphInitialize_ext_t pfnAppendGraphInitialize;
ze_pfnAppendGraphExecute_ext_t pfnAppendGraphExecute;
ze_pfnGraphGetNativeBinary_ext_t pfnGetNativeBinary;
ze_pfnDeviceGetGraphProperties_ext_t pfnDeviceGetGraphProperties;
// version 1.1
ze_pfnGraphGetArgumentMetadata_ext_t pfnGraphGetArgumentMetadata;
ze_pfnGraphGetArgumentProperties_ext_2_t pfnGetArgumentProperties2;
// version 1.2
ze_pfnGraphGetArgumentProperties_ext_3_t pfnGetArgumentProperties3;
// version 1.3
ze_pfnGraphQueryNetworkCreate_ext_t pfnQueryNetworkCreate;
ze_pfnGraphQueryNetworkDestroy_ext_t pfnQueryNetworkDestroy;
ze_pfnGraphQueryNetworkGetSupportedLayers_ext_t pfnQueryNetworkGetSupportedLayers;
// version 1.4
ze_pfnGraphBuildLogGetString_ext_t pfnBuildLogGetString;
// version 1.5
ze_pfnGraphCreate_ext_2_t pfnCreate2;
ze_pfnGraphQueryNetworkCreate_ext_2_t pfnQueryNetworkCreate2;
ze_pfnGraphQueryContextMemory_ext_t pfnQueryContextMemory;
// version 1.6
ze_pfnDeviceGetGraphProperties_ext_2_t pfnDeviceGetGraphProperties2;
// version 1.7
ze_pfnGraphGetNativeBinary_ext_2_t pfnGetNativeBinary2;
// version 1.8
ze_pfnGraphGetProperties_ext_2_t pfnGetProperties2;
ze_pfnGraphInitialize_ext_t pfnGraphInitialize;
// version 1.9
// no API change, DDR memory query now reported in bytes
// version 1.10
// no API change, added driver cache size queries and NF4 precision
// version 1.11
ze_pfnGetSupportedOptions_ext_t pfnCompilerGetSupportedOptions;
ze_pfnIsOptionSupported_ext_t pfnCompilerIsOptionSupported;
// version 1.12
ze_pfnGraphCreate_ext_3_t pfnCreate3;
ze_pfnGraphGetProperties_ext_3_t pfnGetProperties3;
ze_pfnGraphBuildLogGetString_ext_2_t pfnBuildLogGetString2;
ze_pfnGraphBuildLogDestroy_ext_t pfnBuildLogDestroy;
// version 1.13
// no API change, added ZE_GRAPH_FLAG_INPUT_GRAPH_PERSISTENT flag
// version 1.14
// no API change, added ze_graph_input_hash_t and ZE_GRAPH_PROPERTIES_FLAG_NO_STANDARD_ALLOCATION
// version 1.15
ze_pfnGraphSetArgumentValue_ext_t pfnSetArgumentValue2;
// version 1.16
ze_pfnGraphEvict_ext_t pfnEvict;
} ze_graph_dditable_ext_t;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Mutable command lists NPU specific flags and structures
typedef enum _ze_mutable_command_npu_exp_flag_t
{
ZE_MUTABLE_COMMAND_EXP_FLAG_GRAPH_ARGUMENT_DEPRECATED = ZE_BIT(6)
} ze_mutable_command_npu_exp_flag_t;
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // _ZE_GRAPH_EXT_H