Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5016,14 +5016,19 @@ class OffloadingActionBuilder final {
llvm::zip(SYCLDeviceActions, SYCLTargetInfoList)) {
Action *&A = std::get<0>(TargetActionInfo);
auto &TargetInfo = std::get<1>(TargetActionInfo);
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
AssociatedOffloadKind);
if (SYCLDeviceOnly)
Action *PreprocAction = C.getDriver().ConstructPhaseAction(
C, Args, CurPhase, A, AssociatedOffloadKind);
if (SYCLDeviceOnly) {
A = PreprocAction;
continue;
}
// Add an additional compile action to generate the integration
// header.
// header. This action compiles the source file instead of the
// generated preprocessed file to allow for control of the
// diagnostics that could come from the system headers.
Action *CompileAction =
C.MakeAction<CompileJobAction>(A, types::TY_Nothing);
A = PreprocAction;
DA.add(*CompileAction, *TargetInfo.TC, TargetInfo.BoundArch,
Action::OFK_SYCL);
}
Expand Down Expand Up @@ -7974,8 +7979,15 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
if (isa<PreprocessJobAction>(A)) {
PackagerActions.push_back(OA);
A->setCannotBeCollapsedWithNextDependentAction();
Action *CompileAction =
C.MakeAction<CompileJobAction>(A, types::TY_Nothing);
// The input to the preprocessed job is the compilation job.
// Take that input action (it should be one input) which is
// the source file that should be compiled to generate the
// integration header/footer.
ActionList PreprocInputs = A->getInputs();
assert(PreprocInputs.size() == 1 &&
"Single input size to preprocess action expected.");
Action *CompileAction = C.MakeAction<CompileJobAction>(
PreprocInputs.front(), types::TY_Nothing);
DDeps.add(*CompileAction, *TC, BoundArch, Action::OFK_SYCL);
}
});
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-offload-nvptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
// RUN: | FileCheck -check-prefix=CHK-PREPROC %s
// CHK-PREPROC: 1: preprocessor, {0}, c++-cpp-output, (device-sycl, sm_[[CUDA_VERSION:[0-9.]+]])
// CHK-PREPROC: 2: offload, "device-sycl (nvptx64-nvidia-cuda:sm_[[CUDA_VERSION]])" {1}, c++-cpp-output
// CHK-PREPROC: 4: compiler, {1}, none, (device-sycl, sm_[[CUDA_VERSION]])
// CHK-PREPROC: 4: compiler, {0}, none, (device-sycl, sm_[[CUDA_VERSION]])
//
// RUN: not %clangxx -### -std=c++11 -target x86_64-unknown-linux-gnu -fsycl \
// RUN: -fsycl-targets=nvptx64-nvidia-cuda --cuda-path=%S/Inputs/no/CUDA/path/here \
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-preprocess-old-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// PREPROC_PHASES: 1: preprocessor, {0}, c++-cpp-output, (device-sycl)
// PREPROC_PHASES: 2: offload, "device-sycl (spir64-unknown-unknown)" {1}, c++-cpp-output
// PREPROC_PHASES: 3: input, "[[INPUT]]", c++, (host-sycl)
// PREPROC_PHASES: 4: compiler, {1}, none, (device-sycl)
// PREPROC_PHASES: 4: compiler, {0}, none, (device-sycl)
// PREPROC_PHASES: 5: offload, "host-sycl (x86_64-unknown-linux-gnu)" {3}, "device-sycl (spir64-unknown-unknown)" {4}, c++
// PREPROC_PHASES: 6: preprocessor, {5}, c++-cpp-output, (host-sycl)
// PREPROC_PHASES: 7: clang-offload-bundler, {2, 6}, c++-cpp-output, (host-sycl)
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// PREPROC_PHASES: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
// PREPROC_PHASES: 2: input, "[[INPUT]]", c++, (device-sycl)
// PREPROC_PHASES: 3: preprocessor, {2}, c++-cpp-output, (device-sycl)
// PREPROC_PHASES: 4: compiler, {3}, none, (device-sycl)
// PREPROC_PHASES: 4: compiler, {2}, none, (device-sycl)
// PREPROC_PHASES: 5: offload, "device-sycl (spir64-unknown-unknown)" {3}, c++-cpp-output
// PREPROC_PHASES: 6: llvm-offload-binary, {5, 1}, c++-cpp-output
// PREPROC_PHASES: 7: offload, "host-sycl ([[TARGET]])" {1}, "device-sycl (spir64-unknown-unknown)" {3}, "device-sycl (spir64-unknown-unknown)" {4}, " ([[TARGET]])" {6}, c++-cpp-output
Expand Down