@@ -23,29 +23,46 @@ generic implementations of most library requirements, allowing the target
23
23
to override the generic implementation at the granularity of individual
24
24
functions.
25
25
26
- libclc currently only supports the PTX target, but support for more
27
- targets is welcome.
26
+ libclc currently supports PTX, AMDGPU, SPIRV and CLSPV targets, but support for
27
+ more targets is welcome.
28
28
29
- Compiling and installing with Make
30
- ----------------------------------
29
+ Compiling and installing
30
+ ------------------------
31
31
32
- $ ./configure.py --with-llvm-config=/path/to/llvm-config && make
33
- $ make install
32
+ (in the following instructions you can use make or ninja)
34
33
35
- Note you can use the DESTDIR Makefile variable to do staged installs.
34
+ For an in-tree build, Clang must also be built at the same time:
36
35
37
- $ make install DESTDIR=/path/for/staged/install
36
+ $ cmake <path-to>/llvm-project/llvm/CMakeLists.txt -DLLVM_ENABLE_PROJECTS="libclc;clang" \
37
+ -DCMAKE_BUILD_TYPE=Release -G Ninja
38
+ $ ninja
38
39
39
- Compiling and installing with Ninja
40
- -----------------------------------
40
+ Then install:
41
41
42
- $ ./configure.py -g ninja --with-llvm-config=/path/to/llvm-config && ninja
43
42
$ ninja install
44
43
45
- Note you can use the DESTDIR environment variable to do staged installs.
44
+ Note you can use the DESTDIR Makefile variable to do staged installs.
46
45
47
46
$ DESTDIR=/path/for/staged/install ninja install
48
47
48
+ To build out of tree, or in other words, against an existing LLVM build or install:
49
+
50
+ $ cmake <path-to>/llvm-project/libclc/CMakeLists.txt -DCMAKE_BUILD_TYPE=Release \
51
+ -G Ninja -DLLVM_DIR=$(<path-to>/llvm-config --cmakedir)
52
+ $ ninja
53
+
54
+ Then install as before.
55
+
56
+ In both cases this will include all supported targets. You can choose which
57
+ targets are enabled by passing `-DLIBCLC_TARGETS_TO_BUILD` to CMake. The default
58
+ is "all".
59
+
60
+ In both cases, the LLVM used must include the targets you want libclc support for
61
+ (AMDGPU and NVPTX are enabled in LLVM by default). Apart from SPIRV where you do
62
+ not need an LLVM target but you do need the llvm-spirv tool
63
+ (https://github.com/KhronosGroup/SPIRV-LLVM-Translator) available. Either build
64
+ this in-tree, or place it in the directory pointed to by `LLVM_TOOLS_BINARY_DIR`.
65
+
49
66
Website
50
67
-------
51
68
0 commit comments