@@ -10,27 +10,7 @@ explicitly included in user code.
10
10
11
11
Implementation requires a special device library to be linked with a
12
12
SYCL program. The library should match the C or C++ standard library
13
- used to compile the program:
14
-
15
- For example, on Linux with GNU glibc:
16
- .. code:
17
- clang++ -fsycl -c main.cpp -o main.o
18
- clang++ -fsycl main.o $(SYCL_INSTALL)/lib/libsycl-glibc.o -o a.out
19
-
20
- or, in case of Windows:
21
- .. code:
22
- clang++ -fsycl -c main.cpp -o main.obj
23
- clang++ -fsycl main.obj %SYCL_INSTALL%/lib/libsycl-msvc.o -o a.exe
24
-
25
- For Ahead-Of-Time compilation (AOT), fallback libraries (object files)
26
- must be linked as well:
27
-
28
- .. code:
29
- clang++ -fsycl -c -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice \
30
- main.cpp -o main.o
31
- clang++ -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice \
32
- main.o $(SYCL_INSTALL)/lib/libsycl-glibc.o \
33
- $(SYCL_INSTALL)/lib/libsycl-fallback-cassert.o -o a.out
13
+ used to compile the program.
34
14
35
15
List of supported functions from C standard library:
36
16
- assert macro (from <assert.h> or <cassert>)
@@ -120,12 +100,38 @@ following math functions are not supported now:
120
100
- lrintf, lrint
121
101
- nexttowardf, nexttoward
122
102
- nanf, nan
103
+
123
104
Device libraries can't support both single and double precision as some
124
105
underlying device may not support double precision.
125
106
'ldexpf' and 'frexpf' from MSVC <math.h> are implemented using corresponding
126
107
double precision version, they can be used only when double precision is
127
108
supported by underlying device.
128
109
110
+ All device libraries without double precision usage are linked by default and
111
+ in order to use double precision device library, please add
112
+ '-fsycl-device-lib=libm-fp64' or '-fsycl-device-lib=all'.
113
+
114
+ For example, no options need to be added to use `assert ` or float precision
115
+ math functions:
116
+ .. code:
117
+ clang++ -fsycl main.cpp -o main.o
118
+
119
+ To use double precision math functions:
120
+ .. code:
121
+ clang++ -fsycl -fsycl-device-lib=libm-fp64 main.cpp -o main.o
122
+
123
+ For Ahead-Of-Time compilation (AOT), the steps to use device libraries is
124
+ same, no options need to be added to use `assert ` or float precision math
125
+ functions:
126
+ .. code:
127
+ clang++ -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice \
128
+ main.cpp -o main.o
129
+
130
+ To use double precision math functions in AOT:
131
+ .. code:
132
+ clang++ -fsycl -fsycl-device-lib=libm-fp64 -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice \
133
+ main.cpp -o main.o
134
+
129
135
Example of usage
130
136
================
131
137
@@ -212,11 +218,7 @@ wrapper libraries are provided with the SYCL compiler that "lower"
212
218
libc implementation-specific functions into a stable set of functions,
213
219
that can be later handled by a device compiler.
214
220
215
- .. code:
216
- clang++ -fsycl -c main.cpp -o main.o
217
- clang++ -fsycl main.o $(SYCL_INSTALL)/lib/libsycl-glibc.o -o a.out
218
-
219
- This `libsycl-glibc.o ` is one of these wrapper libraries: it provides
221
+ This `libsycl-crt.o ` is one of these wrapper libraries: it provides
220
222
definitions for glibc specific library function, and these definitions
221
223
call the corresponding functions from `__devicelib_* ` set of
222
224
functions.
@@ -237,11 +239,7 @@ For example, `__assert_fail` from IR above gets transformed into:
237
239
unreachable
238
240
239
241
A single wrapper object provides function wrappers for *all * supported
240
- library functions. Every supported C library implementation (MSVC or
241
- glibc) has its own wrapper library object:
242
-
243
- - libsycl-glibc.o
244
- - libsycl-msvc.o
242
+ library functions.
245
243
246
244
SPIR-V
247
245
======
@@ -283,4 +281,5 @@ extension is provided as `libsycl-fallback-cassert.spv`
283
281
For AOT compilation, fallback libraries are provided as object files
284
282
(e.g. `libsycl-fallback-cassert.o `) which contain device code in LLVM
285
283
IR format. Device code in these object files is equivalent to device
286
- code in the `*.spv ` files.
284
+ code in the `*.spv ` files. Those object files are located in compiler
285
+ package's 'lib/' folder.
0 commit comments