https://github.com/wenju-he updated https://github.com/llvm/llvm-project/pull/178119
>From 3922f8f07838a59742fe90ff1c7436f70ca484b6 Mon Sep 17 00:00:00 2001 From: Wenju He <[email protected]> Date: Tue, 27 Jan 2026 06:30:02 +0100 Subject: [PATCH 1/2] [libclc] Make output filename configurable; rename top-level targets This PR relates to c5cb48c39701. Pass `OUTPUT_FILENAME` to `add_libclc_builtin_set` to allow downstream output naming (e.g. libspirv in https://github.com/intel/llvm/tree/sycl/libclc). Rename top-level targets to `libclc-${ARG_TRIPLE}` to avoid collisions with `library-${ARG_ARCH_SUFFIX}` in our downstream when libclc TRIPLE matches libspirv ARCH_SUFFIX. --- libclc/CMakeLists.txt | 1 + libclc/cmake/modules/AddLibclc.cmake | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 7575eff2db64e..cfb39b63c9f99 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -466,6 +466,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} ) OPT_FLAGS ${opt_flags} LIB_FILES ${opencl_lib_files} ALIASES ${${d}_aliases} + OUTPUT_FILENAME libclc PARENT_TARGET libclc-opencl-builtins # Link in the CLC builtins and internalize their symbols INTERNAL_LINK_DEPENDENCIES builtins.link.clc-${arch_suffix} diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake index e8242a2fd4885..f1036be1b7736 100644 --- a/libclc/cmake/modules/AddLibclc.cmake +++ b/libclc/cmake/modules/AddLibclc.cmake @@ -241,6 +241,8 @@ endfunction() # libclc architecture/triple suffix # * TRIPLE <string> # Triple used to compile +# * OUTPUT_FILENAME <string> +# libclc output library name # * PARENT_TARGET <string> # Target into which to group the target builtins # @@ -263,7 +265,7 @@ endfunction() function(add_libclc_builtin_set) cmake_parse_arguments(ARG "CLC_INTERNAL" - "ARCH;DEVICE;TRIPLE;ARCH_SUFFIX;PARENT_TARGET" + "ARCH;DEVICE;TRIPLE;ARCH_SUFFIX;OUTPUT_FILENAME;PARENT_TARGET" "LIB_FILES;COMPILE_FLAGS;OPT_FLAGS;ALIASES;INTERNAL_LINK_DEPENDENCIES" ${ARGN} ) @@ -374,7 +376,7 @@ function(add_libclc_builtin_set) return() endif() - set( LIBCLC_OUTPUT_FILENAME libclc ) + set( LIBCLC_OUTPUT_FILENAME ${ARG_OUTPUT_FILENAME} ) set( builtins_link_lib $<TARGET_PROPERTY:${builtins_link_lib_tgt},TARGET_FILE> ) # We store the library according to its triple and cpu if present. @@ -418,16 +420,16 @@ function(add_libclc_builtin_set) FOLDER "libclc/Device IR/Library" ) - # Also add a 'library' target for the triple. Since a triple may have + # Also add a 'libclc' target for the triple. Since a triple may have # multiple devices, ensure we only try to create the triple target once. The # triple's target will build all of the bytecode for its constituent devices. - if( NOT TARGET library-${ARG_TRIPLE} ) - add_custom_target( library-${ARG_TRIPLE} ALL ) + if( NOT TARGET libclc-${ARG_TRIPLE} ) + add_custom_target( libclc-${ARG_TRIPLE} ALL ) endif() - add_dependencies( library-${ARG_TRIPLE} library-${ARG_ARCH_SUFFIX} ) + add_dependencies( libclc-${ARG_TRIPLE} library-${ARG_ARCH_SUFFIX} ) # Add dependency to top-level pseudo target to ease making other # targets dependent on libclc. - add_dependencies( ${ARG_PARENT_TARGET} library-${ARG_TRIPLE} ) + add_dependencies( ${ARG_PARENT_TARGET} libclc-${ARG_TRIPLE} ) # Install the created library. install( >From d17e1d75fb727f9efa4ee206a1d3c10394d247e4 Mon Sep 17 00:00:00 2001 From: Wenju He <[email protected]> Date: Tue, 27 Jan 2026 14:00:09 +0800 Subject: [PATCH 2/2] Update libclc/cmake/modules/AddLibclc.cmake Co-authored-by: Copilot <[email protected]> --- libclc/cmake/modules/AddLibclc.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake index f1036be1b7736..14f0fb05b9737 100644 --- a/libclc/cmake/modules/AddLibclc.cmake +++ b/libclc/cmake/modules/AddLibclc.cmake @@ -376,6 +376,9 @@ function(add_libclc_builtin_set) return() endif() + if (NOT DEFINED ARG_OUTPUT_FILENAME OR ARG_OUTPUT_FILENAME STREQUAL "") + message(FATAL_ERROR "OUTPUT_FILENAME parameter is required and must be non-empty.") + endif() set( LIBCLC_OUTPUT_FILENAME ${ARG_OUTPUT_FILENAME} ) set( builtins_link_lib $<TARGET_PROPERTY:${builtins_link_lib_tgt},TARGET_FILE> ) _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
