Skip to content

Commit e42b40e

Browse files
Alexander BatashevArtem Gindinson
authored andcommitted
[SYCL][Doc] Add FAQ section (#1045)
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 9fa878f commit e42b40e

File tree

2 files changed

+148
-0
lines changed

2 files changed

+148
-0
lines changed

sycl/doc/FAQ.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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 the full SYCL experience you need a SYCL-capable compiler. Intel
15+
SYCL compiler provides you with both host and device side compilation. Another
16+
requirement for code offloading to specialized devices is a compatible OpenCL
17+
runtime. Our [Get Started Guide](GetStartedWithSYCLCompiler.md) will help you
18+
set up a proper environment. To learn more about using the SYCL compiler, please
19+
refer to [User Manual](SYCLCompilerUserManual.md). If using a special compiler
20+
is not an option for you and/or you would like to experiment without offloading
21+
code to non-host devices, you can exploit SYCL's host device feature. This gives
22+
you the ability to use any C++11 compiler. You will need to link your
23+
application with the SYCL Runtime library and provide a path to the SYCL headers
24+
directory. Please, refer to your compiler manual to learn about specific build
25+
options.
26+
27+
### Q: How are SYCL compilation phases different from those of a usual C++ compiler? Can I customize this flow for my applications?
28+
**A:** Due to the fact that both host and device code need to be compiled and
29+
linked into the final binary, the compilation steps sequence is more complicated
30+
compared to the usual C++ flow.
31+
32+
In general, we encourage our users to rely on the SYCL Compiler for handling all
33+
of the compilation phases "under the hood". However, thorough understanding of
34+
the above-described steps may allow you to customize your compilation by invoking
35+
different phases manually. As an example, you could:
36+
1. preprocess your host code with another C++-capable compiler;
37+
2. turn to the SYCL compiler for generating the integration header and compiling
38+
the device code for the needed target(s);
39+
3. use your preferred host compiler from 1) to compile your preprocessed host
40+
code and the integration header into a host object file;
41+
4. link the host object file and the device image(s) into the final executable.
42+
43+
To learn more about the concepts behind this flow, and the SYCL Compiler
44+
internals 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 a machine without OpenCL?
52+
**A:** If you use the default SYCL device selector (or any other selector that
53+
allows host device), then a fallback to the host device will take place.
54+
Otherwise, 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.
72+
While compiler driver is able to find the library and link against it, your
73+
operating system may struggle. Make sure that the location of the SYCL Runtime
74+
library is listed in the correct environment variable: `LD_LIBRARY_PATH`
75+
(for Linux) or `LIB` (for Windows).
76+
77+
### Q: SYCL fails to compile device code that uses STD functions.
78+
Example error message:
79+
```
80+
In file included from example.cpp:1:
81+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl.hpp:11:
82+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/accessor.hpp:13:
83+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/buffer.hpp:10:
84+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/detail/buffer_impl.hpp:14:
85+
In file included from C:\compiler\lib\clang\10.0.0\include\CL/sycl/detail/aligned_allocator.hpp:16:
86+
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
87+
dllimport function
88+
_STL_ASSERT(!(_Left < _Right), "invalid comparator");
89+
^
90+
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'
91+
#define _STL_ASSERT(cond, mesg) _STL_VERIFY(cond, mesg)
92+
^
93+
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'
94+
_STL_REPORT_ERROR(mesg); \
95+
^
96+
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\include\yvals.h(178,9): note: expanded from macro
97+
'_STL_REPORT_ERROR'
98+
_RPTF0(_CRT_ASSERT, mesg); \
99+
^
100+
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\crtdbg.h(760,37): note: expanded from macro '_RPTF0'
101+
#define _RPTF0(rptno, msg) _RPT_BASE(rptno, __FILE__, __LINE__, NULL, "%s", msg)
102+
^
103+
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\crtdbg.h(747,23): note: expanded from macro '_RPT_BASE'
104+
(void) ((1 != _CrtDbgReport(__VA_ARGS__)) || \
105+
^
106+
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\crtdbg.h(607,26): note: '_CrtDbgReport' declared here
107+
_ACRTIMP int __cdecl _CrtDbgReport(
108+
```
109+
110+
**A:** Section 6.3 of the SYCL specification says:
111+
> Implementations are not required to support any library routines in kernels
112+
> beyond those explicitly mentioned as usable in kernels in this spec.
113+
114+
Replace usage of STD built-ins with SYCL-defined math built-ins. Please, note
115+
that you have to explicitly specify built-in namespace (i.e. `cl::sycl::fmin`).
116+
The full list of SYCL math built-ins is provided in section 4.13.3 of the
117+
specification.
118+
119+
120+
## Device specific questions and issues
121+
122+
### Q: What devices are supported by Intel SYCL compiler?
123+
**A:** By design, SYCL is closely connected to OpenCL, which is used to offload
124+
code to specialized devices. Intel SYCL compiler currently makes use of SPIR-V,
125+
a portable intermediate representation format. It is a core feature of
126+
OpenCL 2.1, so any device, capable of OpenCL 2.1, should be supported.
127+
Otherwise, your OpenCL device must support `cl_khr_il_program` extension.
128+
129+
Apart from that, there's also the so-called host device, which can be used when
130+
no suitable OpenCL device is found. The host device will use your host CPU as
131+
the offload target for kernel execution. Since the device code is also compiled
132+
for the host CPU and no JIT is required, you can easily use any classic C++
133+
debugging tools of your choice for the host device code.
134+
135+
Furthermore, developers can extend capabilities of the SYCL Runtime to
136+
non-OpenCL devices by writing correspondent plugins. To learn more, please check
137+
out our [Plugin Interface Guide](SYCLPluginInterface.md).
138+
139+
### Q: SYCL applications hang on Intel GPUs while working well on other devices
140+
**A:** One of the common reasons is Intel GPUs feature called "hang check".
141+
If your workload runs for more than a certain amount of time, it will be killed
142+
by hardware. From the application point of view this looks like a hang. To allow
143+
heavy kernels to be executed, disable hang check. **Please, note that other apps
144+
on your system may contain bugs, and disabling "hang check" may lead to real
145+
hangs.**
146+
147+
You can find out more about hang check and how to disable it on
148+
[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)