13 KiB
Descriptor lookup cost (vk_descriptor_bench)
Synthetic Vulkan compute timings for the eight-probe descriptor hash table (docs/d3d12_vulkan.md §5.1), measured across four GPUs: Apple M3 Max, NVIDIA RTX 4070 SUPER (Ada), NVIDIA RTX 3070 (Ampere) and Intel UHD Graphics 770 (Xe-LP).
Shared benchmark method
- Workload: 4,096 workgroups of 64 lanes, 64 iterations per lane (16,777,216 logical lane lookups per single-key
dispatch; 33,554,432 per paired T#+S# dispatch, counting texture and sampler separately). Tables hold 90% T# texture
keys and 10% S# sampler keys at 1,000 / 10,000 / 100,000 live entries. For post-
bc8e604cfruns (Ada, Ampere, Intel), capacities were4,096 / 65,536 / 524,288slots (163,844 / 2,621,444 / 20,971,524bytes =0.156 / 2.50 / 20.0 MiB;24.4% / 15.3% / 19.1%load). The M3 Max run (f165a13, before bounded slot relocationbc8e604cf) allocated ~0.156 / 2.50 / 80.0 MiB(2,097,152slots /83,886,084bytes /4.77%load at 100,000). - Query schedule: At 100,000 entries, ordinary uniform hits covered all 90,000 textures or all 10,000 samplers
(one shared key per workgroup per iteration), while the hot-key control (
uniform_hot_tsharp) reused one texture. Divergent misses exhausted the eight-probe search across 1,024 / 16,384 / 131,072 distinct absent keys. Cache residency and memory traffic were unmeasured. - Timing & round order (Apple, Ada, Ampere): Each cell is the median of 12 process medians, each from 25 timed
dispatches after 5 warmups across the 11 scenarios in fixed order (Vulkan timestamps around one dispatch, 64 valid
bits, 1 ns tick period, validation layers off). Letting A, B, C denote 1k, 10k, 100k, rounds 1–6 ran ABC, CBA, BAC,
CAB, ACB, BCA starting with
device,host,device,device,host,hostrespectively; rounds 7–12 reversed the order and swapped the starting memory type (withrebarthird in every round on Ada and Ampere). - Windows TDR guard (Ada, Ampere): Kept the default
--max-dispatch-ms 120guard. Before each scenario, a 64-group, 4-iteration probe estimates full dispatch time; if it exceeds 120 ms, iterations are scaled to aim at 60 ms with 9 timed dispatches after 2 warmups. Shortened cells are marked*. - Replaying older runs: The Apple, Ada and Intel runs predate
--warmup-ms(TEST-277, default 300 ms); only the Ampere run (5d74c27) used--warmup-ms 300. With a current build, add--warmup-ms 0to match those runs as measured.
Apple M3 Max
Divergent misses showed the largest change with table size: on GPU-only memory, one million logical lane lookups took
49 µs at 1,000 live descriptors, 156 µs at 10,000 and 479 µs at 100,000; divergent texture hits took 65, 68 and 74 µs.
Measured on one 40-core M3 Max on AC power (macOS 27.3, MoltenVK 1.4.0, 32-lane subgroups, commit f165a13, old
D3D-56 PR #639).
Each cell is gross GPU time in µs per million logical lane lookups (including key reads and result accumulation):
| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss |
|---|---|---|---|---|---|---|
| 1,000 | GPU-only | 20.8 | 23.2 | 65.0 | 64.0 | 49.3 |
| 1,000 | Host-visible | 20.8 | 23.2 | 65.1 | 64.0 | 49.3 |
| 10,000 | GPU-only | 21.3 | 20.8 | 67.6 | 67.4 | 155.9 |
| 10,000 | Host-visible | 21.3 | 20.8 | 67.7 | 67.4 | 155.8 |
| 100,000 | GPU-only | 20.8 | 20.5 | 73.9 | 74.7 | 479.3 |
| 100,000 | Host-visible | 20.9 | 20.5 | 73.8 | 74.7 | 482.7 |
- At 100,000 entries on type 0, a divergent T# dispatch took 1.24 ms and a T#+S# dispatch took 2.51 ms.
- Both Vulkan memory types share the 128 GiB unified heap: type 0 is
DEVICE_LOCAL; type 1 isDEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT | HOST_CACHED. At 100,000 entries, the 12 round medians for divergent misses ranged from 467–525 µs/M on type 0 and 471–505 on type 1. - Across both memory types and three sizes: 19,800 timed dispatches; a pre-timing dispatch verified 5,042 of 262,144 lane accumulators against the CPU oracle for each case.
Replay on macOS (Vulkan headers, CMake, Ninja, MoltenVK; ran without the TDR guard):
cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build runtime/build --target vk_descriptor_bench
runtime/build/vk_descriptor_bench --self-test
runtime/build/vk_descriptor_bench --list-devices
for memory in device host; do
runtime/build/vk_descriptor_bench --device 0 --memory "$memory" --sizes 1000,10000,100000 \
--groups 4096 --iters 64 --warmup 5 --reps 25 --max-dispatch-ms 0
done
NVIDIA RTX 4070 SUPER (Ada)
On GPU-only VRAM, divergent misses took 150 µs at 1,000 entries, 657 µs at 10,000 and 998 µs at 100,000; divergent
texture hits took 39.7, 75.0 and 119.0 µs. ReBAR (DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT) stayed within 0.5% of
GPU-only in every cell. Non-VRAM host-visible memory was within 8% at 1,000 entries, and at 100,000 was 2.5× slower
for divergent misses and 6.0× slower for uniform texture hits. Measured on Windows 11 with NVIDIA driver 621.01
(commit dcd8ecf).
Each cell is gross GPU time in µs per million logical lane lookups:
| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss |
|---|---|---|---|---|---|---|
| 1,000 | GPU-only | 8.6 | 8.3 | 39.7 | 40.3 | 150.0 |
| 1,000 | Host-visible | 9.2 | 9.0 | 39.9 | 40.4 | 150.6 |
| 1,000 | ReBAR | 8.6 | 8.3 | 39.6 | 40.3 | 149.9 |
| 10,000 | GPU-only | 8.7 | 8.5 | 75.0 | 89.4 | 657.4 |
| 10,000 | Host-visible | 11.5 | 10.1 | 90.0 | 106.3 | 886.8* |
| 10,000 | ReBAR | 8.7 | 8.5 | 75.2 | 89.3 | 658.8 |
| 100,000 | GPU-only | 9.1 | 9.1 | 119.0 | 167.1 | 998.4 |
| 100,000 | Host-visible | 54.4 | 13.9 | 172.4 | 236.6* | 2,460.9* |
| 100,000 | ReBAR | 9.1 | 9.1 | 119.3 | 166.8 | 1,002.1 |
* Shortened by --max-dispatch-ms 120 in 11 or 12 of 12 rounds: 10k divergent_miss ran 17–20 iterations (11
rounds), 100k divergent_miss 13–15 (12 rounds), 100k T#+S# pairs 25–31 (11 rounds); shortened medians 0.49–9.84 ms.
- At 100,000 entries on type 1, a divergent T# dispatch took 2.00 ms and a T#+S# dispatch took 5.61 ms. The hot-key control measured 7.2 µs/M on all three memory types and sizes.
- Memory types: GPU-only = type 1 (
DEVICE_LOCAL, heap 0, 11,997 MiB); Host-visible = type 2 (HOST_VISIBLE | HOST_COHERENT, non-cached, heap 1, 16,243 MiB); ReBAR = type 4 (DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT, heap 0, 16,384 MiB BAR1). - At 100,000 entries, the 12 GPU-only/ReBAR round medians split into two clusters: the four rounds starting with 10k (rounds 3, 6, 7, 10) measured 293–299 µs/M (divergent miss) and 59.6–60.2 (divergent T# hit), while the other eight measured 992–1,015 and 118.7–142.9 (cause unmeasured; table follows the eight). Host-visible divergent misses ranged 1,870–2,810 µs/M; at 1k/10k, round spread was ≤10% on GPU-only/ReBAR and ≤37% on host-visible.
- 36 processes, 28,948 timed dispatches, all 1,188 rows
timing_statusok. - System: GeForce RTX 4070 SUPER 12,282 MiB (
0x10de:0x2783, subsys0x89521043), PCIe 4.0 x16, ReBAR On (16,384 MiB BAR1), subgroup size 32, NVIDIA 621.01 (Vulkan 1.4.357), Windows 11 Home 25H2 (26200.9974), Vulkan SDK 1.4.363.1, VS 2022 Build ToolsRelWithDebInfo.
Replay on Windows:
powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1
runtime\build\vk_descriptor_bench.exe --list-devices
runtime\build\vk_descriptor_bench.exe --self-test
foreach ($memory in 'device', 'host', 'rebar') {
runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 `
--groups 4096 --iters 64 --warmup 5 --reps 25 --csv
}
NVIDIA RTX 3070 (Ampere, ReBAR off)
On this PCIe 3.0 x16 Ampere card with Resizable BAR disabled, host-visible system RAM hit a steep cliff at 100,000
entries: 5.0× slower for uniform T# hits, 14.2× for divergent T# hits, 21.9× for divergent T#+S# pairs and 22.6× for
divergent misses (compared to 1.45×–2.5× on the Ada PCIe 4.0 + ReBAR card). The 214 MiB BAR1 memory type
(DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT, exposed even with ReBAR off) stayed within 0.5% of GPU-only in every
cell. Measured on an idle Windows 11 desktop with NVIDIA driver 621.24 (commit 5d74c27, with --warmup-ms 300).
Each cell is gross GPU time in µs per million logical lane lookups:
| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss |
|---|---|---|---|---|---|---|
| 1,000 | GPU-only | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 |
| 1,000 | Host-visible | 16.5 | 16.4 | 71.3 | 69.9 | 267.6 |
| 1,000 | BAR1 (host_device_local) |
15.0 | 15.1 | 73.0 | 68.2 | 270.3 |
| 10,000 | GPU-only | 15.5 | 15.0 | 94.3 | 115.9 | 773.3 |
| 10,000 | Host-visible | 16.8 | 17.0 | 104.4 | 134.4 | 880.7* |
| 10,000 | BAR1 (host_device_local) |
15.5 | 15.0 | 94.4 | 115.4 | 771.7 |
| 100,000 | GPU-only | 21.7 | 15.7 | 231.9 | 216.6 | 2,502.6 |
| 100,000 | Host-visible | 108.0 | 18.4 | 3,290.5 | 4,734.5 | 56,519.6* |
| 100,000 | BAR1 (host_device_local) |
21.7 | 15.8 | 231.8 | 216.7 | 2,499.3 |
* Shortened by --max-dispatch-ms 120 in all 12 rounds: 10k divergent_miss ran 13–26 iterations (median 4.38 ms,
range 1.60–6.37 ms); 100k divergent_miss ran 19 iterations (median 281.51 ms, range 276.11–285.21 ms); 100k
latency_divergent (outside table; gross median 8,135.0 µs/M) ran 26 iterations (median 55.45 ms, range
47.57–56.15 ms).
- Net timings (key-read baseline subtracted) at 100,000 entries: GPU-only
14.6,8.6,207.6,204.5,2,478.3; BAR114.6,8.6,207.5,204.6,2,475.1; Host-visible101.0,11.5,3,265.5,4,722.4,56,495.1*µs/M. - At 100,000 entries on GPU-only, dispatches took 3.89 ms (divergent T#), 7.27 ms (T#+S#) and 41.99 ms (divergent miss). The hot-key control measured 12.8–13.1 µs/M gross (5.7–6.8 µs/M net) across all types and sizes.
- Memory types: GPU-only = type 1 (
DEVICE_LOCAL, heap 0, 8,018 MiB); Host-visible = type 3 (HOST_VISIBLE | HOST_COHERENT, non-cached, heap 1, 16,345 MiB); BAR1 (--memory rebar) = type 5 (DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT, heap 2, 214 MiB; 256 MiB BAR1 aperture, 227 MiB used / 29 MiB free at idle, 20.0 MiB table fit). - At 100,000 entries on GPU-only/BAR1, round medians split deterministically by starting table size: starting at 1k (rounds 1, 5, 8, 12) gave 167.4–167.9 µs/M (divergent T# hit) and 1,791.5–1,791.9 (divergent miss); starting at 10k (3, 6, 7, 10) gave 231.8–232.1 and 2,498.4–2,505.4; starting at 100k (2, 4, 9, 11) gave 232.2–232.9 and 2,581.9–2,591.8 (cause unmeasured; table follows the eight not starting at 1k).
- 36 processes, 29,124 timed dispatches, all 1,188 rows
timing_statusok; overlays disabled viaDISABLE_RTSS_LAYER=1andDISABLE_VULKAN_OBS_CAPTURE=1(idle desktop: 2% GPU, 993 MiB VRAM, P5). - System: GeForce RTX 3070 8,192 MiB (
0x10de:0x2488, subsys0x404e1458), PCIe 3.0 x16 (B450 AORUS M), ReBAR Off (256 MiB BAR1, 227 MiB used / 29 MiB free at idle; 214 MiB Vulkan heap 2), subgroup size 32, NVIDIA 621.24 (Vulkan 1.4.357), Windows 11 Pro 26H2 (26300.9974), Windows SDK 10.0.26100+, Vulkan headers 1.4.363.0 (-DLEONIDA_VULKAN_HEADERS_FETCH=ON), Visual Studio 18 Professional (MSVC 19.51.36260.0),RelWithDebInfovia CMake + Ninja.
Replay on Windows:
runtime\build\vk_descriptor_bench.exe --list-devices
runtime\build\vk_descriptor_bench.exe --self-test
$env:DISABLE_RTSS_LAYER = "1"
$env:DISABLE_VULKAN_OBS_CAPTURE = "1"
foreach ($memory in 'device', 'host', 'rebar') {
runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 `
--groups 4096 --iters 64 --warmup 5 --reps 25 --warmup-ms 300 --csv
}
Intel UHD Graphics 770 (Xe-LP)
Measured by @kapitche on Windows 11 with Intel driver 101.6129 (subgroup size 32, timestamp period 52.083 ns,
commit 8df277f, old #313 report; default 25 timed dispatches per case).
Each cell is net GPU time in µs per million logical lane lookups (after subtracting the scaled key-read baseline):
| Live entries | Placement | Uniform T# hit | Uniform T#+S# pair | Divergent T# hit | Divergent miss |
|---|---|---|---|---|---|
| 1,000 | device_local |
263.0 | 300.5 | 1,350 | 6,249 |
| 1,000 | host_visible |
263.3 | 300.3 | 1,350 | 6,249 |
| 10,000 | device_local |
264.2 | 296.2 | 1,364 | 6,413 |
| 10,000 | host_visible |
263.9 | 296.3 | 1,363 | 6,402 |
| 100,000 | device_local |
280.5 | 316.0 | 1,483 | 8,263 |
| 100,000 | host_visible |
280.9 | 316.5 | 1,481 | 8,217 |
- Both placements (
device_localtype 0 andhost_visibletype 1 withDEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT) use shared system RAM and stayed within 0.6% of each other across every size and scenario. - From 1,000 to 100,000 entries, hit timings rose 5–10% and divergent misses rose 31–32%.