From 590eb965bd872cffd81c4875bda2a98d80995079 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Mon, 6 Dec 2021 10:55:16 +0000 Subject: [PATCH 1/3] [CI] Provide libclc targets to build and test --- buildbot/configure.py | 38 ++++++++++++++++++++++---------------- libclc/test/lit.cfg.py | 3 ++- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/buildbot/configure.py b/buildbot/configure.py index a87fcea367867..75f170d31c80e 100644 --- a/buildbot/configure.py +++ b/buildbot/configure.py @@ -43,18 +43,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' @@ -63,7 +51,7 @@ 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' @@ -103,10 +91,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 'amdgcn--;amdgcn--amdhsa' not in libclc_targets_to_build: + libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa' + if 'nvptx64--;nvptx64--nvidiacl' not in libclc_targets_to_build: + libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl' install_dir = os.path.join(abs_obj_dir, "install") diff --git a/libclc/test/lit.cfg.py b/libclc/test/lit.cfg.py index ca0fa43231022..7a427032bfa70 100644 --- a/libclc/test/lit.cfg.py +++ b/libclc/test/lit.cfg.py @@ -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': From 0281c0539908b1b25167761adeffee9bcca5c164 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Mon, 6 Dec 2021 11:23:31 +0000 Subject: [PATCH 2/3] [LIBCLC] Add count to libclc's dependencies --- libclc/test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/libclc/test/CMakeLists.txt b/libclc/test/CMakeLists.txt index de7f7803d40b5..80ec1f05d0264 100644 --- a/libclc/test/CMakeLists.txt +++ b/libclc/test/CMakeLists.txt @@ -13,6 +13,7 @@ set(LIBCLC_TEST_DEPS llvm-dis not clang + count ) add_custom_target(check-libclc) From 263dafbe0f3a152521497631c4b7ddbac96be1b9 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Mon, 6 Dec 2021 11:53:35 +0000 Subject: [PATCH 3/3] Use vars for libclc target names --- buildbot/configure.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/buildbot/configure.py b/buildbot/configure.py index 75f170d31c80e..dda3a14528fe2 100644 --- a/buildbot/configure.py +++ b/buildbot/configure.py @@ -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(",", ";") @@ -55,14 +58,14 @@ def do_configure(args): 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 @@ -70,7 +73,7 @@ def do_configure(args): 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 @@ -109,10 +112,10 @@ def do_configure(args): if 'NVPTX' not in llvm_targets_to_build: llvm_targets_to_build += ';NVPTX' # Add both NVIDIA and AMD libclc targets - if 'amdgcn--;amdgcn--amdhsa' not in libclc_targets_to_build: - libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa' - if 'nvptx64--;nvptx64--nvidiacl' not in libclc_targets_to_build: - libclc_targets_to_build += ';nvptx64--;nvptx64--nvidiacl' + 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")