File size: 37,890 Bytes
be903e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
name: test-coverage
on:
  push:
    branches: [master]
    paths:
    - '.ci/test-coverage.yml'
    - 'CMakeLists.txt'
    - 'cmake/**'
    - 'src/**'
    - 'tests/**'
    - 'toolchains/**'
  mr:
    target-branches: [master]
    paths:
    - '.ci/test-coverage.yml'
    - 'CMakeLists.txt'
    - 'cmake/**'
    - 'src/**'
    - 'tests/**'
    - 'toolchains/**'
concurrency:
  group: test-coverage-${{ ci.head_ref }}

jobs:
  linux-gcc-gpu:
    name: linux-gcc-gpu
    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov libvulkan-dev
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-swiftshader
      id: cache-swiftshader
      uses: cache@1.*
      with:
        cachePaths: swiftshader-install
        cacheKey: swiftshader-linux-install-20230420-1

    - name: checkout-swiftshader
      if: steps.cache-swiftshader.outputs.cacheHit != 'true'
      checkout: https://github.com/google/swiftshader.git
      with:
        pullType: COMMIT_ID
        refName: dd55e592406dc0bae219df11adec6363840aff4a
        localPath: swiftshader
        enableSubmodule: false
        enableGitLfs: false

    - name: swiftshader
      if: steps.cache-swiftshader.outputs.cacheHit != 'true'
      run: |
        cd swiftshader
        git -c submodule."third_party/git-hooks".update=none submodule update --init --recursive
        mkdir -p build; cd build
        cmake -DCMAKE_INSTALL_PREFIX=install -DSWIFTSHADER_BUILD_PVR=FALSE -DSWIFTSHADER_BUILD_TESTS=FALSE -DSWIFTSHADER_ENABLE_ASTC=FALSE -DSWIFTSHADER_WARNINGS_AS_ERRORS=FALSE -DREACTOR_BACKEND=Subzero -DREACTOR_DEFAULT_OPT_LEVEL=Default -DCMAKE_BUILD_TYPE=Release ..
        cmake --build . -j $(nproc)
        mkdir ${{ci.workspace}}/swiftshader-install
        cp Linux/* ${{ci.workspace}}/swiftshader-install

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_AVX2=ON -DNCNN_AVX512=OFF -DNCNN_XOP=OFF -DNCNN_OPENMP=OFF -DNCNN_VULKAN=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        printf "[Processor]\nThreadCount=4\n" > build/tests/SwiftShader.ini
        export VK_ICD_FILENAMES="${{ci.workspace}}/swiftshader-install/vk_swiftshader_icd.json"
        cd build && ctest --output-on-failure -j 4
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov -r lcov.info '*/glslang/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-gpu-lavapipe:
    name: linux-gcc-gpu-lavapipe
    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov libvulkan-dev libxcb-shm0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-lavapipe
      id: cache-lavapipe
      uses: cache@1.*
      with:
        cachePaths: lavapipe-install
        cacheKey: lavapipe-linux-install-20211127-4

    - name: checkout-lavapipe
      if: steps.cache-lavapipe.outputs.cacheHit != 'true'
      checkout: https://github.com/mesa3d/mesa.git
      with:
        pullType: COMMIT_ID
        refName: cd39180cfab20734744b379b085cc3b5c2cecd3a
        localPath: mesa
        enableSubmodule: false
        enableGitLfs: false

    - name: lavapipe
      if: steps.cache-lavapipe.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y mesa
        mkdir -p "${{ci.workspace}}/lavapipe-install"
        cd mesa
        mkdir build
        cd build
        meson -Dprefix="${{ci.workspace}}/lavapipe-install" -Dbuildtype=release -Db_lto=true -Db_ndebug=true -Dplatforms="x11" -Ddri3=enabled -Ddri-drivers="" -Dgallium-drivers=swrast -Dgallium-vdpau=disabled -Dgallium-xvmc=disabled -Dgallium-omx=disabled -Dgallium-va=disabled -Dgallium-xa=disabled -Dgallium-opencl=disabled -Dopencl-native=false -Dvulkan-drivers=swrast -Dshader-cache=disabled -Dgles1=disabled -Dgles2=disabled -Dopengl=false -Dgbm=disabled -Dglx=disabled -Degl=disabled -Dllvm=enabled -Dvalgrind=disabled -Dlibunwind=disabled -Dlmsensors=disabled ..
        ninja -j$(nproc)
        ninja install
        find ${{ci.workspace}}/lavapipe-install
        cat ${{ci.workspace}}/lavapipe-install/share/vulkan/icd.d/lvp_icd.x86_64.json

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_AVX2=ON -DNCNN_AVX512=OFF -DNCNN_XOP=OFF -DNCNN_OPENMP=OFF -DNCNN_VULKAN=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export LP_NUM_THREADS=4
        export VK_ICD_FILENAMES="${{ci.workspace}}/lavapipe-install/share/vulkan/icd.d/lvp_icd.x86_64.json"
        cd build
        ctest --output-on-failure -j 4
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov -r lcov.info '*/glslang/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-x64:
    name: linux-gcc-x64
    strategy:
      matrix:
        # openmp: ['OFF', 'ON']
        include:
          - { SSE2: 'OFF', AVX: 'OFF', XOP: 'OFF', F16C: 'OFF', FMA: 'OFF', AVX2: 'OFF', AVX512: 'OFF', AVX512VNNI: 'OFF', AVXVNNI: 'OFF', AVX512BF16: 'OFF', AVX512FP16: 'OFF'}
          - { SSE2: 'ON',  AVX: 'OFF', XOP: 'OFF', F16C: 'OFF', FMA: 'OFF', AVX2: 'OFF', AVX512: 'OFF', AVX512VNNI: 'OFF', AVXVNNI: 'OFF', AVX512BF16: 'OFF', AVX512FP16: 'OFF'}
          - { SSE2: 'ON',  AVX: 'ON',  XOP: 'OFF', F16C: 'OFF', FMA: 'OFF', AVX2: 'OFF', AVX512: 'OFF', AVX512VNNI: 'OFF', AVXVNNI: 'OFF', AVX512BF16: 'OFF', AVX512FP16: 'OFF'}
          - { SSE2: 'ON',  AVX: 'ON',  XOP: 'OFF', F16C: 'ON',  FMA: 'ON',  AVX2: 'ON',  AVX512: 'OFF', AVX512VNNI: 'OFF', AVXVNNI: 'OFF', AVX512BF16: 'OFF', AVX512FP16: 'OFF'}
          - { SSE2: 'ON',  AVX: 'ON',  XOP: 'OFF', F16C: 'ON',  FMA: 'ON',  AVX2: 'ON',  AVX512: 'ON',  AVX512VNNI: 'ON',  AVXVNNI: 'OFF', AVX512BF16: 'OFF', AVX512FP16: 'OFF'}

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_OPENMP=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON \
            -DNCNN_SSE2=${{matrix.SSE2}} \
            -DNCNN_AVX=${{matrix.AVX}} \
            -DNCNN_XOP=${{matrix.XOP}} \
            -DNCNN_F16C=${{matrix.F16C}} \
            -DNCNN_FMA=${{matrix.FMA}} \
            -DNCNN_AVX2=${{matrix.AVX2}} \
            -DNCNN_AVX512=${{matrix.AVX512}} \
            -DNCNN_AVXVNNI=${{matrix.AVXVNNI}} \
            -DNCNN_AVX512VNNI=${{matrix.AVX512VNNI}} \
            -DNCNN_AVX512BF16=${{matrix.AVX512BF16}} \
            -DNCNN_AVX512FP16=${{matrix.AVX512FP16}} \
            ..
        cmake --build . -j $(nproc)
    - name: test
      run: cd build && ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-arm:
    name: linux-gcc-arm
    strategy:
      matrix:
        # openmp: ['OFF', 'ON']
        include:
          - { GNU_INLINE_ASM: 'ON'}
          - { GNU_INLINE_ASM: 'OFF'}

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov g++-arm-linux-gnueabi g++-arm-linux-gnueabihf libcapstone4 libglib2.0-0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-arm-install-20220831-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: 621da7789083b80d6f1ff1c0fb499334007b4f51
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        cd qemu
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=arm-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabi.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_GNU_INLINE_ASM=${{matrix.GNU_INLINE_ASM}} -DNCNN_VFPV4=ON -DNCNN_ARM82=OFF -DNCNN_OPENMP=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-arm TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/arm-linux-gnueabi" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov --list lcov.info

    - name: build-armhf-vfpv3-d16
      run: |
        mkdir build-armhf-vfpv3-d16 && cd build-armhf-vfpv3-d16
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabihf-vfpv3-d16.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_GNU_INLINE_ASM=${{matrix.GNU_INLINE_ASM}} -DNCNN_VFPV4=OFF -DNCNN_ARM82=OFF -DNCNN_OPENMP=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test-armhf-vfpv3-d16
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build-armhf-vfpv3-d16
        TESTS_EXECUTABLE_LOADER=qemu-arm TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/arm-linux-gnueabihf" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect-armhf-vfpv3-d16
      run: |
        cd build-armhf-vfpv3-d16
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build-armhf-vfpv3-d16/*' -o lcov.info
        lcov --list lcov.info

    - name: codecov
      run: |
        ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
        ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build-armhf-vfpv3-d16/lcov.info

  linux-gcc-aarch64:
    name: linux-gcc-aarch64
    strategy:
      matrix:
        # openmp: ['OFF', 'ON']
        include:
          - { GNU_INLINE_ASM: 'ON', ARM82: 'OFF', ARM82DOT: 'OFF', ARM82FP16FML: 'OFF', ARM84BF16: 'OFF', ARM84I8MM: 'OFF', ARM86SVE: 'OFF'}
          - { GNU_INLINE_ASM: 'ON', ARM82: 'ON',  ARM82DOT: 'OFF', ARM82FP16FML: 'OFF', ARM84BF16: 'OFF', ARM84I8MM: 'OFF', ARM86SVE: 'OFF'}
          - { GNU_INLINE_ASM: 'ON', ARM82: 'ON',  ARM82DOT: 'ON',  ARM82FP16FML: 'ON',  ARM84BF16: 'OFF', ARM84I8MM: 'OFF', ARM86SVE: 'OFF'}
          - { GNU_INLINE_ASM: 'ON', ARM82: 'ON',  ARM82DOT: 'ON',  ARM82FP16FML: 'ON',  ARM84BF16: 'ON',  ARM84I8MM: 'ON',  ARM86SVE: 'OFF'}
          - { GNU_INLINE_ASM: 'OFF', ARM82: 'ON',  ARM82DOT: 'ON',  ARM82FP16FML: 'ON',  ARM84BF16: 'ON',  ARM84I8MM: 'ON',  ARM86SVE: 'OFF'}

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov g++-aarch64-linux-gnu libcapstone4 libglib2.0-0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-aarch64-install-20220831-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: 621da7789083b80d6f1ff1c0fb499334007b4f51
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        cd qemu
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=aarch64-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.toolchain.cmake \
            -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_OPENMP=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON \
            -DNCNN_GNU_INLINE_ASM=${{matrix.GNU_INLINE_ASM}} \
            -DNCNN_ARM82=${{matrix.ARM82}} \
            -DNCNN_ARM82DOT=${{matrix.ARM82DOT}} \
            -DNCNN_ARM82FP16FML=${{matrix.ARM82FP16FML}} \
            -DNCNN_ARM84BF16=${{matrix.ARM84BF16}} \
            -DNCNN_ARM84I8MM=${{matrix.ARM84I8MM}} \
            ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-aarch64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/aarch64-linux-gnu" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-mipsisa32r6el:
    name: linux-gcc-mipsisa32r6el
    strategy:
      matrix:
        OPENMP: ['OFF', 'ON']

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov g++-mipsisa32r6el-linux-gnu libcapstone4 libglib2.0-0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-mipsel-install-20220831-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: 621da7789083b80d6f1ff1c0fb499334007b4f51
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        cd qemu
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=mipsel-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/mipsisa32r6el-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_MSA=OFF -DNCNN_MMI=OFF -DNCNN_OPENMP=${{matrix.OPENMP}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-mipsel TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/mipsisa32r6el-linux-gnu" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-mipsisa64r6el:
    name: linux-gcc-mipsisa64r6el
    strategy:
      matrix:
        OPENMP: ['OFF', 'ON']

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov g++-mipsisa64r6el-linux-gnuabi64 libcapstone4 libglib2.0-0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-mips64el-install-20220831-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: 621da7789083b80d6f1ff1c0fb499334007b4f51
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        cd qemu
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=mips64el-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/mipsisa64r6el-linux-gnuabi64.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_MSA=ON -DNCNN_MMI=OFF -DNCNN_OPENMP=${{matrix.OPENMP}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-mips64el TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/mipsisa64r6el-linux-gnuabi64" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-riscv64:
    name: linux-gcc-riscv64
    strategy:
      matrix:
        OPENMP: ['OFF', 'ON']

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov g++-riscv64-linux-gnu libcapstone4 libglib2.0-0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-riscv64-install-20230624-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: b455ce4c2f300c8ba47cba7232dd03261368a4cb
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        apt-get install -y python3-pip
        python3 -m pip install --upgrade pip
        apt-get remove -y python3-setuptools
        pip3 install -U setuptools
        cd qemu
        wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
        patch -p1 -i 0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=riscv64-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: build
      run: |
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_OPENMP=${{matrix.OPENMP}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/riscv64-linux-gnu" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-riscv64-rvv:
    name: linux-gcc-riscv64-rvv
    strategy:
      matrix:
        OPENMP: ['OFF', 'ON']

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov libcapstone4 libglib2.0-0
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-riscv64-install-20230624-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: b455ce4c2f300c8ba47cba7232dd03261368a4cb
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        apt-get install -y python3-pip
        python3 -m pip install --upgrade pip
        apt-get remove -y python3-setuptools
        pip3 install -U setuptools
        cd qemu
        wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
        patch -p1 -i 0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=riscv64-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: cache-rv64gcv
      id: cache-rv64gcv
      uses: cache@1.*
      with:
        cachePaths: rv64gcv-install
        cacheKey: rv64gcv-linux-install-20221029-1

    - name: checkout-riscv-gnu-toolchain
      if: steps.cache-rv64gcv.outputs.cacheHit != 'true'
      checkout: https://github.com/riscv/riscv-gnu-toolchain.git
      with:
        pullType: COMMIT_ID
        refName: da01ba455ce3802ffa84fdca3a089079996dbfc3
        localPath: riscv-gnu-toolchain
        enableSubmodule: false
        enableGitLfs: false

    - name: riscv-gnu-toolchain
      if: steps.cache-rv64gcv.outputs.cacheHit != 'true'
      run: |
        apt-get update
        apt-get install -y autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev device-tree-compiler
        cd riscv-gnu-toolchain
        git submodule update --init --recursive --depth 1 glibc
        git submodule update --init --recursive --depth 1 newlib
        #git submodule update --init --recursive --depth 1 riscv-binutils
        #git submodule update --init --recursive --depth 1 riscv-gcc
        git submodule update --init --recursive --depth 1 riscv-dejagnu
        git submodule update --init --recursive --depth 1 riscv-gdb
        rm -rf riscv-binutils
        git clone -b binutils-2_39-branch https://sourceware.org/git/binutils-gdb.git riscv-binutils
        rm -rf riscv-gcc
        git clone -b riscv-gcc-rvv-next https://github.com/riscv-collab/riscv-gcc.git riscv-gcc
        cd riscv-gcc
        git checkout 8a0c1b106f01c455a8fb478cfe52d859a69020fd
        cd ..
        sed -i '/__OBSOLETE_MATH/d' newlib/newlib/libm/common/math_errf.c
        ./configure --prefix=${{ci.workspace}}/rv64gcv-install --with-arch=rv64gcv_zfh
        make linux -j$(nproc)
        find ${{ci.workspace}}/rv64gcv-install -type f | xargs -i strip -g {} || true

    - name: build
      run: |
        export RISCV_ROOT_PATH=${{ci.workspace}}/rv64gcv-install
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DCMAKE_C_FLAGS="-O1" -DCMAKE_CXX_FLAGS="-O1" -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON -DNCNN_OPENMP=${{matrix.OPENMP}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test-vlen128
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,x-zvfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;${{ci.workspace}}/rv64gcv-install/sysroot" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect-vlen128
      run: |
        cd build
        lcov --gcov-tool ${{ci.workspace}}/rv64gcv-install/bin/riscv64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov -r lcov.info '*/rv64gcv-install/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov-vlen128
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
    - name: test-vlen256
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,x-zvfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;${{ci.workspace}}/rv64gcv-install/sysroot" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect-vlen256
      run: |
        cd build
        lcov --gcov-tool ${{ci.workspace}}/rv64gcv-install/bin/riscv64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov -r lcov.info '*/rv64gcv-install/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov-vlen256
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

  linux-gcc-loongarch64:
    name: linux-gcc-loongarch64
    strategy:
      matrix:
        OPENMP: ['OFF', 'ON']

    runs-on:
      pool-name: docker
      container:
        image: bkci/ci:ubuntu
    steps:
    - name: checkout
      checkout: self
      with:
        strategy: FRESH_CHECKOUT
        enableSubmodule: false
        enableGitLfs: false

    - name: install-deps
      run: |
        apt-get update
        apt-get install -y lcov libcapstone4 libglib2.0-0 python3-venv
        curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
        curl -Os https://uploader.codecov.io/latest/linux/codecov
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
        curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
        gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
        shasum -a 256 -c codecov.SHA256SUM
        chmod +x codecov
        wget https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/8.0/loongarch64-clfs-8.0-cross-tools-gcc-full.tar.xz
        tar -xf loongarch64-clfs-8.0-cross-tools-gcc-full.tar.xz

    - name: cache-qemu
      id: cache-qemu
      uses: cache@1.*
      with:
        cachePaths: qemu-install
        cacheKey: qemu-loongarch64-install-20230524-1

    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      checkout: https://github.com/qemu/qemu.git
      with:
        pullType: COMMIT_ID
        refName: 1c12355b31046a6b35a4f50c85c4f01afb1bd728
        localPath: qemu
        enableSubmodule: false
        enableGitLfs: false

    - name: qemu
      if: steps.cache-qemu.outputs.cacheHit != 'true'
      run: |
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
        echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
        apt-get update
        apt-get build-dep -y qemu
        cd qemu
        wget https://github.com/nihui/ncnn-assets/raw/master/qemu-patches/0001-linux-user-Expose-loongarch-lsx-isa-bit-in-get_elf_hwcap.patch
        patch -p1 -i 0001-linux-user-Expose-loongarch-lsx-isa-bit-in-get_elf_hwcap.patch
        ./configure --prefix=${{ci.workspace}}/qemu-install --target-list=loongarch64-linux-user --disable-system
        make -j$(nproc)
        make install

    - name: build
      run: |
        export LOONGARCH64_ROOT_PATH=${{ci.workspace}}/cross-tools
        mkdir build && cd build
        cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/loongarch64-unknown-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_LSX=ON -DNCNN_LASX=OFF -DNCNN_OPENMP=${{matrix.OPENMP}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
        cmake --build . -j $(nproc)
    - name: test
      run: |
        export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
        cd build
        TESTS_EXECUTABLE_LOADER=qemu-loongarch64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;${{ci.workspace}}/cross-tools/target" ctest --output-on-failure -j $(nproc)
    - name: lcov-collect
      run: |
        cd build
        lcov --gcov-tool ${{ci.workspace}}/cross-tools/bin/loongarch64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
        lcov -r lcov.info '/usr/*' -o lcov.info
        lcov -r lcov.info '*/build/*' -o lcov.info
        lcov -r lcov.info '*/cross-tools/*' -o lcov.info
        lcov --list lcov.info
    - name: codecov
      run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info