Skip to content

[SYCL]Device lib default link #2277

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

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c9bfd8d
[SYCL]Link DeviceLibs with user's device code as default
jinge90 Jul 30, 2020
84b36a1
Merge remote-tracking branch 'origin/sycl' into DeviceLib_default_link
jinge90 Jul 30, 2020
3f5e7dc
Ignore fallback device library in Non-SpirvAOT mode
jinge90 Aug 3, 2020
d8ba722
remove all unnecessary functions introduced by device libraries
jinge90 Aug 4, 2020
f147657
Don't remove dead code in NVPTX or intelfpga compilation
jinge90 Aug 7, 2020
c106cbe
Merge remote-tracking branch 'origin/sycl' into DeviceLib_default_link
jinge90 Aug 7, 2020
498e1ab
adjust devicelib tests, manually linking is not needed
jinge90 Aug 7, 2020
937328f
check 'referenced-indirect' attribute when removing 'unused' function
jinge90 Aug 7, 2020
49845e5
use defaul toolchain to check MSVC environment in device compilation
jinge90 Aug 7, 2020
cccff98
Add -fno-sycl-devicelib to disable device lib auto link
jinge90 Aug 21, 2020
d436af2
merge latest sycl branch and fix conflicts
jinge90 Aug 24, 2020
2ccb0f2
do dae only when sycl-post-link is not doing dead code removal
jinge90 Aug 24, 2020
1cfa766
fix format issue
jinge90 Aug 24, 2020
27515b0
Merge remote-tracking branch 'origin/sycl' into DeviceLib_default_link
jinge90 Aug 31, 2020
083384a
Merge remote-tracking branch 'origin/sycl' into DeviceLib_default_link
jinge90 Aug 31, 2020
3afda66
Enable devicelib default link for -fintelfpga
jinge90 Aug 31, 2020
7a9c03f
Merge remote-tracking branch 'origin/DeviceLib_default_link' into Dev…
jinge90 Aug 31, 2020
7689ade
Fix clang format issue
jinge90 Aug 31, 2020
a651c22
add devicelib test for intelfpga
jinge90 Aug 31, 2020
13948c6
fix clang-format issue
jinge90 Aug 31, 2020
b1e276b
rebase code
jinge90 Aug 31, 2020
74e19cc
fix wrong option lit test
jinge90 Aug 31, 2020
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
5 changes: 5 additions & 0 deletions clang/include/clang/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,13 @@ class SYCLPostLinkJobAction : public JobAction {

bool getRTSetsSpecConstants() const { return RTSetsSpecConsts; }

void setDeadCodeRemoval(bool Val) { DeadCodeRemoval = Val; }

bool getDeadCodeRemoval() const { return DeadCodeRemoval; }

private:
bool RTSetsSpecConsts = true;
bool DeadCodeRemoval = false;
};

class PartialLinkJobAction : public JobAction {
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -3550,6 +3550,8 @@ def fsycl_esimd : Flag<["-"], "fsycl-explicit-simd">, Group<sycl_Group>, Flags<[
HelpText<"Enable SYCL explicit SIMD extension">;
def fno_sycl_esimd : Flag<["-"], "fno-sycl-explicit-simd">, Group<sycl_Group>,
HelpText<"Disable SYCL explicit SIMD extension">, Flags<[NoArgumentUnused, CoreOption]>;
def fno_sycl_devicelib : Flag<["-"], "fno-sycl-devicelib">, Group<sycl_Group>,
HelpText<"Disable SYCL device library link with kernel code">, Flags<[NoArgumentUnused, CoreOption]>;
defm sycl_early_optimizations : OptOutFFlag<"sycl-early-optimizations", "Enable", "Disable", " standard optimization pipeline for SYCL device compiler", [CoreOption]>;
def fsycl_dead_args_optimization : Flag<["-"], "fsycl-dead-args-optimization">,
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Enables "
Expand Down
98 changes: 85 additions & 13 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "clang/Driver/Driver.h"
#include "InputInfo.h"
#include "ToolChains/AIX.h"
Expand Down Expand Up @@ -2714,6 +2713,14 @@ static SmallVector<const char *, 16> getLinkerArgs(Compilation &C,
return LibArgs;
}

static bool IsSYCLDeviceLibObj(std::string ObjFilePath) {
StringRef ObjFileName = llvm::sys::path::filename(ObjFilePath);
bool Ret = (ObjFileName.startswith("libsycl-") && ObjFileName.endswith(".o"))
? true
: false;
return Ret;
}

// Goes through all of the arguments, including inputs expected for the
// linker directly, to determine if we need to perform additional work for
// static offload libraries.
Expand Down Expand Up @@ -3746,7 +3753,6 @@ class OffloadingActionBuilder final {
}

ActionBuilderReturnCode addDeviceDepences(Action *HostAction) override {

// If this is an input action replicate it for each SYCL toolchain.
if (auto *IA = dyn_cast<InputAction>(HostAction)) {
SYCLDeviceActions.clear();
Expand Down Expand Up @@ -3789,7 +3795,10 @@ class OffloadingActionBuilder final {
if (IA->getType() == types::TY_Object) {
if (!isObjectFile(FileName))
return ABRT_Inactive;
if (Args.hasArg(options::OPT_fintelfpga))
// For SYCL device libraries, don't need to add them to
// FPGAObjectInputs as there is no fpga dep files inside.
if (Args.hasArg(options::OPT_fintelfpga) &&
!IsSYCLDeviceLibObj(FileName))
FPGAObjectInputs.push_back(IA);
}
// When creating FPGA device fat objects, all host objects are
Expand Down Expand Up @@ -3853,6 +3862,53 @@ class OffloadingActionBuilder final {
SYCLDeviceActions.clear();
}

void addSYCLDeviceLibs(const ToolChain *TC, ActionList &DeviceLinkObjects,
bool isSpirvAOT, bool isMSVCEnv) {
enum SYCLDeviceLibType {
sycl_devicelib_wrapper,
sycl_devicelib_fallback
};
StringRef LibLoc, LibSysUtils;
if (isMSVCEnv) {
LibLoc = Args.MakeArgString(TC->getDriver().Dir + "/../bin");
LibSysUtils = "libsycl-msvc";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are the device libs for Windows built in the bin directory as opposed to the lib directory like Linux?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe archive libraries on Windows are not supposed to be in bin directory. bin is for DLLs and executables. For OpenMP the BC libraries are located in lib (as they are considered archive librareis), and SPV libraries are located in bin (as the are considered 'dynamic' libraries, i.e. DLLs). Anyway, I think the BC libraries must not be located in bin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @mdtoguchi and @vzakhari
Currently, the device libraries on Windows platform are located in bin/ folder for DPC++ compiler. You can find the details in :
https://github.com/intel/llvm/blob/sycl/libdevice/cmake/modules/SYCLLibdevice.cmake#L209
So, I followed it in this patch. I think the reason why put device libraries in bin/ on Windows is we want to put all 'sycl-related' libraries together with libsycl.so/dll? @asavonic , please feel free to correct me.
Thank you very much.

} else {
LibLoc = Args.MakeArgString(TC->getDriver().Dir + "/../lib");
LibSysUtils = "libsycl-glibc";
}
SmallVector<StringRef, 4> sycl_device_wrapper_libs = {
LibSysUtils, "libsycl-complex", "libsycl-complex-fp64",
"libsycl-cmath", "libsycl-cmath-fp64"};
// For AOT compilation, we need to link sycl_device_fallback_libs as
// default too.
SmallVector<StringRef, 4> sycl_device_fallback_libs = {
"libsycl-fallback-cassert", "libsycl-fallback-complex",
"libsycl-fallback-complex-fp64", "libsycl-fallback-cmath",
"libsycl-fallback-cmath-fp64"};
auto addInputs = [&](SYCLDeviceLibType t) {
auto sycl_libs = (t == sycl_devicelib_wrapper)
? sycl_device_wrapper_libs
: sycl_device_fallback_libs;
for (const StringRef &Lib : sycl_libs) {
SmallString<128> LibName(LibLoc);
llvm::sys::path::append(LibName, Lib);
llvm::sys::path::replace_extension(LibName, ".o");
Copy link
Contributor

Choose a reason for hiding this comment

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

.o is not a standard object name on Windows (typically it is .obj). Probably can be discussed/addressed separately, but having the naming be inconsistent with expectations is confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @mdtoguchi
As we discussed above, current device libraries use ".o" for both Linux and Windows. I agree that ".obj" should be used for Windows and I think we can address separately in another PR.
Thank you very much.

Arg *InputArg = MakeInputArg(Args, C.getDriver().getOpts(),
Args.MakeArgString(LibName));
auto *SYCLDeviceLibsInputAction =
C.MakeAction<InputAction>(*InputArg, types::TY_Object);
auto *SYCLDeviceLibsUnbundleAction =
C.MakeAction<OffloadUnbundlingJobAction>(
SYCLDeviceLibsInputAction);
addDeviceDepences(SYCLDeviceLibsUnbundleAction);
DeviceLinkObjects.push_back(SYCLDeviceLibsUnbundleAction);
}
};
addInputs(sycl_devicelib_wrapper);
if (isSpirvAOT)
addInputs(sycl_devicelib_fallback);
}

void appendLinkDependences(OffloadAction::DeviceDependences &DA) override {
assert(ToolChains.size() == DeviceLinkerInputs.size() &&
"Toolchains and linker inputs sizes do not match.");
Expand All @@ -3862,7 +3918,6 @@ class OffloadingActionBuilder final {

unsigned I = 0;
for (auto &LI : DeviceLinkerInputs) {

auto TripleIt = llvm::find_if(SYCLTripleList, [&](auto &SYCLTriple) {
return SYCLTriple == (*TC)->getTriple();
});
Expand Down Expand Up @@ -3932,13 +3987,25 @@ class OffloadingActionBuilder final {
}
ActionList DeviceLibObjects;
ActionList LinkObjects;
auto TT = SYCLTripleList[I];
auto isNVPTX = (*TC)->getTriple().isNVPTX();
bool isSpirvAOT = TT.getSubArch() == llvm::Triple::SPIRSubArch_fpga ||
TT.getSubArch() == llvm::Triple::SPIRSubArch_gen ||
TT.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
for (const auto &Input : LI) {
// FPGA aoco does not go through the link, everything else does.
if (Input->getType() == types::TY_FPGA_AOCO)
DeviceLibObjects.push_back(Input);
else
LinkObjects.push_back(Input);
}

// For SYCL compilation, add SYCL device libraries as default.
if (!isNVPTX && !Args.hasArg(options::OPT_fno_sycl_devicelib)) {
addSYCLDeviceLibs(
*TC, LinkObjects, isSpirvAOT,
C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment());
}
// The linkage actions subgraph leading to the offload wrapper.
// [cond] Means incoming/outgoing dependence is created only when cond
// is true. A function of:
Expand Down Expand Up @@ -3993,7 +4060,6 @@ class OffloadingActionBuilder final {
Action *DeviceLinkAction =
C.MakeAction<LinkJobAction>(LinkObjects, types::TY_LLVM_BC);
// setup some flags upfront
auto isNVPTX = (*TC)->getTriple().isNVPTX();

if (isNVPTX && DeviceCodeSplit) {
// TODO Temporary limitation, need to support code splitting for PTX
Expand All @@ -4005,10 +4071,6 @@ class OffloadingActionBuilder final {
D.Diag(diag::err_drv_unsupported_opt_for_target)
<< OptName << (*TC)->getTriple().str();
}
auto TT = SYCLTripleList[I];
bool isSpirvAOT = TT.getSubArch() == llvm::Triple::SPIRSubArch_fpga ||
TT.getSubArch() == llvm::Triple::SPIRSubArch_gen ||
TT.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
// reflects whether current target is ahead-of-time and can't support
// runtime setting of specialization constants
bool isAOT = isNVPTX || isSpirvAOT;
Expand All @@ -4021,8 +4083,19 @@ class OffloadingActionBuilder final {
types::ID PostLinkOutType = isNVPTX || !MultiFileActionDeps
? types::TY_LLVM_BC
: types::TY_Tempfiletable;
auto *PostLinkAction = C.MakeAction<SYCLPostLinkJobAction>(
DeviceLinkAction, PostLinkOutType);
SYCLPostLinkJobAction *PostLinkDCRAction = nullptr;
SYCLPostLinkJobAction *PostLinkAction = nullptr;
if (isNVPTX || Args.hasArg(options::OPT_fno_sycl_devicelib)) {
PostLinkAction = C.MakeAction<SYCLPostLinkJobAction>(DeviceLinkAction,
PostLinkOutType);
} else {
PostLinkDCRAction = C.MakeAction<SYCLPostLinkJobAction>(
DeviceLinkAction, types::TY_LLVM_BC);
PostLinkDCRAction->setDeadCodeRemoval(true);
PostLinkDCRAction->setRTSetsSpecConstants(false);
PostLinkAction = C.MakeAction<SYCLPostLinkJobAction>(
PostLinkDCRAction, PostLinkOutType);
}
PostLinkAction->setRTSetsSpecConstants(!isAOT);

if (isNVPTX) {
Expand Down Expand Up @@ -4569,7 +4642,7 @@ class OffloadingActionBuilder final {
return nullptr;

// Let builders add host linking actions.
Action* HA;
Action *HA = nullptr;
for (DeviceActionBuilder *SB : SpecializedBuilders) {
if (!SB->isValid())
continue;
Expand All @@ -4588,7 +4661,6 @@ class OffloadingActionBuilder final {
for (auto *SB : SpecializedBuilders) {
if (!SB->isValid())
continue;

SB->appendLinkDependences(DDeps);
}

Expand Down
10 changes: 8 additions & 2 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7837,8 +7837,15 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
// OPT_fsycl_device_code_split is not checked as it is an alias to
// -fsycl-device-code-split=per_source

auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
bool InDeadCodeRemoval = false;
if (SYCLPostLink && SYCLPostLink->getDeadCodeRemoval()) {
addArgs(CmdArgs, TCArgs, {"--dead-code-removal"});
InDeadCodeRemoval = true;
}

// Turn on Dead Parameter Elimination Optimization with early optimizations
if (!getToolChain().getTriple().isNVPTX() &&
if (!getToolChain().getTriple().isNVPTX() && !InDeadCodeRemoval &&
TCArgs.hasFlag(options::OPT_fsycl_dead_args_optimization,
options::OPT_fno_sycl_dead_args_optimization, false))
addArgs(CmdArgs, TCArgs, {"-emit-param-info"});
Expand All @@ -7854,7 +7861,6 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
addArgs(CmdArgs, TCArgs, {"-symbols"});
}
// specialization constants processing is mandatory
auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
if (SYCLPostLink && SYCLPostLink->getRTSetsSpecConstants())
addArgs(CmdArgs, TCArgs, {"-spec-const=rt"});
else
Expand Down
30 changes: 15 additions & 15 deletions clang/test/Driver/sycl-offload-intelfpga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

/// -fintelfpga -fsycl-link tests
// RUN: touch %t.o
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -fsycl-link %t.o -o libfoo.a 2>&1 \
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -fsycl-link %t.o -o libfoo.a 2>&1 \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @mdtoguchi and @bader
Currently, I added "-fno-sycl-devicelib" to disable devicelib default link in order to not break those lit tests. As those tests depend on the compilation workflow.
I will add some lit test in driver to test devicelib link step later.
Thanks very much.

// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK,CHK-FPGA-EARLY %s
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -fsycl-link=early %t.o -o libfoo.a 2>&1 \
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -fsycl-link=early %t.o -o libfoo.a 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK,CHK-FPGA-EARLY %s
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -fsycl-link=image %t.o -o libfoo.a 2>&1 \
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -fsycl-link=image %t.o -o libfoo.a 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK,CHK-FPGA-IMAGE %s
// CHK-FPGA-LINK-NOT: clang-offload-bundler{{.*}} "-check-section"
// CHK-FPGA-LINK: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice" "-inputs=[[INPUT:.+\.o]]" "-outputs=[[OUTPUT1:.+\.o]]" "-unbundle"
Expand All @@ -50,9 +50,9 @@

/// -fintelfpga -fsycl-link clang-cl specific
// RUN: touch %t.obj
// RUN: %clang_cl -### -fsycl -fintelfpga -fsycl-link %t.obj -Folibfoo.lib 2>&1 \
// RUN: %clang_cl -### -fsycl -fintelfpga -fno-sycl-devicelib -fsycl-link %t.obj -Folibfoo.lib 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK-WIN %s
// RUN: %clang_cl -### -fsycl -fintelfpga -fsycl-link %t.obj -o libfoo.lib 2>&1 \
// RUN: %clang_cl -### -fsycl -fintelfpga -fno-sycl-devicelib -fsycl-link %t.obj -o libfoo.lib 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK-WIN %s
// CHK-FPGA-LINK-WIN: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64_fpga-unknown-unknown-sycldevice{{.*}}" "-inputs=[[INPUT:.+\.obj]]" "-outputs=[[OUTPUT1:.+\.obj]]" "-unbundle"
// CHK-FPGA-LINK-WIN-NOT: clang-offload-bundler{{.*}}
Expand Down Expand Up @@ -185,9 +185,9 @@

/// -fintelfpga -fsycl-link from source
// RUN: touch %t.cpp
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -fsycl-link=early %t.cpp -ccc-print-phases 2>&1 \
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -fsycl-link=early %t.cpp -ccc-print-phases 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK-SRC,CHK-FPGA-LINK-SRC-DEFAULT %s
// RUN: %clang_cl -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -fsycl-link=early %t.cpp -ccc-print-phases 2>&1 \
// RUN: %clang_cl -### -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -fsycl-link=early %t.cpp -ccc-print-phases 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK-SRC,CHK-FPGA-LINK-SRC-CL %s
// CHK-FPGA-LINK-SRC: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl)
// CHK-FPGA-LINK-SRC: 1: preprocessor, {0}, c++-cpp-output, (host-sycl)
Expand Down Expand Up @@ -275,9 +275,9 @@

/// -fintelfpga dependency file use from object phases test
// RUN: touch %t-1.o
// RUN: %clangxx -fsycl -fintelfpga -ccc-print-phases -### %t-1.o 2>&1 \
// RUN: %clangxx -fsycl -fno-sycl-devicelib -fintelfpga -ccc-print-phases -### %t-1.o 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-FPGA-DEP-FILES-OBJ-PHASES -DINPUT=%t-1.o %s
// RUN: %clang_cl -fsycl -fintelfpga -ccc-print-phases -### %t-1.o 2>&1 \
// RUN: %clang_cl -fsycl -fno-sycl-devicelib -fintelfpga -ccc-print-phases -### %t-1.o 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-FPGA-DEP-FILES-OBJ-PHASES -DINPUT=%t-1.o %s
// CHK-FPGA-DEP-FILES-OBJ-PHASES: 0: input, "[[INPUT]]", object, (host-sycl)
// CHK-FPGA-DEP-FILES-OBJ-PHASES: 1: clang-offload-unbundler, {0}, object, (host-sycl)
Expand Down Expand Up @@ -348,7 +348,7 @@
// RUN: llc -filetype=obj -o %t-aoco_cl.o %t-aoco_cl.bc
// RUN: llvm-ar crv %t_aoco.a %t.o %t2.o %t-aoco.o
// RUN: llvm-ar crv %t_aoco_cl.a %t.o %t2_cl.o %t-aoco_cl.o
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -foffload-static-lib=%t_aoco.a %s -### -ccc-print-phases 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -foffload-static-lib=%t_aoco.a %s -### -ccc-print-phases 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-FPGA-AOCO-PHASES %s
// CHK-FPGA-AOCO-PHASES: 0: input, "[[INPUTA:.+\.a]]", object, (host-sycl)
// CHK-FPGA-AOCO-PHASES: 1: input, "[[INPUTCPP:.+\.cpp]]", c++, (host-sycl)
Expand All @@ -375,7 +375,7 @@
// CHK-FPGA-AOCO-PHASES: 22: offload, "host-sycl (x86_64-unknown-linux-gnu)" {10}, "device-sycl (spir64_fpga-unknown-unknown-sycldevice)" {21}, image

/// FPGA AOCO Windows phases check
// RUN: %clang_cl -fsycl -fintelfpga -foffload-static-lib=%t_aoco_cl.a %s -### -ccc-print-phases 2>&1 \
// RUN: %clang_cl -fsycl -fno-sycl-devicelib -fintelfpga -foffload-static-lib=%t_aoco_cl.a %s -### -ccc-print-phases 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO-PHASES-WIN %s
// CHK-FPGA-AOCO-PHASES-WIN: 0: input, "{{.*}}", object, (host-sycl)
// CHK-FPGA-AOCO-PHASES-WIN: 1: input, "[[INPUTSRC:.+\.cpp]]", c++, (host-sycl)
Expand All @@ -401,13 +401,13 @@
// CHK-FPGA-AOCO-PHASES-WIN: 21: offload, "host-sycl (x86_64-pc-windows-msvc)" {10}, "device-sycl (spir64_fpga-unknown-unknown-sycldevice)" {20}, image

/// aoco test, checking tools
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -foffload-static-lib=%t_aoco.a -### %s 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga -foffload-static-lib=%t_aoco.a -### %s 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-LIN %s
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fintelfpga %t_aoco.a -### %s 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -fintelfpga %t_aoco.a -### %s 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-LIN %s
// RUN: %clang_cl -fsycl -fintelfpga -foffload-static-lib=%t_aoco_cl.a -### %s 2>&1 \
// RUN: %clang_cl -fsycl -fno-sycl-devicelib -fintelfpga -foffload-static-lib=%t_aoco_cl.a -### %s 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-WIN %s
// RUN: %clang_cl -fsycl -fintelfpga %t_aoco_cl.a -### %s 2>&1 \
// RUN: %clang_cl -fsycl -fno-sycl-devicelib -fintelfpga %t_aoco_cl.a -### %s 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-AOCO,CHK-FPGA-AOCO-WIN %s
// CHK-FPGA-AOCO-LIN: clang-offload-bundler{{.*}} "-type=ao" "-targets=sycl-fpga_aoco-intel-unknown-sycldevice" "-inputs=[[INPUTLIB:.+\.a]]" "-check-section"
// CHK-FPGA-AOCO-LIN: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]"
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/sycl-offload-static-lib-2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
/// ###########################################################################

/// test behaviors of static lib with no source/object
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t.a -### 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -L/dummy/dir %t.a -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC -DINPUTLIB=%t.a
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t.lo -### 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -L/dummy/dir %t.lo -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC -DINPUTLIB=%t.lo
// STATIC_LIB_NOSRC: clang-offload-bundler{{.*}} "-type=ao" "-targets=host-x86_64-unknown-linux-gnu" "-inputs=[[INPUTLIB]]" "-check-section"
// STATIC_LIB_NOSRC: ld{{.*}} "-r" "-o" "[[PARTIALOBJ:.+\.o]]" "{{.*}}crt1.o" {{.*}} "-L/dummy/dir" {{.*}} "[[INPUTLIB]]"
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/sycl-offload-static-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

/// test behaviors of -foffload-static-lib=<lib> from source
// RUN: touch %t.a
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -foffload-static-lib=%t.a -ccc-print-phases %s 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -foffload-static-lib=%t.a -ccc-print-phases %s 2>&1 \
// RUN: | FileCheck %s -check-prefix=FOFFLOAD_STATIC_LIB_SRC

// FOFFLOAD_STATIC_LIB_SRC: 0: input, "[[INPUTA:.+\.a]]", object, (host-sycl)
Expand Down Expand Up @@ -122,9 +122,9 @@
/// ###########################################################################

/// test behaviors of -foffload-static-lib with no source/object
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir -foffload-static-lib=%t.a -### -ccc-print-phases 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -L/dummy/dir -foffload-static-lib=%t.a -### -ccc-print-phases 2>&1 \
// RUN: | FileCheck %s -check-prefixes=FOFFLOAD_STATIC_LIB_NOSRC_PHASES,FOFFLOAD_STATIC_LIB_NOSRC_PHASES_1
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir -foffload-whole-static-lib=%t.a -### -ccc-print-phases 2>&1 \
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-devicelib -L/dummy/dir -foffload-whole-static-lib=%t.a -### -ccc-print-phases 2>&1 \
// RUN: | FileCheck %s -check-prefixes=FOFFLOAD_STATIC_LIB_NOSRC_PHASES,FOFFLOAD_STATIC_LIB_NOSRC_PHASES_2
// FOFFLOAD_STATIC_LIB_NOSRC_PHASES: 0: input, "[[INPUTA:.+\.a]]", object, (host-sycl)
// FOFFLOAD_STATIC_LIB_NOSRC_PHASES: 1: linker, {0}, image, (host-sycl)
Expand Down
Loading