Skip to content

[LIBCLC] Improve CMake dependency tracking #5019

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
Nov 24, 2021

Conversation

npmiller
Copy link
Contributor

This is (hopefully) resolving an issue where after changing the
implementation of some built-ins in libclc the changes wouldn't get
picked up correctly by CMake and the old implementation would still be
used and a clean build would be required.

As far as I can tell what was happening is that CMake would properly
rebuild up until the opt stage but wouldn't do the prepare_builtins
or remangle stages, leaving the old bitcode for these, and that is the
libraries that are used by clang.

The problem seems to be with how the dependencies are specified between
these two, dependencies between custom commands and custom targets are
really tricky with CMake and it seems like the way it was setup didn't
work.

The most reliable way of connecting multiple custom commands, especially
in the same file like here, is to just use the OUTPUT argument of the
previous custom command as a DEPENDS in the next one. So I've updated
these two stages to work like that, and now as far as I can tell the
dependencies are picked up properly.

This is (hopefully) resolving an issue where after changing the
implementation of some built-ins in libclc the changes wouldn't get
picked up correctly by CMake and the old implementation would still be
used and a clean build would be required.

As far as I can tell what was happening is that CMake would properly
rebuild up until the `opt` stage but wouldn't do the `prepare_builtins`
or `remangle` stages, leaving the old bitcode for these, and that is the
libraries that are used by clang.

The problem seems to be with how the dependencies are specified between
these two, dependencies between custom commands and custom targets are
really tricky with CMake and it seems like the way it was setup didn't
work.

The most reliable way of connecting multiple custom commands, especially
in the same file like here, is to just use the `OUTPUT` argument of the
previous custom command as a `DEPENDS` in the next one. So I've updated
these two stages to work like that, and now as far as I can tell the
dependencies are picked up properly.
@npmiller npmiller requested a review from bader as a code owner November 23, 2021 17:35
@bader bader merged commit 2869ca7 into intel:sycl Nov 24, 2021
bader pushed a commit that referenced this pull request Jan 27, 2022
…mangler (#5398)

PR #5019 added file-level dependency tracking to libclc's CMake, but inadvertently broke Unix Makefile compatibility by removing target-level dependencies. This PR reinstates the target-level deps, *in addition* to the file-level deps.

With thanks to @henrichhegedus for bug report.
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.

2 participants