intel / llvm

Intel staging area for llvm.org contribution. Home for Intel LLVM-based projects.
Other
1.24k stars 736 forks source link

Document the -fintelfpga flag ? #1190

Open fwyzard opened 4 years ago

fwyzard commented 4 years ago

Is there any documentation about the -fintelfpga flag ?

I've tried to build the simply SYCL application from the getting started page with

/data/user/fwyzard/sycl/build/bin/clang++ -O2 -g -Wno-unknown-cuda-version -fsycl -fintelfpga -DFPGA_EMULATOR simple-sycl-app.cpp -o simple-sycl-app-fpga_emu

but that failed with

clang-11: error: unable to execute command: Executable "aoc" doesn't exist!
clang-11: error: fpga compiler command failed with exit code 1 (use -v to see invocation)

Where do I get aoc (apart from the oneAPI beta) ? One installed, Is there any way to point the location of aoc to clang++, other than having it in the PATH ?

I've also tried to build multiple backends at the same time, bit I got the error

clang-11: error: The option -fsycl-targets= conflicts with -fintelfpga

Is that a design choice, or just a short term issue to be improved later ?

fwyzard commented 4 years ago

It looks like -fintelfpga is roughly equivalent to -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice -MMD -lOpenCL ?

bader commented 4 years ago

SYCL specific compiler options are documented here: https://github.com/intel/llvm/blob/sycl/sycl/doc/SYCLCompilerUserManual.md#intel-fpga-specific-options

Please, let us know if it's not clear.

fwyzard commented 4 years ago

Thanks @bader. I think I understand what it means, and I would find it useful to add a bit more information, e.g.

bader commented 4 years ago

@fwyzard, if you could propose a new wording via PR, it would be great. If not, @AGindinson and/or @mdtoguchi should be able to help.

fwyzard commented 4 years ago

Done in #1218.

bader commented 4 years ago

@fwyzard, can we close this issue or there is anything else you wanted to add regarding -fintelfpga flag?

fwyzard commented 4 years ago

Is there a way to install aoc without installing the full oneAPI beta ?

AGindinson commented 4 years ago

Is there a way to install aoc without installing the full oneAPI beta ?

None that I'm aware of. @GarveyJoe, could you please chime in?

GarveyJoe commented 4 years ago

There is not.

fwyzard commented 4 years ago

Thanks. Do you know if the installation from beta 4 is compatible with this branch ?

AlexeySachkov commented 4 years ago

Tagging @vladimirlaz to answer the question

vladimirlaz commented 4 years ago

Tagging @vladimirlaz to answer the question

Late anawer is better than nothing. There is no hard correlation between aoc and siycl compiler. So the latest one should be ok.

j-stephan commented 3 years ago

It looks like -fintelfpga is roughly equivalent to -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice -MMD -lOpenCL ?

Is this still true? I tried to use dpcpp (DevCloud / 2020.1-beta10) together with CMake and pass these options to both the compile and the link flags (using target_compile_options and target_link_options). Running make VERBOSE=1 shows me the following compiler command lines:

# Compilation step
dpcpp -O3 -DNDEBUG -fsycl -sycl-std=2020 -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_fpga-unknown-unknown-sycldevice -g -MMD -o axpy.cpp.o -c axpy.cpp
# Linking step
dpcpp -O3 -DNDEBUG -fsycl -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_fpga-unknown-unknown-sycldevice -g -MMD -Xsycl-target-backend=spir64_fpga-unknown-unknown-sycldevice -hardware -Xsycl-target-backend=spir64_fpga-unknown-unknown-sycldevice -board=pac_a10 -Xsycl-target-backend=spir64_fpga-unknown-unknown-sycldevice -board-package=/glob/development-tools/versions/oneapi/beta10/inteloneapi/intelfpgadpcpp/2021.1-beta10/board/intel_a10gx_pac axpy.cpp.o -o axpy /glob/development-tools/versions/oneapi/beta10/inteloneapi/compiler/2021.1-beta10/linux/lib/libOpenCL.so -lsycl

This emits the following warning:

aoc: Warning: Cannot find dependency file "/home/u55018/tmp/axpy-f07400.d" for source file "/home/u55018/tmp/axpy-f07400.spv". Source code will not be available in the HLD Reports. Ensure you ran dpcpp with the -fintelfpga flag.
GarveyJoe commented 3 years ago

A few extra flags were added over time to tweak the default behaviour to be more amenable for FPGA users. You can always check the latest flags by running "dpcpp -v -fintelfpga <some .cpp file>" as this will emit the full clang++ command that dpcpp runs under the hood. The relevant flag for your warning is "-dependency-file" which is needed by the reports to map generated hardware to code in your program. Another notable difference is that -fintelfpga also now adds "-fno-sycl-early-optimizations" to disable early optimizations by the frontend. Performing these optimization early can result in less useful reports and the backend can perform most of the same optimizations. The flag is desirable for just-in-time (JiT) compilation because it reduces JiT time but -fintelfpga forces ahead-of-time (AoT) compilation.

As an aside, if you are targeting an FPGA, why aren't you simply using "-fintelfpga"? Its purpose is to make targeting an FPGA easier so you don't have to deal with all these flags yourself.

j-stephan commented 3 years ago

Thanks for the hint!

As an aside, if you are targeting an FPGA, why aren't you simply using "-fintelfpga"? Its purpose is to make targeting an FPGA easier so you don't have to deal with all these flags yourself.

As far as I understand the documentation -fintelfpga doesn't work together with the other device types. I want users to be able to compile for all device types, hence I am supplying those flags manually.

AGindinson commented 2 years ago

In view of the extensive existing documentation at https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top.html, I would suggest re-assessing whether the issue is still relevant.

j-stephan commented 2 years ago

Well, what does this flag do exactly? According to the official Intel documentation it is equivalent to -fsycl-targets=spir64-unknown-unknown but the discussion in this topic so far points in a different direction.

bader commented 2 years ago

Hm... it looks like a bug to me. I thought that -fintelfpga is a short alias for setting compiler flags defaults for FPGA target and that -fsycl-targets option value for FPGA is -fsycl-targets=spir64_fpga-unknown-unknown.

bader commented 2 years ago

The option is documented in https://github.com/intel/llvm/blob/sycl/sycl/doc/UsersManual.md#intel-fpga-specific-options.

j-stephan commented 2 years ago

According to @GarveyJoe a few comments above additional flags were added to -fintelfpga over time. Has this been reverted?

AGindinson commented 2 years ago

According to @GarveyJoe a few comments above additional flags were added to -fintelfpga over time. Has this been reverted?

Over time, @mdtoguchi has minimized the gap between the -fsycl-targets=spir64_fpga and -fintelfpga effects - not by "reverting" Intel FPGA functional features, but by letting the -fsycl-targets spelling enable them too. As far as I recall, the only major difference is the default -g -MMD setting that comes with -fintelfpga - Mike will be quick to correct me in case I'm missing some of the details.

mdtoguchi commented 2 years ago

According to @GarveyJoe a few comments above additional flags were added to -fintelfpga over time. Has this been reverted?

Over time, @mdtoguchi has minimized the gap between the -fsycl-targets=spir64_fpga and -fintelfpga effects - not by "reverting" Intel FPGA functional features, but by letting the -fsycl-targets spelling enable them too. As far as I recall, the only major difference is the default -g -MMD setting that comes with -fintelfpga - Mike will be quick to correct me in case I'm missing some of the details.

The differences are -g -MMD -lOpenCL when comparing -fintelfpga to -fsycl-targets=spir64_fpga. Behaviors are also different when dealing with -fsycl-link=early or -fsycl-link=image which are specific to usage with -fintelfpga

j-stephan commented 2 years ago

So the -fsycl-link arguments cannot be used without -fintelfpga?

mdtoguchi commented 2 years ago

So the -fsycl-link arguments cannot be used without -fintelfpga?

Use of -fsycl-link with -fintelfpga will generate either aoco or aocx based archives. Use of -fsycl-link with -fsycl-targets=spir64_fpga will generate host-linkable device objects. At least this is the intention. Some quick experiments with -fsycl-link -fsycl-targets=spir64_fpga looks to have uncovered a bug.

KornevNikita commented 5 months ago

Hi! There have been no updates for at least the last 60 days, though the ticket has assignee(s).

@mdtoguchi, could I ask you to take one of the following actions? :)

Thanks!

github-actions[bot] commented 3 months ago

Hi! There have been no updates for at least the last 60 days, though the issue has assignee(s).

@mdtoguchi, could you please take one of the following actions:

Thanks!

github-actions[bot] commented 1 month ago

Hi! There have been no updates for at least the last 60 days, though the issue has assignee(s).

@mdtoguchi, could you please take one of the following actions:

Thanks!