Measure Windows interop GPU boundaries without added completion waits

This commit is contained in:
Codex committed 2026-10-02 10:08:47 +03:00
1 parent 0b471be024
commit caecad0897
8 files changed
+151 -5

No files matched your search

+4
View File
@@ -64,6 +64,10 @@ tracking/lock waits from driver calls. It is disabled in ordinary runs.
`-ProfileCudaApi` aggregates existing CUDA API host durations without adding
HIP events or synchronization. `-UncachedInteropLists` restores per-frame
copy-list allocation for comparison with the normal safely reused lists.
`-ProfileGpuBoundary` requires `-AsyncInterop` and measures D3D12 GPU intervals
around the input/output copies and external fence. It reads 32 timestamp bytes
only after existing completion, with no extra CPU wait. Its external interval
includes HIP and scheduling; it is not an isolated transformer kernel time.
The runner drains stdout/stderr concurrently as raw bytes; the earlier
line-oriented PowerShell collector imposed large per-frame delays. The optional
ZLUDA kernel profiler is for diagnostics only. Measurements and reproduction
+21
View File
@@ -130,6 +130,27 @@ scans, stdout/stderr, exceptions and runtime provenance. To include the local
validated output-store optimization, pass its combined native directory with
`-NativeRoot`; proprietary objects remain local.
`-ProfileGpuBoundary` (requires `-AsyncInterop`) adds D3D12 timestamps before
and after the VRAM input/output copies. Resolved results are read only once
the copy slot's existing fence completes; 32 diagnostic bytes per frame are
read and no new completion wait is added. `external_span_ms` spans HIP and
host/driver scheduling across the external fence. `between_boundaries_ms`
also includes game rendering, and `input_interval_ms` is not Present timing.
These queries obey the queue's timestamp ordering and add GPU commands; they
are disabled for an ordinary FPS run. GPU clock behavior during idle can
affect intervals; no hardware occupancy is inferred. Timestamp semantics:
[Microsoft D3D12 timing](https://learn.microsoft.com/en-us/windows/win32/direct3d12/timing).
The timestamp-enabled 4K burst/recreation gate completes twelve frames, all
finite; all six async RGB outputs still match their fresh controls exactly.
Each async mode emits all three timing records, including the final frame
at feature release. Results: `test-results/k-async-gpu-boundary-4k`.
All sixteen CTest gates pass on the rebuilt shim. Reproduce with:
```powershell
.\scripts\windows\test-async-k.ps1 -ProfileGpuBoundary
```
Further game coverage (HIP kernel profiling disabled, GPU output checks enabled):
M at 1920x1080 completes 4833 frames, all finite. K at 3840x2160 completes
4685 frames, all finite. Neither has a backend failure, CPU image copy or an
+8
View File
@@ -66,6 +66,14 @@ scan is 0.380 ms. Logs:
stops at its bound (`diagnostic_timeout`); there is no recorded game crash.
The K performance gate remains open.
Optional `-ProfileGpuBoundary` now records D3D12 GPU timestamps around input
copies, the external-fence span and output copies. Copy-slot completion
controls query reuse/readback; only 32 timing bytes are read, with no extra
completion wait. The timestamp-enabled burst/recreate gate passes all twelve
K/4K frames with exact candidate RGB (`test-results/k-async-gpu-boundary-4k`),
and all sixteen CTest gates pass on the rebuilt shim. Game timestamps remain
the next performance diagnostic; their span includes scheduling as well as HIP.
Three ordinary K/4K async frames and three queued together without intermediate
CPU completion all match their corresponding prior synchronous RGB exactly;
the temporal controls differ between frames. One burst attempt times out during