[libclc] 735d7c1 - [libclc] link_bc target should depends on target builtins.link.clc-arch_suffix (#132338)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 03:09:27 PDT 2025
Author: Wenju He
Date: 2025-03-24T10:09:19Z
New Revision: 735d7c153947fd3f1adfb3cda9d29a8359870db0
URL: https://github.com/llvm/llvm-project/commit/735d7c153947fd3f1adfb3cda9d29a8359870db0
DIFF: https://github.com/llvm/llvm-project/commit/735d7c153947fd3f1adfb3cda9d29a8359870db0.diff
LOG: [libclc] link_bc target should depends on target builtins.link.clc-arch_suffix (#132338)
Currently link_bc command depends on the bitcode file that is associated
with custom target builtins.link.clc-arch_suffix.
On windows we randomly see following error:
`
Generating builtins.link.clc-${ARCH}--.bc
Generating builtins.link.libspirv-${ARCH}.bc
error : The requested operation cannot be performed on a file with a
user-mapped section open.
`
I suspect that builtins.link.clc-${ARCH}--.bc file is being generated
while it is being used in link_bc.
This PR adds target-level dependency to ensure
builtins.link.clc-${ARCH}--.bc is generated first.
Added:
Modified:
libclc/CMakeLists.txt
libclc/cmake/modules/AddLibclc.cmake
Removed:
################################################################################
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 426f210a73fcc..3de7ee9b707a8 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -413,7 +413,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
GEN_FILES ${opencl_gen_files}
ALIASES ${${d}_aliases}
# Link in the CLC builtins and internalize their symbols
- INTERNAL_LINK_DEPENDENCIES $<TARGET_PROPERTY:builtins.link.clc-${arch_suffix},TARGET_FILE>
+ INTERNAL_LINK_DEPENDENCIES builtins.link.clc-${arch_suffix}
)
endforeach( d )
endforeach( t )
diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index 2ec6d3256f8a2..be8937cd13107 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -214,9 +214,10 @@ endfunction()
# Optimization options (for opt)
# * ALIASES <string> ...
# List of aliases
-# * INTERNAL_LINK_DEPENDENCIES <string> ...
-# A list of extra bytecode files to link into the builtin library. Symbols
-# from these link dependencies will be internalized during linking.
+# * INTERNAL_LINK_DEPENDENCIES <target> ...
+# A list of extra bytecode file's targets. The bitcode files will be linked
+# into the builtin library. Symbols from these link dependencies will be
+# internalized during linking.
function(add_libclc_builtin_set)
cmake_parse_arguments(ARG
"CLC_INTERNAL"
@@ -313,12 +314,16 @@ function(add_libclc_builtin_set)
INPUTS ${bytecode_files}
DEPENDENCIES ${builtins_comp_lib_tgt}
)
+ set( internal_link_depend_files )
+ foreach( tgt ${ARG_INTERNAL_LINK_DEPENDENCIES} )
+ list( APPEND internal_link_depend_files $<TARGET_PROPERTY:${tgt},TARGET_FILE> )
+ endforeach()
link_bc(
INTERNALIZE
TARGET ${builtins_link_lib_tgt}
INPUTS $<TARGET_PROPERTY:${builtins_link_lib_tmp_tgt},TARGET_FILE>
- ${ARG_INTERNAL_LINK_DEPENDENCIES}
- DEPENDENCIES ${builtins_link_lib_tmp_tgt}
+ ${internal_link_depend_files}
+ DEPENDENCIES ${builtins_link_lib_tmp_tgt} ${ARG_INTERNAL_LINK_DEPENDENCIES}
)
endif()
More information about the cfe-commits
mailing list