"tools/vscode:/vscode.git/clone" did not exist on "be4dda7b94d1f5d57efb5ad5f61349dddf66c817"
CONTRIBUTING.md 2.29 KB
Newer Older
xuxzh1's avatar
init  
xuxzh1 committed
1
2
3
# Pull requests (for contributors)

- Test your changes:
xuxzh1's avatar
update  
xuxzh1 committed
4
  - Using the commands in the [`tests`](tests) folder. For instance, running the `./tests/test-backend-ops` command tests different backend implementations of the `ggml` library
xuxzh1's avatar
init  
xuxzh1 committed
5
  - Execute [the full CI locally on your machine](ci/README.md) before publishing
xuxzh1's avatar
update  
xuxzh1 committed
6
7
- Optionally rate the complexity of your PR (i.e. `Review Complexity : Low`, `Review Complexity : Medium`, `Review Complexity : High`). This makes it easier for maintainers to triage the PRs
- Consider allowing write access to your branch for faster reviews, as reviewers can push commits directly
xuxzh1's avatar
init  
xuxzh1 committed
8
9
10
11
12
13
- If your PR becomes stale, don't hesitate to ping the maintainers in the comments

# Pull requests (for collaborators)

- Squash-merge PRs
- Use the following format for the squashed commit title: `<module> : <commit title> (#<issue_number>)`. For example: `utils : fix typo in utils.py (#1234)`
xuxzh1's avatar
update  
xuxzh1 committed
14
- Optionally pick a `<module>` from here: https://github.com/ggerganov/llama.cpp/wiki/Modules
xuxzh1's avatar
init  
xuxzh1 committed
15
16
17
18
19

# Coding guidelines

- Avoid adding third-party dependencies, extra files, extra headers, etc.
- Always consider cross-compatibility with other operating systems and architectures
xuxzh1's avatar
update  
xuxzh1 committed
20
- Avoid fancy-looking modern STL constructs, use basic `for` loops, avoid templates, keep it simple
xuxzh1's avatar
init  
xuxzh1 committed
21
22
23
24
25
26
27
28
- There are no strict rules for the code style, but try to follow the patterns in the code (indentation, spaces, etc.). 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`
- Naming usually optimizes for common prefix (see https://github.com/ggerganov/ggml/pull/302#discussion_r1243240963)
- 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.$

![matmul](media/matmul.png)

xuxzh1's avatar
update  
xuxzh1 committed
29
30
31
32
33
# Resources

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:

https://github.com/ggerganov/llama.cpp/projects