[libclc] [libclc] [cmake] Fix per-target *_convert.cl dependencies (PR #127315)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 15 08:43:59 PST 2025
================
@@ -249,13 +249,19 @@ function(add_libclc_builtin_set)
get_filename_component( file_dir ${file} DIRECTORY )
+ if( ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64 )
+ set(CONVERT_DEP clspv-generate_convert.cl)
+ else()
+ set(CONVERT_DEP generate_convert.cl)
+ endif()
+
compile_to_bc(
TRIPLE ${ARG_TRIPLE}
INPUT ${input_file}
OUTPUT ${output_file}
EXTRA_OPTS -fno-builtin -nostdlib
"${ARG_COMPILE_FLAGS}" -I${CMAKE_CURRENT_SOURCE_DIR}/${file_dir}
- DEPENDENCIES generate_convert.cl clspv-generate_convert.cl
+ DEPENDENCIES ${CONVERT_DEP}
----------------
frasercrmck wrote:
I think really we should be passing in dependencies as an ARG. I've never like the hard-coding of the `*convert.cl` files here in a helper function.
I also have the feeling that CMake should be able to automatically infer the right dependencies transitively, given that it knows that `clspv-generate_convert.cl` is a `DEPENDENCY` of `clspv-convert.cl` which is an `INPUT`. I'd have to do some experimentation, though. I always forget exactly how CMake works in this regard.
The way we're currently specifying dependencies on `generate_convert.cl` et al is far too coarse, and means we unnecessary rebuild all libclc files when the conversion files change.
https://github.com/llvm/llvm-project/pull/127315
More information about the cfe-commits
mailing list