| commit | 0f191dbbc382f09138c989e37a9c0ac17312199b | [log] [tgz] |
|---|---|---|
| author | Wenju He <wenju.he@intel.com> | Wed Nov 05 08:20:29 2025 +0800 |
| committer | Copybara-Service <copybara-worker@google.com> | Tue Nov 04 16:25:41 2025 -0800 |
| tree | 757d9597f5d8471c4ecf82da4bb597d01aab58e4 | |
| parent | 70bc1d25fa9e7fcfa0165ee5d7d5530c6c142472 [diff] |
[NFC][libclc] Rename clc_cbrt.inc to clc_cbrt.h (#166330) __clc_cbrt functions are declared in clc_cbrt.inc. Rename to .h for consistency with other headers. GitOrigin-RevId: 8648beff758db89e2eb816bd01d9b3c37e6aa3f9
libclc is an open source implementation of the library requirements of the OpenCL C programming language, as specified by the OpenCL 1.1 Specification. The following sections of the specification impose library requirements:
libclc is intended to be used with the Clang compiler's OpenCL frontend.
libclc is designed to be portable and extensible. To this end, it provides generic implementations of most library requirements, allowing the target to override the generic implementation at the granularity of individual functions.
libclc currently supports PTX, AMDGPU, SPIRV and CLSPV targets, but support for more targets is welcome.
(in the following instructions you can use make or ninja)
For an in-tree build, Clang must also be built at the same time:
$ cmake <path-to>/llvm-project/llvm/CMakeLists.txt -DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="libclc" -DCMAKE_BUILD_TYPE=Release -G Ninja
$ ninja
Then install:
$ ninja install
Note you can use the DESTDIR Makefile variable to do staged installs.
$ DESTDIR=/path/for/staged/install ninja install
To build out of tree, or in other words, against an existing LLVM build or install:
$ cmake <path-to>/llvm-project/libclc/CMakeLists.txt -DCMAKE_BUILD_TYPE=Release \ -G Ninja -DLLVM_DIR=$(<path-to>/llvm-config --cmakedir) $ ninja
Then install as before.
In both cases this will include all supported targets. You can choose which targets are enabled by passing -DLIBCLC_TARGETS_TO_BUILD to CMake. The default is all.
In both cases, the LLVM used must include the targets you want libclc support for (AMDGPU and NVPTX are enabled in LLVM by default). Apart from SPIRV where you do not need an LLVM target but you do need the llvm-spirv tool available. Either build this in-tree, or place it in the directory pointed to by LLVM_TOOLS_BINARY_DIR.