Skip to content

Commit 9d89e69

Browse files
Alexander BatashevArtem Gindinson
andcommitted
[SYCL] Add FAQ section
This patch provides basic FAQ section with answers to the most frequently asked questions. The list of questions is not complete and will be extended by other patches. Co-authored-by: Artem Gindinson <[email protected]> Signed-off-by: Alexander Batashev <[email protected]>
1 parent ed115ba commit 9d89e69

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

sycl/doc/FAQ.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Frequently Asked Questions
2+
3+
**Table of contents**
4+
5+
1. [Developing with SYCL](#developing-with-sycl)
6+
1. [Using applications built with SYCL](#using-applications-built-with-sycl)
7+
1. [Common issues](#common-issues)
8+
1. [Device specific questions and issues](#device-specific-questions-and-issues)
9+
10+
11+
## Developing with SYCL
12+
13+
### Q: What do I need to start developing with SYCL?
14+
**A:** To get full SYCL experience you need a SYCL-capable compiler. Intel SYCL
15+
compiler provides you with both host and device side compilation. Another requirement
16+
for device code offloading to accelerators is a compatible OpenCL runtime.
17+
Our [Get Started Guide](GetStartedWithSYCLCompiler.md) will help you set up proper
18+
environment. To learn more about SYCL compiler usage, please refer
19+
to [User Manual](SYCLCompilerUserManual.md). If using a special compiler is not
20+
an option for you and you don't need to offload code to accelerators, you can
21+
exploit SYCL's host device feature. This way gives you ability to use any C++11
22+
compiler. You will need to link your application with SYCL Runtime library and
23+
provide path to SYCL headers directory. Please, refer to you compiler manual
24+
to learn about specific build options.
25+
26+
### Q: How are SYCL compilation phases different from those of a usual C++ compiler? Can I customize this flow for my applications?
27+
**A:** Due to the fact that both host and device code need to be compiled and linked into the final binary, the following steps are
28+
added to the usual C++ compiler flow:
29+
1. Device code needs to be compiled separately to produce a separate device image. The toolchains invoked may slightly differ depending on whether
30+
you wish to compile the device kernels "ahead-of-time", or let the device code be JIT-compiled in runtime. Here, the greatest difference
31+
would be a device-specific BE compiler getting invoked in ahead-of-time compilation mode.
32+
2. To link host/device objects successfully, a so-called integration header needs to be generated. In nature, it is a usual C++ header file
33+
that makes use of OpenCL API. It is automatically produced by SYCL compiler after device code analysis. SYCL compiler mixes the integration
34+
header into the preprocessed host code, and only then compiles all relevant files into a host object (.o) file.
35+
36+
In general, we encourage our users to rely on SYCL Compiler for handling all of the compilation phases "under the hood". However, thorough
37+
understanding of the above-described steps may allow you to customize your compilation by invoking different phases manually.
38+
As an example, you could:
39+
1. preprocess your host code with another C++-capable compiler;
40+
2. turn to SYCL compiler for generating the integration header and compiling the device code for the needed target(s);
41+
3. use your preferred host compiler from 1) to compile your preprocessed host code and the integration header into a host object;
42+
4. use your preferred linker to link the host object and the device image(s) into the final executable.
43+
44+
To learn more about the concepts mentioned, and the internals of SYCL compiler as such, we welcome you to study our
45+
[SYCL Compiler and Runtime architecture design](SYCLCompilerAndRuntimeDesign.md)
46+
document.
47+
48+
49+
## Using applications built with SYCL
50+
51+
### Q: What happens if I run my application on machine without OpenCL?
52+
**A:** If you use the default SYCL device selector (or any other selector that
53+
allows host device), then fallback to host device will take place. Otherwise,
54+
an exception will be thrown.
55+
56+
57+
## Common issues
58+
59+
### Q: SYCL application complains about missing libsycl.so (or sycl.dll) library.
60+
Linux:
61+
```
62+
$ ./app
63+
$ ./app: error while loading shared libraries: libsycl.so: cannot open shared object file: No such file or directory
64+
```
65+
Windows:
66+
67+
![Error screen](images/missing_sycl_dll.png)
68+
69+
*The code execution cannot proceed because sycl.dll was not found. Reinstalling the program may fix this problem.*
70+
71+
**A:** The SYCL Runtime library is required to run SYCL-enabled applications. While
72+
compiler driver is able to find the library and link against it, your operating
73+
system may struggle. Make sure that the location of the SYCL runtime library is listed in
74+
`LD_LIBRARY_PATH` (for Linux) or `LIB` (for Windows) environment variables.
75+
76+
### Q: SYCL fails to compile device code that uses STD functions.
77+
Example error message:
78+
```
79+
In file included from example.cpp:1:
80+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl.hpp:11:
81+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/accessor.hpp:13:
82+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/buffer.hpp:10:
83+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/detail/buffer_impl.hpp:14:
84+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/detail/aligned_allocator.hpp:16:
85+
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\include\algorithm(4493,9): error: SYCL kernel cannot call a
86+
dllimport function
87+
_STL_ASSERT(!(_Left < _Right), "invalid comparator");
88+
^
89+
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\include\yvals.h(193,33): note: expanded from macro '_STL_ASSERT'
90+
#define _STL_ASSERT(cond, mesg) _STL_VERIFY(cond, mesg)
91+
^
92+
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\include\yvals.h(186,13): note: expanded from macro '_STL_VERIFY'
93+
_STL_REPORT_ERROR(mesg); \
94+
^
95+
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\include\yvals.h(178,9): note: expanded from macro
96+
'_STL_REPORT_ERROR'
97+
_RPTF0(_CRT_ASSERT, mesg); \
98+
^
99+
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\crtdbg.h(760,37): note: expanded from macro '_RPTF0'
100+
#define _RPTF0(rptno, msg) _RPT_BASE(rptno, __FILE__, __LINE__, NULL, "%s", msg)
101+
^
102+
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\crtdbg.h(747,23): note: expanded from macro '_RPT_BASE'
103+
(void) ((1 != _CrtDbgReport(__VA_ARGS__)) || \
104+
^
105+
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\crtdbg.h(607,26): note: '_CrtDbgReport' declared here
106+
_ACRTIMP int __cdecl _CrtDbgReport(
107+
```
108+
109+
**A:** Section 6.3 of the SYCL specification says:
110+
> Implementations are not required to support any library routines in kernels
111+
> beyond those explicitly mentioned as usable in kernels in this spec.
112+
113+
Replace usage of STD built-ins with SYCL-defined math built-ins. Please, note
114+
that you have to explicitly specify built-in namespace (i.e. `cl::sycl::fmin`).
115+
The full list of SYCL math built-ins is provided in section 4.13.3 of the specification.
116+
117+
118+
## Device specific questions and issues
119+
120+
### Q: What devices are supported by Intel SYCL compiler?
121+
**A:** By design, SYCL is closely connected to OpenCL, which is used to offload
122+
code to accelerators. Intel SYCL compiler currently makes use of SPIR-V,
123+
a portable intermediate representation format. It is a core feature of
124+
OpenCL 2.1, so any device, capable of OpenCL 2.1, should be supported.
125+
Otherwise, your OpenCL device must support `cl_khr_il_program` extension.
126+
127+
Apart from that, there's also the so-called host device, which can be used when no
128+
suitable OpenCL device is found. The host device will use your host CPU as the offload
129+
target for kernel execution. Since the device code is also compiled for the host CPU
130+
and no JIT is required, you can easily use any classic C++ debugging tools of your
131+
choice for the host device code.
132+
133+
Furthermore, developers can extend capabilities of SYCL Runtime and compiler to
134+
non-OpenCL devices by writing correspondent plugins. To learn more, please check out
135+
our [Plugin Interface Guide](SYCLPluginInterface.md).
136+
137+
### Q: SYCL applications hang on Intel GPUs while working well on other devices
138+
**A:** One of the common reasons is Intel GPUs feature called "hang check".
139+
If your workload runs for more than a certain amount of time, it will be killed
140+
by hardware. From the application point of view this looks like a hang. To allow
141+
heavy kernels to be executed, disable hang check. **Please, note that other apps
142+
on your system may contain bugs, and disabling "hang check" may lead to real
143+
hangs.**
144+
145+
You can find out more about hang check and how to disable it on
146+
[this page](https://software.intel.com/en-us/articles/installation-guide-for-intel-oneapi-toolkits).

sycl/doc/images/missing_sycl_dll.png

12.3 KB
Loading

0 commit comments

Comments
 (0)