Skip to content

[SYCL][libclc] Fix missing build dependencies #13145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

frasercrmck
Copy link
Contributor

@frasercrmck frasercrmck commented Mar 25, 2024

This commit fixes the problem of missing build dependencies between libclc source files and their various includes.

We would like to do this with compiler-generated dependency files because then the dependencies are accurate and there are no false positives, leading to unnecessary rebuilds. This is how regular C/C++ dependencies are usually tracked by CMake.

Note that this variable is an internal API so is not guaranteed to work, but then again all of CMake's support for new languages (which we use for CLC/LL languages) is an internal API. On balance this change is probably worth it due to how minimally invasive it is.

The alternative would be to either:

  1. list/glob all possible files in the directory as dependencies, which would lead to false positives.
  2. rewrite the library generation as a loop over all files and calling add_custom_command, which can produce a dependency file (by tweaking our clang command line) that can also be fed back to the same command via the DEPFILE argument. This would be a much larger change and is not as "neat".

This commit aims to fix the problem of missing build dependencies
between libclc source files and their various includes.

We would like to do this with compiler-generated dependency files
because then the dependencies are accurate and there are no false
positives, leading to unnecessary rebuilds. This is how regular C/C++
dependencies are usually tracked by CMake.

Note that this variable is an internal API so is not guaranteed to work,
but then again *all* of CMake's support for new languages (which we use
for CLC/LL languages) is an internal API. On balance this change is
probably worth it due to how minimally invasive it is.

The alternative would be to either:

1. list/glob all possible files in the directory as dependencies, which
   would lead to false positives.
2. rewrite the library generation as a loop over all files and calling
   `add_custom_command`, which can produce a dependency file (by
   tweaking our clang command line) that can also be fed back to the
   same command via the `DEPFILE` argument. This would be a much larger
   change and is not as "neat".
@frasercrmck frasercrmck requested a review from a team as a code owner March 25, 2024 14:50
@frasercrmck frasercrmck requested a review from JackAKirk March 25, 2024 14:50
Copy link
Contributor

@ldrumm ldrumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're already setting CMAKE_INCLUDE_FLAG_CLC, I think we have precedent for using these internal interfaces.

In fact, since cmake has documentation on how to use these interfaces, I'd say this is better than the custom command option and should be at least as stable as maintaining all the extra code

LGTM

@frasercrmck
Copy link
Contributor Author

@intel/llvm-gatekeepers I think this can be merged - thank you.

@martygrant martygrant merged commit f2ac688 into intel:sycl Mar 28, 2024
@frasercrmck frasercrmck deleted the libclc-depfiles branch March 28, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants