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
/* automatically generated by rust-bindgen 0.70.1 */

pub const __bool_true_false_are_defined: u32 = 1;
pub const true_: u32 = 1;
pub const false_: u32 = 0;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum ErrorCode {
    ERROR_CODE_NO_ERROR = 0,
    ERROR_CODE_OUT_OF_MEMORY = 1,
    ERROR_CODE_NOT_SUPPORT = 2,
    ERROR_CODE_COMPUTE_SIZE_ERROR = 3,
    ERROR_CODE_NO_EXECUTION = 4,
    ERROR_CODE_INVALID_VALUE = 5,
    ERROR_CODE_INPUT_DATA_ERROR = 10,
    ERROR_CODE_CALL_BACK_STOP = 11,
    ERROR_CODE_TENSOR_NOT_SUPPORT = 20,
    ERROR_CODE_TENSOR_NEED_DIVIDE = 21,
}
pub type int_least64_t = i64;
pub type uint_least64_t = u64;
pub type int_fast64_t = i64;
pub type uint_fast64_t = u64;
pub type int_least32_t = i32;
pub type uint_least32_t = u32;
pub type int_fast32_t = i32;
pub type uint_fast32_t = u32;
pub type int_least16_t = i16;
pub type uint_least16_t = u16;
pub type int_fast16_t = i16;
pub type uint_fast16_t = u16;
pub type int_least8_t = i8;
pub type uint_least8_t = u8;
pub type int_fast8_t = i8;
pub type uint_fast8_t = u8;
pub type intmax_t = core::ffi::c_long;
pub type uintmax_t = core::ffi::c_ulong;
pub type wchar_t = core::ffi::c_int;
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
    pub __clang_max_align_nonce1: core::ffi::c_longlong,
    pub __bindgen_padding_0: u64,
    pub __clang_max_align_nonce2: u128,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of max_align_t"][::std::mem::size_of::<max_align_t>() - 32usize];
    ["Alignment of max_align_t"][::std::mem::align_of::<max_align_t>() - 16usize];
    ["Offset of field: max_align_t::__clang_max_align_nonce1"]
        [::std::mem::offset_of!(max_align_t, __clang_max_align_nonce1) - 0usize];
    ["Offset of field: max_align_t::__clang_max_align_nonce2"]
        [::std::mem::offset_of!(max_align_t, __clang_max_align_nonce2) - 16usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MNNForwardType {
    MNN_FORWARD_CPU = 0,
    MNN_FORWARD_AUTO = 4,
    MNN_FORWARD_METAL = 1,
    MNN_FORWARD_CUDA = 2,
    MNN_FORWARD_OPENCL = 3,
    MNN_FORWARD_OPENGL = 6,
    MNN_FORWARD_VULKAN = 7,
    MNN_FORWARD_NN = 5,
    MNN_FORWARD_USER_0 = 8,
    MNN_FORWARD_USER_1 = 9,
    MNN_FORWARD_USER_2 = 10,
    MNN_FORWARD_USER_3 = 11,
    MNN_FORWARD_ALL = 12,
    MNN_FORWARD_CPU_EXTENSION = 13,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MNNGpuMode {
    MNN_GPU_TUNING_NONE = 1,
    MNN_GPU_TUNING_HEAVY = 2,
    MNN_GPU_TUNING_WIDE = 4,
    MNN_GPU_TUNING_NORMAL = 8,
    MNN_GPU_TUNING_FAST = 16,
    MNN_GPU_MEMORY_BUFFER = 64,
    MNN_GPU_MEMORY_IMAGE = 128,
    MNN_GPU_RECORD_OP = 256,
    MNN_GPU_RECORD_BATCH = 512,
}
impl MemoryMode {
    pub const Memory_Normal: MemoryMode = MemoryMode(0);
}
impl MemoryMode {
    pub const Memory_High: MemoryMode = MemoryMode(1);
}
impl MemoryMode {
    pub const Memory_Low: MemoryMode = MemoryMode(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct MemoryMode(pub core::ffi::c_uint);
impl PowerMode {
    pub const Power_Normal: PowerMode = PowerMode(0);
}
impl PowerMode {
    pub const Power_High: PowerMode = PowerMode(1);
}
impl PowerMode {
    pub const Power_Low: PowerMode = PowerMode(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct PowerMode(pub core::ffi::c_uint);
impl PrecisionMode {
    pub const Precision_Normal: PrecisionMode = PrecisionMode(0);
}
impl PrecisionMode {
    pub const Precision_High: PrecisionMode = PrecisionMode(1);
}
impl PrecisionMode {
    pub const Precision_Low: PrecisionMode = PrecisionMode(2);
}
impl PrecisionMode {
    pub const Precision_Low_BF16: PrecisionMode = PrecisionMode(3);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct PrecisionMode(pub core::ffi::c_uint);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MNNBackendConfig {
    _unused: [u8; 0],
}
extern "C" {
    pub fn mnnbc_create() -> *mut MNNBackendConfig;
}
extern "C" {
    pub fn mnnbc_destroy(config: *mut MNNBackendConfig);
}
extern "C" {
    pub fn mnnbc_set_memory_mode(config: *mut MNNBackendConfig, memory_mode: MemoryMode);
}
extern "C" {
    pub fn mnnbc_set_power_mode(config: *mut MNNBackendConfig, power_mode: PowerMode);
}
extern "C" {
    pub fn mnnbc_set_precision_mode(config: *mut MNNBackendConfig, precision_mode: PrecisionMode);
}
extern "C" {
    pub fn mnnbc_set_shared_context(
        config: *mut MNNBackendConfig,
        shared_context: *mut core::ffi::c_void,
    );
}
extern "C" {
    pub fn mnnbc_set_flags(config: *mut MNNBackendConfig, flags: usize);
}
extern "C" {
    pub fn mnnbc_reset(config: *mut MNNBackendConfig);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MNNScheduleConfig {
    _unused: [u8; 0],
}
extern "C" {
    pub fn mnnsc_create() -> *mut MNNScheduleConfig;
}
extern "C" {
    pub fn mnnsc_destroy(config: *mut MNNScheduleConfig);
}
extern "C" {
    pub fn mnnsc_set_save_tensors(
        config: *mut MNNScheduleConfig,
        saveTensors: *const *const core::ffi::c_char,
        saveTensorsSize: usize,
    );
}
extern "C" {
    pub fn mnnsc_set_type(config: *mut MNNScheduleConfig, type_: MNNForwardType);
}
extern "C" {
    pub fn mnnsc_set_num_threads(config: *mut MNNScheduleConfig, numThread: core::ffi::c_int);
}
extern "C" {
    pub fn mnnsc_set_mode(config: *mut MNNScheduleConfig, mode: core::ffi::c_int);
}
extern "C" {
    pub fn mnnsc_set_backup_type(config: *mut MNNScheduleConfig, backupType: MNNForwardType);
}
extern "C" {
    pub fn mnnsc_set_backend_config(
        config: *mut MNNScheduleConfig,
        backendConfig: *mut MNNBackendConfig,
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Session {
    _unused: [u8; 0],
}
extern "C" {
    pub fn Session_destroy(session: *mut Session);
}
extern "C" {
    pub fn Session_hasAsyncWork(session: *mut Session) -> core::ffi::c_int;
}
#[repr(u32)]
#[doc = " Types in the halide type system. They can be ints, unsigned ints,\n or floats (of various bit-widths), or a handle (which is always 64-bits).\n Note that the int/uint/float values do not imply a specific bit width\n (the bit width is expected to be encoded in a separate value)."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum halide_type_code_t {
    #[doc = "!< signed integers"]
    halide_type_int = 0,
    #[doc = "!< unsigned integers"]
    halide_type_uint = 1,
    #[doc = "!< IEEE floating point numbers"]
    halide_type_float = 2,
    #[doc = "!< opaque pointer type (void *)"]
    halide_type_handle = 3,
    #[doc = "!< floating point numbers in the bfloat format"]
    halide_type_bfloat = 4,
}
#[doc = " A runtime tag for a type in the halide type system. Can be ints,\n unsigned ints, or floats of various bit-widths (the 'bits'\n field). Can also be vectors of the same (by setting the 'lanes'\n field to something larger than one). This struct should be\n exactly 32-bits in size."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_type_t {
    #[doc = " The basic type code: signed integer, unsigned integer, or floating point."]
    pub code: halide_type_code_t,
    #[doc = " The number of bits of precision of a single scalar value of this type."]
    pub bits: u8,
    #[doc = " How many elements in a vector. This is 1 for scalar types."]
    pub lanes: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of halide_type_t"][::std::mem::size_of::<halide_type_t>() - 8usize];
    ["Alignment of halide_type_t"][::std::mem::align_of::<halide_type_t>() - 4usize];
    ["Offset of field: halide_type_t::code"][::std::mem::offset_of!(halide_type_t, code) - 0usize];
    ["Offset of field: halide_type_t::bits"][::std::mem::offset_of!(halide_type_t, bits) - 4usize];
    ["Offset of field: halide_type_t::lanes"]
        [::std::mem::offset_of!(halide_type_t, lanes) - 6usize];
};
#[doc = " An opaque struct containing per-GPU API implementations of the\n device functions."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_device_interface_impl_t {
    _unused: [u8; 0],
}
#[doc = " Each GPU API provides a halide_device_interface_t struct pointing\n to the code that manages device allocations. You can access these\n functions directly from the struct member function pointers, or by\n calling the functions declared below. Note that the global\n functions are not available when using Halide as a JIT compiler.\n If you are using raw halide_buffer_t in that context you must use\n the function pointers in the device_interface struct.\n\n The function pointers below are currently the same for every GPU\n API; only the impl field varies. These top-level functions do the\n bookkeeping that is common across all GPU APIs, and then dispatch\n to more API-specific functions via another set of function pointers\n hidden inside the impl field."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_device_interface_t {
    pub device_malloc: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
            device_interface: *const halide_device_interface_t,
        ) -> core::ffi::c_int,
    >,
    pub device_free: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub device_sync: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub device_release: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            device_interface: *const halide_device_interface_t,
        ),
    >,
    pub copy_to_host: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub copy_to_device: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
            device_interface: *const halide_device_interface_t,
        ) -> core::ffi::c_int,
    >,
    pub device_and_host_malloc: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
            device_interface: *const halide_device_interface_t,
        ) -> core::ffi::c_int,
    >,
    pub device_and_host_free: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub buffer_copy: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            src: *mut halide_buffer_t,
            dst_device_interface: *const halide_device_interface_t,
            dst: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub device_crop: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            src: *const halide_buffer_t,
            dst: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub device_release_crop: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub wrap_native: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
            handle: u64,
            device_interface: *const halide_device_interface_t,
        ) -> core::ffi::c_int,
    >,
    pub detach_native: ::std::option::Option<
        unsafe extern "C" fn(
            user_context: *mut core::ffi::c_void,
            buf: *mut halide_buffer_t,
        ) -> core::ffi::c_int,
    >,
    pub impl_: *const halide_device_interface_impl_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of halide_device_interface_t"]
        [::std::mem::size_of::<halide_device_interface_t>() - 112usize];
    ["Alignment of halide_device_interface_t"]
        [::std::mem::align_of::<halide_device_interface_t>() - 8usize];
    ["Offset of field: halide_device_interface_t::device_malloc"]
        [::std::mem::offset_of!(halide_device_interface_t, device_malloc) - 0usize];
    ["Offset of field: halide_device_interface_t::device_free"]
        [::std::mem::offset_of!(halide_device_interface_t, device_free) - 8usize];
    ["Offset of field: halide_device_interface_t::device_sync"]
        [::std::mem::offset_of!(halide_device_interface_t, device_sync) - 16usize];
    ["Offset of field: halide_device_interface_t::device_release"]
        [::std::mem::offset_of!(halide_device_interface_t, device_release) - 24usize];
    ["Offset of field: halide_device_interface_t::copy_to_host"]
        [::std::mem::offset_of!(halide_device_interface_t, copy_to_host) - 32usize];
    ["Offset of field: halide_device_interface_t::copy_to_device"]
        [::std::mem::offset_of!(halide_device_interface_t, copy_to_device) - 40usize];
    ["Offset of field: halide_device_interface_t::device_and_host_malloc"]
        [::std::mem::offset_of!(halide_device_interface_t, device_and_host_malloc) - 48usize];
    ["Offset of field: halide_device_interface_t::device_and_host_free"]
        [::std::mem::offset_of!(halide_device_interface_t, device_and_host_free) - 56usize];
    ["Offset of field: halide_device_interface_t::buffer_copy"]
        [::std::mem::offset_of!(halide_device_interface_t, buffer_copy) - 64usize];
    ["Offset of field: halide_device_interface_t::device_crop"]
        [::std::mem::offset_of!(halide_device_interface_t, device_crop) - 72usize];
    ["Offset of field: halide_device_interface_t::device_release_crop"]
        [::std::mem::offset_of!(halide_device_interface_t, device_release_crop) - 80usize];
    ["Offset of field: halide_device_interface_t::wrap_native"]
        [::std::mem::offset_of!(halide_device_interface_t, wrap_native) - 88usize];
    ["Offset of field: halide_device_interface_t::detach_native"]
        [::std::mem::offset_of!(halide_device_interface_t, detach_native) - 96usize];
    ["Offset of field: halide_device_interface_t::impl_"]
        [::std::mem::offset_of!(halide_device_interface_t, impl_) - 104usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_dimension_t {
    pub min: i32,
    pub extent: i32,
    pub stride: i32,
    pub flags: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of halide_dimension_t"][::std::mem::size_of::<halide_dimension_t>() - 16usize];
    ["Alignment of halide_dimension_t"][::std::mem::align_of::<halide_dimension_t>() - 4usize];
    ["Offset of field: halide_dimension_t::min"]
        [::std::mem::offset_of!(halide_dimension_t, min) - 0usize];
    ["Offset of field: halide_dimension_t::extent"]
        [::std::mem::offset_of!(halide_dimension_t, extent) - 4usize];
    ["Offset of field: halide_dimension_t::stride"]
        [::std::mem::offset_of!(halide_dimension_t, stride) - 8usize];
    ["Offset of field: halide_dimension_t::flags"]
        [::std::mem::offset_of!(halide_dimension_t, flags) - 12usize];
};
pub const halide_buffer_flags_halide_buffer_flag_host_dirty: halide_buffer_flags = 1;
pub const halide_buffer_flags_halide_buffer_flag_device_dirty: halide_buffer_flags = 2;
pub type halide_buffer_flags = core::ffi::c_uint;
#[doc = " \\file\n\n This file declares the routines used by Halide internally in its\n runtime. On platforms that support weak linking, these can be\n replaced with user-defined versions by defining an extern \"C\"\n function with the same name and signature.\n\n When doing Just In Time (JIT) compilation methods on the Func being\n compiled must be called instead. The corresponding methods are\n documented below.\n\n All of these functions take a \"void *user_context\" parameter as their\n first argument; if the Halide kernel that calls back to any of these\n functions has been compiled with the UserContext feature set on its Target,\n then the value of that pointer passed from the code that calls the\n Halide kernel is piped through to the function.\n\n Some of these are also useful to call when using the default\n implementation. E.g. halide_shutdown_thread_pool.\n\n Note that even on platforms with weak linking, some linker setups\n may not respect the override you provide. E.g. if the override is\n in a shared library and the halide object files are linked directly\n into the output, the builtin versions of the runtime functions will\n be called. See your linker documentation for more details. On\n Linux, LD_DYNAMIC_WEAK=1 may help.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct halide_buffer_t {
    #[doc = " A device-handle for e.g. GPU memory used to back this buffer."]
    pub device: u64,
    #[doc = " The interface used to interpret the above handle."]
    pub device_interface: *const halide_device_interface_t,
    #[doc = " A pointer to the start of the data in main memory. In terms of\n the Halide coordinate system, this is the address of the min\n coordinates (defined below)."]
    pub host: *mut u8,
    #[doc = " flags with various meanings."]
    pub flags: u64,
    #[doc = " The type of each buffer element."]
    pub type_: halide_type_t,
    #[doc = " The dimensionality of the buffer."]
    pub dimensions: i32,
    #[doc = " The shape of the buffer. Halide does not own this array - you\n must manage the memory for it yourself."]
    pub dim: *mut halide_dimension_t,
    #[doc = " Pads the buffer up to a multiple of 8 bytes"]
    pub padding: *mut core::ffi::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of halide_buffer_t"][::std::mem::size_of::<halide_buffer_t>() - 64usize];
    ["Alignment of halide_buffer_t"][::std::mem::align_of::<halide_buffer_t>() - 8usize];
    ["Offset of field: halide_buffer_t::device"]
        [::std::mem::offset_of!(halide_buffer_t, device) - 0usize];
    ["Offset of field: halide_buffer_t::device_interface"]
        [::std::mem::offset_of!(halide_buffer_t, device_interface) - 8usize];
    ["Offset of field: halide_buffer_t::host"]
        [::std::mem::offset_of!(halide_buffer_t, host) - 16usize];
    ["Offset of field: halide_buffer_t::flags"]
        [::std::mem::offset_of!(halide_buffer_t, flags) - 24usize];
    ["Offset of field: halide_buffer_t::type_"]
        [::std::mem::offset_of!(halide_buffer_t, type_) - 32usize];
    ["Offset of field: halide_buffer_t::dimensions"]
        [::std::mem::offset_of!(halide_buffer_t, dimensions) - 40usize];
    ["Offset of field: halide_buffer_t::dim"]
        [::std::mem::offset_of!(halide_buffer_t, dim) - 48usize];
    ["Offset of field: halide_buffer_t::padding"]
        [::std::mem::offset_of!(halide_buffer_t, padding) - 56usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct CString {
    pub data: *mut core::ffi::c_char,
    pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of CString"][::std::mem::size_of::<CString>() - 16usize];
    ["Alignment of CString"][::std::mem::align_of::<CString>() - 8usize];
    ["Offset of field: CString::data"][::std::mem::offset_of!(CString, data) - 0usize];
    ["Offset of field: CString::size"][::std::mem::offset_of!(CString, size) - 8usize];
};
extern "C" {
    pub fn createCString(data: *const core::ffi::c_char, size: usize) -> CString;
}
extern "C" {
    pub fn destroyCString(string: *mut CString);
}
#[repr(C)]
#[derive(Debug)]
pub struct TensorInfo {
    pub name: CString,
    pub tensor: *mut core::ffi::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of TensorInfo"][::std::mem::size_of::<TensorInfo>() - 24usize];
    ["Alignment of TensorInfo"][::std::mem::align_of::<TensorInfo>() - 8usize];
    ["Offset of field: TensorInfo::name"][::std::mem::offset_of!(TensorInfo, name) - 0usize];
    ["Offset of field: TensorInfo::tensor"][::std::mem::offset_of!(TensorInfo, tensor) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TensorInfoArray {
    pub tensors: *mut TensorInfo,
    pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of TensorInfoArray"][::std::mem::size_of::<TensorInfoArray>() - 16usize];
    ["Alignment of TensorInfoArray"][::std::mem::align_of::<TensorInfoArray>() - 8usize];
    ["Offset of field: TensorInfoArray::tensors"]
        [::std::mem::offset_of!(TensorInfoArray, tensors) - 0usize];
    ["Offset of field: TensorInfoArray::size"]
        [::std::mem::offset_of!(TensorInfoArray, size) - 8usize];
};
extern "C" {
    pub fn createTensorInfoArray(count: usize) -> *mut TensorInfoArray;
}
extern "C" {
    pub fn destroyTensorInfoArray(array: *mut TensorInfoArray);
}
extern "C" {
    pub fn getTensorInfoArray(array: *const TensorInfoArray, index: usize) -> *mut TensorInfo;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Tensor {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TensorShape {
    pub shape: [core::ffi::c_int; 4usize],
    pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of TensorShape"][::std::mem::size_of::<TensorShape>() - 24usize];
    ["Alignment of TensorShape"][::std::mem::align_of::<TensorShape>() - 8usize];
    ["Offset of field: TensorShape::shape"][::std::mem::offset_of!(TensorShape, shape) - 0usize];
    ["Offset of field: TensorShape::size"][::std::mem::offset_of!(TensorShape, size) - 16usize];
};
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum DimensionType {
    TENSORFLOW = 0,
    CAFFE = 1,
    CAFFE_C4 = 2,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum HandleDataType {
    HANDLE_NONE = 0,
    HANDLE_STRING = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum MapType {
    MAP_TENSOR_WRITE = 0,
    MAP_TENSOR_READ = 1,
}
extern "C" {
    pub fn Tensor_create(dimSize: core::ffi::c_int, type_: DimensionType) -> *mut Tensor;
}
extern "C" {
    pub fn Tensor_createFromTensor(
        tensor: *const Tensor,
        type_: DimensionType,
        allocMemory: core::ffi::c_int,
    ) -> *mut Tensor;
}
extern "C" {
    pub fn Tensor_destroy(tensor: *mut Tensor);
}
extern "C" {
    pub fn Tensor_createDevice(
        shape: *const core::ffi::c_int,
        shapeSize: usize,
        typeCode: halide_type_t,
        dimType: DimensionType,
    ) -> *mut Tensor;
}
extern "C" {
    pub fn Tensor_createWith(
        shape: *const core::ffi::c_int,
        shapeSize: usize,
        typeCode: halide_type_t,
        data: *mut core::ffi::c_void,
        dimType: DimensionType,
    ) -> *mut Tensor;
}
extern "C" {
    pub fn Tensor_copyFromHostTensor(
        deviceTensor: *mut Tensor,
        hostTensor: *const Tensor,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_copyToHostTensor(
        deviceTensor: *const Tensor,
        hostTensor: *mut Tensor,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_createHostTensorFromDevice(
        deviceTensor: *const Tensor,
        copyData: core::ffi::c_int,
    ) -> *mut Tensor;
}
extern "C" {
    pub fn Tensor_getDimensionType(tensor: *const Tensor) -> DimensionType;
}
extern "C" {
    pub fn Tensor_buffer(tensor: *const Tensor) -> *const halide_buffer_t;
}
extern "C" {
    pub fn Tensor_buffer_mut(tensor: *mut Tensor) -> *mut halide_buffer_t;
}
extern "C" {
    pub fn Tensor_host(tensor: *const Tensor) -> *const core::ffi::c_void;
}
extern "C" {
    pub fn Tensor_host_mut(tensor: *mut Tensor) -> *mut core::ffi::c_void;
}
extern "C" {
    pub fn Tensor_deviceId(tensor: *const Tensor) -> u64;
}
extern "C" {
    pub fn Tensor_dimensions(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_shape(tensor: *const Tensor) -> TensorShape;
}
extern "C" {
    pub fn Tensor_size(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_usize(tensor: *const Tensor) -> usize;
}
extern "C" {
    pub fn Tensor_elementSize(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_width(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_height(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_channel(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_batch(tensor: *const Tensor) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_stride(tensor: *const Tensor, index: core::ffi::c_int) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_length(tensor: *const Tensor, index: core::ffi::c_int) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_setStride(tensor: *mut Tensor, index: core::ffi::c_int, stride: core::ffi::c_int);
}
extern "C" {
    pub fn Tensor_setLength(tensor: *mut Tensor, index: core::ffi::c_int, length: core::ffi::c_int);
}
extern "C" {
    pub fn Tensor_getDeviceInfo(
        tensor: *const Tensor,
        dst: *mut core::ffi::c_void,
        forwardType: core::ffi::c_int,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_print(tensor: *const Tensor);
}
extern "C" {
    pub fn Tensor_printShape(tensor: *const Tensor);
}
extern "C" {
    pub fn Tensor_map(
        tensor: *mut Tensor,
        mtype: MapType,
        dtype: DimensionType,
    ) -> *mut core::ffi::c_void;
}
extern "C" {
    pub fn Tensor_unmap(
        tensor: *mut Tensor,
        mtype: MapType,
        dtype: DimensionType,
        mapPtr: *mut core::ffi::c_void,
    );
}
extern "C" {
    pub fn Tensor_clone(tensor: *const Tensor) -> *mut Tensor;
}
extern "C" {
    pub fn Tensor_wait(
        tensor: *mut Tensor,
        mtype: MapType,
        finish: core::ffi::c_int,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_setDevicePtr(
        tensor: *mut Tensor,
        devicePtr: *const core::ffi::c_void,
        memoryType: core::ffi::c_int,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Tensor_getType(tensor: *const Tensor) -> halide_type_t;
}
extern "C" {
    pub fn Tensor_isTypeOf(tensor: *const Tensor, type_: halide_type_t) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Interpreter {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Backend {
    _unused: [u8; 0],
}
#[repr(u32)]
#[doc = " acquire runtime status by Runtime::getCurrentStatus with following keys,"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum RuntimeStatus {
    #[doc = " get status whether this runtime support 16-bits float point arithmetic"]
    STATUS_SUPPORT_FP16 = 0,
    #[doc = " get status whether this runtime support dot-product arithmetic"]
    STATUS_SUPPORT_DOT_PRODUCT = 1,
    #[doc = " get status whether this runtime support power-low (means low priority for\n opencl)"]
    STATUS_SUPPORT_POWER_LOW = 2,
    #[doc = " emum total number"]
    STATUS_COUNT = 3,
}
extern "C" {
    pub fn modelPrintIO(model: *const core::ffi::c_char);
}
extern "C" {
    #[doc = " @brief get mnn version info.\n @return mnn version string."]
    pub fn getVersion() -> *const core::ffi::c_char;
}
extern "C" {
    #[doc = " @brief create net from file.\n @param file  given file.\n @return created net if success, NULL otherwise."]
    pub fn Interpreter_createFromFile(file: *const core::ffi::c_char) -> *mut Interpreter;
}
extern "C" {
    #[doc = " @brief create net from buffer.\n @param buffer    given data buffer.\n @param size      size of data buffer.\n @return created net if success, NULL otherwise."]
    pub fn Interpreter_createFromBuffer(
        buffer: *const core::ffi::c_void,
        size: usize,
    ) -> *mut Interpreter;
}
extern "C" {
    pub fn Interpreter_destroy(interpreter: *mut Interpreter);
}
pub mod SessionMode {
    pub type Type = core::ffi::c_uint;
    #[doc = " About CallBack, Default Session_Debug*/\n/** runSessionWithCallBack is allowed and can get internal op info"]
    pub const Session_Debug: Type = 0;
    #[doc = " runSessionWithCallBack is not valid and can't get any info of op in\nsession"]
    pub const Session_Release: Type = 1;
    #[doc = " About input tenosr, Default Session_Input_Inside*/\n/** The input tensor is alloced by session, input data after session resized"]
    pub const Session_Input_Inside: Type = 2;
    #[doc = " The input tensor is alloced by user, set input data before session\nresize"]
    pub const Session_Input_User: Type = 3;
    #[doc = " The output tensor depends on session, and can't be separate used"]
    pub const Session_Output_Inside: Type = 4;
    #[doc = " The output tensor can be separated from session"]
    pub const Session_Output_User: Type = 5;
    #[doc = " Try Resize Session when create Session or not, default direct:"]
    pub const Session_Resize_Direct: Type = 6;
    #[doc = " Try Resize Session when create Session or not, default direct:"]
    pub const Session_Resize_Defer: Type = 7;
    #[doc = " Determine the Execution's forward type is determine by user or auto\ndetermine"]
    pub const Session_Backend_Fix: Type = 8;
    #[doc = " Determine the Execution's forward type is determine by user or auto\ndetermine"]
    pub const Session_Backend_Auto: Type = 9;
    #[doc = " Determine static memory whether recyle in resizeSession or just cache the\nmemory"]
    pub const Session_Memory_Collect: Type = 10;
    #[doc = " Determine static memory whether recyle in resizeSession or just cache the\nmemory"]
    pub const Session_Memory_Cache: Type = 11;
    #[doc = " Determine whether use codegen function"]
    pub const Session_Codegen_Disable: Type = 12;
    #[doc = " Determine whether use codegen function"]
    pub const Session_Codegen_Enable: Type = 13;
    #[doc = " Dynamic Reisze Optimization"]
    pub const Session_Resize_Check: Type = 14;
    #[doc = " Dynamic Reisze Optimization"]
    pub const Session_Resize_Fix: Type = 15;
}
extern "C" {
    pub fn Interpreter_setSessionMode(interpreter: *mut Interpreter, mode: SessionMode::Type);
}
extern "C" {
    pub fn Interpreter_setCacheFile(
        interpreter: *mut Interpreter,
        cacheFile: *const core::ffi::c_char,
        keySize: usize,
    );
}
extern "C" {
    pub fn Interpreter_setExternalFile(
        interpreter: *mut Interpreter,
        file: *const core::ffi::c_char,
        flag: usize,
    );
}
extern "C" {
    pub fn Interpreter_updateCacheFile(
        interpreter: *mut Interpreter,
        session: *mut Session,
    ) -> ErrorCode;
}
extern "C" {
    pub fn Interpreter_setSessionHint(
        interpreter: *mut Interpreter,
        mode: core::ffi::c_int,
        value: core::ffi::c_int,
    );
}
extern "C" {
    pub fn Interpreter_createSession(
        interpreter: *mut Interpreter,
        config: *const MNNScheduleConfig,
    ) -> *mut Session;
}
extern "C" {
    pub fn Interpreter_createMultiPathSession(
        interpreter: *mut Interpreter,
        configs: *const *const MNNScheduleConfig,
        configSize: usize,
    ) -> *mut Session;
}
extern "C" {
    pub fn Interpreter_releaseSession(
        interpreter: *mut Interpreter,
        session: *mut Session,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Interpreter_resizeSession(interpreter: *mut Interpreter, session: *mut Session);
}
extern "C" {
    pub fn Interpreter_resizeSessionWithFlag(
        interpreter: *mut Interpreter,
        session: *mut Session,
        needRelloc: core::ffi::c_int,
    );
}
extern "C" {
    pub fn Interpreter_releaseModel(interpreter: *mut Interpreter);
}
extern "C" {
    pub fn Interpreter_getModelVersion(interpreter: *const Interpreter)
        -> *const core::ffi::c_char;
}
extern "C" {
    pub fn Interpreter_updateSessionToModel(
        interpreter: *mut Interpreter,
        session: *mut Session,
    ) -> ErrorCode;
}
extern "C" {
    pub fn Interpreter_runSession(
        interpreter: *const Interpreter,
        session: *mut Session,
    ) -> ErrorCode;
}
extern "C" {
    pub fn Interpreter_runSessionWithCallBackInfo(
        interpreter: *const Interpreter,
        session: *const Session,
        before: *mut core::ffi::c_void,
        end: *mut core::ffi::c_void,
        sync: core::ffi::c_int,
    ) -> ErrorCode;
}
extern "C" {
    pub fn Interpreter_getSessionInput(
        interpreter: *mut Interpreter,
        session: *const Session,
        name: *const core::ffi::c_char,
    ) -> *mut Tensor;
}
extern "C" {
    pub fn Interpreter_getSessionOutput(
        interpreter: *mut Interpreter,
        session: *const Session,
        name: *const core::ffi::c_char,
    ) -> *mut Tensor;
}
extern "C" {
    pub fn Interpreter_getSessionInfo(
        interpreter: *mut Interpreter,
        session: *const Session,
        code: core::ffi::c_int,
        ptr: *mut core::ffi::c_void,
    ) -> core::ffi::c_int;
}
extern "C" {
    pub fn Interpreter_getSessionOutputAll(
        interpreter: *const Interpreter,
        session: *const Session,
    ) -> *const TensorInfoArray;
}
extern "C" {
    pub fn Interpreter_getSessionInputAll(
        interpreter: *const Interpreter,
        session: *const Session,
    ) -> *const TensorInfoArray;
}
extern "C" {
    pub fn Interpreter_resizeTensor(
        interpreter: *mut Interpreter,
        tensor: *mut Tensor,
        dims: *const core::ffi::c_int,
        dimsSize: usize,
    );
}
extern "C" {
    pub fn Interpreter_resizeTensorByNCHW(
        interpreter: *mut Interpreter,
        tensor: *mut Tensor,
        batch: core::ffi::c_int,
        channel: core::ffi::c_int,
        height: core::ffi::c_int,
        width: core::ffi::c_int,
    );
}
extern "C" {
    pub fn Interpreter_getBackend(
        interpreter: *const Interpreter,
        session: *const Session,
        tensor: *const Tensor,
    ) -> *const Backend;
}
extern "C" {
    pub fn Interpreter_bizCode(interpreter: *const Interpreter) -> *const core::ffi::c_char;
}
extern "C" {
    pub fn Interpreter_uuid(interpreter: *const Interpreter) -> *const core::ffi::c_char;
}
extern "C" {
    pub fn OperatorInfo_name(op: *const core::ffi::c_void) -> *const core::ffi::c_char;
}
extern "C" {
    pub fn OperatorInfo_type(op: *const core::ffi::c_void) -> *const core::ffi::c_char;
}
extern "C" {
    pub fn OperatorInfo_flops(op: *const core::ffi::c_void) -> f32;
}