https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/186104
Enable libclc build and test in the Linux premerge CI when libclc or .ci files are modified. To minimize build time, only build the amdgcn-amd-amdhsa-llvm target. Update clc.h to test that libclc is built. >From 180ebf62510f80cb98042ab3de63e6fc56e77812 Mon Sep 17 00:00:00 2001 From: Wenju He <[email protected]> Date: Thu, 12 Mar 2026 13:07:24 +0100 Subject: [PATCH] [libclc][CI] Enable libclc in premerge CI with single target Enable libclc build and test in the Linux premerge CI when libclc or .ci files are modified. To minimize build time, only build the amdgcn-amd-amdhsa-llvm target. Update clc.h to test that libclc is built. --- .ci/compute_projects.py | 7 ++++++- .ci/compute_projects_test.py | 20 ++++++++++++++++---- .ci/monolithic-linux.sh | 2 ++ .github/workflows/premerge.yaml | 2 +- libclc/clc/include/clc/internal/clc.h | 4 ++-- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py index 541b33f5034b1..cf8835dff674b 100644 --- a/.ci/compute_projects.py +++ b/.ci/compute_projects.py @@ -81,6 +81,7 @@ "clang": {"compiler-rt"}, "clang-tools-extra": {"libc"}, "libc": {"libc"}, + "libclc": {"libclc"}, "compiler-rt": {"compiler-rt"}, "flang": {"flang-rt"}, "flang-rt": {"flang-rt"}, @@ -107,6 +108,7 @@ "libcxxabi", "libunwind", "flang-rt", + "libclc", # Tests don't work on Windows (check_external_funcs.sh). } # These are projects that we should test if the project itself is changed but @@ -146,6 +148,7 @@ "flang": "check-flang", "flang-rt": "check-flang-rt", "libc": "check-libc", + "libclc": "check-libclc", "lld": "check-lld", "lldb": "check-lldb", "mlir": "check-mlir", @@ -154,7 +157,7 @@ "lit": "check-lit", } -RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc", "flang-rt"} +RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc", "flang-rt", "libclc"} # Meta projects are projects that need explicit handling but do not reside # in their own top level folder. To add a meta project, the start of the path @@ -329,6 +332,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]: # to the CMake invocation and thus we need to use the CMake list separator # (;). We use spaces to separate the check targets as they end up getting # passed to ninja. + libclc_targets = "amdgcn-amd-amdhsa-llvm" if "libclc" in runtimes_to_build else "" return { "projects_to_build": ";".join(sorted(projects_to_build)), "project_check_targets": " ".join(sorted(projects_check_targets)), @@ -338,6 +342,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]: sorted(runtimes_check_targets_needs_reconfig) ), "enable_cir": enable_cir, + "libclc_targets": libclc_targets, } diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py index f0abdd708ca42..88fc90249f7bf 100644 --- a/.ci/compute_projects_test.py +++ b/.ci/compute_projects_test.py @@ -248,6 +248,7 @@ def test_exclude_libcxx_in_projects(self): self.assertEqual(env_variables["runtimes_to_build"], "") self.assertEqual(env_variables["runtimes_check_targets"], "") self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "") + self.assertEqual(env_variables["libclc_targets"], "") def test_include_libc_in_runtimes(self): env_variables = compute_projects.get_env_variables( @@ -259,6 +260,17 @@ def test_include_libc_in_runtimes(self): self.assertEqual(env_variables["runtimes_check_targets"], "check-libc") self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "") + def test_include_libclc_in_runtimes(self): + env_variables = compute_projects.get_env_variables( + ["libclc/CMakeLists.txt"], "Linux" + ) + self.assertEqual(env_variables["projects_to_build"], "clang;llvm") + self.assertEqual(env_variables["project_check_targets"], "") + self.assertEqual(env_variables["runtimes_to_build"], "libclc") + self.assertEqual(env_variables["runtimes_check_targets"], "check-libclc") + self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "") + self.assertEqual(env_variables["libclc_targets"], "amdgcn-amd-amdhsa-llvm") + def test_exclude_docs(self): env_variables = compute_projects.get_env_variables( ["llvm/docs/CIBestPractices.rst"], "Linux" @@ -297,7 +309,7 @@ def test_ci(self): ) self.assertEqual( env_variables["runtimes_check_targets"], - "check-compiler-rt check-flang-rt check-libc", + "check-compiler-rt check-flang-rt check-libc check-libclc", ) self.assertEqual( env_variables["runtimes_check_targets_needs_reconfig"], @@ -318,7 +330,7 @@ def test_windows_ci(self): ) self.assertEqual( env_variables["runtimes_to_build"], - "compiler-rt;libclc", + "compiler-rt", ) self.assertEqual( env_variables["runtimes_check_targets"], @@ -371,7 +383,7 @@ def test_premerge_workflow(self): ) self.assertEqual( env_variables["runtimes_check_targets"], - "check-compiler-rt check-flang-rt check-libc", + "check-compiler-rt check-flang-rt check-libc check-libclc", ) self.assertEqual( env_variables["runtimes_check_targets_needs_reconfig"], @@ -406,7 +418,7 @@ def test_third_party_benchmark(self): ) self.assertEqual( env_variables["runtimes_check_targets"], - "check-compiler-rt check-flang-rt check-libc", + "check-compiler-rt check-flang-rt check-libc check-libclc", ) self.assertEqual( env_variables["runtimes_check_targets_needs_reconfig"], diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 217da893e947a..3c94d63ac4129 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -28,6 +28,7 @@ runtimes="${3}" runtime_targets="${4}" runtime_targets_needs_reconfig="${5}" enable_cir="${6}" +libclc_targets="${7}" lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct" @@ -56,6 +57,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \ -D CMAKE_DISABLE_PRECOMPILE_HEADERS=ON \ -D LIBCXX_CXX_ABI=libcxxabi \ + -D LIBCLC_TARGETS_TO_BUILD="${libclc_targets}" \ -D MLIR_ENABLE_BINDINGS_PYTHON=ON \ -D LLDB_ENABLE_PYTHON=ON \ -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \ diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml index 1795d5256750f..b735c1366fa9d 100644 --- a/.github/workflows/premerge.yaml +++ b/.github/workflows/premerge.yaml @@ -104,7 +104,7 @@ jobs: mkdir artifacts SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server - ./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}" + ./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}" "${libclc_targets}" - name: Upload Artifacts # In some cases, Github will fail to upload the artifact. We want to # continue anyways as a failed artifact upload is an infra failure, not diff --git a/libclc/clc/include/clc/internal/clc.h b/libclc/clc/include/clc/internal/clc.h index fcfb223d5a12d..99ce15309fdd3 100644 --- a/libclc/clc/include/clc/internal/clc.h +++ b/libclc/clc/include/clc/internal/clc.h @@ -24,12 +24,12 @@ #endif /* Function Attributes */ -#include <clc/clcfunc.h> +#include "clc/clcfunc.h" /* 6.1 Supported Data Types */ /* 6.2.4.2 Reinterpreting Types Using __clc_as_type() and __clc_as_typen() */ -#include <clc/clc_as_type.h> +#include "clc/clc_as_type.h" #pragma OPENCL EXTENSION all : disable _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
