@@ -15,6 +15,9 @@ def do_configure(args):
15
15
16
16
llvm_external_projects = 'sycl;llvm-spirv;opencl;libdevice;xpti;xptifw'
17
17
18
+ libclc_amd_target_names = ';amdgcn--;amdgcn--amdhsa'
19
+ libclc_nvidia_target_names = 'nvptx64--;nvptx64--nvidiacl'
20
+
18
21
if args .llvm_external_projects :
19
22
llvm_external_projects += ";" + args .llvm_external_projects .replace ("," , ";" )
20
23
@@ -43,18 +46,6 @@ def do_configure(args):
43
46
sycl_enable_xpti_tracing = 'ON'
44
47
xpti_enable_werror = 'ON'
45
48
46
- build_libclc = False
47
-
48
- if args .ci_defaults :
49
- print ("#############################################" )
50
- print ("# Default CI configuration will be applied. #" )
51
- print ("#############################################" )
52
-
53
- # For clang-format and clang-tidy
54
- llvm_enable_projects += ";clang-tools-extra"
55
- # libclc is required for CI validation
56
- build_libclc = True
57
-
58
49
# replace not append, so ARM ^ X86
59
50
if args .arm :
60
51
llvm_targets_to_build = 'ARM;AArch64'
@@ -63,26 +54,26 @@ def do_configure(args):
63
54
sycl_build_pi_esimd_emulator = 'ON'
64
55
65
56
if args .cuda or args .hip :
66
- build_libclc = True
57
+ llvm_enable_projects += ';libclc'
67
58
68
59
if args .cuda :
69
60
llvm_targets_to_build += ';NVPTX'
70
- libclc_targets_to_build = 'nvptx64--;nvptx64--nvidiacl'
61
+ libclc_targets_to_build = libclc_nvidia_target_names
71
62
libclc_gen_remangled_variants = 'ON'
72
63
sycl_build_pi_cuda = 'ON'
73
64
74
65
if args .hip :
75
66
if args .hip_platform == 'AMD' :
76
67
llvm_targets_to_build += ';AMDGPU'
77
- libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa'
68
+ libclc_targets_to_build += libclc_amd_target_names
78
69
if args .hip_amd_arch :
79
70
sycl_clang_extra_flags += "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + args .hip_amd_arch
80
71
81
72
# The HIP plugin for AMD uses lld for linking
82
73
llvm_enable_projects += ';lld'
83
74
elif args .hip_platform == 'NVIDIA' and not args .cuda :
84
75
llvm_targets_to_build += ';NVPTX'
85
- libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl'
76
+ libclc_targets_to_build += libclc_nvidia_target_names
86
77
libclc_gen_remangled_variants = 'ON'
87
78
88
79
sycl_build_pi_hip_platform = args .hip_platform
@@ -103,10 +94,28 @@ def do_configure(args):
103
94
llvm_build_shared_libs = 'ON'
104
95
105
96
if args .use_lld :
106
- llvm_enable_lld = 'ON'
97
+ llvm_enable_lld = 'ON'
107
98
108
- if build_libclc :
109
- llvm_enable_projects += ';libclc'
99
+ # CI Default conditionally appends to options, keep it at the bottom of
100
+ # args handling
101
+ if args .ci_defaults :
102
+ print ("#############################################" )
103
+ print ("# Default CI configuration will be applied. #" )
104
+ print ("#############################################" )
105
+
106
+ # For clang-format and clang-tidy
107
+ llvm_enable_projects += ";clang-tools-extra"
108
+ # libclc is required for CI validation
109
+ if 'libclc' not in llvm_enable_projects :
110
+ llvm_enable_projects += ';libclc'
111
+ # libclc passes `--nvvm-reflect-enable=false`, build NVPTX to enable it
112
+ if 'NVPTX' not in llvm_targets_to_build :
113
+ llvm_targets_to_build += ';NVPTX'
114
+ # Add both NVIDIA and AMD libclc targets
115
+ if libclc_amd_target_names not in libclc_targets_to_build :
116
+ libclc_targets_to_build += libclc_amd_target_names
117
+ if libclc_nvidia_target_names not in libclc_targets_to_build :
118
+ libclc_targets_to_build += libclc_nvidia_target_names
110
119
111
120
install_dir = os .path .join (abs_obj_dir , "install" )
112
121
0 commit comments