Repository navigation
Commit 1eb67a0
committed
GPU Metal: optionally limit the GPU work in flight
At 20 kHz occupancy the macOS GPU watchdog killed command buffers, and
reset the desktop once, while all 8 streams ran multi-kernel buffers of
up to ~1 s at the same time. Host-serialised execution (serializeGPU 3)
was the only mode that survived. Add two runtime limits, off by default:
- GPUCA_METAL_MAX_KERNELS_PER_BUFFER=N commits a stream's command buffer
after N kernels, so that long chains (sector tracking, SectorRefit,
TrackFit) become short buffers. Buffers of a stream stay ordered by its
order event, the events of the other streams are untouched.
- GPUCA_METAL_MAX_STREAMS_IN_FLIGHT=M makes the host wait, before it
commits a buffer on an idle stream, until fewer than M streams have
committed buffers that are not complete. This cannot deadlock: a buffer
only waits for events signalled by buffers committed before it, since
RecordMarker commits the signal at once, so the work in flight completes
without the host.
pbpb30, M1 Max, 6 rounds of 10 events (timeline: longest buffer, streams
running at once): default unchanged (931 ms/ev, -3 ms over two run orders);
N=1 M=1 1416 ms/ev, 87 ms, 1 stream (serializeGPU 3: 1413 ms/ev);
N=1 M=2 1100 ms/ev, 87 ms, 2; N=2 M=4 941 ms/ev, 123 ms, 4. The longest
buffers left hold the TrackFit kernel (~85 ms alone). Metal dumps byte-identical on
pbpb30 with and without the limits, sim5pp identical to the CPU.1 parent 0cedf04 commit 1eb67a0
3 files changed
Lines changed: 42 additions & 0 deletions
File tree
- GPU/GPUTracking/Base/metal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
251 | 253 | | |
252 | 254 | | |
253 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| |||
406 | 411 | | |
407 | 412 | | |
408 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
409 | 417 | | |
410 | 418 | | |
411 | 419 | | |
| |||
424 | 432 | | |
425 | 433 | | |
426 | 434 | | |
| 435 | + | |
427 | 436 | | |
428 | 437 | | |
429 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
79 | 91 | | |
80 | 92 | | |
81 | 93 | | |
| |||
111 | 123 | | |
112 | 124 | | |
113 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
114 | 145 | | |
115 | 146 | | |
116 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
0 commit comments