GPU: add an opt-in execution performance census #509
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!509
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-509"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@aycow on GitHub · 2026-11-24 04:20 UTC · original
aycow:gpu/execution-performance-census→main· +1272 −60 · 14 files · 13 commits · openWhat this measures
In a diagnostics build,
VICTORY_GPU_CENSUS=1aggregates D3D12 completion spans by pipeline and shader hash. It reports invocation counts, work sizes, GPU spans, CPU pipeline-build time, and refusals. This complements #130's CPU and frame profiling, #279's DRED diagnostics, and #159's title-facing queries.Run the census
The
victory_gpu::censuslog target reports roughly five-second windows on completed submissions. It flushes pending data when the title thread exits or the host reports a GPU failure.Each timestamp pair marks two completion points on the direct queue. Work can overlap, and timestamp queries can affect scheduling. Use the spans to rank work for investigation and measure submission or frame time separately. Timestamp results are resolved into list-owned buffers and collected after the existing fence. The first 2,048 operations in a list can receive timestamps. Later operations, duplicate instances in a batch, and unavailable samples still contribute to call counts. The census takes precedence when both timing switches are set, so normal list batching is retained. D3D12 timing · Indirect count semantics
Synthetic reproduction
The original compute and mesh fixture records two lists and verifies reference output, direct and indirect metadata, timestamp coverage, and one native submission even with the legacy timing switch set. The single-record test passed on AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP with the debug layer and full GPU-based validation. NVIDIA and WARP passed the multi-record control. The tested AMD driver produced only the first record, including with profiling off, and also produced the first record in a separate zero-count control. Those observations apply to the synthetic fixture and driver tested.
Run the hardware test manually with Graphics Tools, Agility SDK 1.620.x x64, and a local x64 DXC:
Set
VICTORY_CENSUS_TEST_MULTI_INDIRECT=1for the three-record probe orVICTORY_CENSUS_TEST_ZERO_INDIRECT=1for the zero-count probe. Clear both timing switches for an unprofiled control. The hosted diagnostics step runs the census unit test for aggregation and work counts. The hardware test runs through the explicit manual command above.Matched title measurements
Use an authorized title setup. Match GPU and driver, title build, scene and inputs, PR stack, and cache warm-up. Use the same present-call window and identify incomplete windows or device removal. Establish a stock frame and submission baseline, then compare builds that both use the census and differ only by the optimization under test. Turn listed-frame capture, legacy timing, DRED, the debug layer, and GPU-based validation off during timed runs. Run validation separately.
Share build SHAs, adapter and driver, frame range, and aggregate rows for the expensive compute and mesh pipelines. Include hashes, calls and timed calls, work sizes or indirect limits, median, maximum and accumulated milliseconds, and refusal counts. Title performance remains unmeasured here.
Earlier validation
Updated onto
ffe310e. The Windows workflow now runs the census diagnostics unit tests explicitly, with the existing default workspace tests and both Clippy configurations retained. The focused unit command and both Clippy commands passed locally. The hardware smoke remains opt-in. The current-main single-record fixture passed on AMD, NVIDIA, and WARP with full GPU-based validation, reference output and one submission. For async composition, the pending submission must retain the recording-specific timestamp/readback allocation and operation metadata through its fence. Early reset can otherwise pair old timestamps with new metadata. This branch collects synchronously.fromthemoonx independently validated the single-record, multi-record, zero-count, and unprofiled controls on a desktop RTX 3060 with full GPU-based validation. The profiled variants used one submission. Independent result
Async census validation
The separate async composition retains queries, readback, operation metadata and shader identities as one recording generation. AMD, NVIDIA and WARP passed the held-fence reset/resubmission and replay fixture with full GPU validation. No samples were collected while the 100 ms CPU gate was held. The original smoke still produced one submission; the new test produced exactly three. The synchronous #509 head and its workflow remain independent.
Earlier upstream compatibility
bfc60cfmerges main70564aewhile retaining normal submission batching and the diagnostics-specific CI step. Both strict workspace Clippy configurations and the asset policy passed. The matched synthetic census-on/off fixture passed on AMD Radeon Graphics and WARP with full GPU-based validation in a composition with the independent startup-probe sampler-heap correction fcf3f3e. It produced identical ALU, mesh and indirect outputs and one native submission in all four runs. The startup probe change is outside this PR. The workspace shader failures observed on that base also reproduced with stock lowering. Upstream fixed the CI adapter selection inccfb029.The exact historical #595 7465030 recording-ownership control is available separately at 6e79490. A contemporary #595 integration requires resolving the changes in main's submission implementation.
For the pathological mesh report in #71, use census windows for pipeline identity, group demand, execution spans and CPU pipeline build cost. #1723 provides primitive and pixel-invocation counters through the separate legacy timing path. Match builds, scene windows and instrumentation settings and use submission-level timing for quantitative comparisons.
AI-assisted with OpenAI Codex.
ccfb02996e' into maintenance/pr509-ccfb029 c7e406b46678ed12e' into maintenance/pr509-78ed12e bd2e94de0af3578e3' into maintenance/pr509-78ed12e 23dd894804@fromthemoonx on GitHub · 2026-11-24 12:25 UTC · original
Tested
99a24ecmerged onto currentmain(ffe310e; merges cleanly, auto-merges inhost.rsandpipeline.rs). This is the desktop-NVIDIA data point for the synthetic fixture.Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1
x86_64-pc-windows-msvc. Agility SDK runtime from theMicrosoft.Direct3D.D3D121.620.2 package (D3D12Core.dll1.620.2.0, Microsoft-signed), SDKdxc.exe10.0.26100, Graphics Tools installed.census_gpu_smoke(VICTORY_CENSUS_TEST_ADAPTER=nvidia, debug layer and full GBV as the test sets them):VICTORY_GPU_CENSUS=1+VICTORY_GPU_TIMING=1…[8..10]=1,1 … [16..18]=1,1MULTI_INDIRECT=1(limit 3, count 2), census + timing[8..13]=1,1,1,1,1,[16..19]=1,1,1ZERO_INDIRECT=1(count 0), census + timing[16..]all 0MULTI_INDIRECT=1, census and timing off (control)So on Ampere, as on your RTX 5070 Laptop and WARP, the counted call writes nothing with a zero count and stops at the GPU count otherwise. The AMD result in the description (first record written even with count 0) doesn't reproduce here, which fits a driver issue on that adapter. Profiling on or off doesn't change the outputs, and census plus timing still makes one submission.
CI's commands, on the merge: both clippy runs (
-D warnings, with and without--all-features) clean;cargo test --workspace --locked: 342 passed, 0 failed, 6 ignored, the same asmain.One note on coverage.
mod censusis#[cfg(all(windows, feature = "diagnostics"))]. CI's test step (cargo test --workspace --locked) runs without features, sosummarizes_timed_and_untimed_calls_and_indirect_limitsnever runs there; only the--all-featuresclippy compiles it. It passes with--features diagnostics(1 passed, the GPU smoke ignored as intended). If CI should keep it from regressing, the test step would need--features diagnostics(or--all-features) forvictory-gpu.Not tested: title measurements; the AMD case (no AMD GPU here); no game data used.
AI-assisted (Claude Code) ran the checks and drafted this comment.
@aycow on GitHub · 2026-11-24 16:26 UTC · original
@fromthemoonx Thanks for the RTX 3060 control and for catching the test-coverage gap.
9c1c691updates the branch toffe310eand adds a Windows CI step that runs the census unit test with diagnostics. That command and both workspace Clippy configurations passed locally. The hardware fixture remains explicitly opt-in. I linked your four-way validation in the description.@aycow on GitHub · 2026-11-24 18:43 UTC · original
I published the isolated #509/#595 integration against exact #509 and current #595 plus its confirmed-fence guard. It has no #387 or #562 dependency. Query heaps, readback and operation metadata stay with each recording through native completion. Held-fence reset/replay and the standalone semantic smoke passed with full GBV on AMD, RTX 5070 Laptop and WARP. There was no collection while gated, and the standard smoke retained one native submission. Both Clippy configurations and asset policy passed locally. This makes the async integration independently reviewable while preserving this standalone PR's scope.
@aycow on GitHub · 2026-11-24 21:03 UTC · original
I independently recomposed the timestamp ownership work with #595's 7465030 revision, which gives repeated lists their own preludes. The standard one-native-submission smoke and held-fence reset/resubmit passed on AMD and WARP with full GBV. The new #595 repeated-prelude regression also passed on WARP. NVIDIA was absent from DXGI enumeration in this session. The composition is local and the standalone PR remains scoped to the existing census.
AI-assisted using Codex.
@aycow on GitHub · 2026-11-24 21:29 UTC · original
I validated repeated recording ownership against #595 7465030 with a test and reproduction. AMD Radeon Graphics and WARP both passed with the debug layer and full GPU-based validation. The normal smoke still used one native submission. In the gated test, resetting the list while its old recording was pending preserved the original operation identities and readback. With both timing flags enabled, a later batch containing the same recording at both ends counted both executions and suppressed the ambiguous spans. The distinct peer kept its span. #595 issued the same two native calls for that batch, with zero additional census calls. These timings are synthetic GPU spans.
AI-assisted using Codex.
@aycow on GitHub · 2026-11-24 22:23 UTC · original · edited 2026-11-24 22:30 UTC
I ran a held-native-fence control against the current census revision
bfc60cfwith the separate startup probe fix. With both timing flags set, AMD Radeon Graphics and WARP passed with the debug layer and full GPU-based validation. Both recorded zero early samples during the 100 ms host gate, kept one native submission, and returned the expected shader outputs. The wall times were 103.7 and 106.7 ms, while the largest timestamp spans were 13 µs and 3.60 ms respectively. That control puts the gate before the first timestamp. Operations that overlap or contend after a start timestamp can still contribute to the measured span, so operation totals should be read alongside whole-submission timing. The existing async recording-ownership test stays separate while #595 updates its ownership and wait handling for current main.AI-assisted using Codex.
Update after @wbkepler’s
dfac3b4rebase. The local composition withbfc60cfpasses the census smoke and held-fence reset/replay on AMD and WARP with full GPU-based validation. The smoke still uses one native submission. The repeated recording contributes four calls with no spans, and its distinct peer keeps one timed sample. The broader #595 suite has a separate AMD upload-visibility failure, reproduced ondfac3b4with census disabled. Matched comparison on #595.@Marvisak on GitHub · 2026-11-25 00:22 UTC · original · edited 2026-11-26 01:23 UTC
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. The new head (
a940992) mergesmainagain and now merges cleanly. Thehost.rsconflict from the last triage is gone, anddocs/gpu-execution-census.mdis now short, as asked.The census itself is diagnostics-only. It is under
cfg(all(windows, feature = "diagnostics"))and opt-in throughVICTORY_GPU_CENSUS. Its hooks indraw.rs(State::census, dispatch/mesh/draw/indirect) andpipeline/make.rs(Pending::make) don't change the default build.The two open questions are still for the maintainer, and only they can settle them:
.github/workflows/ci.yml;census::gpu_tests::census_gpu_smoke(ignored by default), which runs a localdxc.exethroughstd::process::Command, with the path taken fromVICTORY_CENSUS_TEST_DXC.If either one is unwanted, dropping it (or changing the test to compile its fixture with the repo's own shader path) would leave a diagnostics-only change. CI: passing (
check).Generated by Claude Code
@aycow on GitHub · 2026-11-25 01:02 UTC · original · edited 2026-11-25 01:06 UTC
Merged upstream
42363abinto the PR at2968f48. The census counts one launched group per nonempty indirect clamp and records its argument count separately. Diagnostics Clippy, the census aggregation test, and all five clamp tests passed. The full-GPU-validation smoke passed on AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP with the existing local FMad startup sampler-heap workaround. The workaround is outside this PR. Each smoke run reported one submission and the expected readback. GitHub reports a clean merge.Follow-up
daebb52runs the census-specific check before the workspace suite. The previous workflow was stopped by the same gather and wave-32 permute failures seen on upstream42363ab. Upstream CI@aycow on GitHub · 2026-11-25 06:19 UTC · original · edited 2026-11-25 16:58 UTC
@Marvisak The repository guide is now a short enablement and output reference at
06824d2. The PR description holds the reproduction, timing limitations, hardware findings, and matched title measurement instructions. The repository policy test passed locally.Could you confirm whether the dedicated diagnostics workflow step and the ignored fixture's explicit local
dxc.exeinvocation are acceptable? The hosted step runs only the census aggregation unit test. The hardware fixture uses a local DXC path when explicitly invoked.Rebase follow-up
2ea5bcbpreserves upstream traced indirect readback and the new native clamp output buffer. The census aggregation test and strict diagnostics Clippy passed. The one-submission native smoke passed on AMD, GeForce RTX 5070 Laptop GPU, and WARP with full GPU-based validation and the separate local startup sampler workaround. The two earlier maintainer decisions remain open.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.