KhronosGroup / KhronosGroup/OpenCL-Layers

Proposal for layer options (settings file)

Open
#5 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
13
Forks
13
PR merge metrics
No merged PRs in 30d

Description

In the spirit of "not invented here", because OpenCL Layers are following the success of Vulkan layers, it makes sense to follow the same format and locations for setting settings on how layers should behave when loaded.

## File structure example

```ini
# Comments start with #
# settings (by convention) are prefixed by layer name
layer.setting1 = 10
# Empty lines are ignored, trailing and leading whitespace is trimmed

layer.setting2 = true # Line comments
```

In general this is a direct translation of [`vk_layer_settings.txt`](https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/layers/vk_layer_settings.txt)

`$VARIABLE` is used for environment variables.

## Search locations for the file

The order of precedence through which config files are found are as follows:

1. If `$OPENCL_LAYERS_SETTINGS_PATH` is set to a path to a directory, use the file `cl_layer_settings.txt` file from it. Otherwise if set it should be set to the file name to read the settings from.
2. If `$OPENCL_LAYERS_SETTINGS_PATH` is not set search for platform specific directories listed below.
3. If no settings are found in any of the platform specific locations, then fall back to `cl_layer_settings.txt` in the current working directory.

## Platform specific locations

### Linux and MacOS

- `$XDG_DATA_HOME`/settings.d/opencl/cl_layer_settings.txt
- if `$XDG_DATA_HOME` is not set try with `$HOME`/.local/share

### Windows

- If `{HKEY_LOCAL_MACHINE}\Software\Khronos\OpenCL\Settings` has key with zero value, the the name of
the key is used as filename.
- Non admin only: `HKEY_CURRENT_USER` instead of `HKEY_LOCAL_MACHINE`

### Android

The vulkan validation layers use the same locations as in linux, but environment variables are
replaced by properties.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the linked vk_layer_settings.txt proposal and locating the existing OpenCL layer-loading entry points. Define support for cl_layer_settings.txt, the documented environment-variable and platform-specific search locations, and the INI-like syntax. Done means settings are found in the stated precedence order and parsed with comments, whitespace, values, and $VARIABLE references handled as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.