Skip to content

Commit 95d87cb

Browse files
committed
contrib : expand [no ci]
1 parent b6f9640 commit 95d87cb

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

CONTRIBUTING.md

+26-9
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,25 @@
2424
- Clean-up any trailing whitespaces, use 4 spaces for indentation, brackets on the same line, `void * ptr`, `int & a`
2525
- Use sized integer types in the public API
2626
- Declare structs with `struct foo {}` instead of `typedef struct foo {} foo`
27-
- In C++ code omit the `struct` keyword whenever it is not necessary
27+
- In C++ code omit optional `struct` and `enum` keyword whenever they are not necessary
28+
```cpp
29+
// OK
30+
llama_context * ctx;
31+
const llama_rope_type rope_type;
32+
33+
// not OK
34+
struct llama_context * ctx;
35+
const enum llama_rope_type rope_type;
36+
```
2837
> [!NOTE]
2938
> This guideline is yet to be applied to the `llama.cpp` codebase. New code should follow this guideline.
3039
- Try to follow the existing patterns in the code (indentation, spaces, etc.). In case of doubt use `clang-format` to format the added code
40+
- For anything not covered in the current guidelines, refer to the [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)
3141
- Tensors store data in row-major order. We refer to dimension 0 as columns, 1 as rows, 2 as matrices
3242
- Matrix multiplication is unconventional: [`C = ggml_mul_mat(ctx, A, B)`](https://github.com/ggerganov/llama.cpp/blob/880e352277fc017df4d5794f0c21c44e1eae2b84/ggml.h#L1058-L1064) means $C^T = A B^T \Leftrightarrow C = B A^T.$
3343
3444
![matmul](media/matmul.png)
3545
36-
- Preprocessor directives
37-
- (TODO: add guidelines with examples and apply them to the codebase)
38-
39-
```cpp
40-
#ifdef FOO
41-
#endif // FOO
42-
```
43-
4446
# Naming guidelines
4547
4648
- Use `snake_case` for function, variable and type names
@@ -98,6 +100,21 @@
98100
99101
- (TODO: abbreviations usage)
100102
103+
# Preprocessor directives
104+
105+
- (TODO: add guidelines with examples and apply them to the codebase)
106+
107+
```cpp
108+
#ifdef FOO
109+
#endif // FOO
110+
```
111+
112+
# Documentation
113+
114+
- Documentation is a community effort
115+
- When you need to look into the source code to figure out implementation details to figure out how to use an API consider adding a short summary to the header file for future reference
116+
- When you notice incorrect or outdated documentation, please update it
117+
101118
# Resources
102119
103120
The Github issues, PRs and discussions contain a lot of information that can be useful to get familiar with the codebase. For convenience, some of the more important information is referenced from Github projects:

0 commit comments

Comments
 (0)