Skip to content

Commit 6a4fa3a

Browse files
authored
[Driver][SYCL] Additional dependency gen step is part of offload toolchain (#4456)
The additional preprocessing step which is created that creates the dependency information for the host compilation needs to be properly setup as part of the SYCL offloading toolchain. Without doing so, not all of the dependencies (headers for instance) are properly pulled in.
1 parent ce9ef5c commit 6a4fa3a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5510,8 +5510,11 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
55105510
if (Phase == phases::Preprocess && Args.hasArg(options::OPT_fsycl) &&
55115511
Args.hasArg(options::OPT_M_Group) &&
55125512
!Args.hasArg(options::OPT_fno_sycl_use_footer)) {
5513-
Actions.push_back(
5514-
C.MakeAction<PreprocessJobAction>(Current, types::TY_Dependencies));
5513+
Action *PreprocessAction =
5514+
C.MakeAction<PreprocessJobAction>(Current, types::TY_Dependencies);
5515+
PreprocessAction->propagateHostOffloadInfo(Action::OFK_SYCL,
5516+
/*BoundArch=*/nullptr);
5517+
Actions.push_back(PreprocessAction);
55155518
}
55165519

55175520
// FIXME: Should we include any prior module file outputs as inputs of

clang/test/Driver/sycl-int-footer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@
7171
/// Check behaviors for dependency generation
7272
// RUN: %clangxx -fsycl -MD -c %s -### 2>&1 \
7373
// RUN: | FileCheck -check-prefix DEP_GEN %s
74-
// DEP_GEN: clang{{.*}} "-Eonly"
74+
// DEP_GEN: clang{{.*}} "-fsycl-is-host"
75+
// DEP_GEN-SAME: "-Eonly"
7576
// DEP_GEN-SAME: "-dependency-file"
7677
// DEP_GEN-SAME: "-MT"
78+
// DEP_GEN-SAME: "-internal-isystem" "{{.*}}{{[/\\]+}}include{{[/\\]+}}sycl"
7779
// DEP_GEN-SAME: "-x" "c++" "[[INPUTFILE:.+\.cpp]]"
7880
// DEP_GEN: append-file{{.*}} "[[INPUTFILE]]"
7981
// DEP_GEN-NOT: clang{{.*}} "-dependency-file"

0 commit comments

Comments
 (0)