{"id":13751925,"url":"https://github.com/kpet/clvk","last_synced_at":"2025-05-09T18:32:46.040Z","repository":{"id":38983515,"uuid":"148984864","full_name":"kpet/clvk","owner":"kpet","description":"Implementation of OpenCL 3.0 on Vulkan","archived":false,"fork":false,"pushed_at":"2025-04-22T07:48:20.000Z","size":2065,"stargazers_count":385,"open_issues_count":104,"forks_count":43,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-04-22T08:43:34.510Z","etag":null,"topics":["gpu-computing","opencl","vulkan","vulkan-api"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kpet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/supported-applications.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-16T10:26:36.000Z","updated_at":"2025-04-22T07:48:20.000Z","dependencies_parsed_at":"2024-04-25T10:48:49.519Z","dependency_job_id":"9564db20-749a-447f-8946-b34cd2e235c8","html_url":"https://github.com/kpet/clvk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpet%2Fclvk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpet%2Fclvk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpet%2Fclvk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpet%2Fclvk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpet","download_url":"https://codeload.github.com/kpet/clvk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253303144,"owners_count":21886893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpu-computing","opencl","vulkan","vulkan-api"],"created_at":"2024-08-03T09:00:57.138Z","updated_at":"2025-05-09T18:32:45.993Z","avatar_url":"https://github.com/kpet.png","language":"C++","readme":"# clvk [![CI badge](https://github.com/kpet/clvk/actions/workflows/presubmit.yml/badge.svg?branch=main)](https://github.com/kpet/clvk/actions/workflows/presubmit.yml?query=branch%3Amain++) [![Discord Shield](https://discordapp.com/api/guilds/1002628585250631681/widget.png?style=shield)](https://discord.gg/xsVdjmhFM9)\n\nclvk is a [conformant](https://www.khronos.org/conformance/adopters/conformant-products/opencl)\nimplementation of OpenCL 3.0 on top of Vulkan using\n[clspv](https://github.com/google/clspv) as the compiler.\n\n![OpenCL Logo](./docs/opencl-light.svg#gh-light-mode-only)\n![OpenCL Logo](./docs/opencl-dark.svg#gh-dark-mode-only)\n\n# Supported applications\n\n[Full list](docs/supported-applications.md)\n\n# Getting dependencies\n\nclvk depends on the following external projects:\n\n* [clspv](https://github.com/google/clspv) and its dependencies\n* [OpenCL-Headers](https://github.com/KhronosGroup/OpenCL-Headers)\n* [SPIRV-Headers](https://github.com/KhronosGroup/SPIRV-Headers)\n* [SPIRV-Tools](https://github.com/KhronosGroup/SPIRV-Tools)\n* [SPIRV-LLVM-Translator](https://github.com/KhronosGroup/SPIRV-LLVM-Translator)\n\nclvk also (obviously) depends on a Vulkan implementation. The build system\nsupports a number of options there (see [Building section](#building)).\n\nTo fetch all the dependencies needed to build and run clvk, please run:\n\n```\ngit submodule update --init --recursive\n./external/clspv/utils/fetch_sources.py --deps llvm\n```\n\n# Building\n\nclvk uses CMake for its build system.\n\n## Getting started\n\nTo build with the default configuration options, just use following:\n\n```\nmkdir -p build\ncd build\ncmake ../\nmake -j$(nproc)\n```\n\n## Build options\n\nThe build system allows a number of things to be configured.\n\n### Vulkan implementation\n\nYou can select the Vulkan implementation that clvk will target with the\n`CLVK_VULKAN_IMPLEMENTATION` build system option. Two options are currently\nsupported:\n\n* `-DCLVK_VULKAN_IMPLEMENTATION=system` instructs the build system to use the\n  Vulkan implementation provided by your system as detected by CMake's\n  `find_package(Vulkan)`. This is the default. You can use the\n  [Vulkan SDK](https://vulkan.lunarg.com/sdk/home) to provide headers and\n  libraries to build against.\n\n* `-DCLVK_VULKAN_IMPLEMENTATION=custom` instructs the build system to use the\n  values provided by the user manually using `-DVulkan_INCLUDE_DIRS` and\n  `-DVulkan_LIBRARIES`.\n\n### Tests\n\nIt is possible to disable the build of the tests by passing\n`-DCLVK_BUILD_TESTS=OFF`.\n\nIt is also possible to disable only the build of the tests linking with the\nstatic OpenCL library by passing `-DCLVK_BUILD_STATIC_TESTS=OFF`.\n\nBy default, tests needing `gtest` are linked with the libraries coming from\nllvm (through clspv).\nIt is possible to use other libraries by passing\n`-DCLVK_GTEST_LIBRARIES=\u003clib1\u003e;\u003clib2\u003e` (semicolumn separated list).\n\n### Assertions\n\nAssertions can be controlled with the `CLVK_ENABLE_ASSERTIONS` build option.\nThey are enabled by default in Debug builds and disabled in other build types.\n\n### OpenCL conformance tests\n\nPassing `-DCLVK_BUILD_CONFORMANCE_TESTS=ON` will instruct CMake to build the\n[OpenCL conformance tests](https://github.com/KhronosGroup/OpenCL-CTS).\nThis is _not expected to work out-of-the box_ at the moment.\n\nIt is also possible to build GL and GLES interroperability tests by passing\n`-DCLVK_BUILD_CONFORMANCE_TESTS_GL_GLES_SUPPORTED=ON`.\n\n### Clspv compilation\n\nYou can select the compilation style that clvk will use with Clspv via\nthe `CLVK_CLSPV_ONLINE_COMPILER` option. By default, Clspv is run in a\nseparate process.\n\n* `-DCLVK_CLSPV_ONLINE_COMPILER=1` will cause clvk to compile kernels\nin the same process via the Clspv C++ API.\n\nYou can build clvk using an external Clspv source tree by setting\n`-DCLSPV_SOURCE_DIR=/path/to/clspv/source/`.\n\n### SPIRV components\n\nAll needed SPIRV components are added to `clvk` using git submodules.\nIt is possible to disable the build of those component or to reuse already\nexisting sources:\n\n#### SPIRV-Headers\n\n`SPIRV_HEADERS_SOURCE_DIR` can be overriden to use another `SPIRV-Headers`\nrepository.\n\n#### SPIRV-Tools\n\n`SPIRV_TOOLS_SOURCE_DIR` can be overriden to use another `SPIRV-Tools`\nrepository.\nYou can also disable the build of `SPIRV-Tools` by setting\n`-DCLVK_BUILD_SPIRV_TOOLS=OFF`.\n\n#### SPIRV-LLVM-Translator\n\n`LLVM_SPIRV_SOURCE` can be overriden to use another `SPIRV-LLVM-Translator`\nrepository.\nNote that it is not used if the compiler support is disabled (enabled by\ndefault).\n\n### Sanitizers\n\nSupport for [sanitizers](https://github.com/google/sanitizers) is integrated into\nthe build system:\n\n* `CLVK_ENABLE_ASAN` can be used to enable\n   [AddressSanitizer](https://clang.llvm.org/docs/AddressSanitizer.html).\n* `CLVK_ENABLE_TSAN` can be used to enable\n   [ThreadSanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html).\n* `CLVK_ENABLE_UBSAN` can be used to enable\n   [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html).\n\n## Building libclc manually\n\nWhen compiling clvk on small machine (such as Raspberry pi) building libclc\nmanually can help. Here are the few steps to do it:\n\n1. Build a host native clang compiler using the source pointed by clspv in `\u003cclvk\u003e/external/clspv/third_party/llvm`:\n```\ncmake -B \u003cclang_host\u003e -S \u003cclvk\u003e/external/clspv/third_party/llvm \\\n  -DLLVM_ENABLE_PORJECTS=\"clang\" \\\n  -DLLVM_NATIVE_TARGET=1 \\\n  -DCMAKE_BUILD_TYPE=Release \\\n  -DCMAKE_INSTALL_PREFIX=\"\u003cclang_host\u003e/install\"\ncmake --build \u003cclang_host\u003e --target install\n```\n2. Build libclc using that compiler:\n```\ncmake -B \u003clibclc\u003e -S \u003cclvk\u003e/external/clspv/third_party/llvm/libclc \\\n  -DLLVM_CMAKE_DIR=\"\u003cclang_host\u003e/lib/cmake\" \\\n  -DLIBCLC_DIR_TARGETS_TO_BUILD=\"clspv--;clspv64--\"\ncmake --build \u003clibclc\u003e\n```\n3. Pass the following options to CMake when compiling clvk:\n  - `-DCLSPV_EXTERNAL_LIBCLC_DIR=\"\u003clibclc\u003e\"`\n\n## Building for Android\n\nclvk can be built for Android using the\n[Android NDK](https://developer.android.com/ndk) toolchain.\n\n1. Download and extract the NDK toolchain to a directory (`/path/to/ndk`)\n2. Build libclc binaries ([cross-compiling](#Cross-compiling))\n3. Pass the following options to CMake:\n    - `-DCMAKE_TOOLCHAIN_FILE=/path/to/ndk/build/cmake/android.toolchain.cmake`\n    - `-DANDROID_ABI=\u003cABI_FOR_THE_TARGET_DEVICE\u003e`, most likely `arm64-v8a`\n    - `-DVulkan_LIBRARY=/path/to/ndk/**/\u003capi-level\u003e/libvulkan.so`\n4. That should be it!\n\n# Using\n\n## Via the OpenCL ICD Loader\n\nclvk supports the `cl_khr_icd` OpenCL extension that makes it possible\nto use the [OpenCL ICD Loader](https://github.com/KhronosGroup/OpenCL-ICD-Loader).\n\n## Directly\n\nTo use clvk to run an OpenCL application, you just need to make sure that the\nclvk shared library is picked up by the dynamic linker.\n\nWhen clspv is not built into the shared library (which is currently the default),\nyou also need to make sure that clvk has access to the `clspv` binary. If you\nwish to move the built library and `clspv` binary out of the build tree, you will\nneed to make sure that you provide clvk with a path to the `clspv` binary via the\n`CLVK_CLSPV_PATH` environment variable\n(see [Environment variables](#environment-variables)).\n\n### Unix-like systems (Linux, macOS)\n\nThe following ought to work on Unix-like systems:\n\n```\n$ LD_LIBRARY_PATH=/path/to/build /path/to/application\n\n# Running the included simple test\n$ LD_LIBRARY_PATH=./build ./build/simple_test\n```\n\n#### With perfetto traces\n\n\u003e Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.\n\u003e\n\u003e -- https://github.com/google/perfetto/tree/v46.0#perfetto---system-profiling-app-tracing-and-trace-analysis\n\nPerfetto can be enabled by passing the following options to CMake:\n   - `-DCLVK_PERFETTO_ENABLE=ON`\n   - `-DCLVK_PERFETTO_SDK_DIR=/path/to/perfetto/sdk`\n\nThe perfetto SDK can be found in the [Perfetto Github repository](https://github.com/google/perfetto/tree/v46.0)\n\nIf you already have a perfetto library in your system, you still need to provide the path\nto the SDK directory so the build system can find `perfetto.h`.\nBut you should also provide the following option to CMake:\n   - `-DCLVK_PERFETTO_LIBRARY=\u003cyour_perfetto_library_name\u003e`\n\nBy default, clvk will use Perfetto's `InProcess` backend, which means\nthat you just have to run your application to generate traces.\nEnvironment variables can be used to control the maximum size of traces and what file they are saved to.\n\nIf you'd rather use Perfetto's `System` backend, pass the following option\nto CMake:\n   - `-DCLVK_PERFETTO_BACKEND=System`\n\nOnce traces have been generated, you can view them using the\n[perfetto trace viewer](https://ui.perfetto.dev/).\n\n### Windows\n\nCopy `OpenCL.dll` into a system location or alongside the application executable\nyou want to run with clvk.\n\n### Raspberry Pi\n\nMake sure you have an up-to-date Mesa installed on your system.\nAt the time of writing (May 2023) RaspberryPi OS (Debian 11) did not, but Ubuntu\n23.04 does have a compatible vulkan driver.\n\nInstall the prerequisites:\n```\n$ sudo apt install mesa-vulkan-drivers vulkan-tools libvulkan-dev git cmake clang clinfo\n```\n\nCheck if your vulkan implementation has the `VK_KHR_storage_buffer_storage_class`\nextension or supports Vulkan 1.1. Note that it's not enough if this is the case for\nllvmpipe. You need v3dv to support this too. If it does not, your Mesa is too old.\n\nTo fetch the dependencies, do `python3 ./external/clspv/utils/fetch_sources.py`\nbecause the python interpreter may not be found if not explicitly called as python3.\n\nBuilding will take many hours on a rPi4.\nMaybe you can skip some tool building, but building with default settings works, at least.\n\nOnce the libOpenCL.so library has been built, verify with:\n```\nLD_LIBRARY_PATH=/path/to/build clinfo\n```\n\n### With global timing information\n\nGlobal timing information about API functions as well as some internal functions can be logged at the end of the execution.\n\nTo enable it, pass the following option to CMake:\n  - `-DCLVK_ENABLE_TIMING=ON`\n\nHere is an example of what to expect running `simple_test`:\n\n```\n[CLVK] 0.00 ms -\u003e clReleaseContext (1 blocks, avg 0.001 ms)\n[CLVK] 0.02 ms -\u003e clReleaseProgram (1 blocks, avg 0.024 ms)\n[CLVK] 0.01 ms -\u003e clReleaseKernel (1 blocks, avg 0.008 ms)\n[CLVK] 0.00 ms -\u003e clReleaseCommandQueue (1 blocks, avg 0.005 ms)\n[CLVK] 0.01 ms -\u003e clReleaseMemObject (1 blocks, avg 0.007 ms)\n[CLVK] 0.00 ms -\u003e clEnqueueUnmapMemObject (1 blocks, avg 0.002 ms)\n[CLVK] 0.03 ms -\u003e clEnqueueMapBuffer (1 blocks, avg 0.034 ms)\n[CLVK] 5.04 ms -\u003e vkQueueWaitIdle (1 blocks, avg 5.043 ms)\n[CLVK] 5.13 ms -\u003e executor_wait (1 blocks, avg 5.126 ms)\n[CLVK] 0.02 ms -\u003e vkQueueSubmit (1 blocks, avg 0.022 ms)\n[CLVK] 5.07 ms -\u003e execute_cmd: CLVK_COMMAND_BATCH (3 blocks, avg 1.690 ms)\n[CLVK] 5.09 ms -\u003e execute_cmds (3 blocks, avg 1.698 ms)\n[CLVK] 0.00 ms -\u003e extract_cmds_required_by (3 blocks, avg 0.001 ms)\n[CLVK] 0.00 ms -\u003e enqueue_command (3 blocks, avg 0.001 ms)\n[CLVK] 0.00 ms -\u003e end_current_command_batch (1 blocks, avg 0.002 ms)\n[CLVK] 0.12 ms -\u003e flush_no_lock (4 blocks, avg 0.030 ms)\n[CLVK] 5.20 ms -\u003e clFinish (2 blocks, avg 2.602 ms)\n[CLVK] 97.06 ms -\u003e clEnqueueNDRangeKernel (1 blocks, avg 97.063 ms)\n[CLVK] 0.00 ms -\u003e clSetKernelArg (1 blocks, avg 0.002 ms)\n[CLVK] 0.01 ms -\u003e clCreateBuffer (1 blocks, avg 0.012 ms)\n[CLVK] 0.01 ms -\u003e clCreateCommandQueue (1 blocks, avg 0.009 ms)\n[CLVK] 0.19 ms -\u003e clCreateKernel (1 blocks, avg 0.187 ms)\n[CLVK] 237.71 ms -\u003e clBuildProgram (1 blocks, avg 237.713 ms)\n[CLVK] 0.02 ms -\u003e clCreateProgramWithSource (1 blocks, avg 0.016 ms)\n[CLVK] 0.00 ms -\u003e clCreateContext (1 blocks, avg 0.000 ms)\n[CLVK] 0.00 ms -\u003e clGetDeviceInfo (1 blocks, avg 0.001 ms)\n[CLVK] 0.00 ms -\u003e clGetDeviceIDs (1 blocks, avg 0.001 ms)\n[CLVK] 0.00 ms -\u003e clGetPlatformInfo (1 blocks, avg 0.002 ms)\n[CLVK] 0.00 ms -\u003e clGetPlatformIDs (1 blocks, avg 0.000 ms)\n```\n\n## Tuning clvk\n\nclvk can be tuned to improve the performance of specific workloads or on specific platforms. While we try to have the default\nparameters set at their best values for each platform, they can be\nchanged for specific applications. One of the best way to know whether something\ncan be improved is to use traces to understand what should be changed.\n\n### Group size\n\nclvk is grouping commands and waiting for a call to `clFlush` or any\nblocking calls (`clFinish`, `clWaitForEvents`, etc.) to submit those groups for execution.\n\nclvk's default group flushing behaviour can be controlled using the following two variables to flush groups as soon as a given number of commands have been grouped:\n   - `CLVK_MAX_CMD_GROUP_SIZE`\n   - `CLVK_MAX_FIRST_CMD_GROUP_SIZE`\n\n\n### Batch size\n\nclvk relies on vulkan to offload workoad to the GPU. As such, it is better to\nbatch OpenCL commands (translated into vulkan commands) into a vulkan command\nbuffer. But doing that may increase the latency to start running commands.\n\nThe size of those batches can be controlled using the following two variables:\n   - `CLVK_MAX_CMD_BATCH_SIZE`\n   - `CLVK_MAX_FIRST_CMD_BATCH_SIZE`\n\n\n# Configuration\n\nMany aspects of clvk's behaviour can be configured using configuration files\nand/or environment variables. clvk attempts to get its configuration from the\nfollowing sources (in the order documented here). Values obtained from each\nsource take precedence over previously obtained values.\n\n1. System-wide configuration in `/etc/clvk.conf`\n2. Configuration file in `/usr/local/etc/clvk.conf`\n3. Per-user configuration in `~/.config/clvk.conf`\n4. `clvk.conf` in the current directory\n5. An additional configuration file specified using the `CLVK_CONFIG_FILE`\n  environment variable, if provided\n6. Environment variables for individual configuration options\n\nConfiguration files use a key-value format and allow comments beginning with `#`:\n\n```\n# Here's a comment\noption = value\n\nother_option = 42\n```\n\nOptions names are lowercase (e.g `myoption`) in configuration files\nbut uppercase and prefixed with `CLVK_` in environment variables\n(e.g. `CLVK_MYOPTION`).\n\nHere is a list of all the configuration options that clvk supports documented\nusing the name of the corresponding environment variable.\n\n* `CLVK_CONFIG_FILE` specifies the path to an additional configuration file.\n\n* `CLVK_IGNORE_OUT_OF_ORDER_EXECUTION` controls whether out-of-order queues can be\n  created. Out-of-order queues, when allowed, always behave as in-order queues. This can be\n  useful to enable applications that request out-of-order queues but don't use all their features\n  to run.\n\n   * 0: creating an out-of-order queue results in a failure (default)\n   * 1: creating an out-of-order queue is supported but it will function as an in-order queue\n\n* `CLVK_LOG` controls the level of logging\n\n   * 0: only print fatal messages (default)\n   * 1: print errors as well\n   * 2: print warnings as well\n   * 3: print information messages as well\n   * 4: print all debug messages\n\n* `CLVK_LOG_COLOUR` controls colour logging\n\n   * 0: disabled\n   * 1: enabled (default when the output is a terminal)\n\n* `CLVK_LOG_DEST` controls where the logging output goes\n\n   * `stderr`: logging goes to the standard error (default)\n   * `stdout`: logging goes to the standard output\n   * `file:\u003cfname\u003e`: logging goes to `\u003cfname\u003e`. The file will be created if it\n     does not exist and will be truncated.\n\n* `CLVK_LOG_GROUPS` controls what logging groups are enabled. A comma-separated\n  list of group enable/disable requests is accepted. A group is enabled by\n  giving its name and disabled by giving its name with a `-` prefix. A few\n  examples:\n\n   * `api` enables logging of the OpenCL API calls encountered and only that.\n   * `-refcounting` disables logging of object reference counting but keeps all\n     other groups enabled by default.\n\n  All groups are enabled by default. The first group enabled replaces the default.\n\n* `CLVK_CLSPV_PATH` to provide a path to the clspv binary to use\n\n* `CLVK_LLVMSPIRV_BIN` to provide a path to the llvm-spirv binary to use\n\n* `CLVK_ENABLE_SPIRV_IL` to enable support for SPIR-V as an intermediate language\n\n   * 0: disabled\n   * 1: enabled (default)\n\n* `CLVK_VALIDATION_LAYERS` allows to enable Vulkan validation layers\n\n   * 0: disabled (default)\n   * 1: enabled\n\n* `CLVK_CLSPV_OPTIONS` to provide additional options to pass to clspv\n\n* `CLVK_CLSPV_NATIVE_BUILTINS` comma separated list of builtins that will use\n  the native implementation by default\n\n* `CLVK_CLSPV_LIBRARY_BUILTINS` comma separated list of builtins that will be\n  forced to use the libclc implementation\n\n* `CLVK_QUEUE_PROFILING_USE_TIMESTAMP_QUERIES` to use timestamp queries to\n  measure the `CL_PROFILING_COMMAND_{START,END}` profiling infos on devices\n  that do not support `VK_EXT_calibrated_timestamps`.\n\n   * 0: disabled (default)\n   * 1: enabled\n\n  WARNING: the values will not use the same time base as that used for\n  `CL_PROFILING_COMMAND_{QUEUED,SUBMIT}` but this allows to get\n  closer-to-the-execution timestamps.\n\n* `CLVK_SPIRV_VALIDATION` controls SPIR-V validation behaviour.\n\n   * 0: skip validation\n   * 1: warn when validation fails\n   * 2: fail compilation and report an error when validation fails (default)\n\n* `CLVK_SKIP_SPIRV_CAPABILITY_CHECK` to avoid checking whether the Vulkan device\n  supports all of the SPIR-V capabilities declared by each SPIR-V module.\n\n* `CLVK_MAX_BATCH_SIZE` to control the maximum number of commands that can be\n  recorded in a single command buffer.\n\n* `CLVK_KEEP_TEMPORARIES` to keep temporary files created during program build,\n  compilation and link operations.\n\n   * 0: disabled (default)\n   * 1: enabled\n\n* `CLVK_CACHE_DIR` specifies a directory used for caching compiled program data\n  between applications runs. The user is responsible for ensuring that this\n  directory is not used concurrently by more than one application.\n\n* `CLVK_COMPLIER_TEMP_DIR` specifies a directory used to create a temporary\n  folder to store compiled program data used in a single run. This folder shall\n  have write permission (default: current directory).\n\n* `CLVK_MAX_CMD_GROUP_SIZE` specifies the maximum number of commands in a group.\n  When a group reaches this number, it is automatically flushed.\n\n* `CLVK_MAX_FIRST_CMD_GROUP_SIZE` specifies the maximum number of commands in a\n  group when there is no group to be processed or being processed in the queue.\n\n* `CLVK_MAX_CMD_BATCH_SIZE` specifies the maximum number of commands per batch.\n  When this number is reached, the batch will be added to the current group of\n  commands, and a new batch will be created.\n\n* `CLVK_MAX_FIRST_CMD_BATCH_SIZE` specifies the maximum number of commands per\n  batch when there is no batch to be processed or being processed in the queue.\n\n* `CLVK_PERFETTO_TRACE_MAX_SIZE` specifies the maximum size (in kB) of traces\n  generated by Perfetto. It only applies when using Perfetto with the\n  `InProcess` backend.\n\n* `CLVK_PERFETTO_TRACE_DEST` specifies the filename to use for the traces\n  generated by Perfetto (default: `clvk.perfetto-trace`).\n\n* `CLVK_OPENCL_VERSION` specifies the opencl version reported by clvk. The\n  version needs to follow the layout used by `CL_MAKE_VERSION` from the OpenCL\n  Headers:\n\n    * `0x00c00000`: meaning `CL3.0` (default)\n    * `0x00402000`: meaning `CL1.2`\n\n* `CLVK_SUPPORTS_FILTER_LINEAR` specifies whether using samplers with\n  `CL_FILTER_LINEAR` is supported (default: `true`). Note that this is not\n  required for OpenCL conformance on GPU devices and thus can be disabled to pass\n  conformance on devices that do not support linear filtering with all the image formats\n  required for conformance.\n\n* `CLVK_PREFERRED_SUBGROUP_SIZE` specifies the subgroup size to use if nothing\n  is specified in the kernel. When not set use the default value reported by\n  the Vulkan driver.\n\n* `CLVK_FORCE_SUBGROUP_SIZE` specifies the subgroup size to use, overriding\n  everything.\n\n* `CLVK_MAX_COMPUTE_UNITS` specifies the default number of compute units to\n  expose through `CL_DEVICE_MAX_COMPUTE_UNITS` if nothing is set in the device\n  properties (default: `1`).\n\n* `CLVK_QUEUE_GLOBAL_PRIORITY` specifies the queue global priority to use if it\n  is supported by the driver:\n\n  * `0`: `VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR`\n  * `1`: `VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR` (default)\n  * `2`: `VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR`\n  * `3`: `VK_QUEUE_GLOBAL_PRIORITY_REALTIME_KHR`\n\n* `CLVK_MAX_ENTRY_POINTS_INSTANCES` specifies the number of instances of a\n  kernel that can be in flight at the same time. Increasing this value has an\n  impact on the memory usage as it will allocate more descriptor sets per\n  kernel (default: `2048`).\n\n* `CLVK_ENQUEUE_COMMAND_RETRY_SLEEP_US` specifies the time to wait between two\n  attempts to enqueue a command. It is disabled by default, meaning that if an\n  enqueue fails, it returns an error. When specified, it will retry as long as\n  there are groups in flight (commands being processed).\n\n* `CLVK_DESTROY_GLOBAL_STATE` specifies whether global state should be destructed\n  in a global destructor (default: true). Some applications incorrectly use\n  OpenCL API calls in global destructors which is [not guaranteed to work](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#_global_constructors_and_destructors).\n  This option can be used to disable destroying global state which allows these\n  applications to work with the downside of not cleanly terminating clvk. Use\n  with caution.\n\n* `CLVK_DEVICE_EXTENSIONS` specifies extensions to be added to the list of\n  exposed extensions. It expects a comma separated list of extensions.\n\n* `CLVK_DEVICE_EXTENSIONS_MASKED` specifies extensions to be removed from the\n  list of exposed extensions. It expects a comma separated list of extensions.\n\n* `CLVK_BUILD_IN_SEPARATE_THREAD` force to build kernels in a separate thread\n  (default: false). It brings a slight overhead when creating the thread, but\n  can be a work-around when having issues with clang compiling in the\n  application thread.\n\n* `CLVK_INIT_IMAGE_AT_CREATION` force to initialize OpenCL images created with\n  `CL_MEM_COPY_HOST_PTR` or `CL_MEM_USE_HOST_PTR` at creation time instead of\n  initializing them during first use of the image (default: false). It reduces\n  the memory footprint as clvk needs to keep a buffer with the data to\n  initialize at first use.\n\n# Limitations\n\n* Only one device per CL context\n* No support for out-of-order queues\n* No support for device partitioning\n* No support for native kernels\n* All the limitations implied by the use of clspv\n* ... and problably others\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpet%2Fclvk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpet%2Fclvk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpet%2Fclvk/lists"}