Skip to content

[Driver][SYCL] Do not consider non-archive files for FPGA binary checks #4644

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

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,10 @@ bool hasFPGABinary(Compilation &C, std::string Object, types::ID Type) {
if (!llvm::sys::fs::exists(Object))
return false;

// Only static archives are valid FPGA Binaries for unbundling.
if (!isStaticArchiveFile(Object))
return false;

// Temporary names for the output.
llvm::Triple TT;
TT.setArchName(types::getTypeName(Type));
Expand Down
7 changes: 7 additions & 0 deletions clang/test/Driver/sycl-offload-intelfpga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,10 @@
// CHK-TOOLS-IMPLIED-OPTS-NOT: clang{{.*}} "-fsycl-is-device"{{.*}} "-O0"
// CHK-TOOLS-IMPLIED-OPTS: sycl-post-link{{.*}} "-O2"
// CHK-TOOLS-IMPLIED-OPTS: aoc{{.*}} "-g" "-DFOO1" "-DFOO2"

/// shared objects should not be checked for FPGA contents
// RUN: touch %t.so
// RUN: %clangxx -fsycl -fintelfpga %t.so -### 2>&1 \
// RUN: | FileCheck -check-prefix=ERROR_BUNDLE_CHECK %s
// ERROR_BUNDLE_CHECK-NOT: clang-offload-bundler{{.*}} "-targets=sycl-fpga_aoc{{(x|r|r_emu|o)}}-intel-unknown"{{.*}} "-check-section"
// ERROR_BUNDLE_CHECK-NOT: error: file too small to be an archive