You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/user_guide/contributing.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Contributing to quadrants
1
+
# Advanced: Contributing to quadrants
2
2
3
3
## Good practice reminder
4
4
@@ -49,15 +49,15 @@ uv pip install --group dev --group test
49
49
50
50
`build.py` is a python script to automatically set up the build environment for you before invoking the build commands:
51
51
52
-
*`LLVM libraries`: downloads an archive for `LLVM` libraries, decompresses it and sets `LLVM_DIR`.
52
+
*`LLVM libraries`: downloads an archive for [LLVM](https://llvm.org/) libraries (a library for building compilers), decompresses it and sets `LLVM_DIR`.
53
53
*`clang`: depending on the platform, download `clang` or just check if available with the right version.
54
54
55
55
`build.py` can be used at least two ways:
56
56
57
57
*`build.py wheel` to build the wheel (via [scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/), i.e. `pip wheel`)
58
58
*`build.py --shell` to enter a shell with environment variables set up as with `build.py wheel` in order to let you invoke yourself the commands.
59
59
60
-
For incremental development, do an editable install (scikit-build-core "redirect" mode: the compiled core is installed and rebuilt on demand, Python edits are live):
60
+
For incremental development, do an editable install ([scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/) "redirect" mode: the compiled core is installed and rebuilt on demand, Python edits are live):
61
61
62
62
```
63
63
./build.py --shell # run a new shell with environment variables
`build.py`exports both the legacy `QUADRANTS_CMAKE_ARGS`and the`CMAKE_ARGS`that scikit-build-core actually reads, so sourcing `env.sh` (or using `--shell`) is enough -- no manual `export CMAKE_ARGS="$QUADRANTS_CMAKE_ARGS"` step is needed.
75
+
`build.py`reads and exports`CMAKE_ARGS`(scikit-build-core's CMake-args passthrough), so sourcing `env.sh` (or using `--shell`) is enough to make the configured options available to the build.
76
76
77
77
## Building the package for release purposes
78
78
@@ -84,13 +84,13 @@ To build the release package:
84
84
85
85
We use `cmake` to build the C++ core. scikit-build-core puts the CMake build tree under `build/{wheel_tag}`, where the wheel tag encodes the Python version and host platform. For example: `build/cp310-cp310-linux_x86_64`.
86
86
87
-
You can modify the cmake options to your liking in order to enable or disable some features you need or don't need. To discover them, you can use `ccmake`:
87
+
You can modify the cmake options to your liking in order to enable or disable some features you need or don't need. To discover them, you can use [ccmake](https://cmake.org/cmake/help/latest/manual/ccmake.1.html):
88
88
89
89
```
90
90
ccmake build/cp310-cp310-linux_x86_64
91
91
```
92
92
93
-
You could then set the environment variable `CMAKE_ARGS` (scikit-build-core's CMake-args passthrough) to configure the build. `build.py`also accepts the legacy `QUADRANTS_CMAKE_ARGS`and forwards it to `CMAKE_ARGS`. For instance, to disable the CUDA and AMDGPU backends:
93
+
You could then set the environment variable `CMAKE_ARGS` (scikit-build-core's CMake-args passthrough) to configure the build. `build.py`reads it, layers on the toolchain options it manages, and exports it back. For instance, to disable the CUDA and AMDGPU backends:
Quadrants comprises at least three important parts:
122
-
123
-
1.`quadrants` host runtime: Made with a mix of Python and C++. The C++ core is compiled using the OS default C/C++ compiler.
124
-
2.`quadrants` device runtime (bitcode): C++ code compiled using `clang++` from the distribution/OS. Using `clang++` is required as it has to support the same targets as `LLVM`.
125
-
3.`LLVM` libraries used by host runtime: statically or dynamically linked, used to lower the kernel's final IR to machine code on the host. The CI uses an LLVM version compiled from source.
126
-
127
-
### Building LLVM for debugging it
128
-
129
-
Sometimes, it could be useful to have a `LLVM` version that allows to print intermediate passes or with debug symbols to find out where and why LLVM fails (for example, when Instruction Selection fails). To do so you would have to build LLVM by yourself. If so, you should take some inspiration from our [CI pipeline to build LLVM](https://github.com/Genesis-Embodied-AI/quadrants-sdk-builds/blob/main/.github/workflows/llvm-ci.yml) to tweak a little bit to your liking (and not enable/disable options that would create discrepancies).
130
-
131
-
You can then use `LLVM_DIR` to point to the `LLVM` build directory.
132
-
133
117
## CI checks
134
118
135
119
Pull requests are validated by several CI jobs. Most run automatically; a failing check blocks merge.
The `0` in the LoC column for the two new files reflects that both files did not exist before this PR (their pre-PR code-line count is 0). The `42 -42` row for `legacy_stream.cpp` is a fully-deleted file: 42 code lines existed before this PR and all 42 were removed.
228
212
229
213
This check is delayed by 30 minutes, to avoid running repeatedly if multiple commits pushed with a short delay between each.
214
+
215
+
## Advanced
216
+
217
+
### CI Convention about compilers/LLVM
218
+
219
+
Quadrants comprises at least three important parts:
220
+
221
+
1.`quadrants` host runtime: Made with a mix of Python and C++. The C++ core is compiled using the OS default C/C++ compiler.
222
+
2.`quadrants` device runtime (bitcode): C++ code compiled using `clang++` from the distribution/OS. Using `clang++` is required as it has to support the same targets as `LLVM`.
223
+
3.`LLVM` libraries used by host runtime: statically or dynamically linked, used to lower the kernel's final IR to machine code on the host. The CI uses an LLVM version compiled from source.
224
+
225
+
### Building LLVM for debugging it
226
+
227
+
Sometimes, it could be useful to have a `LLVM` version that allows to print intermediate passes or with debug symbols to find out where and why LLVM fails (for example, when Instruction Selection fails). To do so you would have to build LLVM by yourself. If so, you should take some inspiration from our [CI pipeline to build LLVM](https://github.com/Genesis-Embodied-AI/quadrants-sdk-builds/blob/main/.github/workflows/llvm-ci.yml) to tweak a little bit to your liking (and not enable/disable options that would create discrepancies).
228
+
229
+
You can then use `LLVM_DIR` to point to the `LLVM` build directory.
0 commit comments