Skip to content

Commit 3c7971d

Browse files
authored
[Driver] Properly set offload-deps target triple (#4305)
For non SPIR target, offload-deps ignored the offloading target arch. This patch set the associated arch to the actions, properly cache the input info when building the job and properly set the `-targets` flag to be aligned with the bundler. Signed-off-by: Victor Lomuller <victor@codeplay.com>
1 parent 4ccfd21 commit 3c7971d

File tree

3 files changed

+101
-39
lines changed

3 files changed

+101
-39
lines changed

clang/lib/Driver/Driver.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -4249,10 +4249,11 @@ class OffloadingActionBuilder final {
42494249
return;
42504250

42514251
OffloadAction::DeviceDependences Dep;
4252-
Dep.add(*SYCLLinkBinary, *ToolChains.front(), /*BoundArch=*/nullptr,
4253-
Action::OFK_SYCL);
4254-
AL.push_back(C.MakeAction<OffloadAction>(Dep,
4255-
SYCLLinkBinary->getType()));
4252+
withBoundArchForToolChain(ToolChains.front(), [&](const char *BoundArch) {
4253+
Dep.add(*SYCLLinkBinary, *ToolChains.front(), BoundArch,
4254+
Action::OFK_SYCL);
4255+
});
4256+
AL.push_back(C.MakeAction<OffloadAction>(Dep, SYCLLinkBinary->getType()));
42564257
SYCLLinkBinary = nullptr;
42574258
}
42584259

@@ -4650,8 +4651,10 @@ class OffloadingActionBuilder final {
46504651
void addDeviceLinkDependencies(OffloadDepsJobAction *DA) override {
46514652
for (unsigned I = 0; I < ToolChains.size(); ++I) {
46524653
// Register dependent toolchain.
4653-
DA->registerDependentActionInfo(
4654-
ToolChains[I], /*BoundArch=*/StringRef(), Action::OFK_SYCL);
4654+
withBoundArchForToolChain(ToolChains[I], [&](const char *BoundArch) {
4655+
DA->registerDependentActionInfo(ToolChains[I], BoundArch,
4656+
Action::OFK_SYCL);
4657+
});
46554658

46564659
// Add deps output to linker inputs.
46574660
DeviceLinkerInputs[I].push_back(DA);
@@ -6749,7 +6752,8 @@ InputInfo Driver::BuildJobsForActionNoCache(
67496752
// Get the unique string identifier for this dependence and cache the
67506753
// result.
67516754
StringRef Arch;
6752-
if (TargetDeviceOffloadKind == Action::OFK_HIP) {
6755+
if (TargetDeviceOffloadKind == Action::OFK_HIP ||
6756+
TargetDeviceOffloadKind == Action::OFK_SYCL) {
67536757
if (UI.DependentOffloadKind == Action::OFK_Host)
67546758
Arch = StringRef();
67556759
else

clang/lib/Driver/ToolChains/Clang.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -8667,10 +8667,19 @@ void OffloadDeps::constructJob(Compilation &C, const JobAction &JA,
86678667
Targets += ',';
86688668
Targets += Action::GetOffloadKindName(Dep.DependentOffloadKind);
86698669
Targets += '-';
8670-
Targets += Dep.DependentToolChain->getTriple().normalize();
8671-
if (Dep.DependentOffloadKind == Action::OFK_HIP &&
8670+
std::string NormalizedTriple =
8671+
Dep.DependentToolChain->getTriple().normalize();
8672+
Targets += NormalizedTriple;
8673+
if ((Dep.DependentOffloadKind == Action::OFK_HIP ||
8674+
Dep.DependentOffloadKind == Action::OFK_SYCL) &&
86728675
!Dep.DependentBoundArch.empty()) {
8673-
Targets += '-';
8676+
// If OffloadArch is present it can only appear as the 6th hyphen
8677+
// separated field of Bundle Entry ID. So, pad required number of
8678+
// hyphens in Triple.
8679+
// e.g. if NormalizedTriple is nvptx64-nvidia-cuda, 2 more - to
8680+
// generate nvptx64-nvidia-cuda--
8681+
for (int i = 4 - StringRef(NormalizedTriple).count("-"); i > 0; i--)
8682+
Targets += '-';
86748683
Targets += Dep.DependentBoundArch;
86758684
}
86768685
}

clang/test/Driver/sycl-offload-static-lib-2.cpp

+78-29
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
// RUN: touch %t_lib.lo
1919
// RUN: touch %t_obj.o
2020
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t_lib.a -### %t_obj.o 2>&1 \
21-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB
21+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
2222
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t_lib.lo -### %t_obj.o 2>&1 \
23-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB
24-
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs=[[INPUTO:.+\.o]]" "-outputs=[[HOSTOBJ:.+\.o]],{{.+\.o}}"
25-
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs={{.*}}" "-outputs=[[OUTFILE:.+\.a]]"
23+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
24+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -L/dummy/dir %t_lib.a -### %t_obj.o 2>&1 \
25+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
26+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -L/dummy/dir %t_lib.lo -### %t_obj.o 2>&1 \
27+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
28+
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" "-targets={{.*}},[[BUNDLE_TRIPLE]]" "-inputs=[[INPUTO:.+\.o]]" "-outputs=[[HOSTOBJ:.+\.o]],{{.+\.o}}"
29+
// STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" "-inputs={{.*}}" "-outputs=[[OUTFILE:.+\.a]]"
2630
// STATIC_LIB: llvm-link{{.*}} "[[OUTFILE]]"
2731
// STATIC_LIB: ld{{.*}} "{{.*}}_lib.{{(a|lo)}}" "[[HOSTOBJ]]"
2832

@@ -34,19 +38,23 @@
3438
// RUN: touch %t-2.o
3539
// RUN: touch %t-3.o
3640
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t_lib.a -### %t-1.o %t-2.o %t-3.o 2>&1 \
37-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_MULTI_O
38-
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-1.o"
39-
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-2.o"
40-
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" {{.*}} "-inputs={{.+}}-3.o"
41-
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTFILE:.+\.a]]"
41+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_MULTI_O -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
42+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda %t_lib.a -### %t-1.o %t-2.o %t-3.o 2>&1 \
43+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_MULTI_O -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
44+
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" "-targets={{.*}},[[BUNDLE_TRIPLE]]" "-inputs={{.+}}-1.o"
45+
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" "-targets={{.*}},[[BUNDLE_TRIPLE]]" "-inputs={{.+}}-2.o"
46+
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=o" "-targets={{.*}},[[BUNDLE_TRIPLE]]" "-inputs={{.+}}-3.o"
47+
// STATIC_LIB_MULTI_O: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" {{.*}} "-outputs=[[OUTFILE:.+\.a]]"
4248
// STATIC_LIB_MULTI_O: llvm-link{{.*}} "[[OUTFILE]]"
4349

4450
/// ###########################################################################
4551

4652
/// test behaviors of fat static lib from source
4753
// RUN: touch %t_lib.a
4854
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fno-sycl-device-lib=all -fsycl %t_lib.a -ccc-print-phases %s 2>&1 \
49-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC
55+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
56+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fno-sycl-device-lib=all -fsycl-targets=nvptx64-nvidia-cuda -fsycl %t_lib.a -ccc-print-phases %s 2>&1 \
57+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC-CUDA
5058
// STATIC_LIB_SRC: 0: input, "[[INPUTA:.+\.a]]", object, (host-sycl)
5159
// STATIC_LIB_SRC: 1: input, "[[INPUTC:.+\.cpp]]", c++, (host-sycl)
5260
// STATIC_LIB_SRC: 2: append-footer, {1}, c++, (host-sycl)
@@ -71,15 +79,44 @@
7179
// STATIC_LIB_SRC: 21: clang-offload-wrapper, {20}, object, (device-sycl)
7280
// STATIC_LIB_SRC: 22: offload, "host-sycl (x86_64-unknown-linux-gnu)" {11}, "device-sycl (spir64-unknown-unknown)" {21}, image
7381

82+
// STATIC_LIB_SRC-CUDA: 0: input, "[[INPUTA:.+\.a]]", object, (host-sycl)
83+
// STATIC_LIB_SRC-CUDA: 1: input, "[[INPUTC:.+\.cpp]]", c++, (host-sycl)
84+
// STATIC_LIB_SRC-CUDA: 2: append-footer, {1}, c++, (host-sycl)
85+
// STATIC_LIB_SRC-CUDA: 3: preprocessor, {2}, c++-cpp-output, (host-sycl)
86+
// STATIC_LIB_SRC-CUDA: 4: input, "[[INPUTC]]", c++, (device-sycl, sm_50)
87+
// STATIC_LIB_SRC-CUDA: 5: preprocessor, {4}, c++-cpp-output, (device-sycl, sm_50)
88+
// STATIC_LIB_SRC-CUDA: 6: compiler, {5}, ir, (device-sycl, sm_50)
89+
// STATIC_LIB_SRC-CUDA: 7: offload, "host-sycl (x86_64-unknown-linux-gnu)" {3}, "device-sycl (nvptx64-nvidia-cuda:sm_50)" {6}, c++-cpp-output
90+
// STATIC_LIB_SRC-CUDA: 8: compiler, {7}, ir, (host-sycl)
91+
// STATIC_LIB_SRC-CUDA: 9: backend, {8}, assembler, (host-sycl)
92+
// STATIC_LIB_SRC-CUDA: 10: assembler, {9}, object, (host-sycl)
93+
// STATIC_LIB_SRC-CUDA: 11: linker, {0, 10}, image, (host-sycl)
94+
// STATIC_LIB_SRC-CUDA: 12: linker, {0, 10}, host_dep_image, (host-sycl)
95+
// STATIC_LIB_SRC-CUDA: 13: clang-offload-deps, {12}, ir, (host-sycl)
96+
// STATIC_LIB_SRC-CUDA: 14: input, "[[INPUTA]]", archive
97+
// STATIC_LIB_SRC-CUDA: 15: clang-offload-unbundler, {14}, archive
98+
// STATIC_LIB_SRC-CUDA: 16: linker, {6, 13, 15}, ir, (device-sycl, sm_50)
99+
// STATIC_LIB_SRC-CUDA: 17: sycl-post-link, {16}, ir, (device-sycl, sm_50)
100+
// STATIC_LIB_SRC-CUDA: 18: file-table-tform, {17}, ir, (device-sycl, sm_50)
101+
// STATIC_LIB_SRC-CUDA: 19: backend, {18}, assembler, (device-sycl, sm_50)
102+
// STATIC_LIB_SRC-CUDA: 20: assembler, {19}, object, (device-sycl, sm_50)
103+
// STATIC_LIB_SRC-CUDA: 21: linker, {19, 20}, cuda-fatbin, (device-sycl, sm_50)
104+
// STATIC_LIB_SRC-CUDA: 22: foreach, {18, 21}, cuda-fatbin, (device-sycl, sm_50)
105+
// STATIC_LIB_SRC-CUDA: 23: file-table-tform, {17, 22}, tempfiletable, (device-sycl, sm_50)
106+
// STATIC_LIB_SRC-CUDA: 24: clang-offload-wrapper, {23}, object, (device-sycl, sm_50)
107+
// STATIC_LIB_SRC-CUDA: 25: offload, "host-sycl (x86_64-unknown-linux-gnu)" {11}, "device-sycl (nvptx64-nvidia-cuda:sm_50)" {24}, image
108+
74109
/// ###########################################################################
75110

76111
// RUN: touch %t_lib.a
77112
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t_lib.a -o output_name -lOpenCL -### %s 2>&1 \
78-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC2
113+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC2 -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
114+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda %t_lib.a -o output_name -lOpenCL -### %s 2>&1 \
115+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC2 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
79116
// STATIC_LIB_SRC2: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]"
80117
// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "-o" "[[HOSTEXE:.+\.out]]"
81-
// STATIC_LIB_SRC2: clang-offload-deps{{.*}} "-outputs=[[OUTDEPS:.+\.bc]]" "[[HOSTEXE]]"
82-
// STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
118+
// STATIC_LIB_SRC2: clang-offload-deps{{.*}} "-targets=[[BUNDLE_TRIPLE]]" "-outputs=[[OUTDEPS:.+\.bc]]" "[[HOSTEXE]]"
119+
// STATIC_LIB_SRC2: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" {{.*}} "-outputs=[[OUTLIB:.+\.a]]"
83120
// STATIC_LIB_SRC2: llvm-link{{.*}} "[[OUTDEPS]]" "-o" "[[OUTTEMP:.+\.bc]]"
84121
// STATIC_LIB_SRC2: llvm-link{{.*}} "--only-needed" "[[OUTTEMP]]" "[[OUTLIB]]"
85122
// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "[[HOSTOBJ]]"
@@ -88,8 +125,10 @@
88125

89126
// RUN: touch %t_lib.a
90127
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t_lib.a -o output_name -lstdc++ -z relro -### %s 2>&1 \
91-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC3
92-
// STATIC_LIB_SRC3: clang-offload-bundler{{.*}} "-type=a"
128+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC3 -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
129+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda %t_lib.a -o output_name -lstdc++ -z relro -### %s 2>&1 \
130+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC3 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
131+
// STATIC_LIB_SRC3: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]"
93132
// STATIC_LIB_SRC3: llvm-link{{.*}} "{{.*}}"
94133
// STATIC_LIB_SRC3: ld{{(.exe)?}}" {{.*}} "-o" "output_name" {{.*}} "-lstdc++" "-z" "relro"
95134

@@ -102,14 +141,17 @@
102141
// RUN: touch %t_obj.o
103142
// RUN: echo "--whole-archive %/t_lib.a %/t_lib_2.a --no-whole-archive" > %t_arg.arg
104143
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t_obj.o -Wl,--whole-archive %t_lib.a %t_lib_2.a -Wl,--no-whole-archive -### 2>&1 \
105-
// RUN: | FileCheck %s -check-prefixes=WHOLE_STATIC_LIB,WHOLE_STATIC_LIB_1
144+
// RUN: | FileCheck %s -check-prefixes=WHOLE_STATIC_LIB,WHOLE_STATIC_LIB_1 -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
106145
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t_obj.o -Wl,@%/t_arg.arg -### 2>&1 \
107-
// RUN: | FileCheck %s -check-prefix=WHOLE_STATIC_LIB
108-
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" {{.*}}
109-
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs=[[INPUTA:.+\.a]]" "-outputs=[[OUTPUTA:.+\.a]]"
110-
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" {{.*}} "-inputs=[[INPUTB:.+\.a]]" "-outputs=[[OUTPUTB:.+\.a]]"
146+
// RUN: | FileCheck %s -check-prefix=WHOLE_STATIC_LIB -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
147+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -L/dummy/dir %t_obj.o -Wl,--whole-archive %t_lib.a %t_lib_2.a -Wl,--no-whole-archive -### 2>&1 \
148+
// RUN: | FileCheck %s -check-prefixes=WHOLE_STATIC_LIB,WHOLE_STATIC_LIB_1 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
149+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -L/dummy/dir %t_obj.o -Wl,@%/t_arg.arg -### 2>&1 \
150+
// RUN: | FileCheck %s -check-prefix=WHOLE_STATIC_LIB -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
151+
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=o" "-targets={{.*}},[[BUNDLE_TRIPLE]]"
152+
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" "-inputs=[[INPUTA:.+\.a]]" "-outputs=[[OUTPUTA:.+\.a]]"
153+
// WHOLE_STATIC_LIB: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" "-inputs=[[INPUTB:.+\.a]]" "-outputs=[[OUTPUTB:.+\.a]]"
111154
// WHOLE_STATIC_LIB: llvm-link{{.*}} "[[OUTPUTA]]" "[[OUTPUTB]]"
112-
// WHOLE_STATIC_LIB: llvm-spirv{{.*}}
113155
// WHOLE_STATIC_LIB: clang-offload-wrapper{{.*}}
114156
// WHOLE_STATIC_LIB: llc{{.*}}
115157
// WHOLE_STATIC_LIB_1: ld{{.*}} "--whole-archive" "[[INPUTA]]" "[[INPUTB]]" "--no-whole-archive"
@@ -126,15 +168,22 @@
126168

127169
/// test behaviors of static lib with no source/object
128170
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-device-lib=all -L/dummy/dir %t_lib.a -### 2>&1 \
129-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC
171+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC -check-prefix=STATIC_LIB_NOSRC-SPIR -DTARGET=spir64 -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
130172
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fno-sycl-device-lib=all -L/dummy/dir %t_lib.lo -### 2>&1 \
131-
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC
132-
// STATIC_LIB_NOSRC: clang-offload-bundler{{.*}} "-type=a" "-targets=sycl-spir64-unknown-unknown" "-inputs={{.*}}_lib.{{(a|lo)}}" "-outputs=[[DEVICELIB:.+\.a]]" "-unbundle"
173+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC -check-prefix=STATIC_LIB_NOSRC-SPIR -DTARGET=spir64 -DBUNDLE_TRIPLE=sycl-spir64-unknown-unknown
174+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fno-sycl-device-lib=all -L/dummy/dir %t_lib.a -### 2>&1 \
175+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC -check-prefix=STATIC_LIB_NOSRC-CUDA -DTARGET=nvptx64 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
176+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fno-sycl-device-lib=all -L/dummy/dir %t_lib.lo -### 2>&1 \
177+
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_NOSRC -check-prefix=STATIC_LIB_NOSRC-CUDA -DTARGET=nvptx64 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda--sm_50
178+
// STATIC_LIB_NOSRC: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" "-inputs={{.*}}_lib.{{(a|lo)}}" "-outputs=[[DEVICELIB:.+\.a]]" "-unbundle"
133179
// STATIC_LIB_NOSRC: llvm-link{{.*}} "[[DEVICELIB]]" "-o" "[[BCFILE:.+\.bc]]"
134-
// STATIC_LIB_NOSRC: sycl-post-link{{.*}} "-o" "[[TABLE:.+\.table]]" "[[BCFILE]]"
135-
// STATIC_LIB_NOSRC: file-table-tform{{.*}} "-o" "[[LIST:.+\.txt]]" "[[TABLE]]"
136-
// STATIC_LIB_NOSRC: llvm-foreach{{.*}}llvm-spirv{{.*}} "-o" "[[SPVLIST:.+\.txt]]"{{.*}} "[[LIST]]"
137-
// STATIC_LIB_NOSRC: file-table-tform{{.*}} "-o" "[[TABLE1:.+\.table]]" "[[TABLE]]" "[[SPVLIST]]"
138-
// STATIC_LIB_NOSRC: clang-offload-wrapper{{.*}} "-o=[[BCFILE2:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" "-target=spir64" "-kind=sycl" "-batch" "[[TABLE1]]"
180+
// STATIC_LIB_NOSRC: sycl-post-link{{.*}} "-o" "[[TABLE:.+]]" "[[BCFILE]]"
181+
// STATIC_LIB_NOSRC: file-table-tform{{.*}} "-o" "[[LIST:.+]]" "[[TABLE]]"
182+
// STATIC_LIB_NOSRC-SPIR: llvm-foreach{{.*}}llvm-spirv{{.*}} "-o" "[[OBJLIST:.+\.txt]]"{{.*}} "[[LIST]]"
183+
// STATIC_LIB_NOSRC-CUDA: llvm-foreach{{.*}}clang{{.*}} "-o" "[[PTXLIST:.+]]" "-x" "ir" "[[LIST]]"
184+
// STATIC_LIB_NOSRC-CUDA: llvm-foreach{{.*}}ptxas{{.*}} "--output-file" "[[CUBINLIST:.+]]"{{.*}} "[[PTXLIST]]"
185+
// STATIC_LIB_NOSRC-CUDA: llvm-foreach{{.*}}fatbin{{.*}} "--create" "[[OBJLIST:.+]]"{{.*}} "--image={{.*}}[[PTXLIST]]" "--image={{.*}}[[CUBINLIST]]"
186+
// STATIC_LIB_NOSRC: file-table-tform{{.*}} "-o" "[[TABLE1:.+\.table]]" "[[TABLE]]" "[[OBJLIST]]"
187+
// STATIC_LIB_NOSRC: clang-offload-wrapper{{.*}} "-o=[[BCFILE2:.+\.bc]]" "-host=x86_64-unknown-linux-gnu" "-target=[[TARGET]]" "-kind=sycl" "-batch" "[[TABLE1]]"
139188
// STATIC_LIB_NOSRC: llc{{.*}} "-filetype=obj" "-o" "[[FINALOBJ:.+\.o]]" "[[BCFILE2]]"
140189
// STATIC_LIB_NOSRC: ld{{.*}} "-L/dummy/dir" {{.*}} "{{.*}}_lib.{{(a|lo)}}" "[[FINALOBJ]]"

0 commit comments

Comments
 (0)