Skip to content
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

[SYCL][Graph] Permit empty & barrier nodes in Whole Graph Update #374

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b250a61
[SYCL] Cleanup/refactor device_code_tests (#14173)
ianayl Jun 17, 2024
a6a3fc9
[SYCL][ESIMD] Fix runfail due to not having shader dumps enabled (#14…
jasonlizhengjian Jun 17, 2024
516742c
[SYCL][E2E] Remove deprecated multi_ptr use in `UserDefinedReductions…
ayylol Jun 17, 2024
7972aa9
[SYCL][E2E] Fix deprecated warnings in `Scheduler` e2e tests (#14126)
ayylol Jun 17, 2024
75457f1
[SYCL][E2E] Fix memory leak in kernel_max_wg_size.cpp (#14201)
againull Jun 17, 2024
877e5fa
[SYCL][Doc] Correct installation steps for cpu/fpga runtimes (#14204)
againull Jun 17, 2024
3e474e0
[New offload model] Cleanup the way sycl-post-link options are genera…
asudarsa Jun 18, 2024
e310db1
[NFC] Remove uses of deprecated StringRef::equals (#14198)
mikerice1969 Jun 18, 2024
5a2b3c3
[NFC] Remove unused lambda capture (#14203)
mikerice1969 Jun 18, 2024
a5fc29e
Bump urllib3 from 2.2.1 to 2.2.2 in /llvm/utils/git (#14206)
dependabot[bot] Jun 18, 2024
6385079
Bump urllib3 from 2.2.1 to 2.2.2 in /llvm/docs (#14205)
dependabot[bot] Jun 18, 2024
bd97f28
[Bindless][Exp] Windows & DX12 interop. Semaphore ops can take values…
przemektmalon Jun 18, 2024
e11fecf
[SYCL][Driver][thinLTO] Error for -foffload-lto and -fsycl-device-cod…
sarnex Jun 18, 2024
ab77ba8
[UR] Bump L0 tag to 2a31795d (#14213)
kbenzie Jun 18, 2024
ef29e22
[NFC] Add a variable use to silence 'set but not used' warning (#14217)
mikerice1969 Jun 18, 2024
36c88dc
[SYCL][E2E] remove `AtomicRef` native fp tests (#14219)
ayylol Jun 18, 2024
4151c79
[SYCL][Graph] Wait instead of flush dep events in update command (#14…
Bensuo Jun 19, 2024
7928588
[SYCL][COMPAT] Add device_count and testing (#14013)
Jun 19, 2024
ab6c0f5
[E2E][CUDA][HIP][level_zero] Make P2P tests portable. (#14095)
JackAKirk Jun 19, 2024
a0cc14f
[DeviceSanitizer]Change ASan shadow scale from 3 to 4 (#13857)
zhaomaosu Jun 19, 2024
dd4d3fb
[SYCL][E2E] Fix deprecated warnings in `InvokeSimd` e2e tests (#14215)
ayylol Jun 19, 2024
a25d27b
[SYCL][NATIVECPU][LIBCLC] Implement missing builtins for half type (#…
PietroGhg Jun 19, 2024
c641157
[CODEOWNERS] Add code owner for Sanitizer code (#14223)
cdai2 Jun 19, 2024
c3d8e27
[SYCL][E2E] Fix deprecated warnings in `HostInteropTask` e2e tests (#…
ayylol Jun 19, 2024
8e3b8ce
[SYCL] Add sorting APIs for fixed-size private array input (#14185)
againull Jun 19, 2024
82f77d1
[SYCL][Graph] Fix queue recording barrier to different graphs (#14212)
EwanC Jun 20, 2024
768e8d5
[SYCL][Graph] Permit empty & barrier nodes in WGU
EwanC Jun 18, 2024
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
12 changes: 12 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,15 @@ sycl/test-e2e/DeviceCodeSplit/ @intel/dpcpp-tools-reviewers
sycl/test-e2e/SeparateCompile/ @intel/dpcpp-tools-reviewers
sycl/test-e2e/Printf/ @intel/dpcpp-tools-reviewers @intel/llvm-reviewers-runtime
sycl/test-e2e/SpecConstants/ @intel/dpcpp-tools-reviewers

# Sanitizer
clang/lib/Driver/SanitizerArgs.cpp @intel/dpcpp-sanitizers-review
libdevice/sanitizer_utils.cpp @intel/dpcpp-sanitizers-review
libdevice/include/asan_libdevice.hpp @intel/dpcpp-sanitizers-review
libdevice/include/sanitizer_utils.hpp @intel/dpcpp-sanitizers-review
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @intel/dpcpp-sanitizers-review
sycl/test-e2e/AddressSanitizer/ @intel/dpcpp-sanitizers-review
llvm/test/Instrumentation/AddressSanitizer/ @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h @intel/dpcpp-sanitizers-review
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @intel/dpcpp-sanitizers-review
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ def warn_drv_opt_requires_opt
: Warning<"'%0' should be used only in conjunction with '%1'">, InGroup<UnusedCommandLineArgument>;
def err_drv_sycl_missing_amdgpu_arch : Error<
"missing AMDGPU architecture for SYCL offloading; specify it with '-Xsycl-target-backend%select{|=%1}0 --offload-arch=<arch-name>'">;
def err_drv_sycl_thinlto_split_off: Error<
"'%0' is not supported when '%1' is set with '-fsycl'">;
def warn_drv_sycl_offload_target_duplicate : Warning<
"SYCL offloading target '%0' is similar to target '%1' already specified; "
"will be ignored">, InGroup<SyclTarget>;
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1881,9 +1881,9 @@ static llvm::fp::FPAccuracy convertFPAccuracy(StringRef FPAccuracyStr) {
}

static int32_t convertFPAccuracyToAspect(StringRef FPAccuracyStr) {
assert(FPAccuracyStr.equals("high") || FPAccuracyStr.equals("medium") ||
FPAccuracyStr.equals("low") || FPAccuracyStr.equals("sycl") ||
FPAccuracyStr.equals("cuda"));
assert(FPAccuracyStr == "high" || FPAccuracyStr == "medium" ||
FPAccuracyStr == "low" || FPAccuracyStr == "sycl" ||
FPAccuracyStr == "cuda");
return llvm::StringSwitch<int32_t>(FPAccuracyStr)
.Case("high", SYCLInternalAspect::fp_intrinsic_accuracy_high)
.Case("medium", SYCLInternalAspect::fp_intrinsic_accuracy_medium)
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Driver/SanitizerArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,8 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
CmdArgs.push_back("-asan-stack=0");
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-asan-globals=0");
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-asan-mapping-scale=4");
}
return;
}
Expand Down
89 changes: 46 additions & 43 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5846,12 +5846,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
bool IsUsingOffloadNewDriver =
Args.hasFlag(options::OPT_offload_new_driver,
options::OPT_no_offload_new_driver, false);
bool IsSYCLLTOSupported = JA.isDeviceOffloading(Action::OFK_SYCL) &&
Triple.isSPIROrSPIRV() &&
IsUsingOffloadNewDriver;
if (IsDeviceOffloadAction && !JA.isDeviceOffloading(Action::OFK_OpenMP) &&
!IsUsingOffloadNewDriver && !Triple.isAMDGPU() &&
!IsSYCLLTOSupported) {
Arg *SYCLSplitMode =
Args.getLastArg(options::OPT_fsycl_device_code_split_EQ);
bool IsDeviceCodeSplitDisabled =
SYCLSplitMode && StringRef(SYCLSplitMode->getValue()) == "off";
bool IsSYCLLTOSupported =
JA.isDeviceOffloading(Action::OFK_SYCL) && IsUsingOffloadNewDriver;
if ((IsDeviceOffloadAction &&
!JA.isDeviceOffloading(Action::OFK_OpenMP) && !Triple.isAMDGPU() &&
!IsUsingOffloadNewDriver) ||
(JA.isDeviceOffloading(Action::OFK_SYCL) && !IsSYCLLTOSupported)) {
D.Diag(diag::err_drv_unsupported_opt_for_target)
<< Args.getLastArg(options::OPT_foffload_lto,
options::OPT_foffload_lto_EQ)
Expand All @@ -5864,6 +5868,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_foffload_lto_EQ)
->getAsString(Args)
<< "-fno-gpu-rdc";
} else if (JA.isDeviceOffloading(Action::OFK_SYCL) &&
IsDeviceCodeSplitDisabled && LTOMode == LTOK_Thin) {
D.Diag(diag::err_drv_sycl_thinlto_split_off)
<< SYCLSplitMode->getAsString(Args)
<< Args.getLastArg(options::OPT_foffload_lto,
options::OPT_foffload_lto_EQ)
->getAsString(Args);
} else {
assert(LTOMode == LTOK_Full || LTOMode == LTOK_Thin);
CmdArgs.push_back(Args.MakeArgString(
Expand Down Expand Up @@ -10648,31 +10659,34 @@ static void getNonTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
addArgs(PostLinkArgs, TCArgs, {"-lower-esimd-force-stateless-mem=false"});
}

// Add any sycl-post-link options that rely on a specific Triple.
static void
getTripleBasedSYCLPostLinkOpts(const ToolChain &TC, const JobAction &JA,
const llvm::opt::ArgList &TCArgs,
llvm::Triple Triple, ArgStringList &PostLinkArgs,
bool SpecConsts, types::ID OutputType) {
bool NewOffloadDriver = TC.getDriver().getUseNewOffloadingDriver();
// Note: Do not use Triple when NewOffloadDriver is 'true'.
if (!NewOffloadDriver && (OutputType == types::TY_LLVM_BC)) {
// Add any sycl-post-link options that rely on a specific Triple in addition
// to user supplied options. This function is invoked only for the old
// offloading model. For the new offloading model, a slightly modified version
// of this function is called inside clang-linker-wrapper.
// NOTE: Any changes made here should be reflected in the similarly named
// function in clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp.
static void getTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
const llvm::opt::ArgList &TCArgs,
ArgStringList &PostLinkArgs,
llvm::Triple Triple,
bool SpecConstsSupported,
types::ID OutputType) {
if (OutputType == types::TY_LLVM_BC) {
// single file output requested - this means only perform necessary IR
// transformations (like specialization constant intrinsic lowering) and
// output LLVMIR
addArgs(PostLinkArgs, TCArgs, {"-ir-output-only"});
}
// specialization constants processing is mandatory
if (SpecConsts)
if (SpecConstsSupported)
addArgs(PostLinkArgs, TCArgs, {"-spec-const=native"});
else
addArgs(PostLinkArgs, TCArgs, {"-spec-const=emulation"});

// See if device code splitting is requested. The logic here works along side
// the behavior in setOtherSYCLPostLinkOpts, where the option is added based
// on the user setting of-fsycl-device-code-split.
// the behavior in getNonTripleBasedSYCLPostLinkOpts, where the option is
// added based on the user setting of -fsycl-device-code-split.
if (!TCArgs.hasArg(options::OPT_fsycl_device_code_split_EQ) &&
(NewOffloadDriver || !(Triple.getArchName() == "spir64_fpga")))
(Triple.getArchName() != "spir64_fpga"))
addArgs(PostLinkArgs, TCArgs, {"-split=auto"});

// On Intel targets we don't need non-kernel functions as entry points,
Expand All @@ -10683,18 +10697,17 @@ getTripleBasedSYCLPostLinkOpts(const ToolChain &TC, const JobAction &JA,
options::OPT_fsycl_remove_unused_external_funcs,
false) &&
!isSYCLNativeCPU(TC)) &&
(NewOffloadDriver || (!Triple.isNVPTX() && !Triple.isAMDGPU())))
!Triple.isNVPTX() && !Triple.isAMDGPU())
addArgs(PostLinkArgs, TCArgs, {"-emit-only-kernels-as-entry-points"});

if (!NewOffloadDriver && !Triple.isAMDGCN())
if (!Triple.isAMDGCN())
addArgs(PostLinkArgs, TCArgs, {"-emit-param-info"});
// Enable program metadata
if ((!NewOffloadDriver && (Triple.isNVPTX() || Triple.isAMDGCN())) ||
isSYCLNativeCPU(TC))
if (Triple.isNVPTX() || Triple.isAMDGCN() || isSYCLNativeCPU(TC))
addArgs(PostLinkArgs, TCArgs, {"-emit-program-metadata"});
if (OutputType != types::TY_LLVM_BC) {
assert(OutputType == types::TY_Tempfiletable);
bool SplitEsimdByDefault = !NewOffloadDriver && Triple.isSPIROrSPIRV();
bool SplitEsimdByDefault = Triple.isSPIROrSPIRV();
bool SplitEsimd = TCArgs.hasFlag(
options::OPT_fsycl_device_code_split_esimd,
options::OPT_fno_sycl_device_code_split_esimd, SplitEsimdByDefault);
Expand All @@ -10714,7 +10727,7 @@ getTripleBasedSYCLPostLinkOpts(const ToolChain &TC, const JobAction &JA,
if (TCArgs.hasFlag(options::OPT_fsycl_add_default_spec_consts_image,
options::OPT_fno_sycl_add_default_spec_consts_image,
false) &&
(IsAOT || NewOffloadDriver))
IsAOT)
addArgs(PostLinkArgs, TCArgs,
{"-generate-device-image-default-spec-consts"});
}
Expand All @@ -10738,7 +10751,7 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,

llvm::Triple T = getToolChain().getTriple();
getNonTripleBasedSYCLPostLinkOpts(getToolChain(), JA, TCArgs, CmdArgs);
getTripleBasedSYCLPostLinkOpts(getToolChain(), JA, TCArgs, T, CmdArgs,
getTripleBasedSYCLPostLinkOpts(getToolChain(), TCArgs, CmdArgs, T,
SYCLPostLink->getRTSetsSpecConstants(),
SYCLPostLink->getTrueType());

Expand All @@ -10749,8 +10762,6 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
if (T.getSubArch() == llvm::Triple::SPIRSubArch_gen && Device.data())
OutputArg = ("intel_gpu_" + Device + "," + OutputArg).str();

addArgs(CmdArgs, TCArgs, {"-o", OutputArg});

const toolchains::SYCLToolChain &TC =
static_cast<const toolchains::SYCLToolChain &>(getToolChain());

Expand All @@ -10759,6 +10770,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_Xdevice_post_link_EQ,
JA.getOffloadingArch());

addArgs(CmdArgs, TCArgs, {"-o", OutputArg});

// Add input file
assert(Inputs.size() == 1 && Inputs.front().isFilename() &&
"single input file expected");
Expand Down Expand Up @@ -11111,24 +11124,14 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
// --sycl-post-link-options="options" provides a string of options to be
// passed along to the sycl-post-link tool during device link.
SmallString<128> PostLinkOptString;
if (Args.hasArg(options::OPT_Xdevice_post_link)) {
for (const auto &A : Args.getAllArgValues(options::OPT_Xdevice_post_link))
appendOption(PostLinkOptString, A);
}
ArgStringList PostLinkArgs;
bool IsSYCLNativeCPU = driver::isSYCLNativeCPU(Args);
types::ID OutputType = TargetTriple.isSPIROrSPIRV() || IsSYCLNativeCPU
? types::TY_Tempfiletable
: types::TY_LLVM_BC;
bool SpecConsts = TargetTriple.isSPIROrSPIRV();
getNonTripleBasedSYCLPostLinkOpts(getToolChain(), JA, Args, PostLinkArgs);
// Some options like -spec-consts=* depend on target triple as well as some
// user options. So, these options are partly computed here and then
// updated inside the clang-linker-wrapper.
getTripleBasedSYCLPostLinkOpts(getToolChain(), JA, Args, TargetTriple,
PostLinkArgs, SpecConsts, OutputType);
for (const auto &A : PostLinkArgs)
appendOption(PostLinkOptString, A);
if (Args.hasArg(options::OPT_Xdevice_post_link)) {
for (const auto &A : Args.getAllArgValues(options::OPT_Xdevice_post_link))
appendOption(PostLinkOptString, A);
}
if (!PostLinkOptString.empty())
CmdArgs.push_back(
Args.MakeArgString("--sycl-post-link-options=" + PostLinkOptString));
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3858,7 +3858,7 @@ void CompilerInvocation::ParseFpAccuracyArgs(LangOptions &Opts, ArgList &Args,
checkFPAccuracyIsValid(ValElement[0], Diags);
// No need to fill the map if the FPaccuracy is 'default'.
// The default builtin will be generated.
if (!ValElement[0].equals("default")) {
if (ValElement[0] != "default") {
// if FPAccuracyFuncMap of this function has been previously set
// update its value; the last fp-accuracy option in the command
// line wins.
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6185,10 +6185,9 @@ bool Sema::CheckIntelSYCLAllocaBuiltinFunctionCall(unsigned BuiltinID,
}

// Check size is passed as a specialization constant
const auto CheckSize = [this, IsAlignedAlloca, ElementTypeIndex,
SpecNameIndex](const ASTContext &Ctx,
SourceLocation Loc,
const TemplateArgumentList *CST) {
const auto CheckSize = [this, IsAlignedAlloca, SpecNameIndex](
const ASTContext &Ctx, SourceLocation Loc,
const TemplateArgumentList *CST) {
TemplateArgument TA = CST->get(SpecNameIndex);
QualType Ty = TA.getNonTypeTemplateArgumentType();
if (Ty.isNull() || !Ty->isReferenceType())
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/linker-wrapper-sycl-win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// CHK-CMDS: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts=--spirv-preserve-auxdata --llvm-spirv-opts=--spirv-target-env=SPV-IR --llvm-spirv-opts=--spirv-builtin-format=global
// CHK-CMDS-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
// CHK-CMDS-NEXT: "{{.*}}llvm-link.exe" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
// CHK-CMDS-NEXT: "{{.*}}sycl-post-link.exe" SYCL_POST_LINK_OPTIONS{{.*}} -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
// CHK-CMDS-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
// LLVM-SPIRV is not called in dry-run
// CHK-CMDS-NEXT: offload-wrapper: input: [[LLVMSPIRVOUT:.*]].table, output: [[WRAPPEROUT:.*]].bc
// CHK-CMDS-NEXT: "{{.*}}llc.exe" -filetype=obj -o [[LLCOUT:.*]].o [[WRAPPEROUT]].bc
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/linker-wrapper-sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// CHK-CMDS: "{{.*}}spirv-to-ir-wrapper" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts=--spirv-preserve-auxdata --llvm-spirv-opts=--spirv-target-env=SPV-IR --llvm-spirv-opts=--spirv-builtin-format=global
// CHK-CMDS-NEXT: "{{.*}}llvm-link" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
// CHK-CMDS-NEXT: "{{.*}}llvm-link" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
// CHK-CMDS-NEXT: "{{.*}}sycl-post-link" SYCL_POST_LINK_OPTIONS {{.*}} -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
// CHK-CMDS-NEXT: "{{.*}}sycl-post-link"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
// LLVM-SPIRV is not called in dry-run
// CHK-CMDS-NEXT: offload-wrapper: input: [[LLVMSPIRVOUT:.*]].table, output: [[WRAPPEROUT:.*]].bc
// CHK-CMDS-NEXT: "{{.*}}llc" -filetype=obj -o [[LLCOUT:.*]].o [[WRAPPEROUT]].bc
Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/sycl-device-sanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// SYCL-ASAN-SAME: "-mllvm" "-asan-constructor-kind=none"
// SYCL-ASAN-SAME: "-mllvm" "-asan-stack=0"
// SYCL-ASAN-SAME: "-mllvm" "-asan-globals=0"
// SYCL-ASAN-SAME: "-mllvm" "-asan-mapping-scale=4"

// RUN: %clangxx -fsycl -fsanitize=address -mllvm -asan-stack=1 -c %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=SYCL-ASAN-FILTER %s
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Driver/sycl-lto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// RUN: not %clangxx -fsycl -foffload-lto=thin %s -### 2>&1 | FileCheck -check-prefix=CHECK_ERROR %s
// CHECK_ERROR: unsupported option '-foffload-lto=thin' for target 'spir64-unknown-unknown'

// Verify we error when using the new offload driver but with device code split set to off.
// RUN: not %clangxx -fsycl --offload-new-driver -foffload-lto=thin -fsycl-device-code-split=off %s -### 2>&1 | FileCheck -check-prefix=CHECK_SPLIT_ERROR %s
// CHECK_SPLIT_ERROR: '-fsycl-device-code-split=off' is not supported when '-foffload-lto=thin' is set with '-fsycl'

// Verify there's no error and we see the expected cc1 flags with the new offload driver.
// RUN: %clangxx -fsycl --offload-new-driver -foffload-lto=thin %s -### 2>&1 | FileCheck -check-prefix=CHECK_SUPPORTED %s
// CHECK_SUPPORTED: clang{{.*}} "-cc1" "-triple" "spir64-unknown-unknown" {{.*}} "-flto=thin" "-flto-unit"
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-offload-new-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
// RUN: -Xdevice-post-link -post-link-opt -### %s 2>&1 \
// RUN: | FileCheck -check-prefix WRAPPER_OPTIONS_POSTLINK %s
// WRAPPER_OPTIONS_POSTLINK: clang-linker-wrapper{{.*}} "--sycl-post-link-options=-post-link-opt -O2 -device-globals -spec-const=native -split=auto -emit-only-kernels-as-entry-points -symbols -emit-exported-symbols -emit-imported-symbols -lower-esimd"
// WRAPPER_OPTIONS_POSTLINK: clang-linker-wrapper{{.*}} "--sycl-post-link-options=-O2 -device-globals -post-link-opt"

// -fsycl-device-only behavior
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
Expand Down
16 changes: 16 additions & 0 deletions clang/test/Driver/sycl-post-link-options-win.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// REQUIRES: system-windows
/// Verify same set of sycl-post-link options generated for old and new offloading model
// RUN: %clangxx -### --target=x86_64-pc-windows-msvc -fsycl \
// RUN: -Xdevice-post-link -O0 %s 2>&1 \
// RUN: | FileCheck -check-prefix OPTIONS_POSTLINK_JIT_OLD %s
// OPTIONS_POSTLINK_JIT_OLD: sycl-post-link{{.*}} "-O2" "-device-globals" "-spec-const=native" "-split=auto" "-emit-only-kernels-as-entry-points" "-emit-param-info" "-symbols" "-emit-exported-symbols" "-emit-imported-symbols" "-split-esimd" "-lower-esimd" "-O0"

// RUN: %clang -cc1 %s -triple x86_64-pc-windows-msvc -emit-obj -o %t.elf.o
// RUN: clang-offload-packager -o %t.out --image=file=%t.elf.o,kind=sycl,triple=spir64
// RUN: %clang -cc1 %s -triple x86_64-pc-windows-msvc -emit-obj -o %t.o \
// RUN: -fembed-offload-object=%t.out
// RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-pc-windows-msvc \
// RUN: -sycl-device-library-location=%S/Inputs -sycl-device-libraries=libsycl-crt.new.obj \
// RUN: --sycl-post-link-options="-O2 -device-globals -O0" \
// RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck --check-prefix OPTIONS_POSTLINK_JIT_NEW %s
// OPTIONS_POSTLINK_JIT_NEW: sycl-post-link{{.*}} -spec-const=native -split=auto -emit-only-kernels-as-entry-points -emit-param-info -symbols -emit-exported-symbols -emit-imported-symbols -split-esimd -lower-esimd -O2 -device-globals -O0
16 changes: 16 additions & 0 deletions clang/test/Driver/sycl-post-link-options.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// REQUIRES: system-linux
/// Verify same set of sycl-post-link options generated for old and new offloading model
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl -### \
// RUN: -Xdevice-post-link -O0 %s 2>&1 \
// RUN: | FileCheck -check-prefix OPTIONS_POSTLINK_JIT_OLD %s
// OPTIONS_POSTLINK_JIT_OLD: sycl-post-link{{.*}} "-O2" "-device-globals" "-spec-const=native" "-split=auto" "-emit-only-kernels-as-entry-points" "-emit-param-info" "-symbols" "-emit-exported-symbols" "-emit-imported-symbols" "-split-esimd" "-lower-esimd" "-O0"

// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.elf.o
// RUN: clang-offload-packager -o %t.out --image=file=%t.elf.o,kind=sycl,triple=spir64
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o \
// RUN: -fembed-offload-object=%t.out
// RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-unknown-linux-gnu \
// RUN: -sycl-device-library-location=%S/Inputs -sycl-device-libraries=libsycl-crt.new.o \
// RUN: --sycl-post-link-options="-O2 -device-globals -O0" \
// RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck --check-prefix OPTIONS_POSTLINK_JIT_NEW %s
// OPTIONS_POSTLINK_JIT_NEW: sycl-post-link{{.*}} -spec-const=native -split=auto -emit-only-kernels-as-entry-points -emit-param-info -symbols -emit-exported-symbols -emit-imported-symbols -split-esimd -lower-esimd -O2 -device-globals -O0
Loading