forked from google/XNNPACK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
867 lines (826 loc) · 52.1 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
# 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.
# 2024
# Modified for use with ILLIXR hand tracking plugin
CMAKE_MINIMUM_REQUIRED(VERSION 3.15 FATAL_ERROR)
# Allow specifying -D<PackageName>_ROOT.
CMAKE_POLICY(SET CMP0074 NEW)
# MSVC runtime library flags are selected by an abstraction.
CMAKE_POLICY(SET CMP0091 NEW)
# ---[ Project and semantic versioning.
PROJECT(tfl-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)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# ---[ 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_ALL_MICROKERNELS "Builds all XNNPACK Microkernels" ON)
OPTION(XNNPACK_BUILD_BENCHMARKS "Build XNNPACK benchmarks" ON)
OPTION(XNNPACK_USE_SYSTEM_LIBS "Use system-provided dependency libraries" OFF)
OPTION(USE_GNU_SOURCE "Use _GNU_SOURCE macro" OFF)
IF(XNNPACK_BUILD_BENCHMARKS OR XNNPACK_BUILD_TESTS)
SET(XNNPACK_BUILD_ALL_MICROKERNELS ON)
ENDIF()
OPTION(LIBRARY_POSTFIX "Postfix for the library" "")
IF(LIBRARY_POSTFIX)
IF(NOT ((LIBRARY_POSTFIX MATCHES "^-") OR (LIBRARY_POSTFIX MATCHES "^_")))
SET(LIBRARY_POSTFIX "-${LIBRARY_POSTFIX}")
ENDIF()
ELSE()
SET(LIBRARY_POSTFIX "")
ENDIF()
# --- [ 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}")
ADD_COMPILE_OPTIONS("-Wno-shorten-64-to-32")
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(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
SET(XNNPACK_TARGET_PROCESSOR "ppc64")
ELSEIF(NOT XNNPACK_TARGET_PROCESSOR MATCHES "^(x86(_64)?|arm64|riscv(32|64|128)|Hexagon|ppc64)$")
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_ARM_I8MM "Build XNNPACK with ARM I8MM (8-bit integer matrix multiply accumulate) micro-kernels" ON)
IF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "11")
SET(XNNPACK_ENABLE_ARM_I8MM OFF)
ENDIF()
ENDIF()
OPTION(XNNPACK_ENABLE_RISCV_VECTOR "Build XNNPACK with RISC-V Vector micro-kernels" ON)
OPTION(XNNPACK_ENABLE_VSX "Build XNNPACK with VSX Vector micro-kernels for Power" ON)
OPTION(XNNPACK_ENABLE_AVXVNNI "Build XNNPACK with AVX-VNNI micro-kernels" ON)
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "11")
SET(XNNPACK_ENABLE_AVXVNNI OFF)
ENDIF()
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "15")
SET(XNNPACK_ENABLE_AVXVNNI OFF)
ENDIF()
ENDIF()
OPTION(XNNPACK_ENABLE_AVX512AMX "Build XNNPACK with AVX512-AMX micro-kernels" ON)
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "13")
SET(XNNPACK_ENABLE_AVX512AMX OFF)
ENDIF()
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "15")
SET(XNNPACK_ENABLE_AVX512AMX OFF)
ENDIF()
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
SET(XNNPACK_ENABLE_AVX512AMX OFF)
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR STREQUAL "x86")
SET(XNNPACK_ENABLE_AVX512AMX OFF)
ENDIF()
# ---[ CMake options
INCLUDE(GNUInstallDirs)
IF(XNNPACK_BUILD_TESTS)
ENABLE_TESTING()
ENDIF()
ADD_DEFINITIONS("-DXNN_ENABLE_GEMM_M_SPECIALIZATION=$<BOOL:${XNNPACK_ENABLE_GEMM_M_SPECIALIZATION}>")
ADD_DEFINITIONS("-DXNN_ENABLE_JIT=$<BOOL:${XNNPACK_ENABLE_JIT}>")
ADD_DEFINITIONS("-DXNN_ENABLE_AVXVNNI=$<BOOL:${XNNPACK_ENABLE_AVXVNNI}>")
ADD_DEFINITIONS("-DXNN_ENABLE_ARM_FP16_SCALAR=$<BOOL:${XNNPACK_ENABLE_ARM_FP16_SCALAR}>")
ADD_DEFINITIONS("-DXNN_ENABLE_ARM_FP16_VECTOR=$<BOOL:${XNNPACK_ENABLE_ARM_FP16_VECTOR}>")
ADD_DEFINITIONS("-DXNN_ENABLE_SPARSE=$<BOOL:${XNNPACK_ENABLE_SPARSE}>")
ADD_DEFINITIONS("-DXNN_ENABLE_ASSEMBLY=$<BOOL:${XNNPACK_ENABLE_ASSEMBLY}>")
ADD_DEFINITIONS("-DXNN_ENABLE_DWCONV_MULTIPASS=$<BOOL:${XNNPACK_ENABLE_DWCONV_MULTIPASS}>")
ADD_DEFINITIONS("-DXNN_ENABLE_MEMOPT=$<BOOL:${XNNPACK_ENABLE_MEMOPT}>")
ADD_DEFINITIONS("-DXNN_ENABLE_AVX512AMX=$<BOOL:${NNPACK_ENABLE_AVX512AMX}>")
ADD_DEFINITIONS("-DXNN_ENABLE_ARM_BF16=$<BOOL:${XNNPACK_ENABLE_ARM_BF16}>")
ADD_DEFINITIONS("-DXNN_ENABLE_ARM_DOTPROD=$<BOOL:${XNNPACK_ENABLE_ARM_DOTPROD}>")
ADD_DEFINITIONS("-DXNN_ENABLE_ARM_I8MM=$<BOOL:${XNNPACK_ENABLE_ARM_I8MM}>")
ADD_DEFINITIONS("-U_FORTIFY_SOURCE -fstack-protector -fno-omit-frame-pointer -D_FORTIFY_SOURCE=1")
ADD_DEFINITIONS("-ffunction-sections -fdata-sections -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11")
ADD_DEFINITIONS("-fno-canonical-system-headers -Wno-builtin-macro-redefined ")
ADD_DEFINITIONS('-D__DATE__="redacted"')
ADD_DEFINITIONS('-D__TIMESTAMP__="redacted"')
ADD_DEFINITIONS('-D__TIME__="redacted"')
IF(XNNPACK_PLATFORM_JIT STREQUAL "ON" OR XNNPACK_PLATFORM_JIT STREQUAL "OFF")
ADD_COMPILE_DEFINITIONS("XNN_PLATFORM_JIT=$<BOOL:${XNNPACK_PLATFORM_JIT}>")
ENDIF()
IF(USE_GNU_SOURCE)
ADD_COMPILE_DEFINITIONS(_GNU_SOURCE)
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()
foreach(FLAG IN ITEMS CMAKE_ASM_FLAGS CMAKE_ASM_COMPILER_ARG1 CMAKE_C_FLAGS CMAKE_C_COMPILER_ARG1 CMAKE_CXX_FLAGS CMAKE_CXX_COMPILER_ARG1)
if(${FLAG})
string(REGEX REPLACE "-mcpu=[-a-zA-Z0-9_.^$*+?]*" "" _tmp ${${FLAG}})
set(${FLAG} ${_tmp})
endif()
endforeach()
# ---[ 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/batch-matrix-multiply-nc.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/dynamic-fully-connected-nc.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/reduce-nd.c
src/operators/resize-bilinear-nchw.c
src/operators/resize-bilinear-nhwc.c
src/operators/rope-nthc.c
src/operators/scaled-dot-product-attention-nhtc.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/batch-matrix-multiply.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-2d.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-sparse.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/reciprocal-square-root.c
src/subgraph/reshape-helpers.c
src/subgraph/scaled-dot-product-attention.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-mean.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/subgraph/reshape-2d.c
src/subgraph/rope.c
src/tensor.c)
SET(LOGGING_SRCS
src/enums/allocation-type.c
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/configs/argmaxpool-config.c
src/configs/avgpool-config.c
src/configs/binary-elementwise-config.c
src/configs/cmul-config.c
src/configs/conv-hwc2chw-config.c
src/configs/dwconv-config.c
src/configs/dwconv2d-chw-config.c
src/configs/experiments-config.c
src/configs/gavgpool-config.c
src/configs/gavgpool-cw-config.c
src/configs/gemm-config.c
src/configs/ibilinear-chw-config.c
src/configs/ibilinear-config.c
src/configs/lut32norm-config.c
src/configs/maxpool-config.c
src/configs/pavgpool-config.c
src/configs/prelu-config.c
src/configs/raddstoreexpminusmax-config.c
src/configs/reduce-config.c
src/configs/rmax-config.c
src/configs/spmm-config.c
src/configs/transpose-config.c
src/configs/unary-elementwise-config.c
src/configs/unpool-config.c
src/configs/vmulcaddc-config.c
src/configs/xx-fill-config.c
src/configs/xx-pad-config.c
src/configs/x8-lut-config.c
src/configs/zip-config.c
src/init.c
src/params.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(PROD_SCALAR_MICROKERNEL_SRCS src/amalgam/gen/scalar.c)
SET(PROD_FMA_MICROKERNEL_SRCS src/amalgam/gen/fma.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 src/amalgam/gen/neonfma-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_NEONDOT_AARCH64_MICROKERNEL_SRCS src/amalgam/gen/neondot-aarch64.c)
SET(PROD_NEONDOTFP16ARITH_MICROKERNEL_SRCS src/amalgam/gen/neondotfp16arith.c)
SET(PROD_NEONDOTFP16ARITH_AARCH64_MICROKERNEL_SRCS src/amalgam/gen/neondotfp16-aarch64.c)
SET(PROD_NEONI8MM_MICROKERNEL_SRCS src/amalgam/gen/neoni8mm.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_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_AVX512VNNI_MICROKERNEL_SRCS src/amalgam/gen/avx512vnni.c)
SET(PROD_AVX512VNNIGFNI_MICROKERNEL_SRCS src/amalgam/gen/avx512vnnigfni.c)
SET(PROD_AVX512AMX_MICROKERNEL_SRCS src/amalgam/gen/avx512amx.c)
SET(PROD_RVV_MICROKERNEL_SRCS src/amalgam/gen/rvv.c)
SET(PROD_RVVFP16ARITH_MICROKERNEL_SRCS src/amalgam/gen/rvvfp16arith.c)
SET(PROD_AVXVNNI_MICROKERNEL_SRCS src/amalgam/gen/avxvnni.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_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()
IF(XNNPACK_ENABLE_ARM_DOTPROD AND XNNPACK_ENABLE_ARM_FP16_VECTOR)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONDOTFP16ARITH_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_I8MM)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONI8MM_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 AND XNNPACK_ENABLE_ARM_DOTPROD)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONDOTFP16ARITH_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_ARM_I8MM)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONI8MM_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 ${AARCH32_JIT_MICROKERNEL_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})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONDOT_AARCH64_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_DOTPROD AND XNNPACK_ENABLE_ARM_FP16_VECTOR)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONDOTFP16ARITH_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONDOTFP16ARITH_AARCH64_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_I8MM)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_NEONI8MM_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 AND XNNPACK_ENABLE_ARM_DOTPROD)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONDOTFP16ARITH_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})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONDOT_AARCH64_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_ARM_I8MM)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_NEONI8MM_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 ${AARCH64_JIT_MICROKERNEL_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_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 PROD_MICROKERNEL_SRCS ${PROD_AVX512VNNI_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX512VNNIGFNI_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_AVX512AMX)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVX512AMX_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_AVXVNNI)
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_AVXVNNI_MICROKERNEL_SRCS})
ENDIF()
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_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})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX512VNNI_MICROKERNEL_SRCS})
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX512VNNIGFNI_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_AVX512AMX)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVX512AMX_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_AVXVNNI)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_AVXVNNI_MICROKERNEL_SRCS})
ENDIF()
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "Hexagon")
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_HEXAGON_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^ppc64")
IF(XNNPACK_ENABLE_VSX)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_PPC64_MICROKERNEL_SRCS})
ENDIF()
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^riscv")
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_FMA_MICROKERNEL_SRCS})
IF(XNNPACK_ENABLE_RISCV_VECTOR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_RVV_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_RVV_MICROKERNEL_SRCS})
ENDIF()
IF(XNNPACK_ENABLE_RISCV_FP16_VECTOR)
LIST(APPEND ALL_MICROKERNEL_SRCS ${ALL_RVVFP16ARITH_MICROKERNEL_SRCS})
LIST(APPEND PROD_MICROKERNEL_SRCS ${PROD_RVVFP16ARITH_MICROKERNEL_SRCS})
ENDIF()
ENDIF()
# ---[ Configure FP16
FIND_PATH(FP16_HDR fp16.h PATH_SUFFIXES include PATHS ${CMAKE_INSTALL_PREFIX})
IF(NOT FP16_HDR)
MESSAGE(FATAL_ERROR "Cannot find fp16")
ENDIF()
ADD_LIBRARY(fp16 INTERFACE)
TARGET_INCLUDE_DIRECTORIES(fp16 INTERFACE ${FP16_HDR})
SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C)
# ---[ Configure pthreadpool
find_package(pthreadpool REQUIRED CONFIG)
set(LIBRARY_NAME tfl-XNNPACK${LIBRARY_POSTFIX})
IF(XNNPACK_LIBRARY_TYPE STREQUAL "default")
ADD_LIBRARY(${LIBRARY_NAME} ${XNNPACK_SRCS})
ELSEIF(XNNPACK_LIBRARY_TYPE STREQUAL "shared")
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${XNNPACK_SRCS})
ELSEIF(XNNPACK_LIBRARY_TYPE STREQUAL "static")
ADD_LIBRARY(${LIBRARY_NAME} STATIC ${XNNPACK_SRCS})
ELSE()
MESSAGE(FATAL_ERROR "Unsupported XNNPACK library type \"${XNNPACK_LIBRARY_TYPE}\". Must be \"static\", \"shared\", or \"default\"")
ENDIF()
TARGET_COMPILE_DEFINITIONS(${LIBRARY_NAME} PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:4>$<$<NOT:$<CONFIG:Debug>>:0>")
IF(XNNPACK_BUILD_ALL_MICROKERNELS)
target_sources(${LIBRARY_NAME} PRIVATE ${ALL_MICROKERNEL_SRCS} ${TABLE_SRCS})
ENDIF()
target_sources(${LIBRARY_NAME} PRIVATE
src/configs/hardware-config.c
${PROD_MICROKERNEL_SRCS}
${TABLE_SRCS}
src/indirection.c
${LOGGING_SRCS}
src/cache.c
src/allocator.c
src/memory.c
src/microparams-init.c
src/normalization.c
src/packing.c
src/microkernel-utils.c
src/mutex.c
${OPERATOR_SRCS}
src/operator-run.c
src/operator-utils.c
${SUBGRAPH_SRCS}
src/operators/post-operation.c
)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES C_EXTENSIONS YES)
find_library(LIBM m)
if(LIBM)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PRIVATE ${LIBM})
endif()
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PUBLIC
${libcpuinfo_LIBRARIES}
pthreadpool::pthreadpool
pthreadpool::fxdiv
fp16
)
TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/include
src
${libcpuinfo_INCLUDE_DIRS})
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 ${ALL_NEONDOTFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfp16-format=ieee ")
SET_PROPERTY(SOURCE ${PROD_NEONDOTFP16ARITH_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_NEONDOTFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod+fp16 -mfpu=neon-fp-armv8 -fno-math-errno -ffinite-math-only ")
SET_PROPERTY(SOURCE ${PROD_NEONDOTFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod+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 ${ALL_NEONI8MM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+i8mm+fp16 -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${PROD_NEONI8MM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+i8mm+fp16 -mfpu=neon-fp-armv8 ")
SET_PROPERTY(SOURCE ${AARCH32_ASM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod+fp16 -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_NEONDOTFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mfloat-abi=softfp ")
SET_PROPERTY(SOURCE ${PROD_NEONDOTFP16ARITH_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_NEONDOTFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod+fp16 ")
SET_PROPERTY(SOURCE ${PROD_NEONDOTFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod+fp16 ")
SET_PROPERTY(SOURCE ${PROD_NEONDOTFP16ARITH_AARCH64_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod+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 ${ALL_NEONDOT_AARCH64_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod ")
SET_PROPERTY(SOURCE ${PROD_NEONDOT_AARCH64_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+dotprod ")
SET_PROPERTY(SOURCE ${ALL_NEONI8MM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+i8mm+fp16 ")
SET_PROPERTY(SOURCE ${PROD_NEONI8MM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+i8mm+fp16 ")
SET_PROPERTY(SOURCE ${AARCH64_ASM_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv8.2-a+fp16+dotprod ")
ENDIF()
IF(XNNPACK_TARGET_PROCESSOR MATCHES "^ppc64")
IF(XNNPACK_ENABLE_VSX)
SET_PROPERTY(SOURCE ${ALL_PPC_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mvsx ")
ENDIF()
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 -mabi=lp64d ")
SET_PROPERTY(SOURCE ${PROD_RVV_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=rv64gcv -mabi=lp64d ")
ENDIF()
SET_PROPERTY(SOURCE ${ALL_RVVFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=rv64gc_zvfh -mabi=lp64d ")
SET_PROPERTY(SOURCE ${PROD_RVVFP16ARITH_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=rv64gc_zvfh -mabi=lp64d ")
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_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 ")
SET_PROPERTY(SOURCE ${ALL_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${PROD_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX512 ")
SET_PROPERTY(SOURCE ${ALL_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX2 ")
SET_PROPERTY(SOURCE ${PROD_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " /arch:AVX2 ")
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse -clang:-mno-sse2 ")
SET_PROPERTY(SOURCE ${PROD_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse -clang:-mno-sse2 ")
SET_PROPERTY(SOURCE ${ALL_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse2 -clang:-mno-sse3 ")
SET_PROPERTY(SOURCE ${PROD_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse2 -clang:-mno-sse3 ")
SET_PROPERTY(SOURCE ${ALL_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mssse3 -clang:-mno-sse4.1 ")
SET_PROPERTY(SOURCE ${PROD_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mssse3 -clang:-mno-sse4.1 ")
SET_PROPERTY(SOURCE ${ALL_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse4.1 -clang:-mno-sse4.2 ")
SET_PROPERTY(SOURCE ${PROD_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-msse4.1 -clang:-mno-sse4.2 ")
SET_PROPERTY(SOURCE ${ALL_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mavx -clang:-mno-avx2 -clang:-mno-fma -clang:-mno-f16c ")
SET_PROPERTY(SOURCE ${PROD_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mavx -clang:-mno-avx2 -clang:-mno-fma -clang:-mno-f16c ")
SET_PROPERTY(SOURCE ${ALL_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mno-avx2 -clang:-mno-fma ")
SET_PROPERTY(SOURCE ${PROD_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mno-avx2 -clang:-mno-fma ")
SET_PROPERTY(SOURCE ${ALL_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mno-avx2 ")
SET_PROPERTY(SOURCE ${PROD_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mno-avx2 ")
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_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx2 -clang:-mavxvnni ")
SET_PROPERTY(SOURCE ${PROD_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx2 -clang:-mavxvnni ")
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:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl ")
SET_PROPERTY(SOURCE ${PROD_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl ")
SET_PROPERTY(SOURCE ${ALL_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -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:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vbmi ")
SET_PROPERTY(SOURCE ${ALL_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vnni ")
SET_PROPERTY(SOURCE ${PROD_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vnni ")
SET_PROPERTY(SOURCE ${ALL_AVX512VNNIGFNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vnni -clang:-mgfni ")
SET_PROPERTY(SOURCE ${PROD_AVX512VNNIGFNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vnni -clang:-mgfni ")
SET_PROPERTY(SOURCE ${ALL_AVX512AMX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vnni -clang:-mgfni -clang:-mamx-tile -clang:-mamx-int8 ")
SET_PROPERTY(SOURCE ${PROD_AVX512AMX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -clang:-mf16c -clang:-mfma -clang:-mavx512f -clang:-mavx512cd -clang:-mavx512bw -clang:-mavx512dq -clang:-mavx512vl -clang:-mavx512vnni -clang:-mgfni -clang:-mamx-tile -clang:-mamx-int8 ")
ENDIF()
ELSE()
SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse -mno-sse2 ")
SET_PROPERTY(SOURCE ${PROD_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse -mno-sse2 ")
SET_PROPERTY(SOURCE ${ALL_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse2 -mno-sse3 ")
SET_PROPERTY(SOURCE ${PROD_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse2 -mno-sse3 ")
SET_PROPERTY(SOURCE ${ALL_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mssse3 -mno-sse4.1 ")
SET_PROPERTY(SOURCE ${PROD_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mssse3 -mno-sse4.1 ")
SET_PROPERTY(SOURCE ${ALL_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse4.1 -mno-sse4.2 ")
SET_PROPERTY(SOURCE ${PROD_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse4.1 -mno-sse4.2 ")
SET_PROPERTY(SOURCE ${ALL_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mavx -mno-avx2 -mno-fma -mno-f16c ")
SET_PROPERTY(SOURCE ${PROD_AVX_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mavx -mno-avx2 -mno-fma -mno-f16c ")
SET_PROPERTY(SOURCE ${ALL_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mno-avx2 -mno-fma ")
SET_PROPERTY(SOURCE ${PROD_F16C_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mno-avx2 -mno-fma ")
SET_PROPERTY(SOURCE ${ALL_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mfma -mno-avx2 ")
SET_PROPERTY(SOURCE ${PROD_FMA3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mf16c -mfma -mno-avx2 ")
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_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx2 -mavxvnni ")
SET_PROPERTY(SOURCE ${PROD_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx2 -mavxvnni ")
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 " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl ")
SET_PROPERTY(SOURCE ${PROD_AVX512SKX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl ")
SET_PROPERTY(SOURCE ${ALL_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi ")
SET_PROPERTY(SOURCE ${PROD_AVX512VBMI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi ")
SET_PROPERTY(SOURCE ${ALL_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni ")
SET_PROPERTY(SOURCE ${PROD_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni ")
SET_PROPERTY(SOURCE ${ALL_AVX512VNNIGFNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni -mgfni ")
SET_PROPERTY(SOURCE ${PROD_AVX512VNNIGFNI_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni -mgfni ")
SET_PROPERTY(SOURCE ${ALL_AVX512AMX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni -mgfni -mamx-tile -mamx-int8 ")
SET_PROPERTY(SOURCE ${PROD_AVX512AMX_MICROKERNEL_SRCS} APPEND_STRIDE PROPERTY COMPILE_FLAGS " -mf16c -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni -mgfni -mamx-tile -mamx-int8 ")
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 ")
SET_PROPERTY(SOURCE ${ALL_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${PROD_AVX512VNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${ALL_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
SET_PROPERTY(SOURCE ${PROD_AVXVNNI_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-asynchronous-unwind-tables ")
ENDIF()
ENDIF()
ENDIF()
#TARGET_COMPILE_DEFINITIONS(jit PRIVATE "XNN_LOG_LEVEL=$<$<CONFIG:Debug>:4>$<$<NOT:$<CONFIG:Debug>>:0>")
find_package(PkgConfig)
pkg_check_modules(libcpuinfo REQUIRED libcpuinfo)
ADD_DEFINITIONS("-DXNN_ENABLE_CPUINFO=1")
#TARGET_INCLUDE_DIRECTORIES(jit PRIVATE include src)
IF(XNNPACK_BUILD_LIBRARY)
TARGET_INCLUDE_DIRECTORIES(${LIBRARY_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
IF(WIN32)
# Target Windows 7+ API
TARGET_COMPILE_DEFINITIONS(${LIBRARY_NAME} PRIVATE _WIN32_WINNT=0x0601)
ENDIF()
SET_PROPERTY(TARGET ${LIBRARY_NAME} PROPERTY PUBLIC_HEADER include/tfl-xnnpack.h include/experiments-config.h)
ENDIF()
INSTALL(TARGETS ${LIBRARY_NAME} fp16
EXPORT ${LIBRARY_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
EXPORT ${LIBRARY_NAME}Targets
FILE ${LIBRARY_NAME}Targets.cmake
DESTINATION lib/cmake/${LIBRARY_NAME}
NAMESPACE tfl-XNNPACK::
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/${LIBRARY_NAME}ConfigVersion.cmake
VERSION 1.1.0
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
cmake/tfl-XNNPACKConfig.cmake.in
${CMAKE_BINARY_DIR}/${LIBRARY_NAME}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${LIBRARY_NAME}
)
install(
FILES "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}ConfigVersion.cmake" "${CMAKE_BINARY_DIR}/${LIBRARY_NAME}Config.cmake"
DESTINATION lib/cmake/${LIBRARY_NAME}
COMPONENT Devel
)
include(cmake/testing.cmake)
include(cmake/benchmark.cmake)
message("Will be building ${LIBRARY_NAME}")