Skip to content

Commit 9041d78

Browse files
authored
[SYCL][Doc][RTC] Document [un]supported features and build_options (#17459)
Update the non-normative section in the `kernel_compiler` extension to reflect what's currently supported in DPCPP. --------- Signed-off-by: Julian Oppermann <[email protected]>
1 parent b295870 commit 9041d78

File tree

1 file changed

+113
-13
lines changed

1 file changed

+113
-13
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_kernel_compiler.asciidoc

Lines changed: 113 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -959,17 +959,117 @@ this extension.
959959
The SYCL runtime compiler supports the following {dpcpp} options to be passed in
960960
the `build_options` property.
961961

962-
[%header,cols="1,3"]
963-
|===
964-
|Option
965-
|Notes
966-
967-
|`-I<dir>` +
968-
`-I <dir>` +
969-
`--include-directory=<dir>` +
970-
`--include-directory <dir>`
971-
| Add `<dir>` to to the search list for include files (see section "Including
962+
Some options have equivalent long (starting with `--`) and short (starting with
963+
`-`) option names. When using the long option name, an argument can be either
964+
separated by `=` in the same element of the `build_options` property, or given
965+
as a separate element. When using the short option name, an argument is either
966+
appended directly after the option name, or given as a separate element in the
967+
`build_options` property. The following example shows how to construct the
968+
`build_options` property with each of the forms.
969+
970+
[source,c++]
971+
----
972+
build_options{{
973+
{"--include-directory=dir1"},
974+
{"--include-directory"}, {"dir2"},
975+
{"-Idir3"},
976+
{"-I"}, {"dir4"}
977+
}};
978+
----
979+
980+
==== Preprocessor options
981+
982+
===== `--include-directory=<dir>` (`-I<dir>`)
983+
984+
Add `<dir>` to to the search list for include files (see section "Including
972985
files when the language is ``sycl``"). This is useful, for example, to compile
973-
kernels using external libraries. Note that for the second and fourth form,
974-
`dir` is a separate element in the `build_options` list.
975-
|===
986+
kernels using external libraries.
987+
988+
===== `--define-macro=<name>[=<value>]` (`-D<name>[=<value>]`)
989+
990+
Define macro `<name>`, optionally to the given `<value>`.
991+
992+
===== `--undefine-macro=<name>` (`-U<name>`)
993+
994+
Undefine macro `<name>`.
995+
996+
==== Diagnostic options
997+
998+
The `build_options` property accepts warning (`-W`) and remark (`-R`) emission
999+
options supported by the `clang` compiler. For an overview of these options, see
1000+
https://clang.llvm.org/docs/DiagnosticsReference.html. The specific options
1001+
available for SYCL runtime compilation depend on the version of the {dpcpp}
1002+
compiler distributed with the SYCL runtime used by the application.
1003+
1004+
Note: Use the `save_log` property to obtain detailed output from the compilation
1005+
process.
1006+
1007+
==== SYCL-specific options
1008+
1009+
===== `-Xs<arg>`
1010+
1011+
Pass `<arg>` to the backend of the device compiler. When using `-Xs<arg>`, a `-`
1012+
is prepended to `<arg>` before handing it to the backend. Otherwise, `<arg>` is
1013+
passed on unmodified.
1014+
1015+
For example, the following forms are equivalent:
1016+
1017+
[source,c++]
1018+
----
1019+
build_options{{
1020+
{"-XsDFOO=bar"},
1021+
{"-Xs"}, {"-DFOO=bar"}
1022+
}};
1023+
----
1024+
1025+
===== `-fsycl-rtc-mode`
1026+
1027+
Relax the requirement that parameter types for free-function kernels must be
1028+
forward-declarable.
1029+
1030+
=== Known issues and limitations when the language is `sycl`
1031+
1032+
==== Changing the compiler action or output
1033+
1034+
As the {dpcpp} frontend is integrated tightly in the runtime compilation
1035+
pipeline, the application cannot change the runtime compiler's action (e.g.
1036+
`-c`, `-S`) or output file (`-o`). Similarly, options related to linking (e.g.
1037+
`-L`) are incompatible, including the SYCL-specific `-fsycl-link` action. The
1038+
implementation throws an `exception` with the `errc::invalid` error code when it
1039+
detects an option that conflicts with the runtime compilation pipeline.
1040+
1041+
==== Ahead-of-time compilation
1042+
1043+
The kernels in a SYCL source string are compiled automatically to native code
1044+
for all devices passed to the `build` function (see section "New free functions
1045+
to create and build kernel bundles"). The implementation rejects the use of the
1046+
`-fsycl-targets=` options to request ahead-of-time (AOT) compilation, and throws
1047+
an `exception` with the `errc::invalid` error code when this option is detected.
1048+
The application can use the `-Xs` option described above to pass options to the
1049+
backend of the device compiler, but all other options to control AOT compilation
1050+
are ignored.
1051+
1052+
==== `invoke_simd`
1053+
1054+
The SYCL runtime compiler currently does not implement the logic required to
1055+
support the `-fno-sycl-device-code-split-esimd` option, and throws an
1056+
`exception` with the `errc::invalid` error code when this option is detected. As
1057+
a consequence, the `invoke_simd` functionality is unavailable. However, the SYCL
1058+
runtime compiler supports ESIMD kernels and source strings containing a mix of
1059+
SYCL and ESIMD kernels.
1060+
1061+
==== Sanitizers
1062+
1063+
The implementation currently lacks the necessary linking of device libraries to
1064+
support device, memory and thread sanitizers for runtime-compiled code. If the
1065+
`-fsanitize=` option is detected, an `exception` with the `errc::invalid` error
1066+
code is thrown. Other means of activating the sanitizer (e.g. via
1067+
`-Xsycl-device-frontend`) may cause the runtime compilation to fail.
1068+
1069+
=== Caching
1070+
1071+
The `kernel_compiler` implementation in {dpcpp} supports persistent caching. To
1072+
enable it, set the the environment variable `SYCL_CACHE_PERSISTENT=1`. The
1073+
location of the cache can be changed by setting `SYCL_CACHE_DIR`. Refer to
1074+
https://intel.github.io/llvm/design/KernelProgramCache.html#persistent-cache for
1075+
more details on how to control the cache.

0 commit comments

Comments
 (0)