-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-metal.cpp
6080 lines (5162 loc) · 326 KB
/
gen-metal.cpp
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
#include <vector>
#include <iostream>
#include "sys/mman.h"
#include "sys/stat.h"
#define NS_PRIVATE_IMPLEMENTATION
#define CA_PRIVATE_IMPLEMENTATION
#define MTL_PRIVATE_IMPLEMENTATION
#include "frameworks/Metal.hpp"
#define max(x,y) ((x>y)?x:y)
#define int64 long
#define half __fp16
#define uchar unsigned char
#define bool uchar
// using METAL backend
// with export target: metal
// quant enable: True
typedef struct { void* weights; } model_t;
MTL::Buffer* scratch_0;
MTL::Buffer* scratch_1;
MTL::Buffer* scratch_2;
MTL::Buffer* input0;
MTL::Buffer* scratch_4;
MTL::Buffer* scratch_9;
MTL::Buffer* scratch_10;
MTL::Buffer* scratch_14;
MTL::Buffer* scratch_19;
MTL::Buffer* scratch_20;
MTL::Buffer* scratch_31;
MTL::Buffer* scratch_34;
MTL::Buffer* scratch_49;
MTL::Buffer* scratch_52;
MTL::Buffer* scratch_67;
MTL::Buffer* scratch_70;
MTL::Buffer* scratch_85;
MTL::Buffer* scratch_88;
MTL::Buffer* scratch_103;
MTL::Buffer* scratch_106;
MTL::Buffer* scratch_121;
MTL::Buffer* scratch_124;
MTL::Buffer* scratch_139;
MTL::Buffer* scratch_142;
MTL::Buffer* scratch_157;
MTL::Buffer* scratch_160;
MTL::Buffer* scratch_175;
MTL::Buffer* scratch_178;
MTL::Buffer* scratch_193;
MTL::Buffer* scratch_196;
MTL::Buffer* scratch_211;
MTL::Buffer* scratch_214;
MTL::Buffer* scratch_229;
MTL::Buffer* scratch_232;
MTL::Buffer* scratch_247;
MTL::Buffer* scratch_250;
MTL::Buffer* scratch_265;
MTL::Buffer* scratch_268;
MTL::Buffer* scratch_283;
MTL::Buffer* scratch_286;
MTL::Buffer* scratch_301;
MTL::Buffer* scratch_304;
MTL::Buffer* scratch_319;
MTL::Buffer* scratch_322;
MTL::Buffer* scratch_337;
MTL::Buffer* scratch_340;
MTL::Buffer* scratch_355;
MTL::Buffer* scratch_358;
MTL::Buffer* scratch_373;
MTL::Buffer* scratch_376;
MTL::Buffer* scratch_391;
MTL::Buffer* scratch_394;
MTL::Buffer* scratch_409;
MTL::Buffer* scratch_412;
MTL::Buffer* scratch_427;
MTL::Buffer* scratch_430;
MTL::Buffer* scratch_445;
MTL::Buffer* scratch_448;
MTL::Buffer* scratch_463;
MTL::Buffer* scratch_466;
MTL::Buffer* scratch_481;
MTL::Buffer* scratch_484;
MTL::Buffer* scratch_499;
MTL::Buffer* scratch_502;
MTL::Buffer* scratch_517;
MTL::Buffer* scratch_520;
MTL::Buffer* scratch_535;
MTL::Buffer* scratch_538;
MTL::Buffer* scratch_553;
MTL::Buffer* scratch_556;
MTL::Buffer* scratch_571;
MTL::Buffer* scratch_574;
MTL::Buffer* outputs;
MTL::ComputePipelineState* r_6_32_6_pso;
MTL::ComputePipelineState* r_8_2_4_2_16_6_4_3_pso;
MTL::ComputePipelineState* E_500_2_16_4_3_pso;
MTL::ComputePipelineState* r_64_2_16_1024_4_4_3n1_pso;
MTL::ComputePipelineState* r_6_6n1_pso;
MTL::ComputePipelineState* E_32_2752_32_4_4_pso;
MTL::ComputePipelineState* r_2_2_8_3_3_32_4_4_pso;
MTL::ComputePipelineState* E_32_8000_32_4_4_pso;
MTL::ComputePipelineState* r_172_2_16_1024_4_4_3n1_pso;
MTL::ComputePipelineState* r_6_32_6n1_pso;
MTL::ComputePipelineState* r_256_125n1_pso;
MTL::ComputePipelineState* E_2_2_3_3_pso;
MTL::ComputePipelineState* E_250_32_4n1_pso;
MTL::ComputePipelineState* E_32_1024_32_4_4_pso;
MTL::ComputePipelineState* r_64_2_16_8000_4_4_3_pso;
MTL::ComputePipelineState* E_64_2_16_4_3n1_pso;
MTL::ComputePipelineState* r_6_256_16n1_pso;
MTL::ComputePipelineState* r_500_2_16_1024_4_4_3_pso;
MTL::ComputePipelineState* E_6_32_2_3_pso;
MTL::ComputePipelineState* E_6_4_8_16_2_4_pso;
MTL::ComputePipelineState* r_6_256_16_pso;
MTL::ComputePipelineState* r_64_2_16_2752_4_4_3_pso;
MTL::ComputePipelineState* E_250_32_4_pso;
MTL::ComputePipelineState* E_6_32_2_3n1_pso;
MTL::ComputePipelineState* E_64_2_16_4_3_pso;
MTL::ComputePipelineState* E_86_1024_32_4_4_pso;
MTL::ComputePipelineState* r_64_2_16_1024_4_4_3_pso;
MTL::ComputePipelineState* r_256_125_pso;
MTL::ComputePipelineState* r_172_2_16_1024_4_4_3_pso;
MTL::ComputePipelineState* r_6_6_pso;
void init(MTL::Device* device, MTL::Library* library) {
scratch_0 = device->newBuffer(131072000 * sizeof(half), MTL::ResourceStorageModeManaged);
scratch_1 = device->newBuffer(45088768 * sizeof(half), MTL::ResourceStorageModeManaged);
scratch_2 = device->newBuffer(36 * sizeof(float), MTL::ResourceStorageModeManaged);
input0 = device->newBuffer(6 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_4 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_9 = device->newBuffer(66048 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_10 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_14 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_19 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_20 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_31 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_34 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_49 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_52 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_67 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_70 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_85 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_88 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_103 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_106 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_121 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_124 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_139 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_142 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_157 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_160 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_175 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_178 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_193 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_196 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_211 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_214 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_229 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_232 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_247 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_250 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_265 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_268 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_283 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_286 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_301 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_304 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_319 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_322 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_337 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_340 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_355 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_358 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_373 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_376 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_391 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_394 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_409 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_412 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_427 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_430 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_445 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_448 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_463 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_466 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_481 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_484 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_499 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_502 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_517 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_520 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_535 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_538 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_553 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_556 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_571 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
scratch_574 = device->newBuffer(24576 * sizeof(float), MTL::ResourceStorageModeManaged);
outputs = device->newBuffer(32000 * sizeof(float), MTL::ResourceStorageModeManaged);
MTL::Function* r_6_32_6 = library->newFunction(NS::String::string("r_6_32_6", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_6_32_6_err = nullptr; r_6_32_6_pso = device->newComputePipelineState(r_6_32_6, &r_6_32_6_err);
MTL::Function* r_8_2_4_2_16_6_4_3 = library->newFunction(NS::String::string("r_8_2_4_2_16_6_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_8_2_4_2_16_6_4_3_err = nullptr; r_8_2_4_2_16_6_4_3_pso = device->newComputePipelineState(r_8_2_4_2_16_6_4_3, &r_8_2_4_2_16_6_4_3_err);
MTL::Function* E_500_2_16_4_3 = library->newFunction(NS::String::string("E_500_2_16_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_500_2_16_4_3_err = nullptr; E_500_2_16_4_3_pso = device->newComputePipelineState(E_500_2_16_4_3, &E_500_2_16_4_3_err);
MTL::Function* r_64_2_16_1024_4_4_3n1 = library->newFunction(NS::String::string("r_64_2_16_1024_4_4_3n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_64_2_16_1024_4_4_3n1_err = nullptr; r_64_2_16_1024_4_4_3n1_pso = device->newComputePipelineState(r_64_2_16_1024_4_4_3n1, &r_64_2_16_1024_4_4_3n1_err);
MTL::Function* r_6_6n1 = library->newFunction(NS::String::string("r_6_6n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_6_6n1_err = nullptr; r_6_6n1_pso = device->newComputePipelineState(r_6_6n1, &r_6_6n1_err);
MTL::Function* E_32_2752_32_4_4 = library->newFunction(NS::String::string("E_32_2752_32_4_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_32_2752_32_4_4_err = nullptr; E_32_2752_32_4_4_pso = device->newComputePipelineState(E_32_2752_32_4_4, &E_32_2752_32_4_4_err);
MTL::Function* r_2_2_8_3_3_32_4_4 = library->newFunction(NS::String::string("r_2_2_8_3_3_32_4_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_2_2_8_3_3_32_4_4_err = nullptr; r_2_2_8_3_3_32_4_4_pso = device->newComputePipelineState(r_2_2_8_3_3_32_4_4, &r_2_2_8_3_3_32_4_4_err);
MTL::Function* E_32_8000_32_4_4 = library->newFunction(NS::String::string("E_32_8000_32_4_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_32_8000_32_4_4_err = nullptr; E_32_8000_32_4_4_pso = device->newComputePipelineState(E_32_8000_32_4_4, &E_32_8000_32_4_4_err);
MTL::Function* r_172_2_16_1024_4_4_3n1 = library->newFunction(NS::String::string("r_172_2_16_1024_4_4_3n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_172_2_16_1024_4_4_3n1_err = nullptr; r_172_2_16_1024_4_4_3n1_pso = device->newComputePipelineState(r_172_2_16_1024_4_4_3n1, &r_172_2_16_1024_4_4_3n1_err);
MTL::Function* r_6_32_6n1 = library->newFunction(NS::String::string("r_6_32_6n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_6_32_6n1_err = nullptr; r_6_32_6n1_pso = device->newComputePipelineState(r_6_32_6n1, &r_6_32_6n1_err);
MTL::Function* r_256_125n1 = library->newFunction(NS::String::string("r_256_125n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_256_125n1_err = nullptr; r_256_125n1_pso = device->newComputePipelineState(r_256_125n1, &r_256_125n1_err);
MTL::Function* E_2_2_3_3 = library->newFunction(NS::String::string("E_2_2_3_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_2_2_3_3_err = nullptr; E_2_2_3_3_pso = device->newComputePipelineState(E_2_2_3_3, &E_2_2_3_3_err);
MTL::Function* E_250_32_4n1 = library->newFunction(NS::String::string("E_250_32_4n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_250_32_4n1_err = nullptr; E_250_32_4n1_pso = device->newComputePipelineState(E_250_32_4n1, &E_250_32_4n1_err);
MTL::Function* E_32_1024_32_4_4 = library->newFunction(NS::String::string("E_32_1024_32_4_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_32_1024_32_4_4_err = nullptr; E_32_1024_32_4_4_pso = device->newComputePipelineState(E_32_1024_32_4_4, &E_32_1024_32_4_4_err);
MTL::Function* r_64_2_16_8000_4_4_3 = library->newFunction(NS::String::string("r_64_2_16_8000_4_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_64_2_16_8000_4_4_3_err = nullptr; r_64_2_16_8000_4_4_3_pso = device->newComputePipelineState(r_64_2_16_8000_4_4_3, &r_64_2_16_8000_4_4_3_err);
MTL::Function* E_64_2_16_4_3n1 = library->newFunction(NS::String::string("E_64_2_16_4_3n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_64_2_16_4_3n1_err = nullptr; E_64_2_16_4_3n1_pso = device->newComputePipelineState(E_64_2_16_4_3n1, &E_64_2_16_4_3n1_err);
MTL::Function* r_6_256_16n1 = library->newFunction(NS::String::string("r_6_256_16n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_6_256_16n1_err = nullptr; r_6_256_16n1_pso = device->newComputePipelineState(r_6_256_16n1, &r_6_256_16n1_err);
MTL::Function* r_500_2_16_1024_4_4_3 = library->newFunction(NS::String::string("r_500_2_16_1024_4_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_500_2_16_1024_4_4_3_err = nullptr; r_500_2_16_1024_4_4_3_pso = device->newComputePipelineState(r_500_2_16_1024_4_4_3, &r_500_2_16_1024_4_4_3_err);
MTL::Function* E_6_32_2_3 = library->newFunction(NS::String::string("E_6_32_2_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_6_32_2_3_err = nullptr; E_6_32_2_3_pso = device->newComputePipelineState(E_6_32_2_3, &E_6_32_2_3_err);
MTL::Function* E_6_4_8_16_2_4 = library->newFunction(NS::String::string("E_6_4_8_16_2_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_6_4_8_16_2_4_err = nullptr; E_6_4_8_16_2_4_pso = device->newComputePipelineState(E_6_4_8_16_2_4, &E_6_4_8_16_2_4_err);
MTL::Function* r_6_256_16 = library->newFunction(NS::String::string("r_6_256_16", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_6_256_16_err = nullptr; r_6_256_16_pso = device->newComputePipelineState(r_6_256_16, &r_6_256_16_err);
MTL::Function* r_64_2_16_2752_4_4_3 = library->newFunction(NS::String::string("r_64_2_16_2752_4_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_64_2_16_2752_4_4_3_err = nullptr; r_64_2_16_2752_4_4_3_pso = device->newComputePipelineState(r_64_2_16_2752_4_4_3, &r_64_2_16_2752_4_4_3_err);
MTL::Function* E_250_32_4 = library->newFunction(NS::String::string("E_250_32_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_250_32_4_err = nullptr; E_250_32_4_pso = device->newComputePipelineState(E_250_32_4, &E_250_32_4_err);
MTL::Function* E_6_32_2_3n1 = library->newFunction(NS::String::string("E_6_32_2_3n1", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_6_32_2_3n1_err = nullptr; E_6_32_2_3n1_pso = device->newComputePipelineState(E_6_32_2_3n1, &E_6_32_2_3n1_err);
MTL::Function* E_64_2_16_4_3 = library->newFunction(NS::String::string("E_64_2_16_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_64_2_16_4_3_err = nullptr; E_64_2_16_4_3_pso = device->newComputePipelineState(E_64_2_16_4_3, &E_64_2_16_4_3_err);
MTL::Function* E_86_1024_32_4_4 = library->newFunction(NS::String::string("E_86_1024_32_4_4", NS::StringEncoding::UTF8StringEncoding));
NS::Error* E_86_1024_32_4_4_err = nullptr; E_86_1024_32_4_4_pso = device->newComputePipelineState(E_86_1024_32_4_4, &E_86_1024_32_4_4_err);
MTL::Function* r_64_2_16_1024_4_4_3 = library->newFunction(NS::String::string("r_64_2_16_1024_4_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_64_2_16_1024_4_4_3_err = nullptr; r_64_2_16_1024_4_4_3_pso = device->newComputePipelineState(r_64_2_16_1024_4_4_3, &r_64_2_16_1024_4_4_3_err);
MTL::Function* r_256_125 = library->newFunction(NS::String::string("r_256_125", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_256_125_err = nullptr; r_256_125_pso = device->newComputePipelineState(r_256_125, &r_256_125_err);
MTL::Function* r_172_2_16_1024_4_4_3 = library->newFunction(NS::String::string("r_172_2_16_1024_4_4_3", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_172_2_16_1024_4_4_3_err = nullptr; r_172_2_16_1024_4_4_3_pso = device->newComputePipelineState(r_172_2_16_1024_4_4_3, &r_172_2_16_1024_4_4_3_err);
MTL::Function* r_6_6 = library->newFunction(NS::String::string("r_6_6", NS::StringEncoding::UTF8StringEncoding));
NS::Error* r_6_6_err = nullptr; r_6_6_pso = device->newComputePipelineState(r_6_6, &r_6_6_err);
}
void encode(MTL::ComputeCommandEncoder* encoder, MTL::Device* device, model_t* llama) {
encoder->setComputePipelineState(r_6_6_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->dispatchThreadgroups(MTL::Size(1,1,1), MTL::Size(1,1,1));
encoder->setComputePipelineState(r_6_6n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->dispatchThreadgroups(MTL::Size(1,1,1), MTL::Size(1,1,1));
encoder->setComputePipelineState(E_2_2_3_3_pso);
encoder->setBuffer(scratch_2, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2,2,1), MTL::Size(3,3,1));
encoder->setComputePipelineState(E_500_2_16_4_3_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_500_2_16_4_3_weights_0 = device->newBuffer((float*)((char*)llama->weights + 0), 32000 * sizeof(float), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_500_2_16_4_3_weights_0, 0, 1);
encoder->setBuffer(input0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(500,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_64_2_16_8000_4_4_3_pso);
encoder->setBuffer(scratch_4, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
MTL::Buffer* r_64_2_16_8000_4_4_3_weights_128000 = device->newBuffer((half*)((char*)llama->weights + 128000), 131072000 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(r_64_2_16_8000_4_4_3_weights_128000, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_4, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_4, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
MTL::Buffer* E_64_2_16_4_3_weights_262272000 = device->newBuffer((half*)((char*)llama->weights + 262272000), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3_weights_262272000, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_262280192 = device->newBuffer((char*)((char*)llama->weights + 262280192), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_262280192, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_279057408 = device->newBuffer((half*)((char*)llama->weights + 279057408), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_279057408, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_10, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
MTL::Buffer* E_6_4_8_16_2_4_weights_279065600 = device->newBuffer((float*)((char*)llama->weights + 279065600), 262144 * sizeof(float), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_280114176 = device->newBuffer((char*)((char*)llama->weights + 280114176), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_280114176, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_296891392 = device->newBuffer((half*)((char*)llama->weights + 296891392), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_296891392, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_14, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_296899584 = device->newBuffer((char*)((char*)llama->weights + 296899584), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_296899584, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_313676800 = device->newBuffer((half*)((char*)llama->weights + 313676800), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_313676800, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(r_2_2_8_3_3_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_10, 0, 2);
encoder->setBuffer(scratch_2, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(2,2,1), MTL::Size(3,3,8));
encoder->setComputePipelineState(r_6_32_6_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_9, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_6_32_6n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3n1_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_8_2_4_2_16_6_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(scratch_14, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2,8,1), MTL::Size(16,2,4));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_313684992 = device->newBuffer((char*)((char*)llama->weights + 313684992), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_313684992, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_330462208 = device->newBuffer((half*)((char*)llama->weights + 330462208), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_330462208, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_19, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16n1_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_4, 0, 1);
encoder->setBuffer(scratch_19, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3n1_pso);
encoder->setBuffer(scratch_20, 0, 0);
encoder->setBuffer(scratch_4, 0, 1);
encoder->setBuffer(scratch_19, 0, 2);
encoder->setBuffer(scratch_0, 0, 3);
MTL::Buffer* E_64_2_16_4_3n1_weights_330470400 = device->newBuffer((half*)((char*)llama->weights + 330470400), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3n1_weights_330470400, 0, 4);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_2752_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_2752_32_4_4_weights_330478592 = device->newBuffer((char*)((char*)llama->weights + 330478592), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_330478592, 0, 1);
MTL::Buffer* E_32_2752_32_4_4_weights_375567360 = device->newBuffer((half*)((char*)llama->weights + 375567360), 11008 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_375567360, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2752,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(E_32_2752_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
MTL::Buffer* E_32_2752_32_4_4_weights_375589376 = device->newBuffer((char*)((char*)llama->weights + 375589376), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_375589376, 0, 1);
MTL::Buffer* E_32_2752_32_4_4_weights_420678144 = device->newBuffer((half*)((char*)llama->weights + 420678144), 11008 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_420678144, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2752,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_172_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(172,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_172_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->setBuffer(scratch_9, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(172,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_86_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_86_1024_32_4_4_weights_420700160 = device->newBuffer((char*)((char*)llama->weights + 420700160), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_86_1024_32_4_4_weights_420700160, 0, 1);
MTL::Buffer* E_86_1024_32_4_4_weights_465788928 = device->newBuffer((half*)((char*)llama->weights + 465788928), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_86_1024_32_4_4_weights_465788928, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,86,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_2752_4_4_3_pso);
encoder->setBuffer(scratch_20, 0, 0);
encoder->setBuffer(scratch_4, 0, 1);
encoder->setBuffer(scratch_19, 0, 2);
encoder->setBuffer(scratch_1, 0, 3);
encoder->setBuffer(scratch_0, 0, 4);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
MTL::Buffer* E_64_2_16_4_3_weights_465797120 = device->newBuffer((half*)((char*)llama->weights + 465797120), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3_weights_465797120, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_465805312 = device->newBuffer((char*)((char*)llama->weights + 465805312), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_465805312, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_482582528 = device->newBuffer((half*)((char*)llama->weights + 482582528), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_482582528, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_31, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_482590720 = device->newBuffer((char*)((char*)llama->weights + 482590720), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_482590720, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_499367936 = device->newBuffer((half*)((char*)llama->weights + 499367936), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_499367936, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_34, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_499376128 = device->newBuffer((char*)((char*)llama->weights + 499376128), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_499376128, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_516153344 = device->newBuffer((half*)((char*)llama->weights + 516153344), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_516153344, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(r_2_2_8_3_3_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_31, 0, 2);
encoder->setBuffer(scratch_2, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(2,2,1), MTL::Size(3,3,8));
encoder->setComputePipelineState(r_6_32_6_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_9, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_6_32_6n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3n1_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_8_2_4_2_16_6_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(scratch_34, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2,8,1), MTL::Size(16,2,4));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_516161536 = device->newBuffer((char*)((char*)llama->weights + 516161536), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_516161536, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_532938752 = device->newBuffer((half*)((char*)llama->weights + 532938752), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_532938752, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_4, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16n1_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3n1_pso);
encoder->setBuffer(scratch_19, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->setBuffer(scratch_0, 0, 3);
MTL::Buffer* E_64_2_16_4_3n1_weights_532946944 = device->newBuffer((half*)((char*)llama->weights + 532946944), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3n1_weights_532946944, 0, 4);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_2752_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_2752_32_4_4_weights_532955136 = device->newBuffer((char*)((char*)llama->weights + 532955136), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_532955136, 0, 1);
MTL::Buffer* E_32_2752_32_4_4_weights_578043904 = device->newBuffer((half*)((char*)llama->weights + 578043904), 11008 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_578043904, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2752,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(E_32_2752_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
MTL::Buffer* E_32_2752_32_4_4_weights_578065920 = device->newBuffer((char*)((char*)llama->weights + 578065920), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_578065920, 0, 1);
MTL::Buffer* E_32_2752_32_4_4_weights_623154688 = device->newBuffer((half*)((char*)llama->weights + 623154688), 11008 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_623154688, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2752,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_172_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(172,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_172_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->setBuffer(scratch_9, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(172,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_86_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_86_1024_32_4_4_weights_623176704 = device->newBuffer((char*)((char*)llama->weights + 623176704), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_86_1024_32_4_4_weights_623176704, 0, 1);
MTL::Buffer* E_86_1024_32_4_4_weights_668265472 = device->newBuffer((half*)((char*)llama->weights + 668265472), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_86_1024_32_4_4_weights_668265472, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,86,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_2752_4_4_3_pso);
encoder->setBuffer(scratch_19, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->setBuffer(scratch_1, 0, 3);
encoder->setBuffer(scratch_0, 0, 4);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
MTL::Buffer* E_64_2_16_4_3_weights_668273664 = device->newBuffer((half*)((char*)llama->weights + 668273664), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3_weights_668273664, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_668281856 = device->newBuffer((char*)((char*)llama->weights + 668281856), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_668281856, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_685059072 = device->newBuffer((half*)((char*)llama->weights + 685059072), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_685059072, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_49, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_685067264 = device->newBuffer((char*)((char*)llama->weights + 685067264), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_685067264, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_701844480 = device->newBuffer((half*)((char*)llama->weights + 701844480), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_701844480, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_52, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_701852672 = device->newBuffer((char*)((char*)llama->weights + 701852672), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_701852672, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_718629888 = device->newBuffer((half*)((char*)llama->weights + 718629888), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_718629888, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(r_2_2_8_3_3_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_49, 0, 2);
encoder->setBuffer(scratch_2, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(2,2,1), MTL::Size(3,3,8));
encoder->setComputePipelineState(r_6_32_6_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_9, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_6_32_6n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3n1_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_8_2_4_2_16_6_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(scratch_52, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2,8,1), MTL::Size(16,2,4));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_718638080 = device->newBuffer((char*)((char*)llama->weights + 718638080), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_718638080, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_735415296 = device->newBuffer((half*)((char*)llama->weights + 735415296), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_735415296, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_4, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16n1_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3n1_pso);
encoder->setBuffer(scratch_20, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->setBuffer(scratch_0, 0, 3);
MTL::Buffer* E_64_2_16_4_3n1_weights_735423488 = device->newBuffer((half*)((char*)llama->weights + 735423488), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3n1_weights_735423488, 0, 4);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_2752_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_2752_32_4_4_weights_735431680 = device->newBuffer((char*)((char*)llama->weights + 735431680), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_735431680, 0, 1);
MTL::Buffer* E_32_2752_32_4_4_weights_780520448 = device->newBuffer((half*)((char*)llama->weights + 780520448), 11008 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_780520448, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2752,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(E_32_2752_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
MTL::Buffer* E_32_2752_32_4_4_weights_780542464 = device->newBuffer((char*)((char*)llama->weights + 780542464), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_780542464, 0, 1);
MTL::Buffer* E_32_2752_32_4_4_weights_825631232 = device->newBuffer((half*)((char*)llama->weights + 825631232), 11008 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_2752_32_4_4_weights_825631232, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2752,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_172_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(172,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_172_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->setBuffer(scratch_9, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(172,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_86_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_86_1024_32_4_4_weights_825653248 = device->newBuffer((char*)((char*)llama->weights + 825653248), 45088768 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_86_1024_32_4_4_weights_825653248, 0, 1);
MTL::Buffer* E_86_1024_32_4_4_weights_870742016 = device->newBuffer((half*)((char*)llama->weights + 870742016), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_86_1024_32_4_4_weights_870742016, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,86,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_2752_4_4_3_pso);
encoder->setBuffer(scratch_20, 0, 0);
encoder->setBuffer(scratch_19, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->setBuffer(scratch_1, 0, 3);
encoder->setBuffer(scratch_0, 0, 4);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
MTL::Buffer* E_64_2_16_4_3_weights_870750208 = device->newBuffer((half*)((char*)llama->weights + 870750208), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_64_2_16_4_3_weights_870750208, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_870758400 = device->newBuffer((char*)((char*)llama->weights + 870758400), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_870758400, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_887535616 = device->newBuffer((half*)((char*)llama->weights + 887535616), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_887535616, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_67, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_887543808 = device->newBuffer((char*)((char*)llama->weights + 887543808), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_887543808, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_904321024 = device->newBuffer((half*)((char*)llama->weights + 904321024), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_904321024, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_70, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_904329216 = device->newBuffer((char*)((char*)llama->weights + 904329216), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_904329216, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_921106432 = device->newBuffer((half*)((char*)llama->weights + 921106432), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_921106432, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(E_6_4_8_16_2_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(E_6_4_8_16_2_4_weights_279065600, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(4,6,1), MTL::Size(16,8,1));
encoder->setComputePipelineState(r_2_2_8_3_3_32_4_4_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_67, 0, 2);
encoder->setBuffer(scratch_2, 0, 3);
encoder->dispatchThreadgroups(MTL::Size(2,2,1), MTL::Size(3,3,8));
encoder->setComputePipelineState(r_6_32_6_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_9, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_6_32_6n1_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(32,1,1));
encoder->setComputePipelineState(E_6_32_2_3n1_pso);
encoder->setBuffer(scratch_9, 0, 0);
encoder->setBuffer(scratch_0, 0, 1);
encoder->setBuffer(scratch_1, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(2,32,1));
encoder->setComputePipelineState(r_8_2_4_2_16_6_4_3_pso);
encoder->setBuffer(scratch_1, 0, 0);
encoder->setBuffer(scratch_9, 0, 1);
encoder->setBuffer(scratch_70, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(2,8,1), MTL::Size(16,2,4));
encoder->setComputePipelineState(E_32_1024_32_4_4_pso);
encoder->setBuffer(scratch_0, 0, 0);
MTL::Buffer* E_32_1024_32_4_4_weights_921114624 = device->newBuffer((char*)((char*)llama->weights + 921114624), 16777216 * sizeof(char), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_921114624, 0, 1);
MTL::Buffer* E_32_1024_32_4_4_weights_937891840 = device->newBuffer((half*)((char*)llama->weights + 937891840), 4096 * sizeof(half), MTL::ResourceStorageModeManaged);
encoder->setBuffer(E_32_1024_32_4_4_weights_937891840, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(1024,32,1), MTL::Size(4,32,1));
encoder->setComputePipelineState(r_64_2_16_1024_4_4_3n1_pso);
encoder->setBuffer(scratch_4, 0, 0);
encoder->setBuffer(scratch_1, 0, 1);
encoder->setBuffer(scratch_0, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(64,1,1), MTL::Size(16,2,1));
encoder->setComputePipelineState(r_6_256_16n1_pso);
encoder->setBuffer(scratch_0, 0, 0);
encoder->setBuffer(scratch_20, 0, 1);
encoder->setBuffer(scratch_4, 0, 2);
encoder->dispatchThreadgroups(MTL::Size(6,1,1), MTL::Size(256,1,1));
encoder->setComputePipelineState(E_64_2_16_4_3n1_pso);
encoder->setBuffer(scratch_19, 0, 0);