Skip to content

Commit 80cf149

Browse files
authored
[CI] Provide libclc targets to build and test (#5091)
Follow up to #5062 This PR ensures that `libclc` is built and tested against: * `amdgcn--;amdgcn--amdhsa` * `nvptx64--;nvptx64--nvidiacl`
1 parent e560dfe commit 80cf149

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

buildbot/configure.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def do_configure(args):
1515

1616
llvm_external_projects = 'sycl;llvm-spirv;opencl;libdevice;xpti;xptifw'
1717

18+
libclc_amd_target_names = ';amdgcn--;amdgcn--amdhsa'
19+
libclc_nvidia_target_names = 'nvptx64--;nvptx64--nvidiacl'
20+
1821
if args.llvm_external_projects:
1922
llvm_external_projects += ";" + args.llvm_external_projects.replace(",", ";")
2023

@@ -43,18 +46,6 @@ def do_configure(args):
4346
sycl_enable_xpti_tracing = 'ON'
4447
xpti_enable_werror = 'ON'
4548

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-
5849
# replace not append, so ARM ^ X86
5950
if args.arm:
6051
llvm_targets_to_build = 'ARM;AArch64'
@@ -63,26 +54,26 @@ def do_configure(args):
6354
sycl_build_pi_esimd_emulator = 'ON'
6455

6556
if args.cuda or args.hip:
66-
build_libclc = True
57+
llvm_enable_projects += ';libclc'
6758

6859
if args.cuda:
6960
llvm_targets_to_build += ';NVPTX'
70-
libclc_targets_to_build = 'nvptx64--;nvptx64--nvidiacl'
61+
libclc_targets_to_build = libclc_nvidia_target_names
7162
libclc_gen_remangled_variants = 'ON'
7263
sycl_build_pi_cuda = 'ON'
7364

7465
if args.hip:
7566
if args.hip_platform == 'AMD':
7667
llvm_targets_to_build += ';AMDGPU'
77-
libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa'
68+
libclc_targets_to_build += libclc_amd_target_names
7869
if args.hip_amd_arch:
7970
sycl_clang_extra_flags += "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch="+args.hip_amd_arch
8071

8172
# The HIP plugin for AMD uses lld for linking
8273
llvm_enable_projects += ';lld'
8374
elif args.hip_platform == 'NVIDIA' and not args.cuda:
8475
llvm_targets_to_build += ';NVPTX'
85-
libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl'
76+
libclc_targets_to_build += libclc_nvidia_target_names
8677
libclc_gen_remangled_variants = 'ON'
8778

8879
sycl_build_pi_hip_platform = args.hip_platform
@@ -103,10 +94,28 @@ def do_configure(args):
10394
llvm_build_shared_libs = 'ON'
10495

10596
if args.use_lld:
106-
llvm_enable_lld = 'ON'
97+
llvm_enable_lld = 'ON'
10798

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
110119

111120
install_dir = os.path.join(abs_obj_dir, "install")
112121

libclc/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set(LIBCLC_TEST_DEPS
1313
llvm-dis
1414
not
1515
clang
16+
count
1617
)
1718

1819
add_custom_target(check-libclc)

libclc/test/lit.cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"-target", target,
4545
"-Xclang", "-fdeclare-spirv-builtins",
4646
"-Xclang", "-mlink-builtin-bitcode",
47-
"-Xclang", os.path.join(config.llvm_libs_dir, "clc", builtins)
47+
"-Xclang", os.path.join(config.llvm_libs_dir, "clc", builtins),
48+
"-nogpulib"
4849
]
4950

5051
if target == 'amdgcn--amdhsa':

0 commit comments

Comments
 (0)