Skip to content

GPU: VICTORY_LIBRARY_TIMING measures the host FidelityFX upscaler's GPU and CPU cost - #1904

Open
AwkGrep256 wants to merge 1 commit into
Marvisak:mainfrom
AwkGrep256:ffx-gpu-timing
Open

AwkGrep256 wants to merge 1 commit into
Marvisak:mainfrom
AwkGrep256:ffx-gpu-timing

Conversation

@AwkGrep256

Copy link
Copy Markdown

Summary

Nothing measured what the host FidelityFX upscaler costs. This adds a diagnostics switch that times the work host libraries record into the title's lists through external::record.

Switch Effect
VICTORY_LIBRARY_TIMING=1 Each host library call gets a GPU timestamp before and after it, read when its list is reset (its submission has finished), plus the CPU time of the call. Every 60 calls one line reports the GPU time (average, median, slowest) and the average CPU time. Each call is also logged at debug level (VICTORY_LOG=victory_gpu::library_timing=debug).

Off by default and diagnostics-only; when off nothing is recorded. Up to 64 calls can be in flight; past that a call is not timed.

Measurement in the title

Series X profile, title 1.0.2.1, AMD Radeon RX 9070 XT, Windows 11, diag build of main 02fcf5b with #1793 applied for the Series X switches, FidelityFX SDK 2.4.0 signedbin, FSR 4.1.2, 1080p rendered to a 4K output. 50 upscales in the world.

Min Median Max
GPU time per upscale 1.18 ms 1.32 ms 1.36 ms
CPU time to record it 51 µs 80 µs 36.6 ms (first call: the provider's one-time setup)

For scale, the same frames took 100 to 187 ms on the GPU (1.1 to 2.9 s per frame in all), so the upscaler is about 1 % of the frame's GPU time. Rendering 1080p instead of native 4K saves far more than that.

Tested

Check Result
Unit tests: milliseconds from ticks, report statistics ✅
GPU test: a timed call on a real list reads ordered, non-zero timestamps (RX 9070 XT) ✅
cargo clippy --workspace --all-targets -- -D warnings, with and without diagnostics ✅
The title run above ✅

The host FidelityFX upscaler records its passes into the title's list
through external::record, and nothing measured what that costs. With
VICTORY_LIBRARY_TIMING=1 (diagnostics) each such call gets a GPU
timestamp before and after it, resolved into a read-back buffer and
read when the list is reset (its submission has finished), plus the CPU
time of the call. Every 60 calls one line reports the GPU time
(average, median, slowest) and the average CPU time.

Up to 64 calls can be in flight; past that a call is not timed. Off,
nothing is recorded.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

VICTORY_LIBRARY_TIMING measures the host FidelityFX upscale: timing instrumentation behind an env var — debug tooling.

@AwkGrep256
AwkGrep256 force-pushed the ffx-gpu-timing branch 2 times, most recently from 9ca88ee to e556cb7 Compare November 25, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants