Skip to content

Commit f6d9a8b

Browse files
authored
[Driver][SYCL] Update preprocessed file generation (#19849)
When generating preprocessed files for SYCL offloading, create a fully packaged file that contains both the HOST and DEVICE binaries. This will allow for consumption of these binary preprocessed files to be more useful, as opposed to only being able to preprocess and keep the host side of the offloading compilation When the driver encounters preprocessed (file.ii) files on the command line, these are processed in the following way: - Determines if the file is a packaged file (offload binary) - Extracts device side - Compiles device side, packages generated device into offload binary - Extracts host side - Compiles host side, embedding device binary Offload binary determination is performed by checking the magic number associated with the input file. The extraction is done via the clang-offload-packager using a new JobAction. When no output file is given, we will not package the preprocessed files but will just perform the host preprocessing. When output to a file (with an output file option), we will perform the host and device compilation, package and output to that file.
1 parent c0f8a08 commit f6d9a8b

File tree

11 files changed

+256
-8
lines changed

11 files changed

+256
-8
lines changed

clang/include/clang/Driver/Action.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class Action {
7676
OffloadUnbundlingJobClass,
7777
OffloadWrapperJobClass,
7878
OffloadPackagerJobClass,
79+
OffloadPackagerExtractJobClass,
7980
OffloadDepsJobClass,
8081
SPIRVTranslatorJobClass,
8182
SYCLPostLinkJobClass,
@@ -719,6 +720,17 @@ class OffloadPackagerJobAction : public JobAction {
719720
}
720721
};
721722

723+
class OffloadPackagerExtractJobAction : public JobAction {
724+
void anchor() override;
725+
726+
public:
727+
OffloadPackagerExtractJobAction(ActionList &Inputs, types::ID Type);
728+
729+
static bool classof(const Action *A) {
730+
return A->getKind() == OffloadPackagerExtractJobClass;
731+
}
732+
};
733+
722734
class OffloadDepsJobAction final : public JobAction {
723735
void anchor() override;
724736

clang/include/clang/Driver/Driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,9 @@ bool isObjectFile(std::string FileName);
990990
/// \return True if the filename has a static archive/lib extension.
991991
bool isStaticArchiveFile(const StringRef &FileName);
992992

993+
/// \return True if the filename is an Offload Binary file.
994+
bool isOffloadBinaryFile(const StringRef &FileName);
995+
993996
/// \return True if the argument combination will end up generating remarks.
994997
bool willEmitRemarks(const llvm::opt::ArgList &Args);
995998

clang/include/clang/Driver/ToolChain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class ToolChain {
166166
mutable std::unique_ptr<Tool> OffloadBundler;
167167
mutable std::unique_ptr<Tool> OffloadWrapper;
168168
mutable std::unique_ptr<Tool> OffloadPackager;
169+
mutable std::unique_ptr<Tool> OffloadPackagerExtract;
169170
mutable std::unique_ptr<Tool> OffloadDeps;
170171
mutable std::unique_ptr<Tool> SPIRVTranslator;
171172
mutable std::unique_ptr<Tool> SYCLPostLink;
@@ -185,6 +186,7 @@ class ToolChain {
185186
Tool *getOffloadBundler() const;
186187
Tool *getOffloadWrapper() const;
187188
Tool *getOffloadPackager() const;
189+
Tool *getOffloadPackagerExtract() const;
188190
Tool *getOffloadDeps() const;
189191
Tool *getSPIRVTranslator() const;
190192
Tool *getSYCLPostLink() const;

clang/lib/Driver/Action.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const char *Action::getClassName(ActionClass AC) {
4646
return "clang-offload-wrapper";
4747
case OffloadPackagerJobClass:
4848
return "clang-offload-packager";
49+
case OffloadPackagerExtractJobClass:
50+
return "clang-offload-packager-extract";
4951
case OffloadDepsJobClass:
5052
return "clang-offload-deps";
5153
case SPIRVTranslatorJobClass:
@@ -86,6 +88,15 @@ void Action::propagateDeviceOffloadInfo(OffloadKind OKind, const char *OArch,
8688
// Deps job uses the host kinds.
8789
if (Kind == OffloadDepsJobClass)
8890
return;
91+
// Packaging actions can use host kinds for preprocessing. When packaging
92+
// preprocessed files, these packaged files will contain both host and device
93+
// files, where the host side does not have any device info to propagate.
94+
bool hasPreprocessJob =
95+
std::any_of(Inputs.begin(), Inputs.end(), [](const Action *A) {
96+
return A->getKind() == PreprocessJobClass;
97+
});
98+
if (Kind == OffloadPackagerJobClass && hasPreprocessJob)
99+
return;
89100

90101
assert((OffloadingDeviceKind == OKind || OffloadingDeviceKind == OFK_None) &&
91102
"Setting device kind to a different device??");
@@ -485,6 +496,12 @@ OffloadPackagerJobAction::OffloadPackagerJobAction(ActionList &Inputs,
485496
types::ID Type)
486497
: JobAction(OffloadPackagerJobClass, Inputs, Type) {}
487498

499+
void OffloadPackagerExtractJobAction::anchor() {}
500+
501+
OffloadPackagerExtractJobAction::OffloadPackagerExtractJobAction(
502+
ActionList &Inputs, types::ID Type)
503+
: JobAction(OffloadPackagerExtractJobClass, Inputs, Type) {}
504+
488505
void OffloadDepsJobAction::anchor() {}
489506

490507
OffloadDepsJobAction::OffloadDepsJobAction(

clang/lib/Driver/Driver.cpp

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7780,7 +7780,8 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
77807780
Action *HostAction) const {
77817781
// Don't build offloading actions if explicitly disabled or we do not have a
77827782
// valid source input.
7783-
if (offloadHostOnly() || !types::isSrcFile(Input.first))
7783+
if (offloadHostOnly() ||
7784+
!(types::isSrcFile(Input.first) || Input.first == types::TY_PP_CXX))
77847785
return HostAction;
77857786

77867787
bool HIPNoRDC =
@@ -7845,6 +7846,25 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
78457846
for (const ToolChain *TC : ToolChains) {
78467847
for (StringRef Arch : OffloadArchs.lookup(TC)) {
78477848
TCAndArchs.push_back(std::make_pair(TC, Arch));
7849+
// Check if the InputArg is a preprocessed file that is created by the
7850+
// clang-offload-packager.
7851+
if (InputType == types::TY_PP_CXX &&
7852+
isOffloadBinaryFile(InputArg->getAsString(Args))) {
7853+
// Extract the specific preprocessed file given the current arch
7854+
// and triple. Add to DeviceActions if one was extracted.
7855+
ActionList PPActions;
7856+
OffloadAction::DeviceDependences DDep;
7857+
Action *IA = C.MakeAction<InputAction>(*InputArg, InputType, CUID);
7858+
PPActions.push_back(IA);
7859+
Action *PackagerAction =
7860+
C.MakeAction<OffloadPackagerExtractJobAction>(PPActions,
7861+
types::TY_PP_CXX);
7862+
DDep.add(*PackagerAction,
7863+
*C.getSingleOffloadToolChain<Action::OFK_Host>(), nullptr,
7864+
C.getActiveOffloadKinds());
7865+
DeviceActions.push_back(PackagerAction);
7866+
continue;
7867+
}
78487868
DeviceActions.push_back(
78497869
C.MakeAction<InputAction>(*InputArg, InputType, CUID));
78507870
}
@@ -8002,6 +8022,37 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
80028022
DDep.add(*LinkAction, *C.getSingleOffloadToolChain<Action::OFK_Host>(),
80038023
nullptr, C.getActiveOffloadKinds());
80048024
return C.MakeAction<OffloadAction>(DDep, types::TY_Nothing);
8025+
} else if (C.isOffloadingHostKind(Action::OFK_SYCL) &&
8026+
isa<PreprocessJobAction>(HostAction) &&
8027+
getFinalPhase(Args) == phases::Preprocess &&
8028+
Args.hasArg(options::OPT_o, options::OPT__SLASH_P,
8029+
options::OPT__SLASH_o)) {
8030+
// Performing preprocessing only. Take the host and device preprocessed
8031+
// files and package them together.
8032+
ActionList PackagerActions;
8033+
// Only add the preprocess actions from the device side. When one is
8034+
// found, add an additional compilation to generate the integration
8035+
// header/footer that is used for the host compile.
8036+
for (auto OA : OffloadActions) {
8037+
if (const OffloadAction *CurOA = dyn_cast<OffloadAction>(OA)) {
8038+
CurOA->doOnEachDependence(
8039+
[&](Action *A, const ToolChain *TC, const char *BoundArch) {
8040+
assert(TC && "Unknown toolchain");
8041+
if (isa<PreprocessJobAction>(A)) {
8042+
PackagerActions.push_back(OA);
8043+
A->setCannotBeCollapsedWithNextDependentAction();
8044+
Action *CompileAction =
8045+
C.MakeAction<CompileJobAction>(A, types::TY_Nothing);
8046+
DDeps.add(*CompileAction, *TC, BoundArch, Action::OFK_SYCL);
8047+
}
8048+
});
8049+
}
8050+
}
8051+
PackagerActions.push_back(HostAction);
8052+
Action *PackagerAction = C.MakeAction<OffloadPackagerJobAction>(
8053+
PackagerActions, types::TY_PP_CXX);
8054+
DDeps.add(*PackagerAction, *C.getSingleOffloadToolChain<Action::OFK_Host>(),
8055+
nullptr, C.getActiveOffloadKinds());
80058056
} else if (C.isOffloadingHostKind(Action::OFK_SYCL) &&
80068057
Args.hasArg(options::OPT_fsycl_host_compiler_EQ)) {
80078058
// -fsycl-host-compiler will create a bundled object instead of an
@@ -8150,6 +8201,23 @@ Action *Driver::ConstructPhaseAction(
81508201
return C.MakeAction<VerifyPCHJobAction>(Input, types::TY_Nothing);
81518202
if (Args.hasArg(options::OPT_extract_api))
81528203
return C.MakeAction<ExtractAPIJobAction>(Input, types::TY_API_INFO);
8204+
// New offload driver enabled with a Preprocessed input file - check to make
8205+
// sure that the input file is an offload binary - if so, we need to
8206+
// extract the actual preprocessed file from the package, and that is what
8207+
// we will compile.
8208+
if (getUseNewOffloadingDriver() &&
8209+
TargetDeviceOffloadKind == Action::OFK_None &&
8210+
Input->getType() == types::TY_PP_CXX) {
8211+
const InputAction *IA = dyn_cast<InputAction>(Input);
8212+
if (IA && isOffloadBinaryFile(IA->getInputArg().getAsString(Args))) {
8213+
ActionList PPActions;
8214+
PPActions.push_back(Input);
8215+
Action *PackagerAction = C.MakeAction<OffloadPackagerExtractJobAction>(
8216+
PPActions, types::TY_PP_CXX);
8217+
return C.MakeAction<CompileJobAction>(PackagerAction,
8218+
types::TY_LLVM_BC);
8219+
}
8220+
}
81538221
return C.MakeAction<CompileJobAction>(Input, types::TY_LLVM_BC);
81548222
}
81558223
case phases::Backend: {
@@ -9429,7 +9497,8 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
94299497
// For /P, preprocess to file named after BaseInput.
94309498
if (C.getArgs().hasArg(options::OPT__SLASH_P) &&
94319499
((AtTopLevel && isa<PreprocessJobAction>(JA)) ||
9432-
isa<OffloadBundlingJobAction>(JA))) {
9500+
isa<OffloadBundlingJobAction>(JA) ||
9501+
isa<OffloadPackagerJobAction>(JA))) {
94339502
StringRef BaseName = llvm::sys::path::filename(BaseInput);
94349503
StringRef NameArg;
94359504
if (Arg *A = C.getArgs().getLastArg(options::OPT__SLASH_Fi))
@@ -9465,6 +9534,14 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
94659534
}
94669535
}
94679536

9537+
// When generating preprocessed files (-E) with offloading enabled, redirect
9538+
// the output to a properly named output file.
9539+
if (JA.getType() == types::TY_PP_CXX && isa<OffloadPackagerJobAction>(JA)) {
9540+
if (Arg *FinalOutput =
9541+
C.getArgs().getLastArg(options::OPT_o, options::OPT__SLASH_o))
9542+
return C.addResultFile(FinalOutput->getValue(), &JA);
9543+
}
9544+
94689545
// Default to writing to stdout?
94699546
if (AtTopLevel && !CCGenDiagnostics && HasPreprocessOutput(JA)) {
94709547
return "-";
@@ -10437,6 +10514,12 @@ bool clang::driver::isStaticArchiveFile(const StringRef &FileName) {
1043710514
return (Magic == llvm::file_magic::archive);
1043810515
}
1043910516

10517+
bool clang::driver::isOffloadBinaryFile(const StringRef &FileName) {
10518+
llvm::file_magic Magic;
10519+
llvm::identify_magic(FileName, Magic);
10520+
return (Magic == llvm::file_magic::offload_binary);
10521+
}
10522+
1044010523
bool clang::driver::willEmitRemarks(const ArgList &Args) {
1044110524
// -fsave-optimization-record enables it.
1044210525
if (Args.hasFlag(options::OPT_fsave_optimization_record,

clang/lib/Driver/ToolChain.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,12 @@ Tool *ToolChain::getOffloadPackager() const {
617617
return OffloadPackager.get();
618618
}
619619

620+
Tool *ToolChain::getOffloadPackagerExtract() const {
621+
if (!OffloadPackagerExtract)
622+
OffloadPackagerExtract.reset(new tools::OffloadPackagerExtract(*this));
623+
return OffloadPackagerExtract.get();
624+
}
625+
620626
Tool *ToolChain::getOffloadDeps() const {
621627
if (!OffloadDeps)
622628
OffloadDeps.reset(new tools::OffloadDeps(*this));
@@ -707,6 +713,8 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const {
707713
return getOffloadWrapper();
708714
case Action::OffloadPackagerJobClass:
709715
return getOffloadPackager();
716+
case Action::OffloadPackagerExtractJobClass:
717+
return getOffloadPackagerExtract();
710718

711719
case Action::OffloadDepsJobClass:
712720
return getOffloadDeps();

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10300,6 +10300,8 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
1030010300
for (const InputInfo &Input : Inputs) {
1030110301
const Action *OffloadAction = Input.getAction();
1030210302
const ToolChain *TC = OffloadAction->getOffloadingToolChain();
10303+
if (!TC)
10304+
TC = &C.getDefaultToolChain();
1030310305
const ArgList &TCArgs =
1030410306
C.getArgsForToolChain(TC, OffloadAction->getOffloadingArch(),
1030510307
OffloadAction->getOffloadingDeviceKind());
@@ -10389,6 +10391,50 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
1038910391
CmdArgs, Inputs, Output));
1039010392
}
1039110393

10394+
// Use the clang-offload-packager to extract binaries from a packaged
10395+
// binary. This currently only supports single input/single output.
10396+
void OffloadPackagerExtract::ConstructJob(Compilation &C, const JobAction &JA,
10397+
const InputInfo &Output,
10398+
const InputInfoList &Inputs,
10399+
const llvm::opt::ArgList &Args,
10400+
const char *LinkingOutput) const {
10401+
ArgStringList CmdArgs;
10402+
const Action *OffloadAction = Inputs[0].getAction();
10403+
const ToolChain *TC = OffloadAction->getOffloadingToolChain();
10404+
if (!TC)
10405+
TC = &C.getDefaultToolChain();
10406+
const ArgList &TCArgs =
10407+
C.getArgsForToolChain(TC, OffloadAction->getOffloadingArch(),
10408+
OffloadAction->getOffloadingDeviceKind());
10409+
10410+
// Input file name.
10411+
StringRef InFile = C.getArgs().MakeArgString(TC->getInputFilename(Inputs[0]));
10412+
CmdArgs.push_back(Args.MakeArgString(InFile));
10413+
10414+
// Generated --image option containing the output file name, triple, arch
10415+
// and associated offload kind.
10416+
assert(Output.isFilename() && "Invalid output.");
10417+
StringRef File = Output.getFilename();
10418+
StringRef Arch = OffloadAction->getOffloadingArch()
10419+
? OffloadAction->getOffloadingArch()
10420+
: TCArgs.getLastArgValue(options::OPT_march_EQ);
10421+
StringRef Kind =
10422+
Action::GetOffloadKindName(OffloadAction->getOffloadingDeviceKind());
10423+
10424+
SmallVector<std::string> Parts{
10425+
"file=" + File.str(),
10426+
"triple=" + TC->getTripleString(),
10427+
"arch=" + (Arch.empty() ? "generic" : Arch.str()),
10428+
"kind=" + Kind.str(),
10429+
};
10430+
CmdArgs.push_back(Args.MakeArgString("--image=" + llvm::join(Parts, ",")));
10431+
10432+
C.addCommand(std::make_unique<Command>(
10433+
JA, *this, ResponseFileSupport::None(),
10434+
Args.MakeArgString(getToolChain().GetProgramPath(getShortName())),
10435+
CmdArgs, Inputs, Output));
10436+
}
10437+
1039210438
// Begin OffloadDeps
1039310439

1039410440
void OffloadDeps::constructJob(Compilation &C, const JobAction &JA,

clang/lib/Driver/ToolChains/Clang.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ class LLVM_LIBRARY_VISIBILITY OffloadPackager final : public Tool {
190190
const char *LinkingOutput) const override;
191191
};
192192

193+
/// Offload binary extract tool.
194+
class LLVM_LIBRARY_VISIBILITY OffloadPackagerExtract final : public Tool {
195+
public:
196+
OffloadPackagerExtract(const ToolChain &TC)
197+
: Tool("Offload::PackagerExtract", "clang-offload-packager", TC) {}
198+
199+
bool hasIntegratedCPP() const override { return false; }
200+
void ConstructJob(Compilation &C, const JobAction &JA,
201+
const InputInfo &Output, const InputInfoList &Inputs,
202+
const llvm::opt::ArgList &TCArgs,
203+
const char *LinkingOutput) const override;
204+
};
205+
193206
/// Offload deps tool.
194207
class LLVM_LIBRARY_VISIBILITY OffloadDeps final : public Tool {
195208
void constructJob(Compilation &C, const JobAction &JA,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// FOOTER_PREPROC_GEN-SAME: "-dependency-filter" "[[INTHEADER]]"
1818
// FOOTER_PREPROC_GEN-SAME: "-include-internal-footer" "[[INTFOOTER]]"
1919
// FOOTER_PREPROC_GEN-SAME: "-dependency-filter" "[[INTFOOTER]]"
20-
// FOOTER_PREPROC_GEN-SAME: "-E"{{.*}} "-o" "-"
20+
// FOOTER_PREPROC_GEN-SAME: "-E"
2121

2222
/// Preprocessed file use with integration footer
2323
// RUN: touch %t.ii

clang/test/Driver/sycl-preprocess.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/// Test preprocessing capabilities when using -fsycl
1+
// Test the behaviors when enabling SYCL offloading with preprocessed files.
2+
23
/// Creating a preprocessed file is expected to do an integration header
34
/// creation step.
45
// RUN: %clangxx -fsycl --offload-new-driver -E -o %t_output.ii %s -### 2>&1 \
56
// RUN: | FileCheck -check-prefix PREPROC_ONLY %s
6-
// RUN: %clang_cl -fsycl --offload-new-driver -P -Fi%t_output.ii %s -### 2>&1 \
7+
// RUN: %clang_cl -fsycl --offload-new-driver -P %s -### 2>&1 \
78
// RUN: | FileCheck -check-prefix PREPROC_ONLY %s
89
// PREPROC_ONLY: clang{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-int-header=[[INTHEADER:.+\.h]]" "-fsycl-int-footer=[[INTFOOTER:.+\.h]]"{{.*}} "-E"
910
// PREPROC_ONLY: clang{{.*}} "-fsycl-is-host"{{.*}} "-include-internal-header" "[[INTHEADER]]"{{.*}} "-include-internal-footer" "[[INTFOOTER]]"{{.*}} "-o" "[[HOST_OUT:.+\.ii]]"
@@ -14,10 +15,31 @@
1415
// PREPROC_IN-NOT: "-fsycl-int-header={{.*}}"
1516
// PREPROC_IN: clang{{.*}} "-fsycl-is-host"
1617

17-
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl --offload-new-driver -E %s -ccc-print-phases 2>&1 \
18-
// RUN: | FileCheck -check-prefix PREPROC_PHASES %s
18+
/// When generating preprocessed files, verify the compilation phases.
19+
// RUN: %clangxx --target=x86_64-unknown-linux-gnu --offload-new-driver -fsycl -E %s -o %t.ii -ccc-print-phases 2>&1 \
20+
// RUN: | FileCheck %s -check-prefix PREPROC_PHASES -DTARGET=x86_64-unknown-linux-gnu
21+
// RUN: %clang_cl --target=x86_64-pc-windows-msvc --offload-new-driver -fsycl -P %s -Fi%t.ii -ccc-print-phases 2>&1 \
22+
// RUN: | FileCheck %s -check-prefix PREPROC_PHASES -DTARGET=x86_64-pc-windows-msvc
1923
// PREPROC_PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
2024
// PREPROC_PHASES: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
2125
// PREPROC_PHASES: 2: input, "[[INPUT]]", c++, (device-sycl)
2226
// PREPROC_PHASES: 3: preprocessor, {2}, c++-cpp-output, (device-sycl)
23-
// PREPROC_PHASES: 4: offload, "host-sycl (x86_64-unknown-linux-gnu)" {1}, "device-sycl (spir64-unknown-unknown)" {3}, c++-cpp-output
27+
// PREPROC_PHASES: 4: compiler, {3}, none, (device-sycl)
28+
// PREPROC_PHASES: 5: offload, "device-sycl (spir64-unknown-unknown)" {3}, c++-cpp-output
29+
// PREPROC_PHASES: 6: clang-offload-packager, {5, 1}, c++-cpp-output
30+
// 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
31+
32+
/// When generating preprocessed files, verify the tools called and the expected
33+
/// output file name.
34+
// RUN: %clangxx --offload-new-driver -fsycl -E %s -o sycl-preprocess.ii -### 2>&1 \
35+
// RUN: | FileCheck %s -check-prefix PREPROC_TOOLS
36+
// RUN: %clang_cl --offload-new-driver -fsycl -P %s -Fisycl-preprocess.ii -### 2>&1 \
37+
// RUN: | FileCheck %s -check-prefix PREPROC_TOOLS
38+
// RUN: %clang_cl --offload-new-driver -fsycl -E %s -o sycl-preprocess.ii -### 2>&1 \
39+
// RUN: | FileCheck %s -check-prefix PREPROC_TOOLS
40+
// PREPROC_TOOLS: clang{{.*}} "-fsycl-is-device"
41+
// PREPROC_TOOLS-SAME: "-o" "[[DEVICE_PP_FILE:.+\.ii]]
42+
// PREPROC_TOOLS: clang{{.*}} "-fsycl-is-host"
43+
// PREPROC_TOOLS-SAME: "-o" "[[HOST_PP_FILE:.+\.ii]]
44+
// PREPROC_TOOLS: clang-offload-packager{{.*}} "-o" "sycl-preprocess.ii"
45+
// PREPROC_TOOLS-SAME: "--image=file=[[DEVICE_PP_FILE]],triple=spir64-unknown-unknown,arch=generic,kind=sycl{{.*}}" "--image=file=[[HOST_PP_FILE]],triple={{.*}},arch=generic,kind=host"

0 commit comments

Comments
 (0)