contrib : add TODO for preprocessor directives [no ci]
This commit is contained in:
parent
31a44094ad
commit
b6f9640157
1 changed files with 10 additions and 2 deletions
|
@ -23,16 +23,24 @@
|
||||||
- Vertical alignment makes things more readable and easier to batch edit
|
- Vertical alignment makes things more readable and easier to batch edit
|
||||||
- Clean-up any trailing whitespaces, use 4 spaces for indentation, brackets on the same line, `void * ptr`, `int & a`
|
- Clean-up any trailing whitespaces, use 4 spaces for indentation, brackets on the same line, `void * ptr`, `int & a`
|
||||||
- Use sized integer types in the public API
|
- Use sized integer types in the public API
|
||||||
- Declare structs with `struct x {}` instead of `typedef struct x {} x`
|
- Declare structs with `struct foo {}` instead of `typedef struct foo {} foo`
|
||||||
- In C++ code omit the `struct` keyword whenever it is not necessary
|
- In C++ code omit the `struct` keyword whenever it is not necessary
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> This guideline is yet to be applied to the `llama.cpp` codebase. New code should follow this guideline.
|
> This guideline is yet to be applied to the `llama.cpp` codebase. New code should follow this guideline.
|
||||||
|
- Try to follow the existing patterns in the code (indentation, spaces, etc.). In case of doubt use `clang-format` to format the added code
|
||||||
- Tensors store data in row-major order. We refer to dimension 0 as columns, 1 as rows, 2 as matrices
|
- Tensors store data in row-major order. We refer to dimension 0 as columns, 1 as rows, 2 as matrices
|
||||||
- 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.$
|
- 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.$
|
||||||
- Try to follow the existing patterns in the code (indentation, spaces, etc.). In case of doubt use `clang-format` to format the added code
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
- Preprocessor directives
|
||||||
|
- (TODO: add guidelines with examples and apply them to the codebase)
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#ifdef FOO
|
||||||
|
#endif // FOO
|
||||||
|
```
|
||||||
|
|
||||||
# Naming guidelines
|
# Naming guidelines
|
||||||
|
|
||||||
- Use `snake_case` for function, variable and type names
|
- Use `snake_case` for function, variable and type names
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue