Skip to content

Commit a0c26b3

Browse files
authored
Merge branch 'intel:sycl' into cb_event
2 parents 265ab3f + 0a6e6d1 commit a0c26b3

File tree

112 files changed

+3191
-839
lines changed

Some content is hidden

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

112 files changed

+3191
-839
lines changed

.github/workflows/sycl-macos-build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ permissions: read-all
2424
jobs:
2525
build:
2626
name: Build
27-
runs-on: macos-13
27+
runs-on: macos-latest
2828
env:
2929
CCACHE_DIR: $GITHUB_WORKSPACE/build_cache_${{ inputs.build_cache_suffix }}
3030
CCACHE_MAXSIZE: ${{ inputs.build_cache_size }}

.github/workflows/ur-precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
if: ${{ always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur') }}
113113
strategy:
114114
matrix:
115-
os: ['macos-13']
115+
os: ['macos-latest']
116116
runs-on: ${{matrix.os}}
117117

118118
steps:

clang/include/clang/Driver/Options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ enum ClangVisibility {
4141
FlangOption = (1 << 4),
4242
FC1Option = (1 << 5),
4343
DXCOption = (1 << 6),
44+
SYCLRTCOnlyOption = (1 << 7),
4445
};
4546

4647
enum ID {

clang/include/clang/Driver/Options.td

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def FC1Option : OptionVisibility;
107107
// are made available when the driver is running in DXC compatibility mode.
108108
def DXCOption : OptionVisibility;
109109

110+
// SYCLRTCOnlyOption - only acceptable for the SYCL RTC (Run Time Compilation).
111+
def SYCLRTCOnlyOption : OptionVisibility;
112+
110113
/////////
111114
// Docs
112115

@@ -195,6 +198,11 @@ def sycl_Group : OptionGroup<"<SYCL group>">, Group<f_Group>,
195198
DocName<"SYCL options">,
196199
Visibility<[ClangOption, CLOption]>;
197200

201+
def sycl_rtc_only_Group : OptionGroup<"<SYCL RTC only group">,
202+
Group<f_Group>,
203+
DocName<"SYCL RTC specific options">,
204+
Visibility<[SYCLRTCOnlyOption]>;
205+
198206
def cuda_Group : OptionGroup<"<CUDA group>">, Group<f_Group>,
199207
DocName<"CUDA options">,
200208
Visibility<[ClangOption, CLOption]>;
@@ -7543,6 +7551,15 @@ def fsyclbin : Flag<["-"], "fsyclbin">, Alias<fsyclbin_EQ>,
75437551
AliasArgs<["executable"]>;
75447552
} // let Group = sycl_Group
75457553

7554+
// Options specific to the SYCL RTC and only available for JIT compilation (not
7555+
// through regular `clang++ -fsycl` in command line):
7556+
let Visibility = [SYCLRTCOnlyOption] in {
7557+
let Group = sycl_rtc_only_Group in {
7558+
def auto_pch : Flag<["--"], "auto-pch">,
7559+
HelpText<"Enable Auto-PCH for SYCL RTC Compilation">;
7560+
} // let Group = sycl_rtc_only_Group
7561+
} // let Visibility = [SYCLRTCOnlyOption]
7562+
75467563
// FIXME: -fsycl-explicit-simd is deprecated. remove it when support is dropped.
75477564
def : Flag<["-"], "fsycl-explicit-simd">, Flags<[Deprecated]>,
75487565
Group<clang_ignored_legacy_options_Group>,

clang/include/clang/Frontend/PrecompiledPreamble.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class PrecompiledPreamble {
8787
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics,
8888
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
8989
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
90-
bool StoreInMemory, StringRef StoragePath,
91-
PreambleCallbacks &Callbacks);
90+
bool StoreInMemory, StringRef StoragePath, PreambleCallbacks &Callbacks,
91+
bool AllowASTWithErrors = true);
9292

9393
PrecompiledPreamble(PrecompiledPreamble &&);
9494
PrecompiledPreamble &operator=(PrecompiledPreamble &&);

clang/lib/Frontend/PrecompiledPreamble.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,10 @@ class TempPCHFile {
247247
class PrecompilePreambleAction : public ASTFrontendAction {
248248
public:
249249
PrecompilePreambleAction(std::shared_ptr<PCHBuffer> Buffer, bool WritePCHFile,
250-
PreambleCallbacks &Callbacks)
250+
PreambleCallbacks &Callbacks,
251+
bool AllowASTWithErrors = true)
251252
: Buffer(std::move(Buffer)), WritePCHFile(WritePCHFile),
252-
Callbacks(Callbacks) {}
253+
Callbacks(Callbacks), AllowASTWithErrors(AllowASTWithErrors) {}
253254

254255
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
255256
StringRef InFile) override;
@@ -285,17 +286,19 @@ class PrecompilePreambleAction : public ASTFrontendAction {
285286
bool WritePCHFile; // otherwise the PCH is written into the PCHBuffer only.
286287
std::unique_ptr<llvm::raw_pwrite_stream> FileOS; // null if in-memory
287288
PreambleCallbacks &Callbacks;
289+
bool AllowASTWithErrors;
288290
};
289291

290292
class PrecompilePreambleConsumer : public PCHGenerator {
291293
public:
292294
PrecompilePreambleConsumer(PrecompilePreambleAction &Action, Preprocessor &PP,
293295
ModuleCache &ModCache, StringRef isysroot,
294296
std::shared_ptr<PCHBuffer> Buffer,
295-
const CodeGenOptions &CodeGenOpts)
297+
const CodeGenOptions &CodeGenOpts,
298+
bool AllowASTWithErrors = true)
296299
: PCHGenerator(PP, ModCache, "", isysroot, std::move(Buffer), CodeGenOpts,
297300
ArrayRef<std::shared_ptr<ModuleFileExtension>>(),
298-
/*AllowASTWithErrors=*/true),
301+
AllowASTWithErrors),
299302
Action(Action) {}
300303

301304
bool HandleTopLevelDecl(DeclGroupRef DG) override {
@@ -337,7 +340,7 @@ PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
337340

338341
return std::make_unique<PrecompilePreambleConsumer>(
339342
*this, CI.getPreprocessor(), CI.getModuleCache(), Sysroot, Buffer,
340-
CI.getCodeGenOpts());
343+
CI.getCodeGenOpts(), AllowASTWithErrors);
341344
}
342345

343346
template <class T> bool moveOnNoError(llvm::ErrorOr<T> Val, T &Output) {
@@ -415,7 +418,8 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
415418
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics,
416419
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
417420
std::shared_ptr<PCHContainerOperations> PCHContainerOps, bool StoreInMemory,
418-
StringRef StoragePath, PreambleCallbacks &Callbacks) {
421+
StringRef StoragePath, PreambleCallbacks &Callbacks,
422+
bool AllowASTWithErrors) {
419423
assert(VFS && "VFS is null");
420424

421425
auto PreambleInvocation = std::make_shared<CompilerInvocation>(Invocation);
@@ -512,7 +516,7 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
512516
auto Act = std::make_unique<PrecompilePreambleAction>(
513517
std::move(Buffer),
514518
/*WritePCHFile=*/Storage->getKind() == PCHStorage::Kind::TempFile,
515-
Callbacks);
519+
Callbacks, AllowASTWithErrors);
516520
if (!Act->BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]))
517521
return BuildPreambleError::BeginSourceFileFailed;
518522

clang/test/Driver/linker-wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ __attribute__((visibility("protected"), used)) int x;
6060
// TODO: Remove SPIRV-LINK-INTEL once migration to community flow is completed.
6161
// SPIRV-LINK: clang{{.*}} -o {{.*}}.img -dumpdir a.out.spirv64..img. --target=spirv64-unknown-unknown {{.*}}.o --sycl-link -Xlinker -triple=spirv64-unknown-unknown -Xlinker -arch=
6262
// SPIRV-LINK-INTEL: spirv-to-ir-wrapper{{.*}} -o {{.*}}.bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
63-
// SPIRV-LINK-INTEL: llvm-link{{.*}} {{.*}}.bc -o {{.*}}.bc --suppress-warnings
63+
// SPIRV-LINK-INTEL: llvm-link{{.*}} --suppress-warnings {{.*}}.bc -o {{.*}}.bc
6464
//
6565
// RUN: clang-offload-packager -o %t.out \
6666
// RUN: --image=file=%t.elf.o,kind=openmp,triple=x86_64-unknown-linux-gnu \

clang/test/Driver/sycl-linker-wrapper-win.cpp

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
//
1616
// RUN: clang-linker-wrapper -sycl-device-libraries=%t.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-CMDS %s
1717
// CHK-CMDS: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
18-
// CHK-CMDS-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
19-
// CHK-CMDS-NEXT: "{{.*}}llvm-link.exe" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
18+
// CHK-CMDS-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
19+
// CHK-CMDS-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc
2020
// CHK-CMDS-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
2121
// CHK-CMDS-NEXT: "{{.*}}llvm-spirv.exe"{{.*}} LLVM_SPIRV_OPTIONS -o {{.*}}
2222
// CHK-CMDS-NEXT: offload-wrapper: input: {{.*}}, output: [[WRAPPEROUT:.*]].bc
@@ -38,8 +38,8 @@
3838
//
3939
// RUN: clang-linker-wrapper -sycl-device-libraries=%t1.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t1.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-CMDS-AOT-GEN %s
4040
// CHK-CMDS-AOT-GEN: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
41-
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
42-
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}llvm-link.exe" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
41+
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
42+
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc
4343
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
4444
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}llvm-spirv.exe"{{.*}} LLVM_SPIRV_OPTIONS -o {{.*}}
4545
// CHK-CMDS-AOT-GEN-NEXT: "{{.*}}ocloc{{.*}} -output_no_suffix -spirv_input -device pvc -output {{.*}} -file {{.*}}
@@ -62,8 +62,8 @@
6262
//
6363
// RUN: clang-linker-wrapper -sycl-device-libraries=%t2.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t2.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-CMDS-AOT-CPU %s
6464
// CHK-CMDS-AOT-CPU: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
65-
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
66-
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}llvm-link.exe" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
65+
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
66+
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc
6767
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
6868
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}llvm-spirv.exe"{{.*}} LLVM_SPIRV_OPTIONS -o {{.*}}
6969
// CHK-CMDS-AOT-CPU-NEXT: "{{.*}}opencl-aot.exe"{{.*}} --device=cpu -o {{.*}}
@@ -86,8 +86,8 @@
8686
//
8787
// RUN: clang-linker-wrapper -sycl-device-libraries=%t3.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t3.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-CMDS-AOT-NV %s
8888
// CHK-CMDS-AOT-NV: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
89-
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
90-
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}llvm-link.exe" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
89+
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
90+
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc
9191
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
9292
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}clang.exe"{{.*}} -o [[CLANGOUT:.*]] -dumpdir {{.*}}.img. --target=nvptx64-nvidia-cuda -march={{.*}}
9393
// CHK-CMDS-AOT-NV-NEXT: "{{.*}}ptxas{{.*}} --output-file [[PTXASOUT:.*]] [[CLANGOUT]]
@@ -105,7 +105,7 @@
105105
//
106106
// RUN: clang-linker-wrapper -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t4.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-CMDS-AOT-AMD %s
107107
// CHK-CMDS-AOT-AMD: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
108-
// CHK-CMDS-AOT-AMD-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
108+
// CHK-CMDS-AOT-AMD-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
109109
// CHK-CMDS-AOT-AMD-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[FIRSTLLVMLINKOUT]].bc
110110
// CHK-CMDS-AOT-AMD-NEXT: "{{.*}}clang.exe"{{.*}} -o [[CLANGOUT:.*]] -dumpdir {{.*}}.img. --target=amdgcn-amd-amdhsa -mcpu={{.*}}
111111
// CHK-CMDS-AOT-AMD-NEXT: "{{.*}}clang-offload-bundler.exe"{{.*}} -input=[[CLANGOUT]] -output=[[BUNDLEROUT:.*]]
@@ -127,18 +127,30 @@
127127
//
128128
// RUN: clang-linker-wrapper -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t5.o -sycl-device-libraries=libsycl-crt.new.o -sycl-device-library-location=%S/Inputs/SYCL/lib --dry-run 2>&1 | FileCheck -check-prefix=CHK-CMDS-DEVICE-LIB-DIR %s
129129
// CHK-CMDS-DEVICE-LIB-DIR: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
130-
// CHK-CMDS-DEVICE-LIB-DIR-NEXT: "{{.*}}llvm-link.exe" {{.*}} --suppress-warnings
131-
// CHK-CMDS-DEVICE-LIB-DIR-NEXT: "{{.*}}llvm-link.exe" -only-needed {{.*}} --suppress-warnings
130+
// CHK-CMDS-DEVICE-LIB-DIR-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings
131+
// CHK-CMDS-DEVICE-LIB-DIR-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings
132132
// CHK-CMDS-DEVICE-LIB-DIR-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} --device-lib-dir={{.*}}/Inputs/SYCL/lib {{.*}} SYCL_POST_LINK_OPTIONS {{.*}}
133133

134134
// Verify that host linker is not called when --sycl-device-link is passed to clang-linker-wrapper
135135
// RUN: clang-linker-wrapper --sycl-device-link -sycl-device-libraries=%t.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-pc-windows-msvc" "--linker-path=/usr/bin/ld" "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.exe" HOST_LIB_PATH HOST_STAT_LIB %t.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-DEVLINK-CMDS %s
136136
// CHK-DEVLINK-CMDS: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
137-
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}llvm-link.exe" [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
138-
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}llvm-link.exe" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings
137+
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN:.*]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
138+
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc
139139
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}sycl-post-link.exe"{{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
140140
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}llvm-spirv.exe"{{.*}} LLVM_SPIRV_OPTIONS -o {{.*}}
141141
// CHK-DEVLINK-CMDS-NEXT: offload-wrapper: input: {{.*}}, output: [[WRAPPEROUT:.*]].bc
142142
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}clang.exe"{{.*}} -c -o {{.*}} [[WRAPPEROUT]].bc
143143
// CHK-DEVLINK-CMDS-NEXT: "{{.*}}copy"{{.*}} {{.*}} a.exe
144144
// CHK-DEVLINK-CMDS-NOT: "{{.*}}ld"
145+
146+
// Verify list of commands when syclbin is used
147+
// RUN: clang-linker-wrapper -sycl-device-libraries=%t.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" --host-triple=x86_64-pc-windows-msvc --linker-path=/usr/bin/ld -o a.exe %t.o --dry-run -syclbin=executable 2>&1 | FileCheck --check-prefix CHK-SYCLBIN-CMDS %s
148+
// CHK-SYCLBIN-CMDS: "{{.*}}spirv-to-ir-wrapper.exe" {{.*}} -o [[FIRSTLLVMLINKIN:.*]].bc --llvm-spirv-opts --spirv-preserve-auxdata --spirv-target-env=SPV-IR --spirv-builtin-format=global
149+
// CHK-SYCLBIN-CMDS-NEXT: "{{.*}}llvm-link.exe" --suppress-warnings [[FIRSTLLVMLINKIN]].bc -o [[FIRSTLLVMLINKOUT:.*]].bc
150+
// CHK-SYCLBIN-CMDS-NEXT: "{{.*}}llvm-link.exe" -only-needed --suppress-warnings [[FIRSTLLVMLINKOUT]].bc {{.*}}.bc -o [[SECONDLLVMLINKOUT:.*]].bc
151+
// CHK-SYCLBIN-CMDS-NEXT: "{{.*}}sycl-post-link.exe" {{.*}} SYCL_POST_LINK_OPTIONS -o [[SYCLPOSTLINKOUT:.*]].table [[SECONDLLVMLINKOUT]].bc
152+
// CHK-SYCLBIN-CMDS-NEXT: "{{.*}}llvm-spirv.exe" {{.*}} -o {{.*}}
153+
// CHK-SYCLBIN-CMDS-NOT: offload-wrapper: input
154+
// CHK-SYCLBIN-CMDS-NOT: "{{.*}}clang"
155+
// CHK-SYCLBIN-CMDS-NEXT: "{{.*}}copy" {{.*}}.syclbin a.exe
156+
// CHK-SYCLBIN-CMDS-NOT: "{{.*}}ld"

0 commit comments

Comments
 (0)