upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorshayder <darknessshayder@gmail.com>2026-11-22 18:32:52 -0600
committerGitHub <noreply@github.com>2026-11-22 18:32:52 -0600
commit79e7cc5efd7239fb84f31e32c389a0e721f0d09d (patch)
tree20cc8c18641dec460576a6bbe0edba58ce0626bb /docs
parentaa2988cc555bad7ecd508b48a702adbb32fe7c95 (diff)
parent1c604af1a0a9649ae2eef19156a7c0627c676318 (diff)
Merge pull request #4278 from radv-tinker/pr/pipeline-check-memory-budget
vk_pipeline_check: large modules share a memory budget instead of compiling alone
Diffstat (limited to 'docs')
-rw-r--r--docs/pipeline_check.md37
1 files changed, 30 insertions, 7 deletions
diff --git a/docs/pipeline_check.md b/docs/pipeline_check.md
index 856d675d4..6405630c7 100644
--- a/docs/pipeline_check.md
+++ b/docs/pipeline_check.md
@@ -122,13 +122,36 @@ acceptance only.
122 122
123## Limiting concurrent compilation of large modules 123## Limiting concurrent compilation of large modules
124 124
125By default, a SPIR-V module larger than 4 MiB compiles alone. Smaller modules continue to use 125A SPIR-V module larger than 4 MiB is "large". [#884](https://github.com/ItsNotRexed/Leonida/issues/884)
126`--jobs`. The gate covers module creation and both compute and graphics pipelines. The size 126showed why that matters: several compiles that each needed gigabytes of host RAM ran at the same time. Large
127cutoff is a heuristic for [#884](https://github.com/ItsNotRexed/Leonida/issues/884), where several 127modules now share a memory budget (`runtime/test/large_module_gate.h`): each one reserves 512 bytes of RAM per
128compiles that each needed gigabytes of host RAM ran at the same time. The pipeline cache still 128SPIR-V byte, and they enter the driver while their reservations fit three quarters of the memory available when
129checkpoints during the run, and isolated modules count towards the regular results. 129the run starts, up to `--jobs` of them. One large module always gets in when none is compiling, so a module
130 130bigger than the whole budget still compiles, alone among the large ones. Small modules are never held back. On
131`--large-module-bytes N` changes the cutoff in bytes. Set it to `0` to disable isolation. 131Linux the budget is the smaller of `MemAvailable` and the room under the cgroup v2 `memory.max` of the process and
132every cgroup above it (a container, or `systemd-run -p MemoryMax=...`); on Windows it is `ullAvailPhys`. Where
133neither can be read, every large module compiles alone, as before. After each large module, glibc builds call
134`malloc_trim(0)`: the driver's compiler frees its memory into the arena of the thread it ran on, and glibc kept it
135there.
136
137Measured on an RX 9070 XT (RADV GFX1201, Mesa 25.3.6, Mesa shader cache off), on 40 consecutive translated
138compute modules of which 27 are over 4 MiB:
139
140| Large modules | Threads | Wall time | Peak RAM |
141|---|---|---|---|
142| one at a time (`--large-parallel 1`, the old default) | 6 | 297 s | 7.1 GB |
143| memory budget (default) | 6 | 83 s | 8.3 GB |
144| memory budget (default) | 12 | 56 s | 15.1 GB |
145
146One 5.7 MB ray-tracing compute module alone: 12.4 s and 1.96 GB peak (about 330 bytes per SPIR-V byte, hence the
147512 estimate); a 0.36 MB one: 0.13 s and 94 MB. The process grew past one module's peak even one at a time because
148of the arenas (16 modules, 6 threads: 6.2 GB; with `MALLOC_ARENA_MAX=1`: 2.1 GB).
149
150- `--large-module-bytes N` changes the cutoff in bytes. `0` disables the gate.
151- `--large-parallel N` caps how many large modules compile at once: `0` (default) by the budget, `1` alone with
152 the other threads waiting (the behaviour before), `N` at most N without a budget.
153- `--inflight-file` names every module in flight when a large one enters or leaves the driver, so with several
154 large modules in flight it names all of them; the `pipelines` stage of `make_game.py` checks each alone.
132 155
133## Skipping huge modules 156## Skipping huge modules
134 157