Repository navigation
fix(agc): avoid CPU waits for GPU-ordered labels - #9445
oneandonlydean merged 4 commits into
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
A data point for this change. fable-void made the same change on his fork (18b3bcaed9 on We had ported his fix to
On GitHub's Linux runner it fails ×3 with |
MarcZX10
left a comment
There was a problem hiding this comment.
The implementation narrows the wait predicate from any pending label to an actual completion label, and the regression proves that the unrelated callback remains deferred while the consumer gets the GPU-written value. The paired same-machine main/change run follows the repository’s required Vulkan-validation protocol: layer load is confirmed, no new VUID- errors are reported, and the complete 31-test focused set passes on the changed head. Good evidence.
The branch is still based on a6dcea927, while current main is 110a18ba01. I checked the intervening upstream history and found no commits to either changed file (ShaderResources.cpp or Recorder.cpp), so this appears isolated; please nevertheless update the branch and rerun the focused validation comparison plus conventions/overlap so the report/checklist is current. Hosted product jobs are skipped. I did not run local GPU tests.
a9209d9 to
f7e0da2
Compare
|
@MarcZX10 Rebased onto upstream main Added Reran the same 32 focused tests on Windows 11 build 26200, NVIDIA RTX 4070, driver 610.88:
Both runs used Conventions against upstream pass, and GitHub's conventions check passed on the published head. The required The description and checklist now contain the refreshed commits, test set and results. Hosted product jobs remain skipped; these GPU results are from the local matched runs. Ready for another review. |
|
Two notes from GTA V (PPSA04264), Windows, RTX 4090 / i9-13900K. These come from reading the code. I have not run this head yet.
Also checked: AI-assisted: yes (Claude Code) |
f7e0da2 to
cdb2ff3
Compare
|
A run of this head on Windows with an AMD device, and with a second NVIDIA generation. Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release. The set has 26 tests:
Negative control on the RTX 4070 SUPER and on the Radeon: Not run: the validation layer, Linux, a title. AI-assisted: yes (Claude Code) |
|
Static review plus an independent Linux/AMD run on both trees per the repo AGENTS AGC protocol (CachyOS, kernel 7.2.10, GCC 16.2.1, Ninja 1.13.2, Release, What I checked (static)
Focused paired run (VVL env)
The 8 Not covered Every branch of |
✅ NVIDIA GPU test: passedPR head
Intermittent validation messages (1, seen once in the parallel run, not reproduced when the test was re-run alone 2 times; not counted against this PR)Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (2, not counted against this PR)Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validated but not compared (7, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 425 tests)Skipped (41)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Added in db78f14: direct fill-wait counter assertions for GPU labels and overlapping/disjoint CPU completion labels. 9/9 focused tests pass on RTX 4070 with Vulkan validation; pinned main fails the 7 intended false-wait cases, including the new assertions. No VUID errors or skips. Thanks for the suggestion. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (2, not counted against this PR)Validated but not compared (7, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 425 tests)Skipped (41)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
An AMD RDNA 4 run on Windows of Windows 11 Pro 10.0.22631, AMD Radeon RX 9070 XT (
AI-assisted: yes (Claude Code) |
|
GPU test run at current head Head db78f14 (3 runs each, all Passed):
Device evidence line printed by the tests: Baseline main Limitation: no Vulkan validation layer is available on this machine, so no VUID comparison is possible; runs are functional-only.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, looks good
The new counter assertions and focused reruns address the remaining review request, and the current upstream base has no intervening changes to the reviewed implementation or tests.
At head db78f141cd5d620bd4b5be21a6fa489e91079849 against current base 8948f1cec5b2a43f5da47ee2e581449acc3a02ca, the no-build precheck passed diff, conventions, and live mergeability; the hosted Windows job passed on this exact head. The author reports three passing runs of the focused tests on an AMD RX 9070 XT and reports paired Windows RTX 4070 baseline/change tests on the prior functional head; intervening upstream commits from tested base b3b96098997751c89c32693ac67297f50f48a51d do not change any reviewed implementation or test files. I did not run a local build or GPU tests; Linux hosted CI was skipped, and the AMD run did not have a Vulkan validation layer available.
Use the existing completion-store range query when deciding whether resource acquisition needs a CPU write-back wait. An unrelated pending host completion must not turn an ordinary GPU label into a CPU dependency. This applies the distinction already used in CopyBuffer by merged PR boykopovar#4496. Cover fresh and cached direct consumers with an unrelated host completion, exact GPU output and deferred completion execution. The focused regression fails with the broad label query and passes with the completion-store query on an RTX 4070 under Vulkan validation. No gameplay speed claim.
Adapt the completion wait regression offered in EagleBearerYS/AnyPS5@59fad38. Keep the host callback state alive if an assertion unwinds before recorder teardown. Co-authored-by: Yunus Shaikh <75296019+EagleBearerYS@users.noreply.github.com>
db78f14 to
03f66fe
Compare
|
Rebased onto main Fresh RTX 4070 validation: 10/10 focused tests pass; matched main fails the 8 expected false-wait cases. No VUID errors or skips. Earlier wider-suite results remain historical. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (8, not in the main baseline's validation pass)Validation IDs already present on main (5 IDs in 483 tests)Skipped (45)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
main renamed the fill-sync counter labelSynced to fillCompletionSyncs (boykopovar#9445). The [fill-sync] profile line keeps this branch's elided-fill fields and uses the new name.
What
Both
CompletePendingCpuWritesandVulkanDevice::FillBuffercombine a global count of pending host completions withPendingLabelInover the accessed range. An unrelated host callback can therefore make an ordinary GPU-ordered label triggerSyncThrough, even though that label needs no CPU completion.Use the existing
CompletionLabelInrange query at both sites. Resource reads and fills still wait for overlapping CPU completion stores and copied writers, and queued labels retain conservative handling. GPU label stores remain ordered before the fill by the existing store flush and transfer barriers.Add regressions for fresh and revalidated resource bindings and for uniform/patterned fills. The fill suite covers 16-byte and 4096-byte fills, 4/8/64/256-byte labels, labels crossing either fill boundary, disjoint labels, submitted batches, inline label runs and the in-place pattern-fill path. It checks that unrelated callbacks remain deferred, overlapping CPU labels finish before the fill, and completed bytes have the fill pattern. It also checks that overwritten labels are refused for later submissions with the optional late-label shortcut enabled, while earlier submission ordering remains intact. The seven fill test registrations exercise 324 scenarios.
agc_completion_label_waitis adapted from EagleBearerYS/AnyPS5@59fad38624, with contributor attribution preserved. The fresh/reused-binding regression remains.Related: #9858 independently changes the same resource-consumer predicate. This PR retains its original resource fix and includes the equivalent fill-path correction and its regressions. Neither PR is a dependency. No FPS or frame-time improvement is claimed without a matched gameplay benchmark.
Tested
November 2 rebase: head
03f66fe05fa1c6b8cf3e47fbfef7f18750661bfais based on main0580e5c951a8d436af2976a3f86a980c798ef5c2. Resolved the recorder test-registration conflict by placingagc_completion_label_waitin upstream’s newtests/cmake/agc_driver_recorder_tests.cmake; retained all four topic commits and contributor attribution. Fresh Release focused targets built with GCC 15.2 and SPIR-V Tools. The same 10 focused fill/recorder/resource-label tests on Windows RTX 4070 pass 10/10 on the rebased candidate; pinned main with identical fixtures and counter instrumentation fails the 8 intended false-wait cases. Overlapping CPU completion labels and existing recorder classification pass on both. Required Vulkan and disabled shader cache were used, Khronos validation actually loaded, no missing-layer warnings, skips or VUID errors; every test completed within 30 seconds. Earlier wider-suite results below are historical, not fresh results for this rebased head. No gameplay or Linux rerun is claimed. Conventions against this upstream base and diff checks pass; the required stale fork origin/main comparison still reports inherited findings.Rebased the combined branch onto upstream
mainb3b96098997751c89c32693ac67297f50f48a51d. The three commits retain the resource fix, attributed completion-wait regression and fill follow-up separately; candidate head iscdb2ff3f7426b588c6e09092272b59062fc43c2c.Built complete patched Release libraries and 33 focused test executable targets with GCC 15.2, CMake/Ninja and bundled SPIR-V Tools on Windows 11 build 26200, Intel Core i7-13700 and NVIDIA GeForce RTX 4070 (12 GiB), driver 610.88.
Ran the same 48 focused tests sequentially on the same machine/GPU with a 30-second timeout per test:
mainb3b96098997751c89c32693ac67297f50f48a51d, with this PR's regressions and registration overlaidcdb2ff3f7426b588c6e09092272b59062fc43c2cFor the main control, both changed production files were restored byte-for-byte from the pinned main commit. All remaining production files were already from that base. Both runs use identical test code, test names, environments and timeouts.
Main fails only
agc_copied_direct_ordering,agc_completion_label_waitand the six fill cases for GPU labels/disjoint CPU labels. The positive overlapping CPU-label case passes on both main and the change. The combined branch passes all eight regressions and all existing focused tests.Both runs set
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, with verbosectest. Khronos validation layer 1.4.335 actually loaded in both runs. Neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS; neither contains aVUID-validation error. No tests skipped and every test completed in under 30 seconds.The focused set covers resource binding/revalidation, CPU/GPU completion labels, uniform/patterned fills, stale-label lookups, copied/direct writers, pipelined fills and label waits, unimported-label ordering, host-import lifetime, BDA reads and shader-semantic regressions.
git diff --checkand conventions against the pinned upstream base pass. The requiredpython tools/check_conventions.py --base origin/mainwas also run: the fork's stale main causes 275 findings / 43 inherited errors; the isolated comparison against current upstream main passes.Ran
python tools/pr_overlap.py --branch codex/resource-fill-completion-labels --repo boykopovar/AnyPS5. The scan reported no confirmed collisions and 98 shared-file warnings from PRs that conflict with its base. Their topic patches were inspected for both changed predicates and the regression/test names. No duplicate fill-predicate change or fill regression was found. The independently verified parallel resource-predicate change in #9858 is disclosed above; the checker does not flag identical changes as a collision.Gameplay, cross-title stability and matched main-versus-PR game performance measurements are not completed for this combined branch. These tests establish removal of the false waits and preservation of the tested ordering/results. Logs are retained locally; no performance or stability gain is claimed.
Counter assertion follow-up (
db78f141cd5d620bd4b5be21a6fa489e91079849): the fill regression now directly checks that GPU-ordered labels leave the existing completion-label sync counter unchanged, disjoint CPU labels leave it unchanged, and overlapping CPU labels increment it exactly once. On the same Windows RTX 4070 setup with Vulkan validation loaded and shader caching disabled, all 9 focused fill/recorder tests pass; the same fixtures over pinned mainb3b96098997751c89c32693ac67297f50f48a51dwith counter instrumentation fail 7 intended false-wait cases, including the new counter assertions. The overlapping CPU-label and existing recorder classification tests pass on both. No missing validation layer, skips or VUID errors; each test finishes within 30 seconds. This follow-up does not repeat gameplay or Linux testing.Checklist
main; no other open PR implements the same functions — exception: perf(agc): wait only for CPU-completion labels before direct consumers #9858 independently changes the resource-consumer predicate, disclosed aboveNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)