Skip to content

Commit 90c79c7

Browse files
authored
[Driver][SYCL] Address issue when unbundling for non-FPGA archive (#3366)
When unbundling a fat static archive and not targeting FPGA, the driver would assert due to a mismatch of expected unbundled files within the generated toolchain. This was due to the generic nature in which we were searching for AOCO type archives.
1 parent e56e576 commit 90c79c7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6193,7 +6193,8 @@ InputInfo Driver::BuildJobsForActionNoCache(
61936193
TI = types::TY_Tempfilelist;
61946194
} else if (EffectiveTriple.getSubArch() !=
61956195
llvm::Triple::SPIRSubArch_fpga) {
6196-
if (UI.DependentOffloadKind == Action::OFK_SYCL) {
6196+
if (UI.DependentOffloadKind == Action::OFK_SYCL &&
6197+
JA->getType() != types::TY_FPGA_AOCO) {
61976198
// Do not add the current info for device with FPGA device. The
61986199
// device side isn't used
61996200
continue;

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,15 @@
150150
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -foffload-static-lib= -c %s 2>&1 \
151151
// RUN: | FileCheck %s -check-prefixes=FOFFLOAD_STATIC_LIB_NOVALUE
152152
// FOFFLOAD_STATIC_LIB_NOVALUE: warning: argument unused during compilation: '-foffload-static-lib='
153+
154+
/// Use of a static archive with various targets should compile and unbundle
155+
// RUN: touch %t.a
156+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t.a -### 2>&1 \
157+
// RUN: | FileCheck %s -check-prefixes=STATIC_ARCHIVE_UNBUNDLE
158+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_gen-unknown-unknown-sycldevice %t.a -### 2>&1 \
159+
// RUN: | FileCheck %s -check-prefixes=STATIC_ARCHIVE_UNBUNDLE
160+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice %t.a -### 2>&1 \
161+
// RUN: | FileCheck %s -check-prefixes=STATIC_ARCHIVE_UNBUNDLE
162+
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %t.a -### 2>&1 \
163+
// RUN: | FileCheck %s -check-prefixes=STATIC_ARCHIVE_UNBUNDLE
164+
// STATIC_ARCHIVE_UNBUNDLE: clang-offload-bundler{{.*}}

0 commit comments

Comments
 (0)