Repository navigation
Commit a37c1c3
committed
MVS: Reuse sampled current costs (GPU perf)
## Summary
Reuse exact current-source costs already loaded by the probability pass
instead of loading them again during the ordered candidate fold.
- 1536 px: 24.222 -> 23.720 s, 2.1% lower wall time (N=2 per version).
- 3072 px: 89.252 -> 88.051 s, 1.3% lower wall time (N=2 per version).
- All 44 depth/normal maps remain byte-identical in every call.
- All 29 GPU tests pass; focused memory, synchronization and race checks pass.
## Measurements
Incremental base: 1344b32, including
automatic reference pairing and bulk float-map writes.
Fountain P11: 11 images, originally 3072x2048 px; tested at 1536x1024
and 3072x2048. Complete default photometric + geometric PatchMatch
pipeline, 12 CPU input workers and one CUDA worker. Fresh outputs,
tiny default-path prefix then ABBA, N=2 per version at each resolution.
Ryzen 9 3900X / RTX 3080 Ti, GCC 12.4 / CUDA 13.2, WSL2, sm_86.
Arithmetic means; memory columns are maximum observed per arm:
| Resolution | Wall (s) | CPU (s) | Instructions (G) | Peak RSS (MiB) | GPU peak (MiB) |
| --- | --- | --- | --- | --- | --- |
| 1536 | 24.222 -> 23.720 | 25.789 -> 25.265 | 99.344 -> 96.990 | 1200.4 -> 1182.0 | 2697.4 -> 2701.4 |
| 3072 | 89.252 -> 88.051 | 98.582 -> 96.561 | 378.469 -> 367.217 | 2339.4 -> 2338.5 | 3327.4 -> 3357.4 |
Wall ranges are 24.196-24.248 / 23.694-23.747 s at 1536 and
88.873-89.632 / 88.028-88.075 s at 3072. User cycles fall
94.721 -> 92.566 G / 358.127 -> 346.591 G; cache misses remain roughly
flat, 86.681 -> 86.838 M / 163.882 -> 163.872 M. Eight same-pass CPU
counters report 100% running fractions. perf attaches to the native PID
with inheritance; startup gaps and full thread coverage are not proved.
CPU includes driver/wait work. GPU memory is a one-second whole-device
sample peak, not process allocation accounting; no memory-saving claim.
Clocks use dynamic boost, so the small N2 gains describe these matched runs.
A separate first-3072-photo-Sweep diagnostic records 14.951 -> 15.182 G
executed warp instructions (+1.5%): the shared cache adds bookkeeping while
avoiding repeated global reads. Both kernels retain 80 registers and exact
mutable state. Profiler timings are excluded from the wall-time figures.
## Changes and validation
The cooperative eight-column CUDA tile retains up to 16 source costs in
512 bytes of shared memory per block. Existing barriers publish/reuse it;
larger source IDs keep the original global load. Arithmetic, draw order,
RNG, defaults and noncooperative/HIP paths remain unchanged. The compiled
default photo/geometric kernels retain 80 registers, zero spills and six
resident blocks per SM; the 1536 controller still admits five reference
pairs per phase in both versions.
One CUDA unit and the GPU test unit rebuilt incrementally, with no configure
or dependency changes. Both unchanged and patched kernels pass all 29 tests
without skips. The new fixture compares identical-source geometry at 9 and
33 source layers, covering the shared cache and global fallback. Focused
Compute Sanitizer memcheck and synccheck report zero errors on both boundary
tests; racecheck reports zero hazards on the new 9/33-source fixture. Initial
racecheck attempts exhausted a 150-second cap; the completed focused rerun
used a 225-second cap. Every full11 call has 44
finite, correctly sized, byte-identical maps; the tiny full11 gate also passes.
Both changed files pass clang-format 23.1.3 and git diff --check.
HIP, other GPU architectures, a new full C++/Python suite and new ground-truth
or rendered-quality comparisons were not tested. Exact map equality is the
quality evidence here. The earlier parallel result-fold prototype was flat
and is excluded; this patch only reuses already loaded current costs.
AI assistance disclosure: totally vibe coded. AI tools assisted investigation,
implementation and review; reported checks cover the final production change.1 parent 5c05c49 commit a37c1c3
2 files changed
Lines changed: 63 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1078 | 1086 | | |
1079 | 1087 | | |
1080 | 1088 | | |
| |||
1311 | 1319 | | |
1312 | 1320 | | |
1313 | 1321 | | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1314 | 1329 | | |
1315 | 1330 | | |
1316 | 1331 | | |
| |||
1562 | 1577 | | |
1563 | 1578 | | |
1564 | 1579 | | |
1565 | | - | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
1566 | 1590 | | |
1567 | 1591 | | |
1568 | 1592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
599 | 637 | | |
600 | 638 | | |
601 | 639 | | |
| |||
0 commit comments