Skip to content

Conversation

@mdtoguchi
Copy link
Contributor

When using -fintelfpga -fsycl-link=image, the host objects were packaged as objects as they would a regular archive. This was not handled in the same way as -fsycl-link=early, causing an issue with how the objects can be read in, especially on Windows.

Update the -fsycl-link=image behavior when packaging the host objects to match that of -fsycl-link=early. This allows for the host objects to be unbundled and used as actual objects during the link. The Microsoft linker does not expect 'main' to be in a library, so breaking this out allows for proper linking with -fsycl-link=image archives.

When using -fintelfpga -fsycl-link=image, the host objects were packaged
as objects as they would a regular archive.  This was not handled in the
same way as -fsycl-link=early, causing an issue with how the objects can
be read in, especially on Windows.

Update the -fsycl-link=image behavior when packaging the host objects to
match that of -fsycl-link=early.  This allows for the host objects to be
unbundled and used as actual objects during the link.  The Microsoft
linker does not expect 'main' to be in a library, so breaking this out
allows for proper linking with -fsycl-link=image archives.
@mdtoguchi mdtoguchi requested a review from a team as a code owner September 27, 2024 18:39
@mdtoguchi
Copy link
Contributor Author

@intel/dpcpp-clang-driver-reviewers, please take a look

// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fintelfpga -fsycl-link -Xshardware %t.o -o libfoo.a 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK,CHK-FPGA-EARLY %s
// RUN: %clangxx -### -O2 -target x86_64-unknown-linux-gnu -fno-sycl-instrument-device-code -fno-sycl-device-lib=all -fintelfpga -fsycl-link=early -Xshardware %t.o -o libfoo.a 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-FPGA-LINK,CHK-FPGA-EARLY %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does RUN at L5 require check-prefix CHK-FPGA-LINK?
Same for RUN at L3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, CHK-FPGA-LINK usage is generic in nature. The -fsycl-link=early and -fsycl-link=image behaviors are now more closely matched and the CHK-FPGA-LINK checks cover the lines that are common.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think -O2 is probably not needed at L5

@mdtoguchi
Copy link
Contributor Author

@intel/llvm-gatekeepers, this should be ready for merge - thanks!

@sarnex sarnex merged commit 2df7d3f into intel:sycl Oct 8, 2024
13 checks passed
@mdtoguchi mdtoguchi deleted the fpga-image-host-obj branch October 8, 2024 17:32
@steffenlarsen
Copy link
Contributor

@mdtoguchi - It looks like the following started failing after this patch:

Failed Tests (1):
  SYCL :: AOT/fpga-aoc-archive-early2.cpp

Could you please investigate ASAP?

@mdtoguchi
Copy link
Contributor Author

@mdtoguchi - It looks like the following started failing after this patch:

Failed Tests (1):
  SYCL :: AOT/fpga-aoc-archive-early2.cpp

Could you please investigate ASAP?

Thanks for the heads up @steffenlarsen, looking...

@mdtoguchi
Copy link
Contributor Author

PR for fpga-aoc-archive-early2.cpp failure here: #15661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants