Skip to content

Commit e24d975

Browse files
committed
Remove PI references. Add description of cache-related env vars.
1 parent ff63c0b commit e24d975

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

sycl/doc/design/KernelProgramCache.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ which is provided to methods of `sycl::handler` (e.g. `parallel_for` or
126126

127127
### Persistent cache
128128

129-
The cache works behind in-memory cache and stores the same underlying PI
129+
The cache works behind in-memory cache and stores the same underlying UR
130130
object behind `sycl::program` user-level objects in a per-context data storage.
131131
The storage is organized as a map for storing device code image. It uses
132132
different keys to address difference in SYCL objects ids between applications
@@ -167,16 +167,28 @@ upgrades.
167167
compile and link options) set in application or environment variables. There are
168168
three sources of build options:
169169

170-
- from device image (pi_device_binary_struct::CompileOptions,
171-
pi_device_binary_struct::LinkOptions);
170+
- from device image (sycl_device_binary_struct::CompileOptions,
171+
sycl_device_binary_struct::LinkOptions);
172172
- environment variables (SYCL_PROGRAM_COMPILE_OPTIONS,
173173
SYCL_PROGRAM_LINK_OPTIONS);
174174
- options passed through SYCL API.
175175

176176
## Cache configuration
177177

178-
The environment variables which affect cache behavior are described in
179-
[EnvironmentVariables.md](../EnvironmentVariables.md).
178+
The following environment variables affect the cache behavior:
179+
180+
| Environment variable | Values | Description |
181+
| -------------------- | ------ | ----------- |
182+
| `SYCL_CACHE_DIR` | Path | Path to persistent cache root directory. Default values are `%AppData%\libsycl_cache` for Windows and `$XDG_CACHE_HOME/libsycl_cache` on Linux, if `XDG_CACHE_HOME` is not set then `$HOME/.cache/libsycl_cache`. When none of the environment variables are set SYCL persistent cache is disabled. |
183+
| `SYCL_CACHE_PERSISTENT` | Integer | Controls persistent device compiled code cache. Turns it on if set to '1' and turns it off if set to '0'. When cache is enabled SYCL runtime will try to cache and reuse JIT-compiled binaries. Default is off. |
184+
| `SYCL_CACHE_IN_MEM` | '1' or '0' | Enable ('1') or disable ('0') in-memory caching of device compiled code. When cache is enabled SYCL runtime will try to cache and reuse JIT-compiled binaries. Default is '1'. |
185+
| `SYCL_IN_MEM_CACHE_EVICTION_THRESHOLD` | Positive integer | `SYCL_IN_MEM_CACHE_EVICTION_THRESHOLD` accepts an integer that specifies the maximum size of the in-memory program cache in bytes. Eviction is performed when the cache size exceeds the threshold. The default value is 0 which means that eviction is disabled. |
186+
| `SYCL_CACHE_EVICTION_DISABLE` | Any(\*) | Switches persistent cache eviction off when the variable is set. |
187+
| `SYCL_CACHE_MAX_SIZE` | Positive integer | Persistent cache eviction is triggered once total size of cached images exceeds the value in megabytes (default - 8 192 for 8 GB). Set to 0 to disable size-based cache eviction. |
188+
| `SYCL_CACHE_THRESHOLD` | Positive integer | Persistent cache eviction threshold in days (default value is 7 for 1 week). Set to 0 for disabling time-based cache eviction. |
189+
| `SYCL_CACHE_MIN_DEVICE_IMAGE_SIZE` | Positive integer | Minimum size of device code image in bytes which is reasonable to cache on disk because disk access operation may take more time than do JIT compilation for it. Applicable only for persistent cache. Default value is 0 to cache all images. |
190+
| `SYCL_CACHE_MAX_DEVICE_IMAGE_SIZE` | Positive integer | Maximum size of device image in bytes which is cached. Caching big kernels may overload the disk very fast. Applicable only for persistent cache. Default value is 1 GB. |
191+
180192

181193
## Implementation details
182194

@@ -234,7 +246,7 @@ queue). Possibility of enqueueing multiple cacheable kernels simultaneously
234246
from multiple threads requires us to provide thread-safety for the caching
235247
mechanisms.
236248

237-
It is worth of noting that we don't cache the PI resource (kernel or program)
249+
It is worth of noting that we don't cache the UR resource (kernel or program)
238250
by itself. Instead we augment the resource with the status of build process.
239251
Hence, what is cached is a wrapper structure `BuildResult` which contains three
240252
information fields - pointer to built resource, build error (if applicable) and
@@ -282,7 +294,7 @@ class implements RAII to make code look cleaner a bit. Now, GetCache function
282294
will return the mapping to be employed that includes the 3 components: kernel
283295
name, device as well as any specialization constants values. These get added to
284296
`BuildResult` and are cached. The `BuildResult` structure is specialized with
285-
either `PiKernel` or `PiProgram`<sup>[1](#remove-pointer)</sup>.
297+
either `ur_kernel_handle_t` or `ur_program_handle_t`<sup>[1](#remove-pointer)</sup>.
286298

287299
### Hash function
288300

@@ -337,7 +349,7 @@ The device code image are stored on file system using structure below:
337349

338350
- `<cache_root>` - root directory storing cache files, that depends on
339351
environment variables (see SYCL_CACHE_DIR description in the
340-
[EnvironmentVariables.md](../EnvironmentVariables.md));
352+
[Cache configuration](#cache-configuration));
341353
- `<device_hash>` - hash out of device information used to identify target
342354
device;
343355
- `<device_image_hash>` - hash made out of device image used as input for the

0 commit comments

Comments
 (0)