Skip to content

Commit

Permalink
[CI] Provide libclc targets to build and test (#5091)
Browse files Browse the repository at this point in the history
Follow up to #5062

This PR ensures that `libclc` is built and tested against:
*  `amdgcn--;amdgcn--amdhsa`
* `nvptx64--;nvptx64--nvidiacl`
  • Loading branch information
jchlanda authored Dec 6, 2021
1 parent e560dfe commit 80cf149
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
47 changes: 28 additions & 19 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def do_configure(args):

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

libclc_amd_target_names = ';amdgcn--;amdgcn--amdhsa'
libclc_nvidia_target_names = 'nvptx64--;nvptx64--nvidiacl'

if args.llvm_external_projects:
llvm_external_projects += ";" + args.llvm_external_projects.replace(",", ";")

Expand Down Expand Up @@ -43,18 +46,6 @@ def do_configure(args):
sycl_enable_xpti_tracing = 'ON'
xpti_enable_werror = 'ON'

build_libclc = False

if args.ci_defaults:
print("#############################################")
print("# Default CI configuration will be applied. #")
print("#############################################")

# For clang-format and clang-tidy
llvm_enable_projects += ";clang-tools-extra"
# libclc is required for CI validation
build_libclc = True

# replace not append, so ARM ^ X86
if args.arm:
llvm_targets_to_build = 'ARM;AArch64'
Expand All @@ -63,26 +54,26 @@ def do_configure(args):
sycl_build_pi_esimd_emulator = 'ON'

if args.cuda or args.hip:
build_libclc = True
llvm_enable_projects += ';libclc'

if args.cuda:
llvm_targets_to_build += ';NVPTX'
libclc_targets_to_build = 'nvptx64--;nvptx64--nvidiacl'
libclc_targets_to_build = libclc_nvidia_target_names
libclc_gen_remangled_variants = 'ON'
sycl_build_pi_cuda = 'ON'

if args.hip:
if args.hip_platform == 'AMD':
llvm_targets_to_build += ';AMDGPU'
libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa'
libclc_targets_to_build += libclc_amd_target_names
if args.hip_amd_arch:
sycl_clang_extra_flags += "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch="+args.hip_amd_arch

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

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

if args.use_lld:
llvm_enable_lld = 'ON'
llvm_enable_lld = 'ON'

if build_libclc:
llvm_enable_projects += ';libclc'
# CI Default conditionally appends to options, keep it at the bottom of
# args handling
if args.ci_defaults:
print("#############################################")
print("# Default CI configuration will be applied. #")
print("#############################################")

# For clang-format and clang-tidy
llvm_enable_projects += ";clang-tools-extra"
# libclc is required for CI validation
if 'libclc' not in llvm_enable_projects:
llvm_enable_projects += ';libclc'
# libclc passes `--nvvm-reflect-enable=false`, build NVPTX to enable it
if 'NVPTX' not in llvm_targets_to_build:
llvm_targets_to_build += ';NVPTX'
# Add both NVIDIA and AMD libclc targets
if libclc_amd_target_names not in libclc_targets_to_build:
libclc_targets_to_build += libclc_amd_target_names
if libclc_nvidia_target_names not in libclc_targets_to_build:
libclc_targets_to_build += libclc_nvidia_target_names

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

Expand Down
1 change: 1 addition & 0 deletions libclc/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(LIBCLC_TEST_DEPS
llvm-dis
not
clang
count
)

add_custom_target(check-libclc)
Expand Down
3 changes: 2 additions & 1 deletion libclc/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"-target", target,
"-Xclang", "-fdeclare-spirv-builtins",
"-Xclang", "-mlink-builtin-bitcode",
"-Xclang", os.path.join(config.llvm_libs_dir, "clc", builtins)
"-Xclang", os.path.join(config.llvm_libs_dir, "clc", builtins),
"-nogpulib"
]

if target == 'amdgcn--amdhsa':
Expand Down

0 comments on commit 80cf149

Please sign in to comment.