Skip to content

fix(job-manager): account for GPU barrier command capacity - #10811

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
Felipebmaitan:feat/jobmanager-barrier-capacity
Oct 27, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
Felipebmaitan:feat/jobmanager-barrier-capacity

Conversation

@Felipebmaitan

@Felipebmaitan Felipebmaitan commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What

The capacity overflow test is registered with the AGC execution tests as agc_driver_job_manager_compute_capacity, so Windows CI's unchanged skip policy recognizes the intentionally unbuilt execution-test stub.

Supersedes #10300, which GitHub refuses to reopen even with its original head restored.

Match the original module's bounded command-area use across GPU barriers. With two large markers followed by small dispatches, native accepts 224 GPU+Sync groups, accepts Dispatch 225, then exhausts on Sync 225; current main's smaller completion packets admit all 255 groups.

Measure the Sync footprint and reclaimable tail with the existing AGC builders. Pure GPU Sync reserves the full footprint; consecutive empty Syncs consume no additional space; terminal CPU/Wait work reclaims the unused tail. Mixed CPU/GPU groups use normal completion packets. Encode each boundary once so work submitted ahead of an older Sync retains its own accounting. Submission still uses explicit release packets; the native Rewind/protocol difference remains recorded in debt.

Refreshed onto main 70c72b6d5c81f5e8f119a1d543d5312340917493 after all prerequisites merged (#10166, #10188, #10202, #10213, #10231, #10244, #10254, #10264, #10272). The diff now contains only this capacity topic, its tests and the directly related debt entry. Preserve main's canonical API headers and worker-wait wakeup fix; adapt new fixtures to ISequence. The last-minute #8988 getrusage pointer-safety merge was also incorporated; git range-diff confirms the reviewed capacity patch is unchanged by that rebase. After the paired runs, main advanced through #9169, #9529, #9059 and #9519. Their socket, LibreSSL, TLS-export and FreeType changes do not touch this topic; git merge-tree --write-tree HEAD origin/main merges cleanly against d8db8faef5. The paired test results remain pinned to 70c72b6d5c. No speed claim.

Tested

Windows 11 Pro / WinLibs GCC 15.2.0, NVIDIA GeForce RTX 5080 driver 621.01:

  • Exact main 70c72b6d5c: focused JobManager/ulobjmgr CTest 31/31 passed, 17.11 seconds. Updated implementation: 32/32 passed, 18.11 seconds. These are correctness runs, not performance measurements.

  • Both runs used ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and ctest -V on the same machine/GPU. Main and change each contain zero VUID- messages and zero missing-validation-layer messages; no GPU skips.

  • Red/green on 941ace5f34 (its JobManager source is unchanged by the subsequent fix(libkernel): check getrusage output pointers #8988 merge): run the new barrier_storage and barrier_capacity_overflow fixtures against a rebuilt main JobManager, then the updated JobManager. Main exits 1 with the expected spacing/capacity assertions; this change exits 0 for both. The positive capacity fixture covers 224 groups, guard bytes, and storage reuse after Wait; overflow must reject Sync 225 while preserving already submitted work through a separate tail fence.

  • Adversarial source review covered integration, capacity arithmetic, boundary encoding, pure/empty/mixed/terminal barriers, lookahead, waits, reuse, locking and shutdown. It found an unexpected-exception cleanup hazard in the new fixtures; a scope guard now releases the gate and stops manager/driver workers before gate/fence/packet storage leaves scope. Two follow-up adversarial reviews found no remaining blockers; the final review also verified the native failure is independent of this patch. Three temporary fault-injection executables exercised a held storage gate, an early capacity-loop exception and a pending fence: all returned the expected failure status 1 after cleanup, with no validation errors or missing-layer messages.

  • Built the current relinker, NID patcher, focused test targets and patched JobManager/AGC/kernel/libc/ulobjmgr/RazorCpu runtime dependencies from source. Conventions and whitespace checks pass. No new third-party dependency or repository investigation file.

cmake --build build --target agc_driver_job_manager_compute_tests guest_job_manager_profiler_tests guest_job_manager_tests guest_job_manager_failure_tests guest_job_manager_registration_tests job_manager_compute_progress_tests guest_ulobjmgr_tests --parallel 12

ctest --test-dir build -R 'agc_driver_job_manager_compute|guest_job_manager|guest_ulobjmgr' -V

python tools/check_conventions.py --base origin/main

python tools/pr_overlap.py --branch feat/jobmanager-barrier-capacity

Python 3.11 was invoked as python; this Windows machine's python3 command is an inactive Microsoft Store alias.

Fresh owned-original-module comparison through normal relinker startup used module SHA-256 881a191e0c7509edc09b7360cfe470bc5692b2ef8ef2fadcbebe0ef23bdb933d, the final compute fixture, shared reference bindings and synthetic application process metadata. Both new positive cases (barrier_storage, barrier_capacity) pass on the host fallback and original module. Native isolated size, execution, storage, capacity, deferred_inputs and compute_shutdown pass as well.

Native-reference limitation: the existing gpu_barriers CPU-release overlap gate fails under the current host driver (WAIT_REG_MEM timeout; CPU work did not release GPU work beyond its preceding sync). The aggregate native compute run therefore fails too. A separately compiled helper from the exact main fixture reproduces the same native failure. Neither native run stages or loads the changed host JobManager implementation. The host fallback's aggregate compute test passes on main and this change. This inherited native-protocol/parity gap is recorded in docs/dev/debt/libSceJobManager.md; a complete original-module suite pass is not claimed. No fresh Linux, PS5 hardware, or calling-title testing is claimed; the former PR description's old stacked-head results do not certify this refreshed head.

Overlap review checked open work and the merged prerequisite stack. #10249 is the only open PR sharing the original three changed files: its JobManager hunk rewrites shader-pointer decoding in SubmitCompute, independently of this capacity accounting. The overlap tool cannot compare that PR automatically because it already conflicts with main; its hunk was inspected manually. #10717's worker tests, #10654/#8314's other ACB controls and #10744's reference-runner refusals do not implement this change. No open implementation dependency remains.

Checklist

  • Based on current main; no other open PR implements the same functions

  • One topic per PR; follow-ups go in a new PR

  • No comments in code except technical debt

  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file

  • No notes, investigation .md files or images added to the repository (attach them to this PR)

  • New third-party code is a submodule built from source

  • Generic behaviour, not specific to one title

  • Depends on: none

  • Fixes: none

  • Unblocks: none

  • GPUs tested: NVIDIA GeForce RTX 5080, driver 621.01, Windows 11 Pro

  • AI-assisted: yes

@MarcZX10 MarcZX10 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.

I reviewed the capacity accounting and the new boundary/storage fixtures. git diff --check and the current-main conventions check pass; hosted eligibility, intake, labels, report, and conventions checks pass. The repository path filters skip product builds/tests. I did not run the Vulkan tests locally.

I manually compared the shared Export.cpp hunk with #10249: that PR changes how SubmitCompute reads the shader pointers, while this PR changes completion-packet accounting; the edits are separate and compatible. The new fixture also uses the allowed single outstanding Wait at a time, and the overflow case releases its held GPU gate before checking the tail fence. I found no blocking issue in this diff.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 10194 core/libs/prx/libSceAgcDriver/CMakeLists.txt L2620
PR 10472 core/libs/prx/libSceAgcDriver/CMakeLists.txt L2620

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.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4449 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6959 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8365 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8542 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8939 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9176 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9248 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9287 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9289 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9633 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9748 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9749 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9790 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9892 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9969 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10000 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10026 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10043 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10064 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10249 core/libs/prx/libSceJobManager/Export.cpp
PR 10333 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10489 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10757 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10773 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10846 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11207 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11557 core/libs/prx/libSceAgcDriver/CMakeLists.txt

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Felipebmaitan Full CI fails the Windows skip check because the new test guest_job_manager_compute_capacity is skipped there. It runs the AGC execution test binary, which Windows CI builds as a not-built stub, and the skip check only accepts that for agc* test names (all the other tests on those binaries are agc_driver_*). Renaming it to agc_driver_job_manager_compute_capacity, ideally registered next to agc_driver_job_manager_compute in libSceAgcDriver/CMakeLists.txt, should fix it. No Windows path or skip allowance is needed.

@ahmadmuj ahmadmuj 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.

Reviewed head fcbca74 (base 70c72b6), merged locally onto current main 14c99b5 (clean). Linux: WSL2 Ubuntu 24.04, GCC 13.3, Release, lavapipe (llvmpipe, LLVM 20). Since the hosted linux job was skipped, this is the first Linux run I know of.

What I ran:

  • Focused suite with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: ctest -R 'agc_driver_job_manager_compute|guest_job_manager|guest_ulobjmgr' is 32/32, no GPU skip. The new agc_driver_job_manager_compute_capacity runs in 0.27 s.
  • Red control: same tree with main's libSceJobManager/Export.cpp. barrier_storage fails ("GPU barrier command storage differs from the original module"), barrier_capacity_overflow fails ("GPU sync exceeded the original module command capacity"), and barrier_capacity still passes, like you described. Suite 30/32. Restored your file: 32/32 again.
  • Both AGC tests 20 times with --repeat until-fail:20 -j 2: all pass, slowest 0.56 s, so the 3 s fence deadline over ~450 submissions has plenty of room on lavapipe.
  • Validation: the only VUID lines are VUID-VkDeviceCreateInfo-pNext-pNext from vkCreateDevice (unknown pNext struct type 1000574000), 6 on main and 6 on this PR. Nothing from the command stream.
  • tools/check_conventions.py --base origin/main passes.

I also read the Sequence accounting against the AGC builders. reclaimSyncTail is only set right after a sync reserves syncWords and is cleared on every reclaim, dispatch submit, retire and Open, so commandUsed can't underflow, and a flush never writes past its reservation. With the test shader the sizes come out to 39-word dispatch, 37-word sync, 5-word tail, which gives your 304/284/188/492 distances and 224 groups plus dispatch 225 before sync 225 runs out of space. Main's flat 8-word completion is what the red run trips on.

No issues found. Limits: lavapipe only, no console and no original module here, so the 224 native bound comes from your module run, not from me.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Addressed in fcbca74: renamed the test to agc_driver_job_manager_compute_capacity and moved its registration to libSceAgcDriver/CMakeLists.txt, immediately after the AGC execution-test registrations. No workflow or skip-policy allowances were added.

Reproduced the failure locally with Windows CI's ANYPS5_AGC_EXECUTION_TESTS selection: the old name made check_skips.py --job windows fail; with the renamed test, the unchanged checker accepts both intentional stub skips. Restored the real execution-test build and ran both JobManager AGC tests: 2/2 passed on RTX 5080 with Vulkan validation enabled and shader cache disabled, with zero VUID or missing-layer messages. A fresh hosted full-CI run is still needed for this commit.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Felipebmaitan Thanks, the rename and the move to the AGC registrations are what was needed, and both JobManager tests pass here on the new name too. Full CI on this head has already passed on Linux and Windows, including check_skips.

@oneandonlydean
oneandonlydean merged commit 7cee2b5 into boykopovar:main Oct 27, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants