Skip to content

[libclc] Update build instructions in readme #111369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions libclc/README.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,46 @@ generic implementations of most library requirements, allowing the target
to override the generic implementation at the granularity of individual
functions.

libclc currently only supports the PTX target, but support for more
targets is welcome.
libclc currently supports PTX, AMDGPU, SPIRV and CLSPV targets, but support for
more targets is welcome.

Compiling and installing with Make
----------------------------------
Compiling and installing
------------------------

$ ./configure.py --with-llvm-config=/path/to/llvm-config && make
$ make install
(in the following instructions you can use make or ninja)

Note you can use the DESTDIR Makefile variable to do staged installs.
For an in-tree build, Clang must also be built at the same time:

$ make install DESTDIR=/path/for/staged/install
$ cmake <path-to>/llvm-project/llvm/CMakeLists.txt -DLLVM_ENABLE_PROJECTS="libclc;clang" \
-DCMAKE_BUILD_TYPE=Release -G Ninja
$ ninja

Compiling and installing with Ninja
-----------------------------------
Then install:

$ ./configure.py -g ninja --with-llvm-config=/path/to/llvm-config && ninja
$ ninja install

Note you can use the DESTDIR environment variable to do staged installs.
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
(https://github.com/KhronosGroup/SPIRV-LLVM-Translator) available. Either build
this in-tree, or place it in the directory pointed to by `LLVM_TOOLS_BINARY_DIR`.

Website
-------

Expand Down
Loading