-
Notifications
You must be signed in to change notification settings - Fork 224
/
CMakeLists.txt
940 lines (869 loc) · 38.6 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
################################################################################
#
# MIT License
#
# Copyright (c) 2017 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
################################################################################
cmake_policy(SET CMP0057 NEW)
include(ExportHeader)
if(MIOPEN_ENABLE_SQLITE)
add_subdirectory(sqlite)
endif()
# Truncation rounding or (default) rounding to nearest even (RNE) is enabled.
# This switch controls two related but different aspects of MIOpen behavior
# 1. How host code performs conversions of float to bfloat16, important only
# for testing.
# 2. How BF16 kernels (which are kind of mixed-precision now and expected to
# remain in the future) perform final conversion (and rounding) of FP32
# to BF16 results. This affects the main functionality of the library.
option( MIOPEN_USE_RNE_BFLOAT16 "Sets rounding scheme for bfloat16 type" ON )
option( MIOPEN_FP8_IEEE_EXPONENT_BIAS "Sets the FP8 exponent bias to IEEE" ON)
option( MIOPEN_FP8_CLIPPING "Sets the FP8 clipping" ON)
set ( MIOPEN_DEFAULT_FIND_MODE "DynamicHybrid" CACHE STRING "Sets the default find mode")
set_property(CACHE MIOPEN_DEFAULT_FIND_MODE PROPERTY STRINGS
Normal Fast Hybrid FastHybrid DynamicHybrid)
option( MIOPEN_FP8_CLIPPING "Sets the FP8 clipping" ON)
configure_file("${PROJECT_SOURCE_DIR}/include/miopen/config.h.in" "${PROJECT_BINARY_DIR}/include/miopen/config.h")
# configure a header file to pass the CMake version settings to the source, and package the header files in the output archive
configure_file( "${PROJECT_SOURCE_DIR}/include/miopen/version.h.in" "${PROJECT_BINARY_DIR}/include/miopen/version.h" )
if(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY)
#Copy header to Build Dir for generating backward compatibility
configure_file( "${PROJECT_SOURCE_DIR}/include/miopen/miopen.h" "${PROJECT_BINARY_DIR}/include/miopen/miopen.h" )
endif()
message( STATUS "MIOpen_VERSION= ${MIOpen_VERSION}" )
message( STATUS "CMAKE_BUILD_TYPE= ${CMAKE_BUILD_TYPE}" )
# This is incremented when the ABI to the library changes
set( MIOpen_SOVERSION 1.0 )
function(add_kernels FILE_NAME VAR_PREFIX VAR_SUFFIX KERNEL_FILES)
set(INIT_KERNELS_LIST)
set(KERNELS_DECLS)
foreach(KERNEL_FILE ${KERNEL_FILES})
if("${CMAKE_VERSION}" VERSION_LESS 3.0)
configure_file(${KERNEL_FILE} ${KERNEL_FILE}.delete)
else()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${KERNEL_FILE})
endif()
get_filename_component(KERNEL_FILENAME ${KERNEL_FILE} NAME)
get_filename_component(BASE_NAME ${KERNEL_FILE} NAME_WE)
string(TOUPPER "${BASE_NAME}" KEY_NAME)
string(MAKE_C_IDENTIFIER "${KEY_NAME}" VAR_NAME)
string(APPEND KERNELS_DECLS "extern const size_t ${VAR_PREFIX}${VAR_NAME}${VAR_SUFFIX}_SIZE;\n")
string(APPEND KERNELS_DECLS "extern const unsigned char ${VAR_PREFIX}${VAR_NAME}${VAR_SUFFIX}[];\n")
list(APPEND INIT_KERNELS_LIST " { \"${KERNEL_FILENAME}\", std::string(reinterpret_cast<const char*>(${VAR_PREFIX}${VAR_NAME}${VAR_SUFFIX}), ${VAR_PREFIX}${VAR_NAME}${VAR_SUFFIX}_SIZE) }")
endforeach()
string(REPLACE ";" ",\n" INIT_KERNELS "${INIT_KERNELS_LIST}")
configure_file(kernels/${FILE_NAME}.in ${PROJECT_BINARY_DIR}/${FILE_NAME})
endfunction()
set( MIOpen_Source
activ/problem_description.cpp
activ_api.cpp
api/find2_0_commons.cpp
batch_norm.cpp
batch_norm_api.cpp
batchnorm/problem_description.cpp
buffer_info.cpp
check_numerics.cpp
conv/invokers/gcn_asm_1x1u.cpp
conv/invokers/gcn_asm_1x1u_ss.cpp
conv/invokers/gcn_asm_1x1u_us.cpp
conv/invokers/gen_x_w_y_pad.cpp
conv/invokers/impl_gemm.cpp
conv/invokers/impl_gemm_dynamic.cpp
conv/invokers/ocl_wrw_rdc.cpp
conv/problem_description.cpp
conv/solver_finders.cpp
conv_algo_name.cpp
convolution.cpp
convolution_api.cpp
ctc.cpp
ctc_api.cpp
db.cpp
db_record.cpp
driver_arguments.cpp
dropout.cpp
dropout_api.cpp
execution_context.cpp
expanduser.cpp
find_controls.cpp
find_db.cpp
fused_api.cpp
fusion.cpp
fusion/problem_description.cpp
generic_search.cpp
handle_api.cpp
invoker_cache.cpp
kernel_build_params.cpp
kernel_warnings.cpp
load_file.cpp
lock_file.cpp
logger.cpp
layernorm_api.cpp
lrn_api.cpp
op_args.cpp
operator.cpp
performance_config.cpp
pooling/problem_description.cpp
pooling_api.cpp
problem.cpp
ramdb.cpp
readonlyramdb.cpp
reducetensor.cpp
reducetensor_api.cpp
rnn.cpp
rnn_api.cpp
rnn/rnn_util.cpp
rnn/Solutions/rnn_transformer.cpp
softmax_api.cpp
solution.cpp
solver.cpp
solver/activ/bwd_0.cpp
solver/activ/bwd_1.cpp
solver/activ/fwd_0.cpp
solver/activ/fwd_1.cpp
solver/batchnorm/backward_ck.cpp
solver/batchnorm/backward_per_activation.cpp
solver/batchnorm/backward_per_activation_fused.cpp
solver/batchnorm/backward_spatial_multiple.cpp
solver/batchnorm/backward_spatial_single.cpp
solver/batchnorm/forward_inference.cpp
solver/batchnorm/forward_inference_ck.cpp
solver/batchnorm/forward_inference_fused.cpp
solver/batchnorm/forward_per_activation.cpp
solver/batchnorm/forward_per_activation_fused.cpp
solver/batchnorm/forward_spatial_multiple.cpp
solver/batchnorm/forward_spatial_single.cpp
solver/batchnorm/forward_training_ck.cpp
solver/conv_asm_1x1u.cpp
solver/conv_asm_1x1u_bias_activ_fused.cpp
solver/conv_asm_1x1u_stride2.cpp
solver/conv_asm_3x3u.cpp
solver/conv_asm_5x10u2v2b1.cpp
solver/conv_asm_5x10u2v2f1.cpp
solver/conv_asm_7x7c3h224w224k64u2v2p3q3f1.cpp
solver/conv_asm_dir_BwdWrW1x1.cpp
solver/conv_asm_dir_BwdWrW3x3.cpp
solver/conv_asm_implicit_gemm_bwd_v4r1_dynamic.cpp
solver/conv_asm_implicit_gemm_gtc_bwd.cpp
solver/conv_asm_implicit_gemm_gtc_bwd_nhwc.cpp
solver/conv_asm_implicit_gemm_gtc_fwd.cpp
solver/conv_asm_implicit_gemm_gtc_fwd_nhwc.cpp
solver/conv_asm_implicit_gemm_gtc_fwd_nchwc.cpp
solver/conv_asm_implicit_gemm_gtc_perf_config.cpp
solver/conv_asm_implicit_gemm_gtc_wrw_nhwc.cpp
solver/conv_asm_implicit_gemm_v4r1_dynamic.cpp
solver/conv_asm_implicit_gemm_wrw_gtc_dynamic_xdlops.cpp
solver/conv_asm_implicit_gemm_wrw_v4r1_dynamic.cpp
solver/conv_bin_wino3x3U.cpp
solver/conv_bin_winoRxS.cpp
solver/conv_bin_winoRxS_fused.cpp
solver/conv_ck_igemm_fwd_v6r1_dlops_nchw.cpp
solver/conv_ck_igemm_fwd_bias_activ_fused.cpp
solver/conv_direct_naive_conv.cpp
solver/conv_direct_naive_conv_bwd.cpp
solver/conv_direct_naive_conv_fwd.cpp
solver/conv_direct_naive_conv_wrw.cpp
solver/conv_hip_implicit_gemm_bwd_data_xdlops.cpp
solver/conv_hip_implicit_gemm_bwd_v1r1.cpp
solver/conv_hip_implicit_gemm_bwd_v1r1_xdlops.cpp
solver/conv_hip_implicit_gemm_bwd_v4r1.cpp
solver/conv_hip_implicit_gemm_bwd_v4r1_xdlops.cpp
solver/conv_hip_implicit_gemm_fwd_v4r1.cpp
solver/conv_hip_implicit_gemm_fwd_v4r4.cpp
solver/conv_hip_implicit_gemm_fwd_v4r4_xdlops.cpp
solver/conv_hip_implicit_gemm_fwd_v4r4_xdlops_padded_gemm.cpp
solver/conv_hip_implicit_gemm_fwd_v4r5_xdlops.cpp
solver/conv_hip_implicit_gemm_fwd_xdlops.cpp
solver/conv_hip_implicit_gemm_grouped_fwd_xdlops.cpp
solver/conv_hip_implicit_gemm_3d_grouped_fwd_xdlops.cpp
solver/conv_hip_implicit_gemm_3d_grouped_wrw_xdlops.cpp
solver/conv_hip_implicit_gemm_3d_grouped_bwd_xdlops.cpp
solver/conv_hip_implicit_gemm_nonxdlops_common.cpp
solver/conv_hip_implicit_gemm_wrw_v4r4.cpp
solver/conv_hip_implicit_gemm_wrw_v4r4_xdlops.cpp
solver/conv_hip_implicit_gemm_wrw_v4r4_xdlops_padded_gemm.cpp
solver/conv_mlir_igemm_bwd.cpp
solver/conv_mlir_igemm_bwd_xdlops.cpp
solver/conv_mlir_igemm_fwd.cpp
solver/conv_mlir_igemm_fwd_xdlops.cpp
solver/conv_mlir_igemm_wrw.cpp
solver/conv_mlir_igemm_wrw_xdlops.cpp
solver/conv_MP_bidirectional_winograd.cpp
solver/conv_multipass_wino3x3WrW.cpp
solver/conv_ocl_dir2D_bwdWrW_1x1.cpp
solver/conv_ocl_dir2D_bwdWrW_2.cpp
solver/conv_ocl_dir2D_bwdWrW_53.cpp
solver/conv_ocl_dir2D11x11.cpp
solver/conv_ocl_dir2Dfwd.cpp
solver/conv_ocl_dir2Dfwd_fused.cpp
solver/conv_ocl_dir2Dfwd_exhaustive_search.cpp
solver/conv_ocl_dir2Dfwd1x1.cpp
solver/conv_ocl_dir2Dfwdgen.cpp
solver/conv_wino_fury_RxS.cpp
solver/conv_winoRxS.cpp
solver/conv_winoRxS_fused.cpp
solver/fft.cpp
solver/gemm.cpp
solver/gemm_bwd.cpp
solver/gemm_common.cpp
solver/gemm_wrw.cpp
solver/pooling/forward2d.cpp
solver/pooling/forwardNaive.cpp
solver/pooling/forwardNd.cpp
solver/pooling/backward2d.cpp
solver/pooling/backwardNd.cpp
subbuffers.cpp
target_properties.cpp
temp_file.cpp
tensor.cpp
tensor_api.cpp
seq_tensor.cpp
)
if(MIOPEN_ENABLE_AI_KERNEL_TUNING OR MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
list(APPEND MIOpen_Source conv/heuristics/ai_heuristics.cpp)
list(APPEND MIOpen_Source anyramdb.cpp)
endif()
list(APPEND MIOpen_Source tmp_dir.cpp binary_cache.cpp md5.cpp)
if(MIOPEN_ENABLE_SQLITE)
list(APPEND MIOpen_Source sqlite_db.cpp)
endif()
if(MIOPEN_ENABLE_SQLITE AND MIOPEN_ENABLE_SQLITE_KERN_CACHE)
list(APPEND MIOpen_Source kern_db.cpp bz2.cpp)
endif()
if( MIOPEN_BACKEND MATCHES "OpenCL" OR MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPNOGPU")
file(GLOB_RECURSE STATIC_COMPOSABLE_KERNEL_INCLUDE "kernels/static_composable_kernel/include/*/*.hpp")
file(GLOB_RECURSE STATIC_COMPOSABLE_KERNEL_SOURCE "kernels/static_composable_kernel/src/*/*.cpp")
file(GLOB_RECURSE COMPOSABLE_KERNEL_INCLUDE "composable_kernel/composable_kernel/include/*.hpp")
file(GLOB_RECURSE COMPOSABLE_KERNEL_SOURCE "composable_kernel/composable_kernel/src/*.cpp")
file(GLOB_RECURSE COMPOSABLE_KERNEL_DYNAMIC_ASM_SOURCE "kernels/dynamic_igemm/*.s")
file(GLOB_RECURSE COMPOSABLE_KERNEL_DYNAMIC_ASM_INCLUDE "kernels/dynamic_igemm/*.inc")
file(GLOB_RECURSE COMPOSABLE_KERNEL_DYNAMIC_CPP_SOURCE "kernels/dynamic_igemm/*.cpp")
file(GLOB_RECURSE GPU_REFERENCE_KERNEL_HIP "kernels/gpu_reference_kernel/*.cpp")
file(GLOB_RECURSE GPU_REFERENCE_KERNEL_ASM "kernels/gpu_reference_kernel/*.s")
file(GLOB_RECURSE GPU_BATCHED_TRANSPOSE_KERNEL_HIP "kernels/gpu_batched_transpose_kernel/*.cpp")
file(GLOB_RECURSE GPU_GENERAL_TENSOR_REORDER_KERNEL_HIP_INCLUDE "kernels/gpu_general_tensor_reorder_kernel/*.hpp")
file(GLOB_RECURSE GPU_GENERAL_TENSOR_REORDER_KERNEL_HIP_SOURCE "kernels/gpu_general_tensor_reorder_kernel/*.cpp")
set(MIOPEN_KERNEL_INCLUDES
${STATIC_COMPOSABLE_KERNEL_INCLUDE}
${COMPOSABLE_KERNEL_INCLUDE}
${COMPOSABLE_KERNEL_DYNAMIC_ASM_INCLUDE}
${GPU_GENERAL_TENSOR_REORDER_KERNEL_HIP_INCLUDE}
include/miopen/implicitgemm_params.hpp
kernels/gpu_reference_kernel/fp8_kern_types.h
kernels/Conv_Winograd_v13_3_12_fp16dot_stride1.inc
kernels/Conv_Winograd_v13_3_12_fp16dot_stride2_dec.inc
kernels/Conv_Winograd_v13_3_12_fp16dot_stride2_dil.inc
kernels/Conv_Winograd_v14_3_3_fp16dot_stride1.inc
kernels/Conv_Winograd_v14_3_3_fp16dot_stride2_dec.inc
kernels/Conv_Winograd_v14_3_3_fp16dot_stride2_dil.inc
kernels/Conv_Winograd_v13_3_12_epilogue.inc
kernels/Conv_Winograd_v13_3_12_prologue.inc
kernels/Conv_Winograd_v16_5_0_epilogue.inc
kernels/Conv_Winograd_v16_5_0_prologue.inc
kernels/Conv_Winograd_v16_5_0_stride1.inc
kernels/conv_3x3_wheel_alpha_v9_2_7_epilogue.inc
kernels/conv_3x3_wheel_alpha_v9_2_7_prologue.inc
kernels/conv_3x3_wheel_alpha_v9_2_7_gfx8_stride_2_dec.inc
kernels/conv_3x3_wheel_alpha_v9_2_7_gfx8.inc
kernels/conv_3x3_wheel_alpha_v3_0b_epilogue.inc
kernels/conv_3x3_wheel_alpha_v3_0b_prologue.inc
kernels/conv_3x3_wheel_alpha_v3_0b.inc
kernels/conv_3x3_wheel_alpha_v7_0_3b_epilogue.inc
kernels/conv_3x3_wheel_alpha_v7_0_3b_prologue.inc
kernels/conv_3x3_wheel_alpha_v7_0_3b.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_epilogue.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_prologue.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_gfx8_stride_2_dil.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_gfx8_stride_2_dec.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_gfx8.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_gfx9_stride_2_dil.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_gfx9_stride_2_dec.inc
kernels/conv_3x3_wheel_alpha_v9_0_15_gfx9.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp16_dot2_edc_f2x3_dilation2.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp16_dot2_edc_f2x3_stride1.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp16_dot2_edc_f2x3_stride2.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp16_dot2_edc_f3x2_stride1.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp32_f2x3_dilation2.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp32_f2x3_stride1.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp32_f2x3_stride2.inc
kernels/Conv_Winograd_v21_1_3_gfx9_fp32_f3x2_stride1.inc
kernels/Conv_Winograd_v21_1_3_metadata.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp16_dot2_edc_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp16_dot2_edc_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp16_dot2_edc_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp32_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp32_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp32_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp16_dot2_edc_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp16_dot2_edc_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp16_dot2_edc_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp32_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp32_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp32_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp16_dot2_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp16_dot2_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp16_dot2_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp32_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp32_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp32_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp16_dot2_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp16_dot2_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp16_dot2_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp32_f2x3_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp32_f2x3_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp32_f2x3_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp16_dot2_edc_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp16_dot2_edc_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp16_dot2_edc_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp32_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp32_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx94x_fp32_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp16_dot2_edc_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp16_dot2_edc_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp16_dot2_edc_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp32_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp32_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx9_fp32_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp16_dot2_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp16_dot2_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp16_dot2_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp32_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp32_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx10_fp32_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp16_dot2_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp16_dot2_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp16_dot2_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp32_f3x2_dilation2.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp32_f3x2_stride1.inc
kernels/Conv_Winograd_v30_3_1_gfx11_fp32_f3x2_stride2.inc
kernels/Conv_Winograd_v30_3_1_metadata.inc
kernels/xform_bidirect_winograd_code.inc
kernels/rocm_version.inc
kernels/inst_wrappers.inc
kernels/conv_common.inc
kernels/utilities.inc
kernels/xform_data_filter.inc
kernels/xform_kd_cov2.inc
kernels/xform_metadata.inc
kernels/neuron.inc
kernels/conv_sizes.inc
kernels/gpr_alloc.inc
kernels/bfloat16_dev.hpp
kernels/float_types.h
kernels/workaround_issue_1431.hpp
kernels/hip_f8_impl.hpp
kernels/hip_float8.hpp
kernels/stride_array.hpp
)
set(MIOPEN_KERNELS
${STATIC_COMPOSABLE_KERNEL_SOURCE}
${COMPOSABLE_KERNEL_SOURCE}
${COMPOSABLE_KERNEL_DYNAMIC_ASM_SOURCE}
${COMPOSABLE_KERNEL_DYNAMIC_CPP_SOURCE}
${GPU_REFERENCE_KERNEL_HIP}
${GPU_REFERENCE_KERNEL_ASM}
${GPU_BATCHED_TRANSPOSE_KERNEL_HIP}
${GPU_GENERAL_TENSOR_REORDER_KERNEL_HIP_SOURCE}
kernels/detect_llvm_amdgcn_buffer_atomic_fadd_f32_float.cpp
kernels/MIOpenCheckNumerics.cpp
kernels/MIOpenBatchNormActivBwdPerAct.cl
kernels/MIOpenBatchNormActivBwdSpatial.cl
kernels/MIOpenBatchNormActivFwdTrainPerAct.cl
kernels/MIOpenBatchNormActivFwdTrainSpatial.cl
kernels/MIOpenBatchNormFwdTrainSpatial.cl
kernels/MIOpenBatchNormFwdTrainPerAct.cl
kernels/MIOpenBatchNormFwdInferSpatial.cl
kernels/MIOpenBatchNormFwdInferPerAct.cl
kernels/MIOpenBatchNormBwdSpatial.cl
kernels/MIOpenBatchNormBwdPerAct.cl
kernels/MIOpenConvDirUni.cl
kernels/MIOpenConvDirBatchNormActiv.cl
kernels/MIOpenConvDirGenFwd.cl
kernels/MIOpenLayerNorm.cpp
kernels/MIOpenLRNBwd.cl
kernels/MIOpenLRNFwd.cl
kernels/MIOpenNeuron.cl
kernels/MIOpenPooling.cl
kernels/MIOpenPoolingBwd.cl
kernels/MIOpenPoolingBwdND.cl
kernels/MIOpenPoolingForwardNaive.cl
kernels/MIOpenPoolingND.cl
kernels/MIOpenConv1x1S.cl
kernels/MIOpenConv1x1J1.cl
kernels/MIOpenConv1x1J1_stride.cl
kernels/MIOpenSoftmax.cl
kernels/MIOpenUtilKernels3.cl
kernels/MIOpenUtilKernels4.cl
kernels/MIOpenUtilKernels5.cl
kernels/MIOpenIm2d2Col.cl
kernels/MIOpenIm3d2Col.cl
kernels/MIOpenCol2Im2d.cl
kernels/MIOpenCol2Im3d.cl
kernels/MIOpenConvBwdWrWS2.cl
kernels/MIOpenGroupConvBwdWrWS2.cl
kernels/MIOpenConvBwdWrW_LxG_P53.cl
kernels/MIOpenGroupConvBwdWrW_LxG_P53.cl
kernels/MIOpenConvBwdWrW_LxG_5x5.cl
kernels/MIOpenConvBwdWrW1x1_PAD_read4.cl
kernels/MIOpenConvFwd_LxL_11.cl
kernels/MIOpenConvFFT.cl
kernels/MIOpenRNNHiddenStateUpdate.cl
kernels/bugzilla_34765_detect.s
kernels/dummy_kernel.s
kernels/conv3x3.s
kernels/conv1x1u.s
kernels/conv1x1u_stride2.s
kernels/conv1x1u_bias_activ.s
kernels/conv3x3wrw.s
kernels/conv1x1wrw.s
kernels/conv5x10u2v2f1.s
kernels/conv5x10u2v2b1.s
kernels/conv7x7c3h224w224k64u2v2p3q3f1.s
kernels/xform_out.s
kernels/gcnAsmBNBwdTrainSpatial.s
kernels/MIOpenTensorKernels.cl
kernels/MIOpenTensorKernelsHip.cpp
kernels/MIOpenSubTensorOpWithScalarKernel.cl
kernels/MIOpenSubTensorOpWithSubTensorKernel.cl
kernels/MIOpenSubTensorOpWithCastTensorKernel.cl
kernels/MIOpenSubTensorOpWithTransformKernel.cl
kernels/Conv_Winograd_v13_3_12_fp16dot_stride1.s
kernels/Conv_Winograd_v13_3_12_fp16dot_stride2_dec.s
kernels/Conv_Winograd_v13_3_12_fp16dot_stride2_dil.s
kernels/Conv_Winograd_v14_3_3_fp16dot_stride1.s
kernels/Conv_Winograd_v14_3_3_fp16dot_stride2_dec.s
kernels/Conv_Winograd_v14_3_3_fp16dot_stride2_dil.s
kernels/Conv_Winograd_v16_5_0_stride1.s
kernels/conv_3x3_wheel_alpha_v9_0_15_stride_2_dil.s
kernels/conv_3x3_wheel_alpha_v9_0_15_stride_2_dec.s
kernels/conv_3x3_wheel_alpha_v9_0_15.s
kernels/conv_3x3_wheel_alpha_v7_0_3b.s
kernels/conv_3x3_wheel_alpha_v3_0b.s
kernels/conv_3x3_wheel_alpha_v9_2_7.s
kernels/conv_3x3_wheel_alpha_v9_2_7_stride_2_dec.s
kernels/Conv_Winograd_v21_1_3_fp16_dot2_f2x3_dilation2.s
kernels/Conv_Winograd_v21_1_3_fp16_dot2_f2x3_stride1.s
kernels/Conv_Winograd_v21_1_3_fp16_dot2_f2x3_stride2.s
kernels/Conv_Winograd_v21_1_3_fp16_dot2_f3x2_stride1.s
kernels/Conv_Winograd_v21_1_3_fp32_f2x3_dilation2.s
kernels/Conv_Winograd_v21_1_3_fp32_f2x3_stride1.s
kernels/Conv_Winograd_v21_1_3_fp32_f2x3_stride2.s
kernels/Conv_Winograd_v21_1_3_fp32_f3x2_stride1.s
kernels/Conv_Winograd_v30_3_1_fp16_dot2_f2x3_dilation2.s
kernels/Conv_Winograd_v30_3_1_fp16_dot2_f2x3_stride1.s
kernels/Conv_Winograd_v30_3_1_fp16_dot2_f2x3_stride2.s
kernels/Conv_Winograd_v30_3_1_fp32_f2x3_dilation2.s
kernels/Conv_Winograd_v30_3_1_fp32_f2x3_stride1.s
kernels/Conv_Winograd_v30_3_1_fp32_f2x3_stride2.s
kernels/Conv_Winograd_v30_3_1_fp16_dot2_f3x2_dilation2.s
kernels/Conv_Winograd_v30_3_1_fp16_dot2_f3x2_stride1.s
kernels/Conv_Winograd_v30_3_1_fp16_dot2_f3x2_stride2.s
kernels/Conv_Winograd_v30_3_1_fp32_f3x2_dilation2.s
kernels/Conv_Winograd_v30_3_1_fp32_f3x2_stride1.s
kernels/Conv_Winograd_v30_3_1_fp32_f3x2_stride2.s
kernels/Conv_Winograd_Fury_v1_1_1_fp16_fp16acc_f2x3_stride1.s
kernels/MIOpenConvBwdBias.cl
kernels/MIOpenBatchNormActivInfer.cl
kernels/MIOpenCTCLoss.cl
kernels/MIOpenDropout.cl
kernels/xform_data.s
kernels/xform_filter.s
kernels/xform_bidirect_winograd_data.s
kernels/xform_bidirect_winograd_filter.s
kernels/xform_bidirect_winograd_out.s
kernels/UniversalTranspose.cl)
# Kernels in development lists.
# Should be ALWAYS empty in develop branch (at the time of PR merge)
# Intention: to speed up kernel development rebuild time
set(MIOPEN_DEVELOPMENT_KERNELS)
# Only referenced by MIOPEN_DEVELOPMENT_KERNELS
set(MIOPEN_DEVELOPMENT_KERNEL_INCLUDES)
LIST(LENGTH MIOPEN_DEVELOPMENT_KERNELS MIOPEN_DEVELOPMENT_KERNELS_COUNT)
LIST(LENGTH MIOPEN_DEVELOPMENT_KERNEL_INCLUDES MIOPEN_DEVELOPMENT_KERNEL_INCLUDES_COUNT)
add_kernels("kernel.cpp" "MIOPEN_KERNEL_" "" "${MIOPEN_KERNELS}")
add_kernels("kernel_includes.cpp" "MIOPEN_KERNEL_" "_INCLUDE" "${MIOPEN_KERNEL_INCLUDES}")
if(${MIOPEN_DEVELOPMENT_KERNELS_COUNT})
add_kernels("kernel.cpp" "MIOPEN_KERNEL_" "" "${MIOPEN_DEVELOPMENT_KERNELS}")
endif()
if(${MIOPEN_DEVELOPMENT_KERNEL_INCLUDES_COUNT})
add_kernels("kernel_includes.cpp" "MIOPEN_KERNEL_" "_INCLUDE" "${MIOPEN_DEVELOPMENT_KERNEL_INCLUDES}")
endif()
configure_file(db_path.cpp.in ${PROJECT_BINARY_DIR}/db_path.cpp)
list(APPEND MIOpen_Source
activ.cpp
kernel_cache.cpp
lrn.cpp
mlo_dir_conv.cpp
exec_utils.cpp
ocl/activ_ocl.cpp
ocl/batchnormocl.cpp
ocl/convolutionocl.cpp
ocl/lrn_ocl.cpp
ocl/mloNorm.cpp
ocl/pooling_ocl.cpp
ocl/tensorocl.cpp
ocl/softmaxocl.cpp
ocl/rnnocl.cpp
ocl/utilocl.cpp
ocl/ctcocl.cpp
ocl/dropoutocl.cpp
ocl/gcn_asm_utils.cpp
ocl/rnn_util_ocl.cpp
hip/hip_build_utils.cpp
hip/batched_transpose_sol.cpp
hip/general_tensor_reorder_sol.cpp
layer_norm.cpp
pooling.cpp
ocl/fusionopconvocl.cpp
ocl/fusionopbiasbnactivocl.cpp
${PROJECT_BINARY_DIR}/db_path.cpp
)
list(INSERT MIOpen_Source 0
${PROJECT_BINARY_DIR}/kernel.cpp
${PROJECT_BINARY_DIR}/kernel_includes.cpp
)
endif()
if(MIOPEN_USE_ROCBLAS)
list(APPEND MIOpen_Source
gemm_v2.cpp
)
endif()
if( MIOPEN_BACKEND STREQUAL "OpenCL" )
list(APPEND MIOpen_Source
ocl/handleocl.cpp
ocl_kernel.cpp
ocl/oclerrors.cpp
ocl/clhelper.cpp
)
endif()
if( MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIP")
list(APPEND MIOpen_Source
hip/hiperrors.cpp
hip/handlehip.cpp
hipoc/hipoc_kernel.cpp
hipoc/hipoc_program.cpp
)
endif()
if( MIOPEN_BACKEND STREQUAL "HIPNOGPU")
list(APPEND MIOpen_Source
hip/hiperrors.cpp
nogpu/handle.cpp
hipoc/hipoc_kernel.cpp
hipoc/hipoc_program.cpp
)
endif()
if( MIOPEN_BACKEND MATCHES "OpenCL" OR MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPNOGPU")
set(KERNELS_SRC_BATCH_FACTOR 50 CACHE STRING "Amount of kernel source files to inline to a single object file.")
set(KERNELS_BATCH_ID 0)
function(inline_kernels_src BATCH_FACTOR KERNELS KERNEL_INCLUDES EXTRA_OPTIONS MESSAGE_SUFFIX)
set(KERNELS_BATCH)
set(KERNELS_BATCH_SIZE 0)
set(PROCESSED 0)
list(LENGTH KERNELS KERNELS_NUMBER)
foreach(KERNEL ${KERNELS})
list(APPEND KERNELS_BATCH ${KERNEL})
list(LENGTH KERNELS_BATCH KERNELS_BATCH_SIZE)
math(EXPR PROCESSED "1+${PROCESSED}")
if((KERNELS_BATCH_SIZE EQUAL ${BATCH_FACTOR}) OR (PROCESSED EQUAL KERNELS_NUMBER))
set(KERNEL_SRC_HPP_FILENAME batch_${KERNELS_BATCH_ID}.cpp.hpp)
set(KERNEL_SRC_HPP_PATH ${PROJECT_BINARY_DIR}/inlined_kernels/${KERNEL_SRC_HPP_FILENAME})
set(KERNEL_SRC_CPP_PATH ${PROJECT_BINARY_DIR}/inlined_kernels/batch_${KERNELS_BATCH_ID}.cpp)
add_custom_command(
OUTPUT ${KERNEL_SRC_HPP_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS addkernels ${KERNELS_BATCH} ${KERNEL_INCLUDES}
COMMAND ${WINE_CMD} $<TARGET_FILE:addkernels> -target ${KERNEL_SRC_HPP_PATH} -extern ${EXTRA_OPTIONS} -source ${KERNELS_BATCH}
COMMENT "Inlining kernels batch #${KERNELS_BATCH_ID}${MESSAGE_SUFFIX}"
)
configure_file(kernels/kernels_batch.cpp.in ${KERNEL_SRC_CPP_PATH})
list(APPEND MIOpen_Source ${KERNEL_SRC_CPP_PATH} ${KERNEL_SRC_HPP_PATH})
set(KERNELS_BATCH)
math(EXPR KERNELS_BATCH_ID "1+${KERNELS_BATCH_ID}")
endif()
endforeach()
set(KERNELS_BATCH_ID ${KERNELS_BATCH_ID} PARENT_SCOPE)
set(MIOpen_Source ${MIOpen_Source} PARENT_SCOPE)
endfunction()
inline_kernels_src(${KERNELS_SRC_BATCH_FACTOR} "${MIOPEN_KERNELS}" "${MIOPEN_KERNEL_INCLUDES}" "" "")
inline_kernels_src(${KERNELS_SRC_BATCH_FACTOR} "${MIOPEN_KERNEL_INCLUDES}" "" "-no-recurse;-mark-includes" " (includes)")
set(MIOPEN_DEVELOPMENT_KERNELS_DEPS ${MIOPEN_KERNEL_INCLUDES})
list(APPEND MIOPEN_DEVELOPMENT_KERNELS_DEPS ${MIOPEN_DEVELOPMENT_KERNEL_INCLUDES})
if(${MIOPEN_DEVELOPMENT_KERNELS_COUNT})
inline_kernels_src(${KERNELS_SRC_BATCH_FACTOR} "${MIOPEN_DEVELOPMENT_KERNELS}" "${MIOPEN_DEVELOPMENT_KERNELS_DEPS}" "" " (dev kernels)")
endif()
if(${MIOPEN_DEVELOPMENT_KERNEL_INCLUDES_COUNT})
inline_kernels_src(${KERNELS_SRC_BATCH_FACTOR} "${MIOPEN_DEVELOPMENT_KERNEL_INCLUDES}" "" "-no-recurse;-mark-includes" " (dev includes)")
endif()
endif()
if(MIOPEN_USE_COMGR)
list(APPEND MIOpen_Source comgr.cpp)
endif()
if(MIOPEN_USE_MLIR)
list(APPEND MIOpen_Source
mlir_build.cpp
solver/mlir_common.cpp
conv/invokers/mlir_impl_gemm.cpp
)
endif()
# build library
if(MIOPEN_ENABLE_SQLITE)
add_library( MIOpen
${MIOpen_Source}
$<TARGET_OBJECTS:sqlite_memvfs>
)
else()
add_library( MIOpen
${MIOpen_Source}
)
endif()
rocm_set_soversion(MIOpen ${MIOpen_SOVERSION})
clang_tidy_check(MIOpen)
find_package(zstd)
if(zstd_FOUND)
target_link_libraries(MIOpen PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
endif()
function(target_internal_library TARGET)
target_link_libraries(${TARGET} PRIVATE ${ARGN})
set(PASS_ARGS debug optimized)
set(DEPS)
foreach(DEP ${ARGN})
if(DEP IN_LIST PASS_ARGS)
list(APPEND DEPS ${DEP})
else()
list(APPEND DEPS $<BUILD_INTERFACE:${DEP}>)
endif()
endforeach()
target_link_libraries(${TARGET} INTERFACE ${DEPS})
endfunction()
target_include_directories(MIOpen PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/include>
)
set(MIOPEN_CK_LINK_FLAGS)
if(MIOPEN_USE_COMPOSABLEKERNEL)
set(MIOPEN_CK_LINK_FLAGS composable_kernel::device_operations hip::host)
endif()
target_include_directories(MIOpen SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLUDE_DIR}>)
target_include_directories(MIOpen SYSTEM PRIVATE ${BZIP2_INCLUDE_DIR})
# Workaround : change in rocm-cmake was causing linking error so had to add ${CMAKE_DL_LIBS}
# We can remove ${CMAKE_DL_LIBS} once root cause is identified.
target_link_libraries(MIOpen PRIVATE ${CMAKE_DL_LIBS} Threads::Threads ${BZIP2_LIBRARIES} ${MIOPEN_CK_LINK_FLAGS})
miopen_generate_export_header(MIOpen)
if(MIOPEN_ENABLE_AI_KERNEL_TUNING OR MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
find_path(FDEEP_INCLUDE_DIR "fdeep/fdeep.hpp")
if(${FDEEP_INCLUDE_DIR} STREQUAL "FDEEP_INCLUDE_DIR-NOTFOUND")
if(MIOPEN_ENABLE_AI_KERNEL_TUNING)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_KERNEL_TUNING requirement frugally-deep not found")
endif()
if(MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK requirement frugally-deep not found")
endif()
endif()
find_path(EIGEN_INCLUDE_DIR "eigen3/Eigen/Core")
if(${EIGEN_INCLUDE_DIR} STREQUAL "EIGEN_INCLUDE_DIR-NOTFOUND")
if(MIOPEN_ENABLE_AI_KERNEL_TUNING)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_KERNEL_TUNING requirement Eigen not found")
endif()
if(MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK requirement frugally-deep not found")
endif()
endif()
target_include_directories(MIOpen SYSTEM PRIVATE $<BUILD_INTERFACE:${FDEEP_INCLUDE_DIR}>)
target_include_directories(MIOpen SYSTEM PRIVATE $<BUILD_INTERFACE:${EIGEN_INCLUDE_DIR}/eigen3>)
if(NOT BUILD_DEV)
file(GLOB MODEL_FILES kernels/*.model)
if( NOT ENABLE_ASAN_PACKAGING )
install(FILES ${MODEL_FILES} DESTINATION ${DATA_INSTALL_DIR}/db)
endif ()
foreach(MODEL_FILE ${MODEL_FILES})
get_filename_component(MODEL_FILE_FILENAME "${MODEL_FILE}" NAME)
configure_file("${MODEL_FILE}" "${PROJECT_BINARY_DIR}/share/miopen/db/${MODEL_FILE_FILENAME}" COPYONLY)
endforeach()
endif()
endif()
set(PACKAGE_DEPENDS)
set(PACKAGE_STATIC_DEPENDS)
############################################################
# MIOpen depends on OpenCL
if( MIOPEN_BACKEND STREQUAL "OpenCL")
MESSAGE( STATUS "MIOpen linking OpenCL: ${OPENCL_INCLUDE_DIRS}" )
target_include_directories(MIOpen SYSTEM PUBLIC ${OPENCL_INCLUDE_DIRS} )
target_link_libraries( MIOpen PUBLIC ${OPENCL_LIBRARIES} )
list(APPEND PACKAGE_DEPENDS PACKAGE OpenCL)
elseif(MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIP")
target_link_libraries( MIOpen PRIVATE hip::device )
target_link_libraries( MIOpen INTERFACE hip::host )
if(ENABLE_HIP_WORKAROUNDS)
# Workaround hip not setting its usage requirements correctly
target_compile_definitions( MIOpen PRIVATE -D__HIP_PLATFORM_HCC__=1 )
endif()
# This is helpful for the tests
target_link_libraries( MIOpen INTERFACE $<BUILD_INTERFACE:hip::device> )
list(APPEND PACKAGE_DEPENDS PACKAGE hip)
endif()
if(MIOPEN_USE_COMGR)
list(APPEND PACKAGE_DEPENDS PACKAGE amd_comgr)
target_internal_library(MIOpen amd_comgr)
endif()
if(rocblas_FOUND)
target_link_libraries( MIOpen INTERFACE $<BUILD_INTERFACE:roc::rocblas> )
target_link_libraries( MIOpen PRIVATE roc::rocblas )
list(APPEND PACKAGE_STATIC_DEPENDS PACKAGE rocblas)
endif()
# For backward compatibility with ROCm 5.3
# Build with library libMLIRMIOpen
if(LIBMLIRMIOPEN)
target_link_libraries(MIOpen PRIVATE ${LIBMLIRMIOPEN})
endif()
# Build with package rocMLIR
if(rocMLIR_FOUND)
target_link_libraries(MIOpen PRIVATE rocMLIR::rockCompiler)
endif()
target_link_libraries(MIOpen PRIVATE nlohmann_json::nlohmann_json)
target_internal_library(MIOpen
Boost::filesystem
)
list(APPEND PACKAGE_STATIC_DEPENDS PACKAGE Boost COMPONENTS filesystem)
if(NOT WIN32 AND NOT APPLE)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lib.def "
MIOPEN_${MIOPEN_BACKEND}_1
{
global:
miopen*;
extern \"C++\" {
miopen::*;
};
local:
*boost*;
extern \"C++\" {
std::*;
};
};
")
target_link_libraries(MIOpen PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/lib.def")
target_link_libraries(MIOpen PRIVATE "-Wl,--exclude-libs,ALL")
# set_target_properties(MIOpen PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties(MIOpen PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
endif()
#######################################
if(MIOPEN_ENABLE_SQLITE)
# MIOpen depends on SQLite
target_include_directories(MIOpen SYSTEM PRIVATE ${SQLITE3_STATIC_INCLUDE_DIRS})
target_include_directories(MIOpen SYSTEM INTERFACE $<BUILD_INTERFACE:${SQLITE3_STATIC_INCLUDE_DIRS}>)
target_compile_options(MIOpen PRIVATE ${SQLITE3_STATIC_CFLAGS})
target_compile_options(MIOpen INTERFACE $<BUILD_INTERFACE:${SQLITE3_STATIC_CFLAGS}>)
target_link_libraries(MIOpen PRIVATE ${SQLITE3_STATIC_LDFLAGS})
target_link_libraries(MIOpen INTERFACE $<BUILD_INTERFACE:${SQLITE3_STATIC_LDFLAGS}>)
endif()
############################################################
# MIOpen depends on librt for Boost.Interprocess
if(NOT WIN32 AND NOT APPLE)
find_library(LIBRT rt)
if(LIBRT)
MESSAGE(STATUS "Librt: " ${LIBRT})
target_internal_library(MIOpen ${LIBRT})
endif()
endif()
if(NOT WIN32)
target_link_libraries(MIOpen PRIVATE roctx64)
endif()
############################################################
# Installation
set(MIOPEN_CXX_HEADER_PATH)
if(MIOPEN_INSTALL_CXX_HEADERS)
set(MIOPEN_CXX_HEADER_PATH ${PROJECT_SOURCE_DIR}/src/include)
endif()
rocm_install_targets(
TARGETS MIOpen
INCLUDE
${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include
${MIOPEN_CXX_HEADER_PATH}
)
rocm_export_targets(
TARGETS MIOpen
DEPENDS
${PACKAGE_DEPENDS}
STATIC_DEPENDS
${PACKAGE_STATIC_DEPENDS}
)
# Install db files
if(NOT MIOPEN_EMBED_DB STREQUAL "")
include(embed)
if(MIOPEN_EMBED_BINCACHE AND MIOPEN_BINCACHE_PATH STREQUAL "")
if(MIOPEN_NO_LFS_PULLED)
message(WARNING "Binary cache files have not been pulled down from git-lfs, will not embed.")
else()
set(MIOPEN_BINCACHE_PATH "${CMAKE_SOURCE_DIR}/src/kernels")
message("MIOPEN_BINCACHE_PATH: ${MIOPEN_BINCACHE_PATH}")
endif()
else()
message(WARNING "MIOPEN_EMBED_BINCACHE is set and MIOPEN_BINCACHE_PATH was used to override default binary cache files. Proceed at your own risk!")
endif()
set(CODE_OBJECTS)
# embed find db
foreach(EMBED_ARCH ${MIOPEN_EMBED_DB})
message(STATUS "Adding find db for arch: ${EMBED_ARCH}")
list(APPEND CODE_OBJECTS "kernels/${EMBED_ARCH}.${MIOPEN_BACKEND}.fdb.txt")
message(STATUS "Adding perf db for arch: ${EMBED_ARCH}")
list(APPEND CODE_OBJECTS "kernels/${EMBED_ARCH}.db")
endforeach()
# Embed Bin Cache
if(NOT MIOPEN_BINCACHE_PATH STREQUAL "")
foreach(EMBED_ARCH ${MIOPEN_EMBED_DB})
message(STATUS "Adding binary cache for arch: ${EMBED_ARCH}")
download_binary(OUTPUT_PATH "${MIOPEN_BINCACHE_PATH}" "${EMBED_ARCH}")
list(APPEND CODE_OBJECTS "${OUTPUT_PATH}")
endforeach()
endif()
add_embed_library(miopen_data ${CODE_OBJECTS})
target_link_libraries(MIOpen PRIVATE $<BUILD_INTERFACE:miopen_data> )
else()
file(GLOB FIND_DB_FILES kernels/*.fdb.txt)
file(GLOB PERF_DB_FILES kernels/*.db)
list(APPEND FIND_DB_FILES ${PERF_DB_FILES})
if(NOT MIOPEN_DISABLE_SYSDB)
if( NOT ENABLE_ASAN_PACKAGING )
install(FILES
${FIND_DB_FILES}
DESTINATION ${DATA_INSTALL_DIR}/db)
endif()
foreach(DB_FILE ${FIND_DB_FILES})
get_filename_component(DB_FILE_FILENAME "${DB_FILE}" NAME)
configure_file("${DB_FILE}" "${PROJECT_BINARY_DIR}/share/miopen/db/${DB_FILE_FILENAME}" COPYONLY)
endforeach()
endif()
endif()
if(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY)
#Generating Wrapper of each headers for backward compatibility
rocm_wrap_header_file(
export.h config.h version.h miopen.h
HEADER_LOCATION include/miopen
GUARDS WRAPPER
WRAPPER_LOCATIONS miopen/${CMAKE_INSTALL_INCLUDEDIR}/miopen
ORIGINAL_FILES ${PROJECT_BINARY_DIR}/include/miopen/version.h ${PROJECT_BINARY_DIR}/include/miopen/config.h
)
#Installing Wrapper Headers
rocm_install(
DIRECTORY
"${PROJECT_BINARY_DIR}/miopen/include"
DESTINATION "miopen" )
message( STATUS "Backward Compatible Sym Link Created for include directories" )
endif()