Skip to content

Commit 6649a10

Browse files
docs: Mention CUDA gotchas and requirements in README (#441)
1 parent 2efb686 commit 6649a10

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# scip-clang: SCIP indexer for C and C++ ![(Status: Beta)](https://img.shields.io/badge/status-beta-yellow?style=flat)
22

33
scip-clang is a precise code indexer based on Clang 16,
4-
which supports cross-repository code navigation for C and C++
4+
which supports cross-repository code navigation for C, C++ and CUDA
55
in Sourcegraph.
66

77
Here are some code navigation examples:
@@ -11,6 +11,7 @@ Here are some code navigation examples:
1111
- [Find references for #include](https://sourcegraph.com/github.com/llvm/llvm-project@97a03eb2eb5acf269db6253fe540626b52950f97/-/blob/llvm/include/llvm/ADT/SmallSet.h?L1:1-1:81#tab=references)
1212
- [Find references for macros](https://sourcegraph.com/github.com/llvm/llvm-project@daad48d6b236d74c6b29daebba46289b98104241/-/blob/llvm/include/llvm/Support/Debug.h?L101:9-101:19#tab=references)
1313
- [Find references for types](https://sourcegraph.com/github.com/llvm/llvm-project@daad48d6b236d74c6b29daebba46289b98104241/-/blob/clang/include/clang/AST/ASTContext.h?L1472:34-1472:45#tab=references)
14+
- [Find references for a CUDA kernel in apache/mxnet](https://sourcegraph.com/github.com/apache/mxnet@b84609d/-/blob/src/operator/nn/softmax-inl.h?L693:7-693:28#tab=references)
1415

1516
<picture>
1617
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/sourcegraph/scip-clang/assets/93103176/08b3aa95-c3ee-4c56-9920-20dfa4a7070d">
@@ -52,6 +53,19 @@ compatibility should be as good as Clang's compatibility
5253
(i.e. most features should work, with graceful degradation
5354
for features that don't).
5455

56+
<details>
57+
<summary>Extra requirements for indexing CUDA</summary>
58+
59+
When indexing CUDA code, an installation of Clang is required
60+
(using your OS package manager or otherwise),
61+
and the `clang` executable must be available on `PATH`,
62+
so that Clang's CUDA-related headers can be found.
63+
We recommend Clang 16 or newer, but in our testing, headers
64+
from Clang 14 also work.
65+
66+
The CUDA SDK must also be installed.
67+
</details>
68+
5569
scip-clang currently supports indexing using a
5670
[JSON compilation database][].
5771
CMake, Bazel and Meson support emitting this format
@@ -183,6 +197,23 @@ scip-clang --compdb-path=build/small_compdb.json --show-compiler-diagnostics
183197
> If you only want to index a subdirectory, filter out unnecessary
184198
> entries in the compilation database.
185199
200+
<details>
201+
<summary>Known diagnostics when indexing CUDA</summary>
202+
203+
1. If you see an error related to the `texture` template, that is likely
204+
because of the Clang version not being Clang 16 or newer.
205+
See https://github.com/llvm/llvm-project/issues/61340
206+
2. If you see any errors related to GCC headers, that's a
207+
[known issue](https://github.com/sourcegraph/scip-clang/issues/440).
208+
It shouldn't affect indexer correctness.
209+
3. If you see an error related to an unknown flag,
210+
you can generally ignore it.
211+
scip-clang [skips all known NVCC-specific flags](https://sourcegraph.com/github.com/sourcegraph/scip-clang@2efb686d14e92c587e10d452a168d32ccdbb6032/-/blob/indexer/CompilationDatabase.cc?L244-352)
212+
as they generally don't affect the semantics of code navigation.
213+
We can easily add more flags to skip here if needed.
214+
215+
</details>
216+
186217
If there are errors about missing system or SDK headers,
187218
install the relevant system dependencies.
188219

0 commit comments

Comments
 (0)