forked from google/XNNPACK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·3776 lines (3226 loc) · 228 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# Copyright 2019 Google LLC
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
CMAKE_MINIMUM_REQUIRED(VERSION 3.15 FATAL_ERROR)
# MSVC runtime library flags are selected by an abstraction.
CMAKE_POLICY(SET CMP0091 NEW)
# ---[ Project and semantic versioning.
PROJECT(XNNPACK C CXX ASM)
SET(CMAKE_C_STANDARD 99)
SET(CMAKE_C_EXTENSIONS NO)
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED YES)
SET(CMAKE_CXX_EXTENSIONS NO)
# ---[ Options.
SET(XNNPACK_LIBRARY_TYPE "default" CACHE STRING "Type of library (shared, static, or default) to build")
SET_PROPERTY(CACHE XNNPACK_LIBRARY_TYPE PROPERTY STRINGS default static shared)
OPTION(XNNPACK_ENABLE_ASSEMBLY "Build XNNPACK with assembly micro-kernels" ON)
OPTION(XNNPACK_ENABLE_JIT "Build XNNPACK with JIT micro-kernels" OFF)
OPTION(XNNPACK_ENABLE_MEMOPT "Build XNNPACK with optimized memory allocation scheme" ON)
OPTION(XNNPACK_ENABLE_SPARSE "Build XNNPACK with graph rewriting for sparse inference" ON)
OPTION(XNNPACK_ENABLE_GEMM_M_SPECIALIZATION "Build XNNPACK with support for selecting microkernel with different MR" ON)
OPTION(XNNPACK_ENABLE_DWCONV_MULTIPASS "Build XNNPACK with DWCONV multipass microkernels enabled" OFF)
SET(XNNPACK_PLATFORM_JIT "DEFAULT" CACHE STRING "Determine if XNN_PLATFORM_JIT detection should be overwritten")
SET_PROPERTY(CACHE XNNPACK_PLATFORM_JIT PROPERTY STRINGS DEFAULT ON OFF)
OPTION(XNNPACK_BUILD_LIBRARY "Build XNNPACK library" ON)
OPTION(XNNPACK_BUILD_TESTS "Build XNNPACK unit tests" ON)
OPTION(XNNPACK_BUILD_BENCHMARKS "Build XNNPACK benchmarks" ON)
OPTION(XNNPACK_USE_SYSTEM_LIBS "Use system-provided dependency libraries" OFF)
# --- [ Determine target processor
IF(CMAKE_OSX_ARCHITECTURES)
LIST(LENGTH CMAKE_OSX_ARCHITECTURES CMAKE_OSX_ARCHITECTURES_COUNT)
IF(CMAKE_OSX_ARCHITECTURES_COUNT GREATER 1)
MESSAGE(FATAL_ERROR "Unsupported XNNPACK build with multiple OSX architectures (${CMAKE_OSX_ARCHITECTURES}). "
"Specify a single architecture in CMAKE_OSX_ARCHITECTURES and re-configure. ")
ENDIF()
IF(NOT CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64|arm64|arm64e|arm64_32)$")
MESSAGE(FATAL_ERROR "Unrecognized CMAKE_OSX_ARCHITECTURES value \"${CMAKE_OSX_ARCHITECTURES}\"")
ENDIF()
SET(XNNPACK_TARGET_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
ELSEIF(CMAKE_GENERATOR MATCHES "^Visual Studio " AND CMAKE_GENERATOR_PLATFORM)
IF(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
SET(XNNPACK_TARGET_PROCESSOR "x86")
ELSEIF(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
SET(XNNPACK_TARGET_PROCESSOR "x86_64")
ELSEIF(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
SET(XNNPACK_TARGET_PROCESSOR "arm64")
ELSEIF(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64EC")
SET(XNNPACK_TARGET_PROCESSOR "arm64ec")
ELSE()
MESSAGE(FATAL_ERROR "Unsupported Visual Studio architecture \"${CMAKE_GENERATOR_PLATFORM}\"")
ENDIF()
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^i[3-7]86$")
SET(XNNPACK_TARGET_PROCESSOR "x86")
ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
SET(XNNPACK_TARGET_PROCESSOR "x86_64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^armv[5-8]")
SET(XNNPACK_TARGET_PROCESSOR "arm")
ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
SET(XNNPACK_TARGET_PROCESSOR "arm64")
ELSEIF(NOT XNNPACK_TARGET_PROCESSOR MATCHES "^(x86(_64)?|arm64|riscv(32|64|128)|Hexagon)$")
SET(XNNPACK_TARGET_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
ELSE()
MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_PROCESSOR value \"${CMAKE_SYSTEM_PROCESSOR}\"")
ENDIF()
# --- [ Processor-specific options
OPTION(XNNPACK_ENABLE_ARM_FP16_SCALAR "Build XNNPACK with ARM FP16 (FP16 data processing) scalar micro-kernels" ON)
OPTION(XNNPACK_ENABLE_ARM_FP16_VECTOR "Build XNNPACK with ARM FP16 (FP16 data processing) vector micro-kernels" ON)
OPTION(XNNPACK_ENABLE_ARM_BF16 "Build XNNPACK with ARM BF16 (BFLOAT16) micro-kernels" ON)
OPTION(XNNPACK_ENABLE_ARM_DOTPROD "Build XNNPACK with ARM DotProd (integer dot product) micro-kernels" ON)
OPTION(XNNPACK_ENABLE_RISCV_VECTOR "Build XNNPACK with RISC-V Vector micro-kernels" ON)
# ---[ CMake options
INCLUDE(GNUInstallDirs)
IF(XNNPACK_BUILD_TESTS)
ENABLE_TESTING()
ENDIF()
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_ARM_FP16_VECTOR=$<BOOL:${XNNPACK_ENABLE_ARM_FP16_VECTOR}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_ARM_FP16_SCALAR=$<BOOL:${XNNPACK_ENABLE_ARM_FP16_SCALAR}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_ARM_BF16=$<BOOL:${XNNPACK_ENABLE_ARM_BF16}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_ARM_DOTPROD=$<BOOL:${XNNPACK_ENABLE_ARM_DOTPROD}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_RISCV_VECTOR=$<BOOL:${XNNPACK_ENABLE_RISCV_VECTOR}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_ASSEMBLY=$<BOOL:${XNNPACK_ENABLE_ASSEMBLY}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_JIT=$<BOOL:${XNNPACK_ENABLE_JIT}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_MEMOPT=$<BOOL:${XNNPACK_ENABLE_MEMOPT}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_SPARSE=$<BOOL:${XNNPACK_ENABLE_SPARSE}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_GEMM_M_SPECIALIZATION=$<BOOL:${XNNPACK_ENABLE_GEMM_M_SPECIALIZATION}>")
ADD_COMPILE_DEFINITIONS("XNN_ENABLE_DWCONV_MULTIPASS=$<BOOL:${XNNPACK_ENABLE_DWCONV_MULTIPASS}>")
IF(XNNPACK_PLATFORM_JIT STREQUAL "ON" OR XNNPACK_PLATFORM_JIT STREQUAL "OFF")
ADD_COMPILE_DEFINITIONS("XNN_PLATFORM_JIT=$<BOOL:${XNNPACK_PLATFORM_JIT}>")
ENDIF()
IF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# Disable "unary minus operator applied to unsigned type, result still unsigned" warning
ADD_COMPILE_OPTIONS("/wd4146")
# Test files have many sections, increase the limit. See
# https://learn.microsoft.com/en-us/cpp/build/reference/bigobj-increase-number-of-sections-in-dot-obj-file.
ADD_COMPILE_OPTIONS("/bigobj")
ENDIF()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Disable "note: parameter passing for argument of type ... changed/will change in ..."
ADD_COMPILE_OPTIONS("-Wno-psabi")
ENDIF()
# ---[ Build flags
IF(NOT CMAKE_SYSTEM_NAME)
MESSAGE(FATAL_ERROR "CMAKE_SYSTEM_NAME not defined")
ELSEIF(NOT CMAKE_SYSTEM_NAME MATCHES "^(Android|Darwin|iOS|Linux|Windows|CYGWIN|MSYS|QURT)$")
MESSAGE(FATAL_ERROR "Unrecognized CMAKE_SYSTEM_NAME value \"${CMAKE_SYSTEM_NAME}\"")
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
# Disable min/max macros as they break std::min/max and std::numeric_limits<T>min/max.
ADD_COMPILE_DEFINITIONS("NOMINMAX")
ENDIF()
# ---[ Download deps
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
IF(NOT DEFINED CPUINFO_SOURCE_DIR)
MESSAGE(STATUS "Downloading cpuinfo to ${CMAKE_BINARY_DIR}/cpuinfo-source (define CPUINFO_SOURCE_DIR to avoid it)")
CONFIGURE_FILE(cmake/DownloadCpuinfo.cmake "${CMAKE_BINARY_DIR}/cpuinfo-download/CMakeLists.txt")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/cpuinfo-download")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/cpuinfo-download")
SET(CPUINFO_SOURCE_DIR "${CMAKE_BINARY_DIR}/cpuinfo-source" CACHE STRING "cpuinfo source directory")
ENDIF()
IF(NOT DEFINED FP16_SOURCE_DIR)
MESSAGE(STATUS "Downloading FP16 to ${CMAKE_BINARY_DIR}/FP16-source (define FP16_SOURCE_DIR to avoid it)")
CONFIGURE_FILE(cmake/DownloadFP16.cmake "${CMAKE_BINARY_DIR}/FP16-download/CMakeLists.txt")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/FP16-download")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/FP16-download")
SET(FP16_SOURCE_DIR "${CMAKE_BINARY_DIR}/FP16-source" CACHE STRING "FP16 source directory")
ENDIF()
IF(NOT DEFINED FXDIV_SOURCE_DIR)
MESSAGE(STATUS "Downloading FXdiv to ${CMAKE_BINARY_DIR}/FXdiv-source (define FXDIV_SOURCE_DIR to avoid it)")
CONFIGURE_FILE(cmake/DownloadFXdiv.cmake "${CMAKE_BINARY_DIR}/FXdiv-download/CMakeLists.txt")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/FXdiv-download")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/FXdiv-download")
SET(FXDIV_SOURCE_DIR "${CMAKE_BINARY_DIR}/FXdiv-source" CACHE STRING "FXdiv source directory")
ENDIF()
IF(NOT DEFINED PTHREADPOOL_SOURCE_DIR)
MESSAGE(STATUS "Downloading pthreadpool to ${CMAKE_BINARY_DIR}/pthreadpool-source (define PTHREADPOOL_SOURCE_DIR to avoid it)")
CONFIGURE_FILE(cmake/DownloadPThreadPool.cmake "${CMAKE_BINARY_DIR}/pthreadpool-download/CMakeLists.txt")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pthreadpool-download")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pthreadpool-download")
SET(PTHREADPOOL_SOURCE_DIR "${CMAKE_BINARY_DIR}/pthreadpool-source" CACHE STRING "pthreadpool source directory")
ENDIF()
IF(XNNPACK_BUILD_TESTS AND NOT DEFINED GOOGLETEST_SOURCE_DIR)
MESSAGE(STATUS "Downloading Google Test to ${CMAKE_BINARY_DIR}/googletest-source (define GOOGLETEST_SOURCE_DIR to avoid it)")
CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
SET(GOOGLETEST_SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-source" CACHE STRING "Google Test source directory")
ENDIF()
IF(XNNPACK_BUILD_BENCHMARKS AND NOT DEFINED GOOGLEBENCHMARK_SOURCE_DIR)
MESSAGE(STATUS "Downloading Google Benchmark to ${CMAKE_BINARY_DIR}/googlebenchmark-source (define GOOGLEBENCHMARK_SOURCE_DIR to avoid it)")
CONFIGURE_FILE(cmake/DownloadGoogleBenchmark.cmake "${CMAKE_BINARY_DIR}/googlebenchmark-download/CMakeLists.txt")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googlebenchmark-download")
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googlebenchmark-download")
SET(GOOGLEBENCHMARK_SOURCE_DIR "${CMAKE_BINARY_DIR}/googlebenchmark-source" CACHE STRING "Google Benchmark source directory")
ENDIF()
ENDIF()
# ---[ XNNPACK library
INCLUDE(cmake/microkernels.cmake)
SET(OPERATOR_SRCS
src/operator-delete.c
src/operators/argmax-pooling-nhwc.c
src/operators/average-pooling-nhwc.c
src/operators/binary-elementwise-nd.c
src/operators/channel-shuffle-nc.c
src/operators/constant-pad-nd.c
src/operators/convolution-nchw.c
src/operators/convolution-nhwc.c
src/operators/deconvolution-nhwc.c
src/operators/fully-connected-nc.c
src/operators/global-average-pooling-ncw.c
src/operators/global-average-pooling-nwc.c
src/operators/lut-elementwise-nc.c
src/operators/max-pooling-nhwc.c
src/operators/prelu-nc.c
src/operators/resize-bilinear-nchw.c
src/operators/resize-bilinear-nhwc.c
src/operators/slice-nd.c
src/operators/softmax-nc.c
src/operators/transpose-nd.c
src/operators/unary-elementwise-nc.c
src/operators/unpooling-nhwc.c)
SET(SUBGRAPH_SRCS
src/memory-planner.c
src/runtime.c
src/subgraph.c
src/subgraph/abs.c
src/subgraph/add2.c
src/subgraph/argmax-pooling-2d.c
src/subgraph/average-pooling-2d.c
src/subgraph/bankers-rounding.c
src/subgraph/ceiling.c
src/subgraph/clamp.c
src/subgraph/concatenate.c
src/subgraph/convert.c
src/subgraph/convolution-2d.c
src/subgraph/copy.c
src/subgraph/deconvolution-2d.c
src/subgraph/depth-to-space.c
src/subgraph/depthwise-convolution-2d.c
src/subgraph/divide.c
src/subgraph/elu.c
src/subgraph/even-split.c
src/subgraph/floor.c
src/subgraph/fully-connected.c
src/subgraph/global-average-pooling.c
src/subgraph/global-sum-pooling.c
src/subgraph/hardswish.c
src/subgraph/leaky-relu.c
src/subgraph/max-pooling-2d.c
src/subgraph/maximum2.c
src/subgraph/minimum2.c
src/subgraph/multiply2.c
src/subgraph/negate.c
src/subgraph/prelu.c
src/subgraph/sigmoid.c
src/subgraph/softmax.c
src/subgraph/space-to-depth-2d.c
src/subgraph/square-root.c
src/subgraph/square.c
src/subgraph/squared-difference.c
src/subgraph/static-constant-pad.c
src/subgraph/static-reshape.c
src/subgraph/static-resize-bilinear-2d.c
src/subgraph/static-slice.c
src/subgraph/static-transpose.c
src/subgraph/subtract.c
src/subgraph/tanh.c
src/subgraph/unpooling-2d.c
src/subgraph/validation.c
src/tensor.c)
SET(LOGGING_SRCS
src/enums/datatype-strings.c
src/enums/microkernel-type.c
src/enums/node-type.c
src/enums/operator-type.c
src/log.c)
SET(XNNPACK_SRCS
src/avgpool-config.c
src/binary-elementwise-config.c
src/init.c
src/params.c
src/pavgpool-config.c
src/transpose-config.c
src/unary-elementwise-config.c
src/x8-lut-config.c
src/xx-fill-config.c
src/xx-pad-config.c)
SET(TABLE_SRCS
src/tables/exp2-k-over-64.c
src/tables/exp2-k-over-2048.c
src/tables/exp2minus-k-over-4.c
src/tables/exp2minus-k-over-8.c
src/tables/exp2minus-k-over-16.c
src/tables/exp2minus-k-over-32.c
src/tables/exp2minus-k-over-64.c
src/tables/exp2minus-k-over-2048.c
src/tables/vlog.c)
SET(JIT_SRCS
src/jit/aarch32-assembler.cc
src/jit/aarch64-assembler.cc
src/jit/assembler.cc)
SET(JIT_AARCH32_SRCS
src/f32-gemm/gen/f32-gemm-1x8-aarch32-neon-cortex-a53.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch32-neon-cortex-a7.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch32-neon-cortex-a53.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch32-neon-cortex-a55.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch32-neon-cortex-a75.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch32-neon-ld64.cc
src/f32-igemm/gen/f32-igemm-1x8-aarch32-neon-cortex-a53.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch32-neon-cortex-a7.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch32-neon-cortex-a53.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch32-neon-cortex-a55.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch32-neon-cortex-a75.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch32-neon-ld64.cc
src/qc8-gemm/gen/qc8-gemm-4x8-fp32-aarch32-neonv8-mlal-lane-ld64.cc
src/qc8-gemm/gen/qc8-gemm-4x8c4-fp32-aarch32-neondot-ld64.cc
src/qc8-igemm/gen/qc8-igemm-4x8-fp32-aarch32-neonv8-mlal-lane-ld64.cc
src/qc8-igemm/gen/qc8-igemm-4x8c4-fp32-aarch32-neondot-ld64.cc
src/qs8-gemm/gen/qs8-gemm-4x8-rndnu-aarch32-neon-mlal-lane-ld64.cc
src/qs8-gemm/gen/qs8-gemm-4x8c4-rndnu-aarch32-neondot-ld64.cc
src/qs8-igemm/gen/qs8-igemm-4x8-rndnu-aarch32-neon-mlal-lane-ld64.cc
src/qs8-igemm/gen/qs8-igemm-4x8c4-rndnu-aarch32-neondot-ld64.cc)
SET(JIT_AARCH64_SRCS
src/f16-gemm/gen/f16-gemm-1x16-aarch64-neonfp16arith-ld64.cc
src/f16-gemm/gen/f16-gemm-4x16-aarch64-neonfp16arith-ld64.cc
src/f16-gemm/gen/f16-gemm-6x16-aarch64-neonfp16arith-cortex-a55.cc
src/f16-gemm/gen/f16-gemm-6x16-aarch64-neonfp16arith-cortex-a55r0.cc
src/f16-gemm/gen/f16-gemm-6x16-aarch64-neonfp16arith-cortex-a75.cc
src/f16-gemm/gen/f16-gemm-6x16-aarch64-neonfp16arith-ld64.cc
src/f16-igemm/gen/f16-igemm-1x16-aarch64-neonfp16arith-ld64.cc
src/f16-igemm/gen/f16-igemm-4x16-aarch64-neonfp16arith-ld64.cc
src/f16-igemm/gen/f16-igemm-6x16-aarch64-neonfp16arith-ld64.cc
src/f16-igemm/gen/f16-igemm-6x16-aarch64-neonfp16arith-cortex-a55.cc
src/f16-igemm/gen/f16-igemm-6x16-aarch64-neonfp16arith-cortex-a55r0.cc
src/f16-igemm/gen/f16-igemm-6x16-aarch64-neonfp16arith-cortex-a75.cc
src/f32-gemm/gen/f32-gemm-1x8-aarch64-neonfma-cortex-a53.cc
src/f32-gemm/gen/f32-gemm-1x8-aarch64-neonfma-cortex-a75.cc
src/f32-gemm/gen/f32-gemm-1x8-aarch64-neonfma-ld64.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch64-neonfma-cortex-a53.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch64-neonfma-cortex-a55.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch64-neonfma-cortex-a75.cc
src/f32-gemm/gen/f32-gemm-4x8-aarch64-neonfma-ld128.cc
src/f32-gemm/gen/f32-gemm-6x8-aarch64-neonfma-cortex-a53.cc
src/f32-gemm/gen/f32-gemm-6x8-aarch64-neonfma-cortex-a55.cc
src/f32-gemm/gen/f32-gemm-6x8-aarch64-neonfma-cortex-a75.cc
src/f32-gemm/gen/f32-gemm-6x8-aarch64-neonfma-ld128.cc
src/f32-igemm/gen/f32-igemm-1x8-aarch64-neonfma-cortex-a53.cc
src/f32-igemm/gen/f32-igemm-1x8-aarch64-neonfma-cortex-a75.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch64-neonfma-cortex-a53.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch64-neonfma-cortex-a55.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch64-neonfma-cortex-a75.cc
src/f32-igemm/gen/f32-igemm-4x8-aarch64-neonfma-ld128.cc
src/f32-igemm/gen/f32-igemm-6x8-aarch64-neonfma-cortex-a53.cc
src/f32-igemm/gen/f32-igemm-6x8-aarch64-neonfma-cortex-a55.cc
src/f32-igemm/gen/f32-igemm-6x8-aarch64-neonfma-cortex-a75.cc
src/f32-igemm/gen/f32-igemm-6x8-aarch64-neonfma-ld128.cc)
SET(PROD_SCALAR_MICROKERNEL_SRCS src/amalgam/gen/scalar.c)
SET(PROD_SCALAR_AARCH32_MICROKERNEL_SRCS src/amalgam/gen/scalar-aarch32.c)
SET(PROD_SCALAR_RISCV_MICROKERNEL_SRCS src/amalgam/gen/scalar-riscv.c)
SET(PROD_ARMSIMD32_MICROKERNEL_SRCS src/amalgam/gen/armsimd32.c)
SET(PROD_FP16ARITH_MICROKERNEL_SRCS src/amalgam/gen/fp16arith.c)
SET(PROD_NEON_MICROKERNEL_SRCS src/amalgam/gen/neon.c)
SET(PROD_NEONFP16_MICROKERNEL_SRCS src/amalgam/gen/neonfp16.c)
SET(PROD_NEONFMA_MICROKERNEL_SRCS src/amalgam/gen/neonfma.c)
SET(PROD_NEON_AARCH64_MICROKERNEL_SRCS src/amalgam/gen/neon-aarch64.c)
SET(PROD_NEONV8_MICROKERNEL_SRCS src/amalgam/gen/neonv8.c)
SET(PROD_NEONFP16ARITH_MICROKERNEL_SRCS src/amalgam/gen/neonfp16arith.c)
SET(PROD_NEONFP16ARITH_AARCH64_MICROKERNEL_SRCS src/amalgam/gen/neonfp16arith-aarch64.c)
SET(PROD_NEONDOT_MICROKERNEL_SRCS src/amalgam/gen/neondot.c)
SET(PROD_SSE_MICROKERNEL_SRCS src/amalgam/gen/sse.c)
SET(PROD_SSE2_MICROKERNEL_SRCS src/amalgam/gen/sse2.c)
SET(PROD_SSSE3_MICROKERNEL_SRCS src/amalgam/gen/ssse3.c)
SET(PROD_SSE41_MICROKERNEL_SRCS src/amalgam/gen/sse41.c)
SET(PROD_AVX_MICROKERNEL_SRCS src/amalgam/gen/avx.c)
SET(PROD_F16C_MICROKERNEL_SRCS src/amalgam/gen/f16c.c)
SET(PROD_XOP_MICROKERNEL_SRCS src/amalgam/gen/xop.c)
SET(PROD_FMA3_MICROKERNEL_SRCS src/amalgam/gen/fma3.c)
SET(PROD_AVX2_MICROKERNEL_SRCS src/amalgam/gen/avx2.c)
SET(PROD_AVX512F_MICROKERNEL_SRCS src/amalgam/gen/avx512f.c)
SET(PROD_AVX512SKX_MICROKERNEL_SRCS src/amalgam/gen/avx512skx.c)
SET(PROD_AVX512VBMI_MICROKERNEL_SRCS src/amalgam/gen/avx512vbmi.c)
SET(PROD_MICROKERNEL_SRCS ${PROD_SCALAR_MICROKERNEL_SRCS})
SET(ALL_MICROKERNEL_SRCS ${ALL_SCALAR_MICROKERNEL_SRCS} ${ALL_FMA_MICROKERNEL_SRCS})
IF(XNNPACK_TARGET_PROCESSOR STREQUAL "arm")
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_SCALAR_AARCH32_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_ARMSIMD32_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEON_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFP16_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFMA_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONV8_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_ARM_FP16_SCALAR)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_FP16ARITH_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_FP16_VECTOR)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFP16ARITH_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_DOTPROD)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONDOT_MICROKERNEL_SRCS})
ENDIF()
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_ARMSIMD32_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEON_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFP16_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFMA_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONV8_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_ARM_FP16_SCALAR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_FP16ARITH_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_FP16_VECTOR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFP16ARITH_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_BF16)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONBF16_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_DOTPROD)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONDOT_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ASSEMBLY)
LIST(APPEND PROD_MICROKERNEL_SRCS ${AARCH32_ASM_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${AARCH32_ASM_MICROKERNEL_SRCS})
ENDIF()
LIST(APPEND JIT_SRCS ${JIT_AARCH32_SRCS})
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^arm64")
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEON_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFP16_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFMA_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONV8_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEON_AARCH64_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_ARM_FP16_VECTOR)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFP16ARITH_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONFP16ARITH_AARCH64_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_DOTPROD)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONDOT_MICROKERNEL_SRCS})
ENDIF()
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEON_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFP16_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFMA_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONV8_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEON_AARCH64_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFMA_AARCH64_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_ARM_FP16_SCALAR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_FP16ARITH_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_FP16_VECTOR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFP16ARITH_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONFP16ARITH_AARCH64_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_BF16)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONBF16_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_DOTPROD)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONDOT_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ASSEMBLY)
LIST(APPEND PROD_MICROKERNEL_SRCS ${AARCH64_ASM_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${AARCH64_ASM_MICROKERNEL_SRCS})
ENDIF()
LIST(APPEND JIT_SRCS ${JIT_AARCH64_SRCS})
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^x86(_64)?$")
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_SSE_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_SSE2_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_SSSE3_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_SSE41_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_F16C_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_XOP_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_FMA3_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX2_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX512F_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX512SKX_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX512VBMI_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_SSE_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_SSE2_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_SSSE3_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_SSE41_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_F16C_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_XOP_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_FMA3_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX2_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX512F_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX512SKX_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX512VBMI_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "Hexagon")
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_HEXAGON_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^riscv")
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_SCALAR_RISCV_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_RISCV_VECTOR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_RVV_MICROKERNEL_SRCS})
ENDIF()
ENDIF()
ADD_LIBRARY(microkernels-all OBJECT ${ALL_MICROKERNEL_SRCS} ${TABLE_SRCS})
ADD_LIBRARY(microkernels-prod OBJECT ${PROD_MICROKERNEL_SRCS} ${TABLE_SRCS})
ADD_LIBRARY(hardware-config OBJECT src/hardware-config.c)
ADD_LIBRARY(indirection OBJECT src/indirection.c)
ADD_LIBRARY(jit OBJECT ${JIT_SRCS})
ADD_LIBRARY(logging OBJECT ${LOGGING_SRCS})
ADD_LIBRARY(microparams-init OBJECT src/microparams-init.c)
ADD_LIBRARY(normalization OBJECT src/normalization.c)
ADD_LIBRARY(packing OBJECT src/packing.c)
TARGET_LINK_LIBRARIES(hardware-config PRIVATE logging)
TARGET_LINK_LIBRARIES(jit PRIVATE logging)
IF(XNNPACK_BUILD_LIBRARY)
ADD_LIBRARY(allocator OBJECT src/allocator.c)
ADD_LIBRARY(cache OBJECT src/cache.c)
ADD_LIBRARY(memory OBJECT src/memory.c)
ADD_LIBRARY(microkernel-utils OBJECT src/microkernel-utils.c)
ADD_LIBRARY(mutex OBJECT src/mutex.c)
ADD_LIBRARY(operators OBJECT ${OPERATOR_SRCS})
ADD_LIBRARY(operator-run OBJECT src/operator-run.c)
ADD_LIBRARY(operator-utils OBJECT src/operator-utils.c)
ADD_LIBRARY(subgraph OBJECT ${SUBGRAPH_SRCS})
# Need C_EXTENSIONS to get constants for mmap (MAP_ANONYMOUS).
SET_TARGET_PROPERTIES(memory PROPERTIES C_EXTENSIONS YES)
ADD_LIBRARY(convolution-test-helpers OBJECT test/convolution-test-helpers.cc)
ADD_LIBRARY(post-operation OBJECT src/operators/post-operation.c)
IF(XNNPACK_LIBRARY_TYPE STREQUAL "default")
ADD_LIBRARY(XNNPACK ${XNNPACK_SRCS})
ELSEIF(XNNPACK_LIBRARY_TYPE STREQUAL "shared")
ADD_LIBRARY(XNNPACK SHARED ${XNNPACK_SRCS})
ELSEIF(XNNPACK_LIBRARY_TYPE STREQUAL "static")
ADD_LIBRARY(XNNPACK STATIC ${XNNPACK_SRCS})
ELSE()
MESSAGE(FATAL_ERROR "Unsupported XNNPACK library type \"${XNNPACK_LIBRARY_TYPE}\". Must be \"static\", \"shared\", or \"default\"")
ENDIF()
TARGET_LINK_LIBRARIES(memory PRIVATE logging)
TARGET_LINK_LIBRARIES(mutex PRIVATE logging)
TARGET_LINK_LIBRARIES(operators PRIVATE allocator indirection logging microkernel-utils normalization operator-utils packing post-operation)
TARGET_LINK_LIBRARIES(operator-run PRIVATE logging)
TARGET_LINK_LIBRARIES(operator-utils PRIVATE logging)
TARGET_LINK_LIBRARIES(subgraph PRIVATE allocator logging memory mutex operators operator-run)
TARGET_LINK_LIBRARIES(XNNPACK PRIVATE allocator cache hardware-config indirection jit logging memory microkernel-utils microparams-init mutex normalization operators operator-run operator-utils packing post-operation microkernels-prod subgraph)
SET_TARGET_PROPERTIES(XNNPACK PROPERTIES C_EXTENSIONS YES)
ENDIF()
IF(NOT MSVC)
SET_PROPERTY(SOURCE ${ALL_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-math-errno ")
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR STREQUAL "arm")
SET_PROPERTY(SOURCE ${ALL_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -marm ")
SET_PROPERTY(SOURCE ${PROD_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -marm ")
SET_PROPERTY(SOURCE ${ALL_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv6 -mfpu=vfp -munaligned-access ")
SET_PROPERTY(SOURCE ${PROD_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv6 -mfpu=vfp -munaligned-access ")
SET_PROPERTY(SOURCE ${ALL_NEON_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon ")
SET_PROPERTY(SOURCE ${PROD_NEON_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon ")
SET_PROPERTY(SOURCE ${ALL_NEONFP16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon-fp16 ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon-fp16 ")
# GCC requires -mfp16-format=ieee to define __fp16 type, but Clang doesn't support this option at all.
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
SET_PROPERTY(SOURCE ${ALL_NEONFP16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
SET_PROPERTY(SOURCE ${ALL_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
SET_PROPERTY(SOURCE ${PROD_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
SET_PROPERTY(SOURCE ${ALL_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
ENDIF()
SET_PROPERTY(SOURCE ${ALL_NEONFMA_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon-vfpv4 ")
SET_PROPERTY(SOURCE ${PROD_NEONFMA_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon-vfpv4 ")
SET_PROPERTY(SOURCE ${ALL_NEONV8_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8-a -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${PROD_NEONV8_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8-a -mfpu=neon-fp-armv8 ")
# -mfpu=fp-armv8 should suffice for FP16ARITH microkernels, if not for GCC emitting wrong directives for assembler
# -fno-math-errno for the vsqrth_f16 polyfill using sqrtf
# -ffinite-math-only for the vminnmh_f16/vmaxnmh_f16 polyfills using compare + select
SET_PROPERTY(SOURCE ${ALL_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 -mfpu=neon-fp-armv8 -fno-math-errno -ffinite-math-only ")
SET_PROPERTY(SOURCE ${PROD_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 -mfpu=neon-fp-armv8 -fno-math-errno -ffinite-math-only ")
SET_PROPERTY(SOURCE ${ALL_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${ALL_NEONBF16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+bf16 -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${ALL_NEONDOT_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${PROD_NEONDOT_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${AARCH32_ASM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod -mfpu=neon-fp-armv8 ")
# Workground the neon detection bug in ARM v8
# Related links:
# https://github.com/android/ndk/issues/910
# https://reviews.llvm.org/D58477
IF(ANDROID_NDK_MAJOR AND ANDROID_NDK_MAJOR LESS 21)
SET_PROPERTY(SOURCE ${ALL_NEONV8_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${PROD_NEONV8_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${ALL_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${PROD_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${ALL_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${ALL_NEONBF16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${ALL_NEONDOT_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${PROD_NEONDOT_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${AARCH32_ASM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
ENDIF()
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^arm64" AND NOT MSVC)
SET_PROPERTY(SOURCE ${ALL_FP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 ")
SET_PROPERTY(SOURCE ${ALL_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 ")
SET_PROPERTY(SOURCE ${ALL_NEONFP16ARITH_AARCH64_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 ")
SET_PROPERTY(SOURCE ${PROD_NEONFP16ARITH_AARCH64_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16 ")
SET_PROPERTY(SOURCE ${ALL_NEONBF16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+bf16 ")
SET_PROPERTY(SOURCE ${ALL_NEONDOT_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod ")
SET_PROPERTY(SOURCE ${PROD_NEONDOT_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod ")
SET_PROPERTY(SOURCE ${AARCH64_ASM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16+dotprod ")
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^riscv")
IF(XNNPACK_ENABLE_RISCV_VECTOR)
SET_PROPERTY(SOURCE ${ALL_RVV_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=rv64gcv ")
ENDIF()
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^x86(_64)?$")
IF(MSVC)
IF(XNNPACK_TARGET_PROCESSOR STREQUAL "x86" OR CMAKE_SIZEOF_VOID_P EQUAL 4)
SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE ")
SET_PROPERTY(SOURCE ${PROD_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE ")
SET_PROPERTY(SOURCE ${ALL_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE2 ")
SET_PROPERTY(SOURCE ${PROD_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE2 ")
SET_PROPERTY(SOURCE ${ALL_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE2 ")
SET_PROPERTY(SOURCE ${PROD_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE2 ")
SET_PROPERTY(SOURCE ${ALL_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE2 ")
SET_PROPERTY(SOURCE ${PROD_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:SSE2 ")
ENDIF()
SET_PROPERTY(SOURCE ${ALL_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${PROD_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${ALL_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${PROD_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${ALL_XOP_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${PROD_XOP_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${ALL_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${PROD_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX ")
SET_PROPERTY(SOURCE ${ALL_AVX2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX2 ")
SET_PROPERTY(SOURCE ${PROD_AVX2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX2 ")
SET_PROPERTY(SOURCE ${ALL_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${PROD_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${ALL_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${PROD_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${ALL_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${PROD_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse ")
SET_PROPERTY(SOURCE ${PROD_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse ")
SET_PROPERTY(SOURCE ${ALL_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse2 ")
SET_PROPERTY(SOURCE ${PROD_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse2 ")
SET_PROPERTY(SOURCE ${ALL_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mssse3 ")
SET_PROPERTY(SOURCE ${PROD_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mssse3 ")
SET_PROPERTY(SOURCE ${ALL_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse4.1 ")
SET_PROPERTY(SOURCE ${PROD_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse4.1 ")
SET_PROPERTY(SOURCE ${ALL_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mavx ")
SET_PROPERTY(SOURCE ${PROD_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mavx ")
SET_PROPERTY(SOURCE ${ALL_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c ")
SET_PROPERTY(SOURCE ${PROD_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c ")
SET_PROPERTY(SOURCE ${ALL_XOP_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mxop ")
SET_PROPERTY(SOURCE ${PROD_XOP_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mxop ")
SET_PROPERTY(SOURCE ${ALL_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma ")
SET_PROPERTY(SOURCE ${PROD_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma ")
SET_PROPERTY(SOURCE ${ALL_AVX2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx2 ")
SET_PROPERTY(SOURCE ${PROD_AVX2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx2 ")
SET_PROPERTY(SOURCE ${ALL_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mavx512f ")
SET_PROPERTY(SOURCE ${PROD_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mavx512f ")
SET_PROPERTY(SOURCE ${ALL_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl ")
SET_PROPERTY(SOURCE ${PROD_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl ")
SET_PROPERTY(SOURCE ${ALL_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vbmi ")
SET_PROPERTY(SOURCE ${PROD_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vbmi ")
ENDIF()
ELSE()
SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse ")
SET_PROPERTY(SOURCE ${PROD_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse ")
SET_PROPERTY(SOURCE ${ALL_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse2 ")
SET_PROPERTY(SOURCE ${PROD_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse2 ")
SET_PROPERTY(SOURCE ${ALL_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mssse3 ")
SET_PROPERTY(SOURCE ${PROD_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mssse3 ")
SET_PROPERTY(SOURCE ${ALL_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse4.1 ")
SET_PROPERTY(SOURCE ${PROD_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse4.1 ")
SET_PROPERTY(SOURCE ${ALL_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mavx ")
SET_PROPERTY(SOURCE ${PROD_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mavx ")
SET_PROPERTY(SOURCE ${ALL_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c ")
SET_PROPERTY(SOURCE ${PROD_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c ")
SET_PROPERTY(SOURCE ${ALL_XOP_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mxop ")
SET_PROPERTY(SOURCE ${PROD_XOP_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mxop ")
SET_PROPERTY(SOURCE ${ALL_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mfma ")
SET_PROPERTY(SOURCE ${PROD_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mfma ")
SET_PROPERTY(SOURCE ${ALL_AVX2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx2 ")
SET_PROPERTY(SOURCE ${PROD_AVX2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx2 ")
SET_PROPERTY(SOURCE ${ALL_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mavx512f ")
SET_PROPERTY(SOURCE ${PROD_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mavx512f ")
SET_PROPERTY(SOURCE ${ALL_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl ")
SET_PROPERTY(SOURCE ${PROD_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl ")
SET_PROPERTY(SOURCE ${ALL_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi ")
SET_PROPERTY(SOURCE ${PROD_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi ")
IF(MINGW OR CMAKE_SYSTEM_NAME MATCHES "^(CYGWIN|MSYS)$")
# Work-around for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782
SET_PROPERTY(SOURCE ${ALL_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${PROD_AVX512F_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${ALL_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${PROD_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${ALL_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${PROD_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
ENDIF()
ENDIF()
ENDIF()
TARGET_COMPILE_DEFINITIONS(hardware-config PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(jit PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(logging PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
IF(XNNPACK_BUILD_LIBRARY)
TARGET_COMPILE_DEFINITIONS(XNNPACK PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(allocator PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(cache PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(microkernel-utils PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(subgraph PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(operators PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(operator-run PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(operator-utils PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(packing PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(mutex PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
TARGET_COMPILE_DEFINITIONS(memory PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:5>$<$<NOT:$<CONFIG:Debug>>:0>")
ENDIF()
IF(MSVC)
# Even though MSVC has __restrict, it can't be used in all the same contexts as the C99 restrict keyword
TARGET_COMPILE_DEFINITIONS(microkernels-all PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(microkernels-prod PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(hardware-config PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(indirection PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(jit PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(microparams-init PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(normalization PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(packing PRIVATE "restrict=")
IF(XNNPACK_BUILD_LIBRARY)
TARGET_COMPILE_DEFINITIONS(cache PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(mutex PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(microkernel-utils PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(subgraph PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(operators PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(operator-run PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(operator-utils PRIVATE "restrict=")
TARGET_COMPILE_DEFINITIONS(XNNPACK PRIVATE "restrict=")
ENDIF()
TARGET_COMPILE_OPTIONS(microkernels-all PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(microkernels-prod PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(hardware-config PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(indirection PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(jit PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
TARGET_COMPILE_OPTIONS(microparams-init PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(normalization PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
TARGET_COMPILE_OPTIONS(packing PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
IF(XNNPACK_BUILD_LIBRARY)
TARGET_COMPILE_OPTIONS(microkernel-utils PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(operator-run PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(operator-utils PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O2>")
TARGET_COMPILE_OPTIONS(cache PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
TARGET_COMPILE_OPTIONS(mutex PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
TARGET_COMPILE_OPTIONS(subgraph PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
TARGET_COMPILE_OPTIONS(operators PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
TARGET_COMPILE_OPTIONS(XNNPACK PRIVATE "$<$<NOT:$<CONFIG:Debug>>:/O1>")
ENDIF()
ELSE()
TARGET_COMPILE_OPTIONS(microkernels-all PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(microkernels-prod PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(hardware-config PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(indirection PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(jit PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
TARGET_COMPILE_OPTIONS(microparams-init PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(normalization PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
TARGET_COMPILE_OPTIONS(packing PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
IF(XNNPACK_BUILD_LIBRARY)
TARGET_COMPILE_OPTIONS(microkernel-utils PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(operator-run PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(operator-utils PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O2>")
TARGET_COMPILE_OPTIONS(cache PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
TARGET_COMPILE_OPTIONS(mutex PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
TARGET_COMPILE_OPTIONS(subgraph PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
TARGET_COMPILE_OPTIONS(operators PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
TARGET_COMPILE_OPTIONS(XNNPACK PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-Os>")
ENDIF()
ENDIF()
TARGET_INCLUDE_DIRECTORIES(microkernels-all PRIVATE src)
TARGET_INCLUDE_DIRECTORIES(microkernels-prod PRIVATE src)
TARGET_INCLUDE_DIRECTORIES(hardware-config PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(indirection PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(jit PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(microparams-init PRIVATE src)
TARGET_INCLUDE_DIRECTORIES(normalization PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(packing PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(logging PRIVATE include src)
IF(XNNPACK_BUILD_LIBRARY)
TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC include)
TARGET_INCLUDE_DIRECTORIES(XNNPACK PRIVATE src)
TARGET_INCLUDE_DIRECTORIES(allocator PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(cache PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(microkernel-utils PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(subgraph PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(operators PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(operator-run PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(operator-utils PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(memory PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(mutex PRIVATE include src)
TARGET_INCLUDE_DIRECTORIES(post-operation PUBLIC include src)
IF(WIN32)
# Target Windows 7+ API
TARGET_COMPILE_DEFINITIONS(XNNPACK PRIVATE _WIN32_WINNT=0x0601)
TARGET_COMPILE_DEFINITIONS(mutex PRIVATE _WIN32_WINNT=0x0601)
ENDIF()
SET_TARGET_PROPERTIES(XNNPACK PROPERTIES PUBLIC_HEADER include/xnnpack.h)
ENDIF()
# ---[ Find libm
FIND_LIBRARY(LIBM m)
IF(LIBM)
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE ${LIBM})
TARGET_LINK_LIBRARIES(microkernels-prod PRIVATE ${LIBM})
TARGET_LINK_LIBRARIES(hardware-config PRIVATE ${LIBM})
TARGET_LINK_LIBRARIES(indirection PRIVATE ${LIBM})
IF(XNNPACK_BUILD_LIBRARY)
TARGET_LINK_LIBRARIES(XNNPACK PRIVATE ${LIBM})
ENDIF()
ENDIF()
# ---[ Configure cpuinfo
IF(NOT TARGET cpuinfo)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_BENCHMARKS OFF CACHE BOOL "")
ADD_SUBDIRECTORY(
"${CPUINFO_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/cpuinfo")
ELSE()
ADD_LIBRARY(cpuinfo SHARED IMPORTED)
FIND_LIBRARY(CPUINFO_LIBRARY cpuinfo)
IF(NOT CPUINFO_LIBRARY)
MESSAGE(FATAL_ERROR "Cannot find cpuinfo")
ENDIF()
SET_PROPERTY(TARGET cpuinfo PROPERTY IMPORTED_LOCATION "${CPUINFO_LIBRARY}")
SET_PROPERTY(TARGET cpuinfo PROPERTY IMPORTED_IMPLIB "${CPUINFO_LIBRARY}")
ENDIF()
ENDIF()
IF(XNNPACK_BUILD_LIBRARY)
TARGET_LINK_LIBRARIES(hardware-config PRIVATE cpuinfo)
TARGET_LINK_LIBRARIES(XNNPACK PRIVATE cpuinfo)
ENDIF()
# ---[ Configure pthreadpool
IF(NOT TARGET pthreadpool)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "")
SET(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "")
SET(PTHREADPOOL_ALLOW_DEPRECATED_API OFF CACHE BOOL "")
ADD_SUBDIRECTORY(
"${PTHREADPOOL_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/pthreadpool")
ELSE()
ADD_LIBRARY(pthreadpool SHARED IMPORTED)
FIND_LIBRARY(PTHREADPOOL_LIBRARY pthreadpool)
IF(NOT PTHREADPOOL_LIBRARY)
MESSAGE(FATAL_ERROR "Cannot find pthreadpool")
ENDIF()
SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}")
SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_IMPLIB "${PTHREADPOOL_LIBRARY}")
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(microkernels-prod PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(hardware-config PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(indirection PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(jit PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(logging PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(microparams-init PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(normalization PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(packing PRIVATE pthreadpool)
IF(XNNPACK_BUILD_LIBRARY)
TARGET_LINK_LIBRARIES(XNNPACK PUBLIC pthreadpool)
TARGET_LINK_LIBRARIES(allocator PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(cache PRIVATE memory pthreadpool)
TARGET_LINK_LIBRARIES(subgraph PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(operators PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(operator-run PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(operator-utils PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(mutex PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(memory PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(post-operation PUBLIC pthreadpool allocator)
ENDIF()
# ---[ Configure FXdiv
IF(NOT TARGET fxdiv)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
SET(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
ADD_SUBDIRECTORY(
"${FXDIV_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/FXdiv")
ELSE()
FIND_FILE(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
IF(NOT FXDIV_HDR)
MESSAGE(FATAL_ERROR "Cannot find fxdiv")
ENDIF()
ADD_LIBRARY(fxdiv STATIC "${FXDIV_HDR}")
SET_PROPERTY(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE fxdiv)
TARGET_LINK_LIBRARIES(microkernels-prod PRIVATE fxdiv)
TARGET_LINK_LIBRARIES(indirection PRIVATE fxdiv)
IF(XNNPACK_BUILD_LIBRARY)
TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fxdiv)
ENDIF()
# ---[ Configure FP16
IF(NOT TARGET fp16)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(FP16_BUILD_TESTS OFF CACHE BOOL "")
SET(FP16_BUILD_BENCHMARKS OFF CACHE BOOL "")
ADD_SUBDIRECTORY(
"${FP16_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/FP16")
ELSE()
FIND_FILE(FP16_HDR fp16.h PATH_SUFFIXES include)
IF(NOT FP16_HDR)
MESSAGE(FATAL_ERROR "Cannot find fp16")
ENDIF()
ADD_LIBRARY(fp16 STATIC "${FP16_HDR}")
SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C)
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(microkernels-all PRIVATE fp16)
TARGET_LINK_LIBRARIES(microkernels-prod PRIVATE fp16)
TARGET_LINK_LIBRARIES(microparams-init PRIVATE fp16)
TARGET_LINK_LIBRARIES(packing PRIVATE fp16)
TARGET_LINK_LIBRARIES(indirection PRIVATE fp16)
IF(XNNPACK_BUILD_LIBRARY)
TARGET_LINK_LIBRARIES(subgraph PRIVATE fp16)
TARGET_LINK_LIBRARIES(operators PRIVATE fp16)
TARGET_LINK_LIBRARIES(operator-run PRIVATE fp16)
TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fp16)
INSTALL(TARGETS XNNPACK
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
ENDIF()
# ---[ XNNPACK unit tests
IF(XNNPACK_BUILD_TESTS)
# ---[ Build google test
IF(NOT TARGET gtest)
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
ADD_SUBDIRECTORY(
"${GOOGLETEST_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/googletest")
ENDIF()
# Helper libraries
ADD_LIBRARY(gemm-microkernel-tester STATIC test/gemm-microkernel-tester.cc)
TARGET_INCLUDE_DIRECTORIES(gemm-microkernel-tester PRIVATE . include src test)
TARGET_LINK_LIBRARIES(gemm-microkernel-tester PRIVATE fp16 pthreadpool gtest)
TARGET_LINK_LIBRARIES(gemm-microkernel-tester PRIVATE jit packing)
IF(XNNPACK_BUILD_LIBRARY)
TARGET_LINK_LIBRARIES(gemm-microkernel-tester PRIVATE XNNPACK post-operation)
ENDIF()
IF(XNNPACK_BUILD_LIBRARY)
# ---[ Build size tests
ADD_EXECUTABLE(operator-size-test test/operator-size.c)
TARGET_LINK_LIBRARIES(operator-size-test PRIVATE XNNPACK)
ADD_EXECUTABLE(subgraph-size-test test/subgraph-size.c)
TARGET_LINK_LIBRARIES(subgraph-size-test PRIVATE XNNPACK)
# ---[ Build operator-level unit tests
ADD_EXECUTABLE(abs-nc-test test/abs-nc.cc)
TARGET_INCLUDE_DIRECTORIES(abs-nc-test PRIVATE src test)
TARGET_LINK_LIBRARIES(abs-nc-test PRIVATE XNNPACK fp16 gtest gtest_main)
ADD_TEST(NAME abs-nc-test COMMAND abs-nc-test)
ADD_EXECUTABLE(abs-nc-eager-test test/abs-nc-eager.cc)
TARGET_INCLUDE_DIRECTORIES(abs-nc-eager-test PRIVATE src test)
TARGET_LINK_LIBRARIES(abs-nc-eager-test PRIVATE XNNPACK fp16 gtest gtest_main)
ADD_TEST(NAME abs-nc-eager-test COMMAND abs-nc-eager-test)
ADD_EXECUTABLE(add-nd-test test/add-nd.cc)
TARGET_INCLUDE_DIRECTORIES(add-nd-test PRIVATE src test)
TARGET_LINK_LIBRARIES(add-nd-test PRIVATE XNNPACK fp16 gtest gtest_main)
ADD_TEST(NAME add-nd-test COMMAND add-nd-test)
ADD_EXECUTABLE(add-nd-eager-test test/add-nd-eager.cc)
TARGET_INCLUDE_DIRECTORIES(add-nd-eager-test PRIVATE src test)
TARGET_LINK_LIBRARIES(add-nd-eager-test PRIVATE XNNPACK fp16 gtest gtest_main)
ADD_TEST(NAME add-nd-eager-test COMMAND add-nd-eager-test)
ADD_EXECUTABLE(argmax-pooling-nhwc-test test/argmax-pooling-nhwc.cc)
TARGET_INCLUDE_DIRECTORIES(argmax-pooling-nhwc-test PRIVATE src test)
TARGET_LINK_LIBRARIES(argmax-pooling-nhwc-test PRIVATE XNNPACK gtest gtest_main)
ADD_TEST(NAME argmax-pooling-nhwc-test COMMAND argmax-pooling-nhwc-test)
ADD_EXECUTABLE(average-pooling-nhwc-test test/average-pooling-nhwc.cc)
TARGET_INCLUDE_DIRECTORIES(average-pooling-nhwc-test PRIVATE src test)