Skip to content

Commit ab0a4e8

Browse files
authored
Merge branch 'sycl' into run-device-global-hip
2 parents ad977d0 + 84c6ab5 commit ab0a4e8

File tree

64 files changed

+1060
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1060
-494
lines changed

clang/include/clang/Driver/Action.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,16 @@ class OffloadWrapperJobAction : public JobAction {
698698
// Get the compilation step setting.
699699
bool getCompileStep() const { return CompileStep; }
700700

701+
// Set the offload kind for the current wrapping job action. Default usage
702+
// is to use the kind of the current toolchain.
703+
void setOffloadKind(OffloadKind SetKind) { Kind = SetKind; }
704+
705+
// Get the offload kind.
706+
OffloadKind getOffloadKind() const { return Kind; }
707+
701708
private:
702709
bool CompileStep = true;
710+
OffloadKind Kind = OFK_None;
703711
};
704712

705713
class OffloadPackagerJobAction : public JobAction {

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,6 +3943,10 @@ def foperator_arrow_depth_EQ : Joined<["-"], "foperator-arrow-depth=">, Group<f_
39433943
Visibility<[ClangOption, CC1Option]>,
39443944
HelpText<"Maximum number of 'operator->'s to call for a member access">,
39453945
MarshallingInfoInt<LangOpts<"ArrowDepth">, "256">;
3946+
def fsycl_remove_unused_external_funcs : Flag<["-"], "fsycl-remove-unused-external-funcs">,
3947+
Group<sycl_Group>, HelpText<"Allow removal of unused `SYCL_EXTERNAL` functions (default)">;
3948+
def fno_sycl_remove_unused_external_funcs : Flag<["-"], "fno-sycl-remove-unused-external-funcs">,
3949+
Group<sycl_Group>, HelpText<"Prevent removal of unused `SYCL_EXTERNAL` functions">;
39463950

39473951
def fsave_optimization_record : Flag<["-"], "fsave-optimization-record">,
39483952
Visibility<[ClangOption, FlangOption]>,

clang/lib/Driver/Driver.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,6 +3698,7 @@ bool Driver::checkForOffloadStaticLib(Compilation &C,
36983698
// FPGA binaries with AOCX or AOCR sections are not considered fat
36993699
// static archives.
37003700
return !(hasFPGABinary(C, OLArg.str(), types::TY_FPGA_AOCR) ||
3701+
hasFPGABinary(C, OLArg.str(), types::TY_FPGA_AOCR_EMU) ||
37013702
hasFPGABinary(C, OLArg.str(), types::TY_FPGA_AOCX));
37023703
}
37033704
return false;
@@ -5377,12 +5378,14 @@ class OffloadingActionBuilder final {
53775378
OWA->setCompileStep(false);
53785379
ActionList BundlingActions;
53795380
BundlingActions.push_back(DeviceWrappingAction);
5380-
DeviceAction =
5381-
C.MakeAction<OffloadBundlingJobAction>(BundlingActions);
5382-
// We created a bundled section for the wrapped images that
5383-
// are not compiled. Create another image set that are
5384-
// compiled. This set would be extracted for feeding into
5385-
// the offline compilation step when consumed.
5381+
5382+
// Wrap and compile the wrapped device device binary. This will
5383+
// be used later when consumed as the input .bc file to retain
5384+
// the symbols and properties associated.
5385+
DeviceAction = C.MakeAction<OffloadWrapperJobAction>(
5386+
BundlingActions, types::TY_Object);
5387+
if (auto *OWA = dyn_cast<OffloadWrapperJobAction>(DeviceAction))
5388+
OWA->setOffloadKind(Action::OFK_Host);
53865389
Action *CompiledDeviceAction =
53875390
C.MakeAction<OffloadWrapperJobAction>(WrapperItems,
53885391
types::TY_Object);
@@ -5754,12 +5757,14 @@ class OffloadingActionBuilder final {
57545757
OWA->setCompileStep(false);
57555758
ActionList BundlingActions;
57565759
BundlingActions.push_back(DeviceWrappingAction);
5757-
DeviceAction =
5758-
C.MakeAction<OffloadBundlingJobAction>(BundlingActions);
5759-
// We created a bundled section for the wrapped images that
5760-
// are not compiled. Create another image set that are
5761-
// compiled. This set would be extracted for feeding into
5762-
// the offline compilation step when consumed.
5760+
5761+
// Wrap and compile the wrapped device device binary. This will
5762+
// be used later when consumed as the input .bc file to retain
5763+
// the symbols and properties associated.
5764+
DeviceAction = C.MakeAction<OffloadWrapperJobAction>(
5765+
BundlingActions, types::TY_Object);
5766+
if (auto *OWA = dyn_cast<OffloadWrapperJobAction>(DeviceAction))
5767+
OWA->setOffloadKind(Action::OFK_Host);
57635768
Action *CompiledDeviceAction =
57645769
C.MakeAction<OffloadWrapperJobAction>(WrapperInputs,
57655770
types::TY_Object);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9706,6 +9706,9 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
97069706
// default is "none" which means runtime must try to determine it
97079707
// automatically.
97089708
StringRef Kind = Action::GetOffloadKindName(OffloadingKind);
9709+
Action::OffloadKind OK = WrapperJob.getOffloadKind();
9710+
if (OK != Action::OFK_None)
9711+
Kind = Action::GetOffloadKindName(OK);
97099712
WrapperArgs.push_back(
97109713
C.getArgs().MakeArgString(Twine("-kind=") + Twine(Kind)));
97119714

@@ -10212,10 +10215,13 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
1021210215
addArgs(CmdArgs, TCArgs, {"-split=auto"});
1021310216
}
1021410217

10215-
// On FPGA target we don't need non-kernel functions as entry points, because
10216-
// it only increases amount of code for device compiler to handle, without any
10217-
// actual benefits.
10218-
if (T.getArchName() == "spir64_fpga")
10218+
// On Intel targets we don't need non-kernel functions as entry points,
10219+
// because it only increases amount of code for device compiler to handle,
10220+
// without any actual benefits.
10221+
// TODO: Try to extend this feature for non-Intel GPUs.
10222+
if (!TCArgs.hasFlag(options::OPT_fno_sycl_remove_unused_external_funcs,
10223+
options::OPT_fsycl_remove_unused_external_funcs, false) &&
10224+
!T.isNVPTX() && !T.isAMDGPU())
1021910225
addArgs(CmdArgs, TCArgs, {"-emit-only-kernels-as-entry-points"});
1022010226

1022110227
// OPT_fsycl_device_code_split is not checked as it is an alias to
@@ -10573,7 +10579,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1057310579

1057410580
// Add any SYCL offloading specific options to the clang-linker-wrapper
1057510581
if (C.hasOffloadToolChain<Action::OFK_SYCL>()) {
10576-
// --sycl-device-libraries=<comma separated list> contains all of the SYCL
10582+
// -sycl-device-libraries=<comma separated list> contains all of the SYCL
1057710583
// device specific libraries that are needed. This provides the list of
1057810584
// files file only.
1057910585
// TODO: This generic list will be populated with only device binaries
@@ -10601,14 +10607,14 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1060110607
LibList += ",";
1060210608
LibList += AddLib;
1060310609
}
10604-
// --sycl-device-libraries=<libs> provides a comma separate list of
10610+
// -sycl-device-libraries=<libs> provides a comma separate list of
1060510611
// libraries to add to the device linking step.
1060610612
// SYCL device libraries can be found.
1060710613
if (LibList.size())
1060810614
CmdArgs.push_back(
10609-
Args.MakeArgString(Twine("--sycl-device-libraries=") + LibList));
10615+
Args.MakeArgString(Twine("-sycl-device-libraries=") + LibList));
1061010616

10611-
// --sycl-device-library-location=<dir> provides the location in which the
10617+
// -sycl-device-library-location=<dir> provides the location in which the
1061210618
// SYCL device libraries can be found.
1061310619
SmallString<128> DeviceLibDir(D.Dir);
1061410620
llvm::sys::path::append(DeviceLibDir, "..", "lib");
@@ -10630,7 +10636,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1063010636
}
1063110637
}
1063210638
CmdArgs.push_back(Args.MakeArgString(
10633-
Twine("--sycl-device-library-location=") + DeviceLibDir));
10639+
Twine("-sycl-device-library-location=") + DeviceLibDir));
1063410640
}
1063510641

1063610642
auto appendOption = [](SmallString<128> &OptString, StringRef AddOpt) {

clang/test/Driver/sycl-offload-intelfpga-emu.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
// CHK-FPGA-LINK: clang-offload-wrapper{{.*}} "-o=[[WRAPOUT:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" {{.*}} "-kind=sycl" "-batch" "[[TABLEOUT2]]"
2525
// CHK-FPGA-LINK: llc{{.*}} "-o" "[[OBJOUTDEV:.+\.o]]" "[[WRAPOUT]]"
2626
// CHK-FPGA-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPPEROUT_O:.+\.o]]" "-host=x86_64-unknown-linux-gnu" "--emit-reg-funcs=0" "-target=fpga_aocx-intel-unknown" "-kind=sycl" "-batch" "[[TABLEOUT2]]"
27-
// CHK-FPGA-IMAGE: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocx-intel-unknown" "-output=[[BUNDLEROUT:.+\.o]]" "-input=[[WRAPPEROUT_O]]"
27+
// CHK-FPGA-IMAGE: clang-offload-wrapper{{.*}} "-host=x86_64-unknown-linux-gnu"{{.*}} "-target=fpga_aocx-intel-unknown" "-kind=host" "[[WRAPPEROUT_O]]"
28+
// CHK-FPGA-IMAGE: llc{{.*}} "-filetype=obj" "-o" "[[WRAPWRAPOUT:.+\.o]]"
2829
// CHK-FPGA-EARLY: clang-offload-wrapper{{.*}} "-host" "x86_64-unknown-linux-gnu" "-o" "[[WRAPOUTHOST:.+\.bc]]" "-kind=host"
2930
// CHK-FPGA-EARLY-NOT: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-O2"
3031
// CHK-FPGA-EARLY: "-o" "[[OBJOUT:.+\.o]]" {{.*}} "[[WRAPOUTHOST]]"
3132
// CHK-FPGA-EARLY: llvm-ar{{.*}} "cqL" "libfoo.a" "[[OBJOUT]]" "[[OBJOUTDEV]]"
32-
// CHK-FPGA-IMAGE: llvm-ar{{.*}} "cqL" "libfoo.a" "[[INPUT]]"{{.*}} "[[BUNDLEROUT]]"
33+
// CHK-FPGA-IMAGE: llvm-ar{{.*}} "cqL" "libfoo.a" "[[INPUT]]"{{.*}} "[[WRAPWRAPOUT]]"
3334

3435
/// -fintelfpga -fsycl-link clang-cl specific
3536
// RUN: touch %t.obj
@@ -73,15 +74,19 @@
7374
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" "--emit-reg-funcs=0" "-target=fpga_aocx-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
7475
// CHK-FPGA-LINK-LIB-IMAGE: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPPED_SYM_PROP]]"
7576
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP2:.+\.o]]" "-host=x86_64-unknown-linux-gnu" "--emit-reg-funcs=0" "-target=fpga_aocx-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
76-
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocx-intel-unknown"{{.*}} "-input=[[WRAPPED_SYM_PROP2]]"
77+
// CHK-FPGA-LINK-LIB-IMAGEx: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocx-intel-unknown"{{.*}} "-input=[[WRAPPED_SYM_PROP2]]"
78+
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPWRAP_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu"{{.*}} "-target=fpga_aocx-intel-unknown" "-kind=host" "[[WRAPPED_SYM_PROP2]]"
79+
// CHK-FPGA-LINK-LIB-IMAGE: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPWRAP_SYM_PROP]]"
7780
// CHK-FPGA-LINK-LIB-EARLY: llvm-foreach{{.*}} "--out-ext=aocr" "--in-file-list=[[OUTPUT2]]" "--in-replace=[[OUTPUT2]]" "--out-file-list=[[OUTPUT3:.+\.aocr]]" "--out-replace=[[OUTPUT3]]" "--" "{{.*}}opencl-aot{{.*}}" "-device=fpga_fast_emu" "-spv=[[OUTPUT2]]" "-ir=[[OUTPUT3]]" "--bo=-g"
7881
// CHK-FPGA-LINK-LIB-EARLY: file-table-tform{{.*}} "-rename=0,Code" "-o" "[[OUTPUT4:.+\.txt]]" "[[OUTPUT3]]"
7982
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-bundler{{.*}} "-type=aoo" "-targets=host-fpga_aocr_emu-intel-unknown" "-input=[[INPUT]]" "-output=[[OUTPUT_BUNDLE_BC:.+\.txt]]" "-unbundle"
8083
// CHK-FPGA-LINK-LIB-EARLY: file-table-tform{{.*}} "-rename=0,SymAndProps" "-o" "[[OUTPUT_BC2:.+\.txt]]" "[[OUTPUT_BUNDLE_BC]]"
8184
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" "-target=fpga_aocr_emu-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
8285
// CHK-FPGA-LINK-LIB-EARLY: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPPED_SYM_PROP]]"
8386
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP2:.+\.o]]" "-host=x86_64-unknown-linux-gnu" "-target=fpga_aocr_emu-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
84-
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocr_emu-intel-unknown"{{.*}} "-input=[[WRAPPED_SYM_PROP2]]"
87+
// CHK-FPGA-LINK-LIB-EARLYx: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocr_emu-intel-unknown"{{.*}} "-input=[[WRAPPED_SYM_PROP2]]"
88+
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-o=[[WRAPWRAP_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu"{{.*}} "-target=fpga_aocr_emu-intel-unknown" "-kind=host" "[[WRAPPED_SYM_PROP2]]"
89+
// CHK-FPGA-LINK-LIB-EARLY: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPWRAP_SYM_PROP]]"
8590
// CHK-FPGA-LINK-LIB: clang-offload-bundler{{.*}} "-type=aoo" "-targets=host-x86_64-unknown-linux-gnu" "-input=[[INPUT]]" "-output=[[OUTPUT1:.+\.txt]]" "-unbundle"
8691
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-host" "x86_64-unknown-linux-gnu" "-o" "[[WRAPPED_AOCR_LIST_BC:.+\.bc]]" "-kind=host" "-target=x86_64-unknown-linux-gnu" "[[OUTPUT1]]"
8792
// CHK-FPGA-LINK-LIB-EARLY: clang{{.*}} "-o" "[[OUTPUT_O:.+\.o]]" "-x" "ir" "[[WRAPPED_AOCR_LIST_BC]]"
@@ -237,7 +242,7 @@
237242
// CHK-FPGA-LINK-SRC: 19: file-table-tform, {15, 18}, tempfiletable, (device-sycl)
238243
// CHK-FPGA-LINK-SRC: 20: clang-offload-wrapper, {19}, object, (device-sycl)
239244
// CHK-FPGA-LINK-SRC: 21: clang-offload-wrapper, {19}, object, (device-sycl)
240-
// CHK-FPGA-LINK-SRC: 22: clang-offload-bundler, {21}, object, (device-sycl)
245+
// CHK-FPGA-LINK-SRC: 22: clang-offload-wrapper, {21}, object, (device-sycl)
241246
// CHK-FPGA-LINK-SRC: 23: offload, "host-sycl (x86_64-unknown-linux-gnu)" {13}, "device-sycl (spir64_fpga-unknown-unknown)" {20}, "device-sycl (spir64_fpga-unknown-unknown)" {22}, archive
242247

243248
/// Check for implied options with emulation (-g -O0)

clang/test/Driver/sycl-offload-intelfpga-link.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,17 @@
7878
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" "--emit-reg-funcs=0" "-target=fpga_aocx-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
7979
// CHK-FPGA-LINK-LIB-IMAGE: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPPED_SYM_PROP]]"
8080
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP2:.+\.o]]" "-host=x86_64-unknown-linux-gnu" "--emit-reg-funcs=0" "-target=fpga_aocx-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
81-
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocx-intel-unknown"{{.*}} "-input=[[WRAPPED_SYM_PROP2]]"
81+
// CHK-FPGA-LINK-LIB-IMAGE: clang-offload-wrapper{{.*}} "-o=[[WRAPWRAP_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu"{{.*}} "-target=fpga_aocx-intel-unknown" "-kind=host" "[[WRAPPED_SYM_PROP2]]"
82+
// CHK-FPGA-LINK-LIB-IMAGE: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPWRAP_SYM_PROP]]"
8283
// CHK-FPGA-LINK-LIB-EARLY: llvm-foreach{{.*}} "--out-ext=aocr" "--in-file-list=[[OUTPUT2]]" "--in-replace=[[OUTPUT2]]" "--out-file-list=[[OUTPUT3:.+\.aocr]]" "--out-replace=[[OUTPUT3]]" "--out-increment=a.prj" "--" "{{.*}}aoc{{.*}}" "-o" "[[OUTPUT3]]" "[[OUTPUT2]]" "-sycl" "-rtl" "-output-report-folder=a.prj" "-g"
8384
// CHK-FPGA-LINK-LIB-EARLY: file-table-tform{{.*}} "-rename=0,Code" "-o" "[[OUTPUT4:.+\.txt]]" "[[OUTPUT3]]"
8485
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-bundler{{.*}} "-type=aoo" "-targets=host-fpga_aocr-intel-unknown" "-input=[[INPUT]]" "-output=[[OUTPUT_BUNDLE_BC:.+\.txt]]" "-unbundle"
8586
// CHK-FPGA-LINK-LIB-EARLY: file-table-tform{{.*}} "-rename=0,SymAndProps" "-o" "[[OUTPUT_BC2:.+\.txt]]" "[[OUTPUT_BUNDLE_BC]]"
8687
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" "-target=fpga_aocr-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
8788
// CHK-FPGA-LINK-LIB-EARLY: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPPED_SYM_PROP]]"
8889
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-o=[[WRAPPED_SYM_PROP2:.+\.o]]" "-host=x86_64-unknown-linux-gnu" "-target=fpga_aocr-intel-unknown" "-kind=sycl" "--sym-prop-bc-files=[[OUTPUT_BC2]]" "-batch" "[[OUTPUT4]]"
89-
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-bundler{{.*}} "-type=o" "-targets=host-fpga_aocr-intel-unknown"{{.*}} "-input=[[WRAPPED_SYM_PROP2]]"
90+
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-o=[[WRAPWRAP_SYM_PROP:.+\.bc]]" "-host=x86_64-unknown-linux-gnu"{{.*}} "-target=fpga_aocr-intel-unknown" "-kind=host" "[[WRAPPED_SYM_PROP2]]"
91+
// CHK-FPGA-LINK-LIB-EARLY: llc{{.*}} "-filetype=obj"{{.*}} "[[WRAPWRAP_SYM_PROP]]"
9092
// CHK-FPGA-LINK-LIB: clang-offload-bundler{{.*}} "-type=aoo" "-targets=host-x86_64-unknown-linux-gnu" "-input=[[INPUT]]" "-output=[[OUTPUT1:.+\.txt]]" "-unbundle"
9193
// CHK-FPGA-LINK-LIB-EARLY: clang-offload-wrapper{{.*}} "-host" "x86_64-unknown-linux-gnu" "-o" "[[WRAPPED_AOCR_LIST_BC:.+\.bc]]" "-kind=host" "-target=x86_64-unknown-linux-gnu" "[[OUTPUT1]]"
9294
// CHK-FPGA-LINK-LIB-EARLY: clang{{.*}} "-o" "[[OUTPUT_O:.+\.o]]" "-x" "ir" "[[WRAPPED_AOCR_LIST_BC]]"
@@ -153,7 +155,7 @@
153155
// CHK-FPGA-LINK-SRC: 19: file-table-tform, {15, 18}, tempfiletable, (device-sycl)
154156
// CHK-FPGA-LINK-SRC: 20: clang-offload-wrapper, {19}, object, (device-sycl)
155157
// CHK-FPGA-LINK-SRC: 21: clang-offload-wrapper, {19}, object, (device-sycl)
156-
// CHK-FPGA-LINK-SRC: 22: clang-offload-bundler, {21}, object, (device-sycl)
158+
// CHK-FPGA-LINK-SRC: 22: clang-offload-wrapper, {21}, object, (device-sycl)
157159
// CHK-FPGA-LINK-SRC: 23: offload, "host-sycl (x86_64-unknown-linux-gnu)" {13}, "device-sycl (spir64_fpga-unknown-unknown)" {20}, "device-sycl (spir64_fpga-unknown-unknown)" {22}, archive
158160

159161
/// -fintelfpga with AOCR library and additional object

clang/test/Driver/sycl-offload-intelfpga.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,6 @@
4141
// RUN: | FileCheck -check-prefix=CHK-NON-KERNEL-ENTRY-POINTS %s
4242
// CHK-NON-KERNEL-ENTRY-POINTS: sycl-post-link{{.*}} "-emit-only-kernels-as-entry-points"
4343

44-
/// Non-FPGA targets should not imply -emit-only-kernels-as-entry-points in sycl-post-link
45-
// RUN: %clang -### -fsycl -fsycl-targets=spir64_fpga,spir64_gen %s 2>&1 \
46-
// RUN: | FileCheck %s --check-prefix=CHK-NON-KERNEL-ENTRY-POINTS-NEG-1
47-
// CHK-NON-KERNEL-ENTRY-POINTS-NEG-1: clang{{.*}} "-triple" "spir64_fpga-unknown-unknown"
48-
// CHK-NON-KERNEL-ENTRY-POINTS-NEG-1: sycl-post-link{{.*}} "-emit-only-kernels-as-entry-points"
49-
// CHK-NON-KERNEL-ENTRY-POINTS-NEG-1: clang{{.*}} "-triple" "spir64_gen-unknown-unknown"
50-
// CHK-NON-KERNEL-ENTRY-POINTS-NEG-1: sycl-post-link
51-
// CHK-NON-KERNEL-ENTRY-POINTS-NEG-1-NOT: "-emit-only-kernels-as-entry-points"
52-
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=CHK-NON-KERNEL-ENTRY-POINTS-NEG-2
53-
// CHK-NON-KERNEL-ENTRY-POINTS-NEG-2-NOT: "-emit-only-kernels-as-entry-points"
54-
5544
/// -fsycl-disable-range-rounding is applied to all compilations if fpga is used
5645
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_fpga-unknown-unknown,spir64_gen-unknown-unknown %s 2>&1 \
5746
// RUN: | FileCheck -check-prefix=CHK-RANGE-ROUNDING-MULTI %s

clang/test/Driver/sycl-offload-new-driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
// RUN: --sysroot=%S/Inputs/SYCL -### %s 2>&1 \
3939
// RUN: | FileCheck -check-prefix WRAPPER_OPTIONS %s
4040
// WRAPPER_OPTIONS: clang-linker-wrapper{{.*}} "--triple=spir64"
41-
// WRAPPER_OPTIONS-SAME: "--sycl-device-libraries=libsycl-crt.o,libsycl-complex.o,libsycl-complex-fp64.o,libsycl-cmath.o,libsycl-cmath-fp64.o,libsycl-imf.o,libsycl-imf-fp64.o,libsycl-imf-bf16.o,libsycl-itt-user-wrappers.o,libsycl-itt-compiler-wrappers.o,libsycl-itt-stubs.o"
42-
// WRAPPER_OPTIONS-SAME: "--sycl-device-library-location={{.*}}/lib"
41+
// WRAPPER_OPTIONS-SAME: "-sycl-device-libraries=libsycl-crt.o,libsycl-complex.o,libsycl-complex-fp64.o,libsycl-cmath.o,libsycl-cmath-fp64.o,libsycl-imf.o,libsycl-imf-fp64.o,libsycl-imf-bf16.o,libsycl-itt-user-wrappers.o,libsycl-itt-compiler-wrappers.o,libsycl-itt-stubs.o"
42+
// WRAPPER_OPTIONS-SAME: "-sycl-device-library-location={{.*}}/lib"
4343

4444
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
4545
// RUN: -Xspirv-translator -translator-opt -### %s 2>&1 \

clang/test/Driver/sycl-offload.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,11 @@
170170
/// Check if the clang with fsycl adds C++ libraries to the link line
171171
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl %s 2>&1 | FileCheck -check-prefix=CHECK-FSYCL-WITH-CLANG %s
172172
// CHECK-FSYCL-WITH-CLANG: "-lstdc++"
173+
174+
/// Check selective passing of -emit-only-kernels-as-entry-points to sycl-post-link tool
175+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_fpga %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_PASS %s
176+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_gen %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_PASS %s
177+
// CHECK_SYCL_POST_LINK_OPT_PASS: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
178+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_gen -fno-sycl-remove-unused-external-funcs %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_NO_PASS %s
179+
// CHECK_SYCL_POST_LINK_OPT_NO_PASS-NOT: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
180+

0 commit comments

Comments
 (0)