llvm icon indicating copy to clipboard operation
llvm copied to clipboard

Document the -fintelfpga flag ?

Open fwyzard opened this issue 5 years ago • 25 comments

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 avatar Feb 26 '20 07:02 fwyzard

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

fwyzard avatar Feb 26 '20 08:02 fwyzard

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.

bader avatar Feb 26 '20 10:02 bader

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

  • that it relies on the aoc external tool
  • that it is a shortcut for -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice or similar
  • that (unlike this) it is not compatible with other -fsycl-targets options

fwyzard avatar Feb 26 '20 11:02 fwyzard

@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.

bader avatar Feb 26 '20 16:02 bader

Done in #1218.

fwyzard avatar Feb 28 '20 17:02 fwyzard

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

bader avatar Mar 06 '20 08:03 bader

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

fwyzard avatar Mar 06 '20 09:03 fwyzard

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?

AGindinson avatar Mar 06 '20 09:03 AGindinson

There is not.

GarveyJoe avatar Mar 09 '20 19:03 GarveyJoe

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

fwyzard avatar Mar 09 '20 19:03 fwyzard

Tagging @vladimirlaz to answer the question

AlexeySachkov avatar Mar 17 '20 10:03 AlexeySachkov

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.

vladimirlaz avatar Jul 09 '20 16:07 vladimirlaz

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.

j-stephan avatar Dec 04 '20 15:12 j-stephan

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.

GarveyJoe avatar Dec 04 '20 17:12 GarveyJoe

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.

j-stephan avatar Dec 04 '20 17:12 j-stephan

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.

AGindinson avatar Jan 26 '22 09:01 AGindinson

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.

j-stephan avatar Jan 26 '22 10:01 j-stephan

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 avatar Jan 26 '22 10:01 bader

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

bader avatar Jan 26 '22 10:01 bader

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

j-stephan avatar Jan 26 '22 10:01 j-stephan

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.

AGindinson avatar Jan 26 '22 10:01 AGindinson

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

mdtoguchi avatar Jan 26 '22 14:01 mdtoguchi

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

j-stephan avatar Jan 27 '22 09:01 j-stephan

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.

mdtoguchi avatar Jan 27 '22 15:01 mdtoguchi

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? :)

  • Please provide an update if you have any (or just a small comment if you don't have any yet).
  • OR mark this issue with the 'confirmed' label if you have confirmed the problem/request and our team should work on it.
  • OR close the issue if it has been resolved.
  • OR take any other suitable action.

Thanks!

KornevNikita avatar May 17 '24 11:05 KornevNikita

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:

  • provide an update if you have any
  • unassign yourself if you're not looking / going to look into this issue
  • mark this issue with the 'confirmed' label if you have confirmed the problem/request and our team should work on it
  • close the issue if it has been resolved
  • take any other suitable action.

Thanks!

github-actions[bot] avatar Jul 17 '24 00:07 github-actions[bot]

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:

  • provide an update if you have any
  • unassign yourself if you're not looking / going to look into this issue
  • mark this issue with the 'confirmed' label if you have confirmed the problem/request and our team should work on it
  • close the issue if it has been resolved
  • take any other suitable action.

Thanks!

github-actions[bot] avatar Sep 15 '24 00:09 github-actions[bot]

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:

  • provide an update if you have any
  • unassign yourself if you're not looking / going to look into this issue
  • mark this issue with the 'confirmed' label if you have confirmed the problem/request and our team should work on it
  • close the issue if it has been resolved
  • take any other suitable action.

Thanks!

github-actions[bot] avatar Nov 15 '24 00:11 github-actions[bot]

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:

  • provide an update if you have any
  • unassign yourself if you're not looking / going to look into this issue
  • mark this issue with the 'confirmed' label if you have confirmed the problem/request and our team should work on it
  • close the issue if it has been resolved
  • take any other suitable action.

Thanks!

github-actions[bot] avatar Jan 15 '25 00:01 github-actions[bot]

Unassigning Michael for further work.

KornevNikita avatar Jan 29 '25 16:01 KornevNikita