@@ -148,12 +148,34 @@ For this purpose DPC++ front-end generates `module-id` attribute on each
148148
149149### sycl-post-link changes
150150
151- In order to support dynamic linking of device code, `sycl-post-link` performs
152- 2 main tasks:
151+ When device code splitting is performed during a typical compilation of a SYCL offloading program,
152+ all dependent device code is brought into a split image in order to construct a complete image.
153+ When device code splitting is performed during the compilation flow to generate a dynamic library,
154+ construction of a complete device image is not possible since the dynamic library may rely on
155+ functions that are not defined in the library. Thus, when supporting dynamic linking a dependency
156+ to a `canBeImportedFunction` will not cause the dependent function to be added to the image.
157+
158+ `canBeImportedFunction` is a boolean function accepting a Function input and returns true
159+ if the Function "can be imported". A `canBeImportedFunction` is:
160+
161+ 1. Not an intrinsic
162+ 2. Name does not start with "__"
163+ 3. Demangled name does not start with "__"
164+ 4. Must be a `SYCL_EXTERNAL` function
165+
166+ More information about `SYCL_EXTERNAL` can be found in:
167+ https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#subsec:syclexternal
168+
169+ In order to support dynamic linking of device code, `sycl-post-link` has
170+ the following modifications:
171+
172+ - Device images that have a dependency to a `canBeImportedFunction` do not include the
173+ function. Instead the dependency is recorded in the imported symbols property list.
174+ - An image that provides a `canBeImportedFunction` has the symbol recorded in the exported
175+ symbols property list.
176+ - All functions symbols that are not `canBeImportedFunction` are internalized
177+
153178
154- - Supplies device images containing exports with an information about exported
155- symbols
156- - Supplies device images with an information about imported symbols
157179
158180In addition, `SYCL_EXTERNAL` functions as well as kernels are considered as entry
159181points during device code split.
0 commit comments